Saving AIPath Component

Hi,

Is there a recommended way to save AIPath? Currently i’m saving the position and target but i’m getting some odd results when loading my game back in and restoring those properties.

I’ve searched and can’t see any concrete info.

Thanks,

Hi

What odd results are you seeing?

I don’t think i was restoring the AIPath properties properly however it still leaves the open question of what am i supposed to be saving and restoring from AIPath in order to full restore it.

Thanks,

Hi

If all the settings in the inspector are saved/restored from a prefab then I think you’d only need to save the agent’s destination.
What odd results are you seeing?

Hi,

This is for a game save though which is all being done through Xml so it’s not a case of saving a prefab. I basically needed to know what properties of AIPath i needed to save and restore from my save file to reinstate the original behaviour.

I seem to have got it all working except one thing, velocity. How do I set the character velocity? I am restoring the position and destination but on every load the aipath begins walking from a stop rather than from walking speed. How do i set velocity on an AIPath? The velocity member is a getter only.

Thanks,

Hi

The velocity is a protected field I’m afraid. You can subclass the AIPath script and expose a setter for it I suppose.

Alternatively you can upgrade to the beta version which exposes this field as the desiredVelocityWithoutLocalAvoidance property.