public Queue

If I use a public List, I can see the list and make edits to it in the Unity editor. But if I change this to a Queue, which is what I actually want, I cannot do that.

How can I change a public Queue from within the Editor? Or is this where I just need to sacrifice performance for convenience?

2 Answers

2

Unity only supports native editing (and serialization) for a very small number of basic types. Queue, Stack, and Dictionary are not supported. The most common solution is to store and edit the data in a List and then transfer to a Queue in OnEnable or somesuch.

You can use something like:

private List<GameObject> asteroidQueue;
GameObject a = asteroidQueue[0];
asteroidQueue.Remove(a);

Similar to Queue usage.