Spy-Shifty / BrokenBricksECS

Rebuild of Unity3D upcoming Entity Component System !OUT OF DEVELOPMENT!
MIT License
162 stars 28 forks source link

Add a GameObjectEntityComponent to access the Unity GameObject inside the component systems #15

Closed Gwindalmir closed 6 years ago

Gwindalmir commented 6 years ago

Adds a GameObjectEntityComponent to the Entity so the Unity game object is directly accessible.

Without this, there doesn't seem to be any way to directly access a unity game object from inside the ECS system, except indirectly via the ECSTransform, or other components, which may or may not be present.

Spy-Shifty commented 6 years ago

Hello, I thought about it. I'm not sure which advantage that would bring? Why accessing the GameObject directly?

My thought is GameObject is similar to Entity. If you want to access GameObject Components use a ECSComponent + ComponentWrapper

Maybe I missed something.

Gwindalmir commented 6 years ago

Well, I was trying to find a good explanation for why this would be useful, but honestly the use case for this is lower than I originally thought it would be.

The only reason for needing it would be when using empty gameobjects, as then only component you would have is ECSTransform. However that much means you must either always assign it, or check the "auto add ECS components" check box, even if you never care about Transform specifically.

Of course then that begs the question, what would you do with it? I suppose this isn't needed after all.

Spy-Shifty commented 6 years ago

If we find a good use case I'll add them. But for now i'll reject it.