记一次xlua热更问题
作者:互联网
1.lua中Vector2的变量不能用Vector3来赋值。
2.lua中自己写的方法调用原类中变量
由于lua中的变量都相当于静态变量,都是跟着类走的,不跟着实例走,所以必须要在自己写的函数内部获取到要修复的这个类的实例,这里采用射线检测
local OpenGunState = function() local theaterRect = nil;--射线检测ui eventSystem = CS.UnityEngine.EventSystems.EventSystem.current; pointerEventData = CS.UnityEngine.EventSystems.PointerEventData(eventSystem); pointerEventData.position = CS.UnityEngine.Vector2(CS.UnityEngine.Input.mousePosition.x,CS.UnityEngine.Input.mousePosition.y); local uiRaycastResult = CS.System.Collections.Generic.List(CS.UnityEngine.EventSystems.RaycastResult)(); eventSystem:RaycastAll(pointerEventData, uiRaycastResult); for i=0,uiRaycastResult.Count-1 do theaterRect = uiRaycastResult[i].gameObject:GetComponent(typeof(CS.TheaterFormationRectItem)); if(theaterRect ~= nil) then break; end end
if theaterRect ~= nil then ----省略 end uiRaycastResult = nil; end
标签:UnityEngine,一次,end,nil,theaterRect,xlua,问题,uiRaycastResult,CS 来源: https://www.cnblogs.com/mcyushao/p/15233616.html