I have a Dictionary with waypoints for my nav mesh agent, and I want him to do multiple operations on the waypoints and the ability to set this in the inspector.
I know how to get a dictionary to show up in the inspector, but not with its own class and properties.
The data looks like this:
public class Operations
{
public LoadOperation loadOperation;
public UnloadOperation unloadOperation;
public enum LoadOperation
{
NoLoading,
Load
}
public enum UnloadOperation
{
NoUnloading,
Unload
}
}
[Serializable]
public class WaypointList
{
public Transform waypoint;
public Operations operation;
}
// Holds the list of waypoints and their operation
[SerializeField]
private List<WaypointList> waypointList;
// The list of operations for each waypoint
private Dictionary<Transform, Operations> operationsList;
private void Awake()
{
// Create an in editor friendly array with waypoints and the operations for each
operationsList = new Dictionary<Transform, Operations>();
foreach (WaypointList entry in waypointList) {
operationsList.Add(entry.waypoint, entry.operation);
}
}
Right now it only shows me the waypoints in the array because editor can’t read the class…
So in the inspector I want to set the waypoints in an array, drag the transform on to the waypoint, then set the one or multiple operations to execute on this waypoint.