js调用c#的问题
有两个script文件:Test01.cs和Test02.js 附加到同一个对象。using UnityEngine;
using System.Collections;
public class Test01 : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
}
public void DoSomething () {
Debug.Log("Test01 is callde");
}
}
function Start () {
var a = gameObject.GetComponent("Test01");
//Debug.Log("" + a);
a.DoSomething();
}
function Update () {
}
编译的时候出错了,错误信息是:Assets/MyDemo/Script/Test02.js(6,11): BCE0019: 'DoSomething' is not a member of 'UnityEngine.Component'.
新人请教大神错在哪里,急急急………………
public void DoSomething ()
public static void DoSomething ()试试. 很不错 楼主是超人 顶顶多好 难得一见的好帖 不错不错 好帖就是要顶 顶顶多好 难得一见的好帖
页:
[1]