AResourceManager load usage
See original GitHub issueI’m trying to find the proper way to use AResourceManager
, and I don’t see too many examples so I thought I’d see if you can help.
The example in the readme shows you can load a Texture2D
and the manager can assign it to the DrawInfo
component (which I believe it’s just assuming any entity with a ManagedResource<string, Texture2D>
will have). But this example already breaks down when you show how to load multiple resources of the same type. The circle.png
will presumably overwrite square.png
in the entity’s DrawInfo
.
So how would this work in a real-world scenario? Let’s say you need a texture for a character, and a texture for his footprints. The manager wouldn’t know where to put each. You could create a separate manager for each kind of Texture2D
(e.g. a CharacterTextureManager
and FootprintTextureManager
). These would be mostly identical though, except for the field, or maybe component, that you’re setting. I thought you could try specifying the destination along with the texture name in TInfo
, but then you’d need reflection or something to set it.
Is there a good way to specify which component or field to load resources into so that you can reuse resource managers? Hopefully the question makes sense.
Issue Analytics
- State:
- Created 3 years ago
- Comments:23 (12 by maintainers)
If you need any more assistance don’t hesitate to reopen this issue or create a new one, I will close it in the meantime 😉
no, if a resource is used by an other entity in an other world the
Unload
method of AResourceManager will not be called 😃 That was the whole point, so you don’t have to reload everything between screen.