为什么需要跟你的组件添加公共方法呢? 留一条后路嘛,万一你那天想起要给全部的组件添加一个方法. 此时我只能告诉你慢慢修改吧累死你

 

子组件:A ,父组件:B
继承方式:  A -> B –> MonoBehaviour.  此时你在B中写入方法(简单吧)

using UnityEngine;
using System.Collections;


namespace MyNamespace 
{

    public class MyCompoment : MonoBehaviour
    {

        //公共方法
    }
}

 

using UnityEngine;
using System.Collections;

namespace MyNamespace 
{
    public class 组件名:MyCompoment
    {
         
    }
}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-06
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-26
  • 2021-09-22
  • 2021-10-18
  • 2022-12-23
相关资源
相似解决方案