CS.UnityEngine静态方法访问unity虚拟机
创建游戏物体
CS.UnityEngine.GameObject('new by lua');
静态属性
CS.UnityEngine.GameObject('new by lua'); -- 创建
local camera = CS.UnityEngine.GameObject.Find('Main Camera'); --查找
camera.name = 'Renamed by Lua';
访问组件
local gameObject = CS.UnityEngine.GameObject;
local camera = gameObject.Find('Main Camera'); --查找
camera.name = 'Renamed by Lua'; --修改
两种形式 . & :
local cameraCom = camera:GetComponent("Camera")
local cameraCom = camera.GetComponent(camera,"Camera")
--销毁
gameObject.Destory(cameraCom)