I've made and animated a player sprite in one unity scene and saved the gameobject as a prefab. In the scene I created it it animates wonderfully, but whenever I try the prefab in another scene it breaks. After some debugging it appears that the Animator component is null in the other scenes, and has relevant data in the original scene. The following is what I'm using to get a reference to the animator in code that works in the original scene but not in the others.
private Animator myAnim;
void start(){
myAnim.getComponent<Animator>();
if(myAnim != null)
{
print("myAnim Exists"); //this happens in the original scene but not in the others
}
}
void update(){
myAnim.SetFloat("moveX", myRB.velocity.x); //where the red error points to at runtime. Says an object reference doesn't exist
}