Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

Transform Position in Mesh Instantiated from Script

Discussion in 'Editor & General Support' started by BeyondMASC, Jul 10, 2019.

  1. BeyondMASC


    Feb 11, 2019
    How to set/match the transform origin with the origin of the mesh, when the mesh is instantiated from Script.

    If a gameobject is instantiated (i.e. GameObject gO = Instantiate(meshGenPrefab);) without a specify position, the origin of the transform (i.e. origin to move, rotate and scale) appears at 0,0,0 global position and the gameobject is rendered in the place assigned.

    If the gameobject is instantiated with the specific position assigned (i.e. GameObject gO = Instantiate(meshGenPrefab, startPos, Quaternion.identity), the gameobject is rendered with an offset of the position assigned (i.e. with a offset of startPos).