Author Topic: About Position.Z of Widget of UI Root (3D) !! Help!!!  (Read 2414 times)

xiaoniaojjj

  • Full Member
  • ***
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 140
    • View Profile
About Position.Z of Widget of UI Root (3D) !! Help!!!
« on: October 10, 2012, 10:53:10 PM »
I create a Label for Panel by GameObject.Instantiate(). See below code , The value from Debug.Log is "LabelFloat(Clone):(0.5, 0.0, 0.0)" , But in inspector it's "(200, 0, -678.3)", Actually the value is true in world, See attach, whatever i set any value for the position.z , it always -678.3.  But no problem in " UI Root (2D)" !
public void Update(){                  
      Debug.Log(uLabel.gameObject.name+":"+uLabel.transform.position);
   }

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: About Position.Z of Widget of UI Root (3D) !! Help!!!
« Reply #1 on: October 11, 2012, 04:25:19 AM »
Inspector shows local coordinates. transform.position is in world coordinates. Try printing transform.localPosition instead.