Not loading game over scene on chr death

so my interface works with the click to start or restart game depending on which scene is loaded. when I play the game and either crash into the enemy or get shot to death it won’t launch the loaggameover()
method. any ideas?
(I have compared my script againts the lecture script and seems to be correct.)

Hi Oraphen,

Have you already tried to add Debug.Logs to your code to see what is going on during runtime? For instance, does a OnCollision* method get called when the player crashes into an enemy? Does the player’s health decrease if the player gets hit by a bullet(?)?

So I think I solved it but still have a bug.
what I did was set the isPlayer bool =false; and then go to each prefab and check and uncheck each serielizedfield. so now it seems to work except if I crash into the enemy with my ship. not sure what to do to resolve the crash bit

Does the collision between enemy and player ship work? Use a Debug.Log to figure that out. If the message appears in your console, the problem is in your code. If the message does not appear, there might either be a typo in the method name, the method might be within another method (= local method) or something is wrong with these two game objects in the scene.

Try to figure out what works and do not assume that something does work just because it looks as if it worked. The computer is relatively unpredictable in this respect because a lot is going on during runtime. We never know if something is correct unless we explicitely check that.

so after more testing. I found that if the player ship has 1 hit left from a laser and collides the scene change occurs. if the player has more heal it the ship is destroyed but the script does trigger.

Solved it
I put an if(tag =="player) in the dmage dealer script and seems to work properly now,

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms