0 votes

So I'm making a project on GitHub which involves uploading scene files to GitHub from within the game. To do that I need them as text which I can then Base64-encode with Marshalls.utf8tobase64.
This works perfectly fine for an existing file within the project where I can do the following:

var file = File.new()
file.open("res://SceneFile/0.tscn", file.READ)
var content = file.get_as_text()
file.close()

However the problem is I want to do this for scene objects that don't already exist within the project as files. In other words nodes that exist within the game which I could normally just save with PackedScene and ResourceSaver. Problem is when the game is run as HTML5 hosted on GitHub I'm fairly sure (?) I can't just save a file to a path and then open it (since the game isn't in an actual directory on your computer). Please do let me know if I'm wrong about that, but regardless it would be optimal if I could do this without having to save the file.

So essentially is it possible to get an object - as a scene file - as text, without first saving that object as a file.

Godot version v.3.4.2
in Engine by (74 points)

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.