- Home /
Question by
god_of_gamblers · May 18 at 05:42 PM ·
serialize
Cannot drag and reference List in the inspector window
The definition of the list is as follows:public List KeyState=new List(new bool[62]); The inspector window shows all 62 elements of the list, but I can't drag it to another List object to make a reference.
Comment
Your question is a bit unclear. Do you want to reference your List of booleans in another script using the editor only? This is not possible unfortunately, you'll have to do it by code.
public class A : MonoBehaviour
{
public List<bool> KeyState = new List<bool>(new bool[62]);
}
public class B : MonoBehaviour
{
public A A; // drag & drop other script
private List<bool> aKeyState;
private void Start()
{
aKeyState = A.KeyState;
}
}
Your answer
Follow this Question
Related Questions
Need to serialize a Monobehaviour Class 2 Answers
usage of FieldInfo.SetValue with SerializeField 2 Answers
Save and load a class 0 Answers
Serializing NetworkPlayer 0 Answers