private Rigidbody2D rb;
private Animator Anim;
void Start()
{
rb = GetComponent<Rigidbody2D>();
Anim = GetComponent<Animator>();
}
私有在unity界面不显示,通过start连接组件。
[SerializeField]private Rigidbody2D rb;
可在unity中显示私有,便于debug
最后
以上就是孤独画笔最近收集整理的关于Unity2D入门2 public和private的全部内容,更多相关Unity2D入门2内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复