Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Transform Position in Mesh Instantiated from Script

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

  1. BeyondMASC

    BeyondMASC

    Joined:
    Feb 11, 2019
    Posts:
    2
    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).