-
i cannot pass the string to the AddResource method. even I tried to cast it to gd.StringName but still it was unsuccessful. func (w *World) Ready() {
w.Class.Super().SetEnvironment(Environment.Instance{})
env.AddResource("world1", "res://world1.tres")
} error: env.AddResource undefined (type "grow.graphics/gd/internal/classdb".Environment has no field or method AddResource) even I've tried to make StringName var but there is no way to add string to it var name gd.StringName
var path gd.Resource |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
It doesn't look like the Godot Environment class has an I regards to func (w *World) Ready() {
var name = StringName.New("Go string that will become a StringName")
// do something with name
} Note that for any godot reference types (including string names & classes), the zero value is not valid, ie. it is essentially |
Beta Was this translation helpful? Give feedback.
It doesn't look like the Godot Environment class has an
add_resource
method?https://docs.godotengine.org/en/4.2/classes/class_environment.html
I regards to
StringName
, this is a Godot defined reference type, it can be created with theStringName
package. The value will be valid until it has been un-used for a frame.Note that for any godot reference types (including string names & classes), the zero value is not valid, ie. it is essentially
nil
. So passingEnvironment.Instance{}
does not create a new Environment as you may be expecting. UseEnvironment.New
f…