Hi there, in my game I have a script with a static variable for the GameSpeed, so that the speed of the simulation can be changed. I can’t access this variable from the AILerp script and I can’t get access to the AILerp script using GetComponent. I don’t know if this is because the pathfinding scripts use their own namespace or perhaps because of the VersionedMonoBehaviour. Could someone provide me with an explanation to how this can be done?
Pathfinding AI scripts use a namespace:
Get like so:
this.GetComponent<AILerp>() this.GetComponent<IAstarAI>() (if just needing interface)
For simulation speed, you can set Time.timeScale to speed up or slow down the simulation. When you change GameSpeed, you could change timeScale at the same time. That might be easiest. However, if you’re using your own special tick, then maybe when you change GameSpeeds you might iterate all your agents to set speed/rotation fields on each agent. Alternatively, you could also modify AILerp so that speed, a field, is a property that pulls from YourSpeedClass.yourStaticSpeedField.