- Home /
Problem with creating a Unity 2d Animation
Hey, So to keep it brief I'm trying to make a 2d game and wanted to try and implement an animation for my character. I have imported all the key frames, given the player an animator, attached an animation controller, selected the character and then created a new animation called 'MoonRun' When i try and drag the sprites to the animation timeline I get this little pop up
and by clicking either of them I get this error message NullReferenceException: Object reference not set to an instance of an object UnityEditorInternal.DopeSheetEditor.SelectTypeForCreatingNewPptrDopeline (System.Object userData, System.String[] options, Int32 selected) (at /Users/builduser/buildslave/unity/build/Editor/Mono/Animation/AnimationWindow/DopeSheetEditor.cs:705)
I was using a video guide but their screen looked a bit different and this didn't occur and have tried looking through other asks for similar problems but couldn't find the answer. Any help greatly appreciated
$$anonymous$$aybe you need to add a Sprite Renderer component to your game object before adding sprites to the animation.
I have a sprite renderer already, incase it matters here is a picture of what is on the character entity
Got the same problem. On Unity3D pro Windows 10. Cannot drop sprite onto animation. Please help as I am stuck on project due to this bug.
$$anonymous$$e too - this is always happening to me. I would love to know what causes it and how to go around it.
I have been having this problem as well. It must be something to do with the script attached to the game object since when I remove the script component I can drag sprites into the animation no problem.
Answer by Ferrety6012 · Oct 28, 2015 at 01:30 PM
Mine fixed itself when I updated Unity to the latest version. If you are already on the latest version of Unity I can only assume that a re-install would serve the same purpose.
Answer by Alpants · Apr 24, 2016 at 08:05 PM
This seems to be a duplicate of http://forum.unity3d.com/threads/difficulty-dragging-sprites-onto-animation-screen.341881/ Here is the answer I posted there:
I am experiencing this also. The problem seems to be getting the sprite element of the sprite renderer added as a property of the animation. I found a work around:
Make sure your game object selected and your desired animation is selected
Press the record button on the animator. The animation component should get unchecked in the properties window and turn pink
Drag your first sprite into the "Sprite" property on the Sprite Renderer object attached to your game object in the properties panel
This should automatically add the sprite component to the animator and add your first sprite. Now you should be able to drag one/more sprites into the animator as you normally would.
Hope this helps!
If it doesn't, you could try copying / renaming an existing animation file that has the sprite renderer component already attached, then erasing all sprites manually to start fresh.
Your answer

Follow this Question
Related Questions
Please help me with my 2D animations - c# 2 Answers
2D Animation does not start 1 Answer
2d sprite animation issue 2 Answers
How to make a sprite stay at a consistant baseline during animation? 1 Answer
Zombie Cafe style game. 1 Answer