Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more..
    Dismiss Notice
  3. Dismiss Notice

prefab into an empty gameobject make instantiate make wierd stuff.

Discussion in 'Prefabs' started by raitoryuukuu, Feb 8, 2021.

  1. raitoryuukuu

    raitoryuukuu

    Joined:
    Jan 21, 2020
    Posts:
    7
    hi everyone.

    I have an issue i didn"ts succeed to fix or even understand.

    in my scene i have prefab that when you touch it it instantiate another prefab, it does work nice but when i put the prefab into an empty gameobject in the scene to create kind of folder to make the scene easier to work on the instantiate object appear far away of my object.

    Without putting the prefab into the empty gameobject it appear right at the place of my initial prefab.

    thanks in advance to everyone who's going to help me finding out why this is happening and how to fix it (the point of this is at the end to have my level into a big gameobject so i just have to change the level gameobject in the scene every time we switch level, using différents scene to each level isn"t practical as it's a VR project and i don"t want to remake everything about the camera etc in every scene if i change anything)

    I use onSelectExited i tought it will happen once we release an object like a singleton but it does seams it is call everysingle frame nothing is held in the hand so it create infinite call of my method
     
    Last edited: Feb 9, 2021
  2. raitoryuukuu

    raitoryuukuu

    Joined:
    Jan 21, 2020
    Posts:
    7
    Solution

    so i found out why this happen so poeple can fix it themself :

    use transform.position instead of transform.localposition it use the root position so the instance pop in the right place and no depening on the whole thing that are into the same parrent empty game object.