Trying to use ResourceSaver.save, getting error: p_resource.is_null() ' is true. returned: ERR_INVALID_PARAMETER

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

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.

#resourceScript.gd
export (String) var resourceName;
export (Color) var color;
export (float) var height;

and am trying to create the resource using this:

#someotherscript.gd
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

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?

flurick | 2019-03-16 00:23