Enemies on enable delete new path and ignore state in the world

Can I get some help, please?

I have been stuck on this for almost a week now and still don’t get it.

On enemy enable, in the object pool, it clears the path list and recalculates the path but it is ignoring any towers placed in the world there for sticking to the original path it first made upon starting the game.

i am getting these error messages

Hi,

Before you try to solve this problem, I would suggest to watch the next video (“Overloading Methods”) because Gary refines the current solution further. The game is not complete yet.

Regarding the yellow warning message, please check your game objects. Maybe there is a “Missing” component on one of them. This sometimes happens if you rename a class or file, or if you delete a script.

1 Like

Probably you have script file name that doesnt match name of class.

1 Like

I found the missing script reference it was my tile script. I watched the overloading methods video and fixed my enemies a little bit but they don’t listen to the change in the state of the world, they only listen to the path made for them when they are enabled, only the following enemy enabled after will listen to the new path

I tried the observer method like you showed me it’s still very difficult for me to wrap my head around with the current project on how to tie it all in, there is so many intertwined things that I’m scared i’ll break it even more than I have. I did create another scene and created a simple trigger to happen on mouse input to get my feet wet with the concept of actions and I think they’re really cool. I look forward to when I fully understand how to use them properly in a project of this size

they only listen to the path made for them when they are enabled, only the following enemy enabled after will listen to the new path

Have you already tried to add Debug.Logs to your code to see what is going on during runtime?

So broadcast message is not being called upon tower placement nothing is coming up in my log. I am calling notifyrecievers method in scope of the issuccessful bool check in the tile script. Broadcast message is within pathfinder as well so I don’t get why it’s not being broadcasted to all of the object pool children

Double-check the spelling in your code. And did you add Debug.Logs to verify that the other method was not called? Or did you just assume that it was not called?

Yes I debug.loged within the notify receivers to see if it was being called and nothing popped up in my console

Did you check the spelling? Have you already compared your code to the Lecture Project Changes which can be found in the Resources of this lecture? Are there any error messages in your console? Please share a bit more information on what you did and have in your project because, otherwise, it’s a bit difficult to help you with this problem.