Custom Object Queues


I’m new to Javascript and especially Unity and I couldn’t find anything answering my question.

Currently I’m trying to create an object field which uses FIFO (First-In-First-Out). I was hoping for some native/inbuild method in Unity and then I found this: Queue's in UnityScript - Questions & Answers - Unity Discussions

This helped me only a bit though, because there seems to be no possible way to insert custom objects into this queue. I also couldnt find queues in the Unity Scripting API Reference.

Is there an actual possibility to add custom objects - as declared as below - in this queue or any other native FIFO structure or do I have to make something myself?

var tower_brick : Transform;

Thanks in advance!

If you want a thorough explanation on how to implement object pooling, I’d suggest you check out this tutorial:

It should explain everything you need and more tips on optimizing the pool.
(It is in C# though)

The default Array can act like a queue. Check out the Shift and Unshift methods. There’s no Peek-like method, but you could put a pretty thin abstraction on top of Array to get the standard queue API.