Running scripts when Image is detected and NavMesh Agent Position Errors
I may need some help guys. I am creating an AR game in AR Foundation, and all of the components work properly without the AR Components, in which the entire game starts if I enable the Master Script.
However, when I implemented the AR components for this game, I ended up with errors that pertain to the NavMesh Script, saying that the NavMesh Agent is not close enough to the NavMesh itself, even though that wasn't the case beforehand. This resulted to the objects in the scene moving in all sorts of places based on the movement of the camera, as shown here.
Here is the script that I have implemented for when the image is recognised, where I activated the script when the image is activated upon ImageChange, though I'm not quite sure how to implement this properly. I may need help in this regard in addition to finding out what caused this to happen.
Thanks in advance!
TL;DR: Positions out of wack after using script from prefab in AR, even though it works without it. Need help on how do I activate scripts in prefabs properly when image is scanned, while finding out what caused this.
Here's the script, as well as the debug logs: https://hastebin.com/mitejinuro.cs https://hastebin.com/wozuyemepo.sql
Also, here's the script responsible for spawning the defensive AI. https://hastebin.com/jehogaroga.cpp