Skip to content

Add get_singleton() function in the prelude for easy access to autoloads #126

@ttencate

Description

@ttencate

Something like:

fn get_singleton<T>(name: impl Into<GodotString>) -> Result<Gd<T>, Error>

Right now you have to do something like:

self.get_node_as::<MySingleton>("/root/GlobalMySingleton")

That's not very intuitive.

If we implement get_singleton like this, it would need access to the scene tree. I'm not sure if there is a better way.

Metadata

Metadata

Assignees

No one assigned

    Labels

    c: engineGodot classes (nodes, resources, ...)featureAdds functionality to the library

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions