I have a custom editor for manipulating waypoints for pathfinding. I have a few issues with the elegance of it all that make me think I could be doing most of this better, but this is the most troublesome right now. I have one object holding the network of waypoints together, and I have a pathfinding component that pulls up that object and gets this component.
What I was kind of hoping would work was:
- I assign the visual editing component that has the waypoint network to the level data object in my editor.
- I then do my editing operations, which creates various waypoints that get stuffed into the waypoint network container.
- Now in the game, I was hoping a pathfinding component I have on my AI-controlled mobs could retrieve that network and use it.
However, in the actual game, it does not have any of the pathfinding data that it has in the editor. It is completely uninitialized.
Is there some elegant way to bind these together in Unity? All I can think to do right now is add a button to serialize the container and have my pathfinding deserialize it from disk or something. It seems like such a waste because technically, that data is all in there somewhere already.