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(){

  }

}

posted on 2016-02-28 16:49  wantnon  阅读(369)  评论(0编辑  收藏  举报

导航