-
-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More generic overloads for world.
and entity.
methods
#20
Comments
world.Create
, entity.Set
, èntity.Get
, entity.Remove
and entity.Add
world.
and entity.
methods
If im fine with all of thse, i completely disagree with: entity.Get<Health, Transform>(out var health, out var transform);
world.Get<Health, Transform>(out var health, out var transform); These will create a copy of the components all the time, so you will need to call Also, probably OT, maybe this needs a different issue: |
Thanks for the feedback and i totally forgot the copy mechanic in that place :D I just wonder if its possible to return multiple references... single entity operations are still slow since each operation needs to search the archetype for acessing its content, would be cool to be able to batch public ref References<T,...N>{ ref T first, ref T second, ref T third... }
var referencesStruct = entity.Get<...>(); That could probably work and speed up things ^^ |
Implemented in db51cb9. Parts of this feature could also act as #21 . var entity = world.Create(new Transform(), new Velocity(),...);
var has = entity.Has<Transform, Velocity>();
var refs = entity.Get<Transform, Velocity>(); // Returns a ref struct with ref fields in it.
entity.Set(new Transform(), new Velocity());
entity.Add<PowerUp, AI>(new PowerUp(), new AI()); // Changes archetype;
entity.Add<Alive, AdditionalStrength, Flying>();
entity.Remove<Dead, Frozen>();
|
Would be probably a cool addition to the existing API to allow some generic methods to have more generic overloads...
This would reduce boilerplate code and would also speed up some stuff :)
Probably #19 needed, since the generic overloads would likely need to target the fitting archetype ( atleast for creating, adding and removing ).
The text was updated successfully, but these errors were encountered: