0 votes

I'm probably just not understanding how to properly do this in GoDot 3 (using 3.1 beta 8). I found this old QA from 2016, as I can't seem to find anything newer in my searches.

I Have a script I am trying to turn into a resource so that I can export it elsewhere into the inspector.

export (String) var resourceName;
export (Color) var color;
export (float) var height;

and am trying to create the resource using this:

var res = preload('res://scripts/resourceScript.gd').new()
ResourceSaver.save("res://testResource.tres", res)

And I end up with this in the console:

ERROR: save: Condition ' p_resource.is_null() ' is true. returned: ERR_INVALID_PARAMETER
in Engine by (12 points)

Could "res" be null because the script has no return value there? What resource are you trying to create, if maybe there is a .new() function in that type?

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 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 webmaster@godotengine.org with your username.