Hi all !
Here is my problem (very simplified). I don’t know if it’s possible or not.
I can drag and drop a C# Script in inspector thanks to this class.
[System.Serializable]
public class AreaInfo
{
public UnityEngine.MonoScript _Instance;
// others members
}
In my hierarchy, i’ve attached the following script on a gameobject :
public class Game : MonoBehaviour
{
public AreaInfo[] areaInfos;
void Start()
{
foreach(AreaInfo info in areaInfos)
{
// my dream would be :
NameClass toto = new ( info._Instance.GetClass() ); // the code is totally wrong, but i'm looking for if a solution exists
}
}
}
I would like to instantiate an instance according to the type of Script (All my scripts inherits from MonoBehaviour) that i drag and drop in the inspector… Is it possible ?
thanks in advance !