Jump to content

[SOLVED] Enabled Objects not immediately visible in WidgetSpriteViewport


photo

Recommended Posts

We have a piece of Unigine Script which looks roughly like this:

 

Node nodeA, nodeB;

 

nodeA.setEnabled(0);

nodeB.setEnabled(1);

 

If the world is being viewed through a WidgetSpriteViewport, and this code is called, for a split second both nodes are invisible. This behaviour is not seen when rendering the world normally; I would've expected this to occur "atomically" in both cases.

 

This is using the 64bit version of Unigine (The log file says the binary is: Windows 64bit Visual C++ 1600 Release Apr 11 2012 r8850).

Link to comment

OK, so here's a test I've tried to throw together. If you load this up, open the console, then try the command "toggle_switch", with some luck you'll eventually see the issue. I've limited the framerate of the WidgetSpriteViewport because this makes it really clear when you see a frame with neither node being visible.

 

In our software this actually occurs almost every time, but there's a lot more content involved in that case. With this example I've sometimes had to try upwards of 40 times before the issue occurs.

railtest.zip

Link to comment

Yep, I've reproduced this issue, indeed, for a sec they disappear. Will pass it to our developers for them to dig into it or suggest a workaround.

Link to comment
  • 1 month later...

At last we've found what was missing :)

main.setEnabled(!main.isEnabled());
branch.setEnabled(!branch.isEnabled());
// You need to add this into your code.
engine.world.updateSpatial();

Link to comment
×
×
  • Create New...