Yue Posted February 9, 2021 Share Posted February 9, 2021 When I use FindEntity to search for a brush on the stage, I get errors when using it in the Update functions of the Scripts. function Script:Start() self.myBox = World:GetCurrent():FindEntity("Box1") end function Script:Update() self.myBox:SetColor(1,0,0) -- Unexpected program shutdown. end The error is not evident if I use property variables. Script.myBox = nil --entity "MyBox" function Script:Start() end function Script:Update() self.myBox:SetColor(1,0,0) -- Not Error. end The error does not occur if I search for a mesh entity imported into leadwerks, or an entity such as light, pivot, camera etc. Only with brushes. Quote Link to comment Share on other sites More sharing options...
Yue Posted February 12, 2021 Author Share Posted February 12, 2021 function Script:Start() self.c = World:GetCurrent():FindEntity("Camera") self.c:SetRange(0.001,1000) --<<<<<<<<<<<< Error. end Not Error. Script.camera = nil --entity "Camera :" --Fix Error. function Script:Start() self.c = World:GetCurrent():FindEntity("Camera") self.c:SetRange(0.001,1000) -- Not Error. end 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.