Advanced Arrays in C++?

I really need some crucial tasks relating array.

In flash, they look like:
Array.push(Item) - add an item to an array
Array[ItemName] - get an array by name

I know you can usually do them in C# by using std::vector and other fancy scripts, but that doesn’t work in nity.

Is there a way around?

Unity doesn’t use C++. Look here for some of the collections you can use in C# and Unityscript.

–Eric

Sorry, I ment C#.

Edit: That does solve SOME of my problems. Not sure how to add named indexes though…

I think you should use the “Dictionary” Class for it.
This class will have a “key” and a “value”. I recommend you to use this class like this.
Dictionary < key, value> test_Dic = new Dictionary<key, value>();
The ‘key’ part should be written into type of variable.
For example
Dictionary < int, value> test_Dic = new Dictionary< int, value>();
if you are using Item with Item_ID(int) then you should use int for ‘key’ value.
and ‘value’ can be anything. It can be written into type of variable like ‘key’.
For example
Dictionary <int, int> or Dictionary < int, string>
like this.
And finally I like to say you can use ‘value’ into class type. This is very important part.
Because you can use like this!

Dictionary <string(this is for Item name), Item(this is item class)> = new Dictionary <string, Item>();

This is very useful and you will use “Dictionary” class very often with “ArrayList”.
Before I end up this commend, you should add top of the code like this(blue one).

using UnityEngine;
using System.Collection;
using System.Collection.Generic;

if you are more interested in Dictionary class, go into this site.

You mentioned std::vector, though, so I suggest refreshing on the differences between the two. They’re both called C-something and they can often look similar or even identical, but they are quite different languages and life will be hard if you get them mixed up.

Hmm… I used Dictionary before in C# already when I was making with inventory system…

The C# equivalent of std::vector is List