[solved]How can I get multiple properties for the same public array object?


I would like to know, how to set up Arrays wich contains more than just one information in the unity inspector. An Example would be the input under project settings. There is an array “Axes” with different properties like an string “Name”, a float “Gravity” and a bool “Snap”.

In my case I wanna put an Texture2D and an bool together…

//Edit: Okay, found the solution:
I had to declare an class with [System.Serializable] storing my properties and now it works.
Example (C#) for those searching for the same answer:

public class BuyableItem{
    public GUIContent item;
    public bool buyable;
    public int value;
public BuyableItem[] items;

If you’re using C#, you can use the generic datatype Tuple to store those two different types. Arrays, in general, can only store one type, but by wrapping both types into a single container, you can then store the container objects in the array instead of their components, and you essentially end up with an array of “pairs”. Note that to access either one, you have to first get the pair, or tuple, from the array, and then access the data from that object.

Array of struct object that contains what you need?

	public struct Data
		 public Texture2D _Texture;	
		 public bool _Active;
	Data[] _data = new Data[100];

You then use it in a way like this:
_data[4]._Active = true;

Hope this helps you out.