Trying to use, 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.
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/').new()"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