- Home /
Playing Queued Animation Freezes Unity, Causes Error
Hi,
I am trying to play a queued animation for a character in a javascript file, which causes Unity to freeze for approximately 20 seconds. Every time I attempt to play the queued animation after that, the game throws an error:
MissingComponentException: There is no 'Animation' attached to the "basketball2" game object, but a script is trying to access it. You probably need to add a [sic] Animation to the game object "basketball2". Or your script needs to check if the component is attacked before using it.
I have a .fbx model with animations that was imported into my game, and I have assigned labels to the animations, as well as made sure to click the "Import Animation" checkbox in the Import settings. This is the code I am using to play the queued animation:
//more up here
//...
function Update()
{
if(Input.GetButtonDown("Player1") && canControl1)
{
player1.animation.PlayQueued("aim");
}
if(Input.GetButtonDown("Player2") && canControl2)
{
player2.animation.PlayQueued("aim");
}
if(Input.GetButtonDown("Player3") && canControl3)
{
player3.animation.PlayQueued("aim");
}
}
I am certain that I have an animation that is labeled "aim", that (I assume) was imported with the .fbx model.
I am running Unity 4 in Windows 8. If anyone has any idea as to what could be happening, I would love to hear it.