Author Topic: Setting Z-Index on UIPanel  (Read 3009 times)

phenotype

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Setting Z-Index on UIPanel
« on: September 14, 2012, 03:05:10 PM »
Strange problem I am trying to set the z value on the transform of the UIPanel gameobject but the value is being altered. First here is the line that changes the z value;

  1. MyDialog.transform.position = new Vector3(MyDialog.transform.position.x, MyDialog.transform.position.y, this.Sequence)
  2.  

where Sequence is an integer that represents the order in which they are displayed.

If I set the value to -1, the actual value appears as -241. If I set it to -2 the actual value is -482 and the UIPanel disappears outside the view.

Is NGUI changing this value? If so, what is the best way to layer panels for display?

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Setting Z-Index on UIPanel
« Reply #1 on: September 14, 2012, 04:57:56 PM »
You're setting the absolute position. Inspector shows the local position.

phenotype

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Setting Z-Index on UIPanel
« Reply #2 on: September 14, 2012, 10:21:32 PM »
switched to;

  1. MyDialog.transform.localPosition = new Vector3(MyDialog.transform.localPosition.x, MyDialog.transform.localPosition.y, this.Sequence); 
  2.  

And everything works fine.

Thanks