You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all
MonoBehaviour:.ctor()
cs:.ctor()
什么情况
You are trying to create a MonoBehaviour using the 'new' keyword. This is not allowed. MonoBehaviours can only be added using AddComponent(). Alternatively, your script can inherit from ScriptableObject or no base class at all这个出现好几次
using UnityEngine;
using System.Collections;
public class csmouspo : MonoBehaviour {
cs cs1=new cs();
void Start(){
int i=this.cs1.cshs();
print ("r:"+i+"\n");
}
using UnityEngine;
using System.Collections;
public class cs : MonoBehaviour {
public int cshs() {
return 1; }
}