ResourceLoader best practices

Vale-gitVale-git Posts: 240Member

In my project I use often ResourceLoader to load a scene even If I can attach it to tree.

Example LoginScreen is loaded at runtime and it is freed when I don't need it any more.
Is more convenient to hide it instead bother to load/free it every time I need?

What are the best practices? Its worth to attach all of them in scene tree having as downside a more complex tree at design time?
I use c#

Thanks for your suggestions


  • Vale-gitVale-git Posts: 240Member

    Nobody know? I didn't expect was a difficult question.
    Sorry. :)

  • xyzxyz Posts: 940Member
    edited January 23

    Resources are cached by default. Only the first load from a specified path will actually do the loading. Subsequent loads from the same path will just return a reference to the cached data. So there's virtually no performance cost for calling load() multiple times. If you want to force the reload, you can set no_cache flag when calling load().
    It's all explained pretty well in ResourceLoader class reference in the docs:

Sign In or Register to comment.