I am working on my combat function and to test out the code I created a cube with a Enemy tag on it. The way I have it is when the currhealth on it reaches below 1 it is supposed to be destroyed. The destroy part works just fine however when I load up the menu or the character screen (both of them has problems) and click on return, the game object respawns.
If anyone needs more of a code than this I’ll be more than happy to supply more but as far as the code that controls it on the player attack it is, GameObject enemy = GameObject.FindGameObjectWithTag (“Enemy”);
DestroyObject (enemy);
And the code for the menu and character screen is GameObject go = GameObject.FindGameObjectWithTag (“Player”);
I’m not sure if this would make any difference in the problem I’m having but I also got a
if (huntscout.enemyscoutquest == false && enemyalive == true), in there as well and once the enemy is dead it would switch enemyalive to false.
My apologies if there are any confusion and if anyone else had this problem before can you please let me know what you did to fix it?
Also I have noticed that while I’m getting a lot better in Unity Coding and C# coding and I can do a lot more, it seems like I’m just putting in more logic errors than I intend to, for example in this case so if anyone knows what part of the Unity documentation or any of the video lessons they can point me to that would also be helpful.
Thank you.