Jump to content

Hidden lights still show up


EvilTurtleProductions
 Share

Recommended Posts

In my procedurally generated levels I want to be able to turn lights on or off when, for example, the power goes out and thus all lights need to go out.
The level is generated from CFG prefabs, which are then decorated with models and lights. The lights are parented to the CFG prefab.

But I've been struggling with a strange bug, it seems only half the lights in the level go out. I've tried using SetIntensity(), SetColor() and Hide(). I've also tried unparenting, reparenting or not parenting at all. All create the same result.
In the screenshot it's clearly visible: there are four lights close to the floor, two to the left, two to the right. When the lights are turned off the ones on the left indeed go off, but the ones on the right still seem to be there?

Any suggestions what this could be? I'm quite lost right now. Is there some limit I'm hitting (there's about 100 to 200 lights in a level)?

disinf_lightissue.png

Link to comment
Share on other sites

On 4/8/2022 at 12:29 PM, Josh said:

Will need a demo to debug. I strongly suspect the lights aren't really being hidden, and there is an error in the programming.

I've made a simple demo, replicating the way the game builds levels (albeit just one node in this test) and modifies the lights and I get the same issue.

See attachment for the project.
All the code is in C++, I've commented it heavily so hopefully that is some help.

The prefab objects are in the Prefabs folder & in the editor in scene/prefabs.

LightsTest.zip

Link to comment
Share on other sites

I know why this is happening. :)

	//find lights in the primary decoration
	for (int i = 0; i < dec_prim->CountChildren(); i++)
	{
		Entity* findlights = dec_prim->GetChild(i);
		if (findlights->GetKeyValue("name") == "Light")
		{
			//parent the light
			findlights->SetParent(node); // Hmmm, do you think COuntChildren) will return the same result next time i call it lol???
		}
	}

 

  • Haha 1

My job is to make tools you love, with the features you want, and performance you can't live without.

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...