Hey, everyone! Long time since I’ve been on here.
Been jumping into Unity DOTS - really enjoying it! However, I do have a question that I can’t seem to find an answer to.
Essentially, I have a system which adds a tag to an entity when a given condition is met. I’d like to have another system that picks up entities which have this tag, so the concerning entity’s material can be changed (and the tag removed).
Now, to get the material I know I need to get the RenderMesh, change the material, and then set it back again. What I don’t know, is the best way to give the material to the system.
I could use a Singleton manager class, but seems icky. I could also make the tag an ISharedComponentData and have the material within there, but I’m not too keen on that idea either. Mainly as I’m not sure how the component instance would get that material reference if it’s being assigned by another system - it just leads to a Singleton material manager of sorts again.
As you can tell, I don’t like this SIngleton idea. I know it will work, but I’m wondering if there’s something better out there. Perhaps an angle I haven’t considered, or maybe even something built into Entities that makes this process easier! I know there is an [Inject] attribute for the systems, but not really dived into that as of yet - perhaps that has features that could help me.
Anyway, I’m rambling. Thank you in advance