Hello! I’m still relatively new to Godot and for some reason some of the nodes in my project are vanishing from the Remote tab when switching back to my Main Scene from another scene.
I’m not sure if this may be related but just before this happened, I had the error where it kept saying my scene files were corrupted and not opening, so I followed forums and renamed the scenes to get it working again (I’ve renamed them back to their original names now though) Everything only stopped working after this as they worked perfectly fine before and didn’t vanish, so maybe this is part of the issue?
preloads can create infinite loops of preloading, since your main scene must load the fishing rod and with a preload it must load the main scene, which has a fishing rod thus repeating forever. There has been some work on fixing this, so it doesn’t crash, but it silently fails and removes the node at the moment.
Prefer to use change_scene_to_file over change_scene_to_packed
It’s quite big but here is the script. Maybe because it is a scene as well? I started the project (and using Godot) with this scene not realising it wasn’t just the node so it’s the messiest file. Although, sanddollar_score is also a scene and that’s showing.
extends Area2D
# sfx - splash
# art - sanddollar, book
# 70% sand dollar
# 30% fish -- then split
@onready var ready_to_catch = $"../ReadyToCatch"
@onready var fishing_animation = $fishing_animation
@onready var splash = $"../Splash"
@export var sfx_casting_rod : AudioStream
@export var sfx_reeling_sanddollar : AudioStream
@export var sfx_reeling_fish : AudioStream
@export var sfx_casting_bobber : AudioStream
@export var sfx_catch_bobber : AudioStream
@export var sfx_book_open : AudioStream
@export var sfx_splash_fish : AudioStream
@export var sfx_splash_sanddollar : AudioStream
@export var value : Label
var fish_timer = 0
var cast_chance = 0
var fish_chance = 0
var fish_number = 0
var RodStatus = 0
func _ready():
splash.hide()
ready_to_catch.hide()
# 0 = still
# 1 = in water
# 2 = caught
func load_sfx(sfx_to_load):
if %rod_sfx.stream != sfx_to_load:
%rod_sfx.stop()
%rod_sfx.stream = sfx_to_load
func load_sfx2(sfx_to_load):
if %water_sfx.stream != sfx_to_load:
%water_sfx.stop()
%water_sfx.stream = sfx_to_load
func _on_fish_action_pressed():
if RodStatus == 0: # ROD STILL
RodStatus = 1 # IN WATER
load_sfx(sfx_casting_rod)
%rod_sfx.play()
fishing_animation.play("casting")
await get_tree().create_timer(0.8).timeout
load_sfx(sfx_casting_bobber)
%rod_sfx.play()
fish_timer = randi() % 5 + 5
await get_tree().create_timer(fish_timer).timeout
RodStatus = 0 # READY TO CATCH
if RodStatus == 0:
load_sfx(sfx_catch_bobber)
%rod_sfx.play()
RodStatus = 2
ready_to_catch.show()
ready_to_catch.play("ready")
elif RodStatus == 2: # FISH CAUGHT
ready_to_catch.hide()
fishing_animation.play("reeling")
cast_chance = randi() % 100
if cast_chance <= 70:
load_sfx(sfx_reeling_sanddollar)
%rod_sfx.play()
await get_tree().create_timer(0.5).timeout
load_sfx2(sfx_splash_sanddollar)
%water_sfx.play()
splash.show()
splash.play("sanddollar")
MainScene.sanddollar += 1
print(MainScene.sanddollar)
value.text = str(MainScene.sanddollar)
print(value.text)
print("done")
else:
fish_chance = randi() % 16 + 101 # 101 to 116
print(fish_chance)
fish_number = fish_chance - 100 # 1 to 16
MainScene.fish1[fish_number] += 1
load_sfx(sfx_reeling_fish)
%rod_sfx.play()
await get_tree().create_timer(0.5).timeout
load_sfx2(sfx_splash_fish)
%water_sfx.play()
splash.show()
splash.play(str(fish_chance))
print(MainScene.fish1)
RodStatus = 0 #bugrepellant cant reel right after
await get_tree().create_timer(2.0).timeout
splash.hide()
if RodStatus == 1:
await get_tree().create_timer(2.0).timeout
RodStatus = 0
Also, I’m having this issue every time I open the project, and even after I fix it (following forums and renaming files), the next time I open it, it does the same thing again. What could be causing this? It started happening suddenly and I don’t recall doing anything that could’ve caused something like this.
I might’ve been using the .NET version of Godot, but I just redownloaded Godot as 4.3 instead of the 4.2.2 I was working on and now everything is working again? Still unsure as to why but that worked for me.