unity接口类继承以及继承MonoBehaviour
unity中一个类同时继承MonoBehaviour和接口类,应该怎么做呢
----------------------------------------------------------------------------------------------------------------
TC_IWeapon类如下所示
using System.Collections.Generic;
using UnityEngine;
//using System.Collections;
public interface TC_IWeapon
{
List Stat { get; set; }
void PerformAttack();
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
public class TC_Sword : MonoBehaviour,TC_IWeapon
{
}
可以看到直接把接口继承这样写是错误的
右键,选择“快速操作和重构”
选择“实现接口”
VS自动实现接口
----------------------------------------------------------------------------------------------------------------
unity接口类继承以及继承MonoBehaviour
unity中一个类同时继承MonoBehaviour和接口类,应该怎么做呢
重复上面的步骤
文章为作者独立观点,不代表股票交易接口观点