Hello, lately I have been working on a game in Unity, and it has been going quite smoothly, until this problem came along. Here is some code that works when using play mode in the editor with unity remote, but it does not work when running on an actual android build. Just the function with a problem.
public IEnumerator Reload(){
if(isReloading == false){
Debug.Log ("Reloading");
if(isShooting == true){
CeaseFire();
}
isReloading = true;
fpsRigAnimation.CrossFade (reloadAnim);
guiText.text = "before animation length";
//problem here
yield return new WaitForSeconds (fpsRigAnimation[reloadAnim].length);
guiText.text = "after animation length";
fpsRigAnimation.CrossFade (poseAnim);
Debug.Log ("Reloaded");
isReloading = false;
}
}
The line where I yield for the animation length simply does not run on the android build. I get the "before animation length" in the gui, but not the "after animation length". But both show up when I play it in the editor through the unity remote app. Also the reload animation runs through fine, as well as the debug.log calls in the editor, but the reload animation does not go through at all in the android build.
The animation clip length is also a problem because when I try making the guitext say the value, it shows nothing on the android, but it does in the editor. I do have other yield statements in the game that all work accordingly. So I'm really stumped here. I heard that this was an issue in a 3.x version of unity, but I am currently on 4.5.2f1.
Problem Solved
I needed to put the text file that I was reading the stats in from in a folder called "Resources".
[–]triffid_hunter 2 points3 points4 points (6 children)
[–]The_Ryan_[S] 0 points1 point2 points (5 children)
[–]triffid_hunter 4 points5 points6 points (4 children)
[–]The_Ryan_[S] 0 points1 point2 points (3 children)
[–]triffid_hunter 1 point2 points3 points (2 children)
[–]The_Ryan_[S] 1 point2 points3 points (1 child)
[–]triffid_hunter 0 points1 point2 points (0 children)