Search Unity

Bug When I add a reference to a object placed in the scene to an animation, it disappears upon reloading

Discussion in 'Animation' started by RandomGeneratorCodes, May 27, 2023.

  1. RandomGeneratorCodes

    RandomGeneratorCodes

    Joined:
    May 8, 2020
    Posts:
    6
    I'm trying to animate a boss fight for my game, and I'm using the Unity animation system to do it.
    I need to spawn a prefab (bullet) at the position of another object (the hand it is being thrown from).
    So in different parts of the animation I change one of the values in the spawner script, the value that tells the game which game object to spawn the bullets on top of.
    So I add a bunch of references to different objects in the scene as the values in that variable throughout the animation.
    However, when I reload the scene all of the keyframes for that value have turned into references of "None (GameObject)".
    This seems to only be happening for references to objects that have been placed in the scene, because once when I accidentally made a reference to the PREFAB it STAYED when I reloaded the scene.
    I'm really confused. Any ideas?
    Let me know if you need any more info, I'm kind of new to the forums.




    My Unity version is 2021.3.16f1.
    I am using Windows 11.
     

    Attached Files:

  2. RandomGeneratorCodes

    RandomGeneratorCodes

    Joined:
    May 8, 2020
    Posts:
    6
    I think I was supposed to give this post the "Question" prefix, not the "Bug" prefix... How do I change that?
     
  3. RandomGeneratorCodes

    RandomGeneratorCodes

    Joined:
    May 8, 2020
    Posts:
    6
    I ended up just making an array of the game objects I want to use and I animated an integer which corresponds to the index in that array of the object I want to spawn. Really weird issue.