Singletons/autoloads for scene transitions

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Cwodo

Hello,

I have a problem with a simple thing, but I can’t figure out how to fix it.
I’m making a visual novel and i want to have a transition between scenes (fade in/out).

Currently I have three scenes:

VisualNovel.tscn → Main scene
Scena2.tscn–> scene i want to call
global.tscn → transition scene

global.tscn is quite simple, it has a canvas layer, colorRect and animationPlayer.
I made a simple animation to switch from trasparent to color (using Alpha).

global.tscn has a simple script that i’ve found in this video

Then, in project → autoload i load global.tscn.

So theoretically when I click a button it would switch to scene2 with a fade effect. The problem is that it doesn’t recognize any inputs. I’m making an android app and handling input with “_unhandled_input(event)” function and it works perfect until i load , in (project–>)autoload section, global.tscn.

it is as if loading the autoload prevents any input, both as a mouse and as a touch.

What i’m doing wrong?

P.S: I downloaded the project from the video and it works perfectly.

Thanks for your time.

:bust_in_silhouette: Reply From: CreekWorks

I believe whatever you are using to fade, probably a colorrect, is blocking the inputs. A solution would be either to move it after it’s faded in and then move it back when its done.

func _on_AnimationPlayer_animation_finished(anim_name):
#1000 or some other big number
	$Colorrect.position.y = 1000
#Put the following wherever you start your animation
$Colorrect.position.x = 0
#the return position should be whatever you currently have it as

Another option I am not totally sure about is just hiding the node

func _on_AnimationPlayer_animation_finished(anim_name):
	$Colorrect.hide()
#Put the following wherever you start your animation
$Colorrect.show()

There are other and maybe better options but these are the ones I know about

You’re absolutly right.

I found a quicker solution, in color rect filter (input → mouse) just select “ignore”. Default selection is “stop” and this causes the problem.

The guy in the video, in the end he recommends to fix the mouse filter, but I didn’t give importance because I have touch input …

Cwodo | 2021-06-03 12:58