0 votes

Hey there! I'm trying to render a scene as a transparent overlay atop of another scene using a viewport. I have gotten it to properly display my chosen scene, however, I am having difficulties getting it to switch scenes from any other scene besides the first one I had initially loaded.

Here is my code:

func _preview(timeline, state):

preview.visible = true
var current_time = load("res://Resources/Nodes/Scenes/Levels/"+ Level +"/Timelines/" + timeline as String + ".tscn").instance()
viewport.call_deferred("add_child", current_time)
var rtt = viewport.get_texture()
preview.get_node("Container/Sprite").texture = rtt
if last_preview:    
last_preview = current_time

This function is called whenever the player presses Q or E, and the timeline variable is always a number 1-5 (Which corresponds with the name of the scene it's loading)

Here's my node hierarchy!
enter image description here

Here is an example of it in action, but with numbers 2-5 not working
Youtube Link

Godot version GLES3
in Engine by (12 points)
edited by

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.