- Home /
Question by
ziladothemado · Jan 27, 2021 at 10:31 PM ·
player movementdeath
Player keeps moving after death....
So, i made a game where the player moves forward automatically and when he hits an obstacle he stops moving forward, plays a death animation and the player loses control of the character. the script worked fine in the editor but when i exported the game and tried it out, he would hit the obstacle play the death animation but keep moving forward, jump and move left to right. Can someone please help me? here are the lines of code that do all the death stuff.
if(other.gameObject.tag == "Deadly"){
GameObject player = GameObject.FindGameObjectWithTag("Player");
animations.SetBool("Lose",true);
losePanel.SetActive(true);
player.GetComponent<automve>().enabled = false;
}
if(other.gameObject.tag == "Deadly"){
GameObject player = GameObject.FindGameObjectWithTag("Player");
Animation.SetBool("Lose",true);
player.GetComponent<PlayerController>().enabled = false;
}
Comment
First I would try building your game in development mode and attaching to the player log. This will allow your game to output errors like it normally would. I expect that you are getting some kind of error that is causing your code to drop out before it disables your player controller.
Your answer