OK so I've had a really annoying problem for the last three days and I've finally nailed down the problem but not sure how to fix it. I have used a youtube tutorial series by Sebastain Lague on creating your own path-finding which works amazingly well and I wanted to create my own target selection to find the closest target and set that as the target for the path-finding to use which i have set up and works fine. I than created a Spawner script but any enemy created through this script the path-finding will only work for the first target it finds to be the closest if the player or another object becomes the closest it selects that as the target but refuses to move towards it or use path-finding at all.
So my question is simple why does this work for objects that ain't prefabs. I myself can't imagine something working fine for just a gameobject in the level at the start and one that I spawned in during the game. This is the part that is the confusing to me as all the objects are the same and if i just duplicate an enemy it will work fine but instantiate one in and i get an error. The only clue I have is an error which shows the following:
![alt text][1]
[1]: /storage/temp/123920-unityerror3.png
If you want to see the spawner script and other scripts affected I have a unity forums thread with them all shown listed below:
https://forum.unity.com/threads/dynamic-path-finding-script-having-problems.549877/
↧