- Home /
Unity behaviour changes overnight
Hi! I'm quite lost and frustrated :) I'm working on a game which relies heavily on AI. I wrote the AI code once and it stopped working overnight. I wrote it again, more stable, reliable and seperated all AI tasks in different classes.
Now today I woke up, booted Unity and the behaviour is much different from the way I left it last night. Somehow Unity is messing up my scripts?! Is this even possible? I'm at a point of ditching the engine all together. MonoDev asks me convert the line endings every time too!
As an example, I've got woodcutters and stonemasons. They find their resource and gather it. These two scripts are basically copies of one another and the stone still works, but the wood isn't. I rewrote everything multiple times, it works for a day. Next day it's broken.
There's nobody in my household who has access to the PC.
$$anonymous$$ind of going away from the topic of Unity at the end there...
But it's possible that Awake() and Start() of all of your scripts are running in different orders. $$anonymous$$aybe it's because of the order of your initialization. I suggest you to go mess with this:
http://docs.unity3d.com/$$anonymous$$anual/class-ScriptExecution.html
$$anonymous$$ight fix the problem.
Before scrapping it entirely have you tried debugging the data being passed into the scripts? Step through the data line for line just to check that the information is correct. Your code could potentially be fine, but the data it's trying to compute might be incorrect! http://www.gamedev.net/page/resources/_/technical/general-program$$anonymous$$g/debugging-follow-the-data-r3913 It'd be a bugger to lose all your hard work!
Gratitude! You just made my day :) One function was called before a loop finished and returned null as a target 99/100 times. I just added a delay for now and it works again! Thanks very muts!
Your answer
![](https://koobas.hobune.stream/wayback/20220611235505im_/https://answers.unity.com/themes/thub/images/avi.jpg)