Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

I put a prefab in my scene and it moves to (0,0,0)

Discussion in 'Prefabs' started by jma00049, Jan 17, 2020.

  1. jma00049

    jma00049

    Joined:
    Feb 21, 2019
    Posts:
    89
    Hi all,
    I am doing a zoo and I have a bear prefab. I put my bear prefab in his jail and when I start the game the bear is at (0,0,0). What is happening?

    Here is where my bear should be:

    bear.PNG

    And here where my bear is when I start:
    bear2.PNG
     
  2. roykoma

    roykoma

    Joined:
    Dec 9, 2016
    Posts:
    176
    Hey,

    as I see there is a Animator on your bear, I'd think that you probably have a animation running which is probably the culprit.
    If you animate a position this is not being animated/played relative to where the object was before, it instead just straight of sets the value.

    A workaround would be to create an empty GameObject and set the bear as it's child. Then move the empty GameObject (with the bear childed to it) to the spot you want instead of the bear itself.

    Hope it works!

    Greetings,
    Roy
     
  3. jma00049

    jma00049

    Joined:
    Feb 21, 2019
    Posts:
    89
    Thanks for your help! It works!