Jump to content

FindEntity error en Brushes.


Yue
 Share

Recommended Posts

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.

 

 

Link to comment
Share on other sites

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

 

  • Upvote 1

 

 

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...