示例#1
0
    static int GameObject_Find(IntPtr L)
    {
        string name = Clua.lua_tostring(L, -1);

        UnityEngine.GameObject go = UnityEngine.GameObject.Find(name);
        if (go)
        {
            //Clua.lua_pushlightuserdata(L, go);
        }
        else
        {
            UnityEngine.Debug.LogError("go is null");
            return(0);
        }
        return(1);
    }
示例#2
0
    static int create_GameObject(IntPtr L)
    {
        try
        {
            int count = Clua.lua_gettop(L);
            //UnityEngine.Debug.Log("创建物体的名字是参数个数 "+count);
            string name = Clua.lua_tostring(L, -1);
            //UnityEngine.Debug.Log("创建物体的名字 :" + name);

            UnityEngine.GameObject go = new UnityEngine.GameObject(name);

            //Clua.lua_pushstring(L,"创建gameobject成功 "+go.name);
            IntPtr data = Clua.lua_newuserdata(L, go);

            LuaManager.Instance.luaObjectDic.Add(data.ToInt64(), go);
            //Clua.lua_pushlightuserdata(L, data);
        }
        catch (IOException message)
        {
            UnityEngine.Debug.LogError(message.Message);
        }

        return(1);
    }