- Home /
Question by
$$anonymous$$ · Sep 27, 2014 at 03:38 PM ·
listpublic variablequeue
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?
Comment
Best Answer
Answer by MakeCodeNow · Sep 27, 2014 at 04:46 PM
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.
Answer by JadsonAlmeida · Jun 16, 2021 at 12:55 AM
You can use something like:
private List<GameObject> asteroidQueue;
GameObject a = asteroidQueue[0];
asteroidQueue.Remove(a);
Similar to Queue usage.