save gdscript godot4 1个回答 0投票 正如您的错误所述:您尝试获取为零的变量的全局位置。 看着你的加载代码,我很确定这发生在这里: func load_checkpoint(): if load_checkpoint_from_file(): return { "position": current_checkpoint.global_position, <--- here "scene": current_checkpoint_scene } ...
LogPath="user://logs/UnitTest.log";publicstaticColorPassedColor=Colors.Green;publicstaticColorFailedColor=Colors.Red;publicControlDialog;publicUIUpdaterUIUpdater;publicvoidSaveData(){JObjectroot=newJObject();foreach(UnitTestClassclsinClasses){JObjectclassObject=newJObject();root[cls.Type.ToString()]=cl...
Achieving better mouse input: The perfect camera controllerhttps://yosoyfreeman.github.io/article/godot/tutorial/achieving-better-mouse-input-in-godot-4-the-perfect-camera-controller/ Chevifier: Plane Controllerhttps://www.youtube.com/watch?v=hObR7r3GOMs File access and save GDNative wrapper for S...
save(material, surface_path, ResourceSaver.FLAG_CHANGE_PATH) == OK: # Now using a resource loader load the same material and overwrite the old one var new_material = ResourceLoader.load(surface_path) as Material # This prevents the imported scene from storing the material as a sub resource...
另外,还顺带增加了json的resource类 可以直接使用load("xxx.json")来加载和使用ResourceSaver.save来保存了。 下载链接:网页链接 JsonScript类有几个方法: func set_as_text(text:String) # 将text保存至文件 func get_as_text() -> String # 获取文件文本 func set_as_data(value) # 将value保存至文件 ...
(设为自动加载,这样所有代码都能访问的到): # 加载游戏存档函数 func load_game(): var loader = File.new() loader.open("res://Json/Game.json", File.READ) var json = parse_json(loader.get_line()) loader.close() return json # 保存游戏存档函数 func save_game(game_data): var saver =...
30、e node and delete it while nothing ishappening初始化场景从代码初始化场景非常简单,有两种方式。第一种是从磁盘加载场景python var scene = load() # will load when the script is instanced有些时候,使用 preload会更方便,因为,它在解析时执行。python var scene = preload() # will load when parsi...
Alien monsters have invaded Earth! It's up to the Star Guardians, a dysfunctional group of heroines, to protect the planet and awkwardly save the day (yet again)! Published byFlynn's Arcade Developed byAndrea Demetrio Made withGodot 4.1 ...
70、 loading_runtime_save_load.zip 2.3MB 71、 loading_scene_changer.zip 6.34KB 72、 loading_serialization.zip 43.35KB 73、 loading_threads.zip 227.47KB 74、 misc_2.5d.zip 2.56MB 75、 misc_compute_shader_heightmap.zip 107.66KB 76、 misc_joypads.zip 189.64KB ...
(设为自动加载,这样所有代码都能访问的到): # 加载游戏存档函数 func load_game(): var loader = File.new() loader.open("res://Json/Game.json", File.READ) var json = parse_json(loader.get_line()) loader.close() return json # 保存游戏存档函数 func save_game(game_data): var saver =...