unity, public+[HideInInspector] vs private
下面写法不报错:
[System.Serializable]
public class CmyObj{
CA m_a;
...
}
public class XXX: MonoBehavior{
[HideInInspector]
public CmyObj m_myObj;
void Start(){
}
void Update(){
}
}
下面写法也不报错:
[System.Serializable]
public class CmyObj{
CA m_a=new CA();
...
}
public class XXX: MonoBehavior{
private CmyObj m_myObj;
void Start(){
}
void Update(){
}
}