[SOLVED]How to access script array param in Unity inspector?

Hello,

I don’t know if it is possible, but I need to modify some array class variable in Unity inspector directly.

If I set in my C# script a simple public float value, I can use it easyly in the inspector of my GameObject.

But, I need to pass an array of string and Texture2D as :

public class Definitions : MonoBehaviour
{	
	public class ObjectDef
	{
		public Texture2D icon;
		public string categorie;
	}

	public ObjectDef[] myList; // Doesn't work

	public float myValue; // Works
	...

In the inspector, I can see my variable myValue but not my array myList.

Can you help me to do this ?

Thanks.

Kcm

You just need to declare the ObjectDef class at the top level (ie, outside the Definitions class) and mark it with the System.Serializable attribute:-

[System.Serializable]
public class ObjectDef { 
    public Texture2D icon; 
    public string categorie; 
}

public class Definitions {
   public ObjectDef[] myList;
   ...
}

Thanks!
It works well!