Search Unity

Spawned Object disappear if animated?

Discussion in 'Editor & General Support' started by briosh, Aug 9, 2010.

  1. briosh

    briosh

    Joined:
    Aug 9, 2010
    Posts:
    17
    When I add an object (a spaceship model) in the scene and give it an initial looped animation or change animation during the game, it plays fine. The model is inside a parent object in order to have local coordinates for the animation.

    But when i instanciate the spaceship object:
    1. it disappears if i change animation or,
    2. it does not even appear if it has an initial animation!

    I tried having a manually placed object at the same time the 'instanciator script' runs and the results are the same: the object in the scene is the exact same object i instanciate, but the latter does not appear while the manually placed appears and animates correctly!

    i apologize if its been solved before i just can't find anything.

    (i am using unity free edition for windows and my pc meets all requirements. the model i am using is obj format and the animation was done using the unity built-in animation tools)
     
  2. briosh

    briosh

    Joined:
    Aug 9, 2010
    Posts:
    17
    Ok i solved the issue. I created an other object inside the parent and then my model inside the second object. It is child to the child object now.

    [ prefab ] -> [object] -> [myModel]

    My guess is that when instanciating, unity clones the object nested inside the prefab, not the whole prefab. So the 'child' of a prefab becomes the instanciated object and hence, there is no parent for it in the scene.