Closed ShaunJansa closed 9 months ago
So if, I set the shader material beforehand instead of creating it on the fly through code, then the material is loaded, but it still isn't displaying the viewport texture (prob due to the viewport and camera being created though code). Probably if I create the cameras beforehand, everything will work. The question is why creating the material, viewport and camera won't work after exporting. Am I doing something wrong at export?
Update:
So if I create subviewports and cameras beforehand instead of creating them by code, they work perfectly in the editor only and it still doesn't work once exported.
So I think it is something to do with either the shader itself or having multiple viewports. Is there any reason any of these things might not work once exported?
Thank you for the bug report. I did a quick test by exporting the demo project and it worked the way it should.
Could you upload a minimal example project, and mention what export platform you used?
Seems like there is a Godot4 bug that sometimes prevents subviewports from working once exported unless you set _viewport.render_target_update_mode = SubViewport.UPDATE_ALWAYS
This solved the problem for me.
I can't create a minimal example right now, sorry. If I get time I will!
"Update the render target only when it is visible. This is the default value."
Well, it should work by default, so maybe there is nothing to update in the code if it was a bug.
Hi, Thanks for the fantastic portal solution. As the title says though, I have the problem that it wont work once the project has been exported.
In the editor, the portals work perfectly -you can look through them and see the area you would teleport to. Once exported, the portal mesh just stays white. Somehow either the shader isn't working or instantiating cameras or viewports on the fly outside of the editor is problematic...?
Any help would be greatly appreciated!
Using Godot 4.1.1