- Home /
Android: object dissapears when animator starts playing animation
I have a pretty big problem. I tried a lot of things. Recreated the animation, animator controller and even added a script to enable the animator a second after start but still nothing. My object is supposed to change position and rotation s couple of times. In the editor the animation works perfectly. However when I build the game for the phone the animation doesnt play. The object stays for one second and when the animator is enabled the object dissappears. Please help.
Answer by JennyHide · Jan 23, 2016 at 01:30 AM
Assuming you're using Mecanim to animate, it looks like this is a known bug (logged here https://issuetracker.unity3d.com/issues/android-animation-sets-transform-to-nan-when-it-includes-a-rotation-component ).
It's the rotation that is causing the problem - you can work around it by changing the interpolation of the rotation to either "Euler Angles (Quaternion Approximation)" or "Quaternion" (see image).
Is there any way to change this on all animations, or to change the default?
I don't think so. This issue tracker says it's fixed in Unity 5.3.3 though, so if you have a project with lots of animations, it might be worth waiting for that.
Answer by Amon · Jan 23, 2016 at 12:50 AM
Need some Code to see otherwise we are all of us blind in helping you find a solution.
#pragma strict
public var Bullet1 : GameObject;
public var Bullet2 : GameObject;
function Launch_Anim()
{
gameObject.GetComponent.<Text>().text = "Bullet Dodger";
Bullet1.GetComponent.<Animator>().enabled = true;
Bullet2.GetComponent.<Animator>().enabled = true;
}
function Start()
{
Bullet1.GetComponent.<Animator>().enabled = false;
Bullet2.GetComponent.<Animator>().enabled = false;
Invoke("Launch_Anim", 1);
}
Even without the script the animation doesn't play.