2
votes

I've identified a problem with one of my 2d platform gameobjects with a animator component attached to it.

The platforms sprite goes missing at runtime and this is directly caused by the animator itself, which before wasn't a problem. when I disable the animator and run the game the sprite doesn't go "missing", but as soon as I enable it, it's missing again.

This is probably happening because I started the project in unity 2019b and switched to 2018.4.12 because I was getting weird CURL errors that prevented me from building for Android. The affected prefab(platform) functions as it should other then the fact that the sprite goes missing at runtime and nothing about the project has changed. Code works perfectly as it did when there were no issues.

I just installed unity 2019.2.13 hoping this would solve it but no change. Tried re-importing the asset but nothing. This isn't a collision issue. The 'z' axis is not modified at runtime. and its definitely not a code issue because as stated before the functionality isn't affected, its just the sprite going missing. I'm out of ideas now and exhausted online resources. Can anyone help in any way. Thanks in advance.

1
In the Animator there seems to be a keyframe somewhere in one of the AnimationClips that changes this property. As soon as there is one little keyframe somewhere the Animator "locks" this property to the default unless it is changed in the keyframe .. you can't even change it via script as long as the Animator is enabled .. go through all your animations and check whether somewhere you have a keyframe for this sprite! Maybe it reffers to a sprite that doesn't exist anymore or the default state was a sprite that doesn't exist anymore - derHugo

1 Answers

0
votes

simple fix. i just created a new prefab and re-created the animations... Annoying but it worked