当前位置:   article > 正文

unity中隐藏基类的方法与字段_unity 字段不显示

unity 字段不显示
  1. using UnityEngine;
  2. public class HideMemeber : MonoBehaviour
  3. {
  4. // Start is called before the first frame update
  5. void Start()
  6. {
  7. Debug.Log("-------------------------------");
  8. Humanoid human = new Humanoid();
  9. Humanoid enemy = new Enemy();
  10. Humanoid orc = new Orc();
  11. //注意每个 Humanoid 变量如何包含
  12. //对继承层级视图中
  13. //不同类的引用,但每个变量都
  14. //调用 Humanoid Yell() 方法。
  15. human.Yell();
  16. enemy.Yell();
  17. orc.Yell();
  18. Debug.Log("-------------------------------");
  19. Humanoid human1 = new Humanoid();
  20. Enemy enemy1 = new Enemy();
  21. Orc orc1 = new Orc();
  22. human1.Yell();
  23. enemy1.Yell();
  24. orc1.Yell();
  25. }
  26. // Update is called once per frame
  27. void Update()
  28. {
  29. }
  30. }
  31. public class Humanoid
  32. {
  33. //Yell 方法的基版本
  34. public void Yell()
  35. {
  36. Debug.Log("Humanoid versi
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/酷酷是懒虫/article/detail/806553
推荐阅读
相关标签
  

闽ICP备14008679号