Screen transitions via Proxy and lingering Nodes

I tried making screen transitions by fading out a GUI node. It covers the entire screen and animates to full alpha. Calling that before going to another screen makes this node last, and the screen black in my case, even though I load another proxy and unload the one with the node in it. Is this intended behaviour or did I make some rookie mistake?

Can you show the collection hierarchy of your project? Is the GUI on the same collection which was unloaded? Is there a global variable controlling the GUI logic?

I have a collection with the transition node. It sends a message - usually on button push - to a manager script in the bootstrap collection. There, the message causes the new proxy to be loaded and the one that sent the messaeg to be unloaded (in that order).
So, yes, the GUI was on the unloaded proxy, which is what I find so perplexing. I don’t think I had any global variables that do anything to the GUI logic when it happened.

Maybe it is not that the new scene has problems with black screen but there is a problem with the new scene being loaded so you only see a black screen. Can you make sure the new scene is being loaded without an issue?

Try to change the gui transition to other color like red, to see which is the problem

The proxies do load. I tried using this in the first proxy to transition to the next one:

timer.delay(2, false, function() 	gui.animate(gui.get_node("fade-in"), "color.w", 0, gui.EASING_LINEAR, 0.2) 	msg.post("manager:/manager", "load_startup") end)

But the fading node stays. I tried using another colour as above poster suggested and it really is that node.

EDIT: I realise the above code doesn’t work because the timer needs to go before the message and after the animation has played. This however is not the crucial point as the node persists no matter what I do to it.

More information on the project and node/go structure would make pin pointing the problem faster.

But, you could try setting the color of the node right before switching the scenes (after fading is node) to see if the black you see belongs to the previous scene’s node

What information do you need?

Screen shot of the lcollections you use for levels, the logic you use for scene change, gui nodes/logic etc. anything related to scene change would help. You could also share a striped down project that you can still produce the bug if possible

This is a blank project for only this.
That’s my collection setup.

This is the manager.script:

function on_message(self, message_id, message, sender)if message_id == hash(“proxy_loaded”) thenmsg.post(sender, “enable”)endif message_id == hash(“load_main”) thenprint(message_id)msg.post(“#px_main”, “load”)msg.post(“#px_second”, “unload”)elseif message_id == hash(“load_second”) thenprint(message_id)msg.post(“#px_second”, “load”)msg.post(“#px_main”, “unload”)endend
function init(self)print(“loaded manager”)msg.post(“.”, “acquire_input_focus”)msg.post(“#px_main”, “load”)–print(“manager”, msg.url())end

And it gets stuck on a black screen. Also, it does not seem to correctly call the new proxy. I was suggested that this might be a render order thing. Adding a timer DOES work:

gui.animate(gui.get_node(“fade”), “color.w”, 0, gui.EASING_LINEAR, 1, 0, function()
print(“done fading second, moving to main”)
timer.delay(1.1, false, function()
msg.post(“manager:/manager#manager”, “load_main”)
end)

But I wonder if it is necessary or if I am doing something wrong.
end)

Sorry for the messy code inserts…

I assume the main problem is loading a proxy before unloading the previous one so both proxies are being rendered at the same time? You should wait till the current proxy is unloaded then send the load message.

I suggest following this video (you can download the project too) and implementing the scene change logic in a more dynamic way and also implements reloading functionality: https://www.youtube.com/watch?v=fB0S15AOtb4&t=39s

Let me know if you have any question on it (here or on the comment section)

The video doesn’t touch on my issues.

I did not mean it provides a fix to the bug. What I mean is, the way you handle proxy load/unload is likely the cause of the bug. So, you could use the approach on the video (or somewhere else) to rework the logic and the bug should be gone at the end

Well, maybe I wasn’t clear at the beginning. The thing I want to achieve, screen transitions, can easily be done. I posted here because I do not udnerstand why the way I present here does not work. Thanks for your help.

Then, I cannot see any obvious problem with the code. (On the code try calling unload on the current before calling the load on the new one, switch line order, not that I think it will make difference but worth trying)

If you could share the project file, I could help more probably

Please share the project or a minimal version of it as a zip file so that we can take a look!

1 Like

ScreenTransition_ProxyNotLoading.zip (919.8 KB)

I hope I did this right. I am mostly sure it’s some loading order/render pipeline thing. But I don’t get why it only happens when I try the transitions, everyhting else is exactly like I did it on a dozen projects.

When I click, the transition happens and after the scene change is made, the black screen disappears. Could you describe the problem and is it on the video?

The black screen is the problem. The prints indicate that the next proxy isn’t loaded.