#Aspect, what is the point ?
1 messages · Page 1 of 1 (latest)
basically saves time as you can implement logic in your aspect, use it (in IJobEntity jobs) without needing to get a whole bunch of components and do double work
you can also nest them
Could that replace a static helper class so instead of :
public static void UpdateSomething(
Entity entity,
ref A a,
ref B b,
ref C c,
ref D d,
ref E e,
ref F f,
ref SystemState state) {
// Do something with abcdef
}
This could be done :
public readonly partial struct FactoryStateAspect : IAspect
{
public readonly RefRW<A> A;
public readonly RefRW<B> B;
public readonly RefRW<c> C;
public readonly RefRW<D> D;
public readonly RefRW<E> E;
public readonly RefRW<F> F;
public void DoSomething()
{
// Do something with abcdef ?
}
public readonly Entity Self;
}
Or am I getting it wrong here ?
and is it burst compatible ?
yeah burst compat
then you just have a job like
[BurstCompile]
partial struct MyCoalFactoryProducingJob : IJobEntity
{
public void Execute(FactoryStateAspect factoryAspect, ref LocalTransform transform)
{
//etc
}
Aspects cannot be generic, so that's pretty much useless
I personally see aspects as something that never should have been introduced
Their benefit is that you can make helper methods for combination of components, but that just goes against ecs
My only real use case is that they allow avoiding some bugs with codegen 😅
i only have 1 aspect and it's just grouping 2 dynamic buffers to save myself writing code
i would find them more useful if they fixed some of their limitations
(buffers could be optional, marked [readonly] etc)
that's what I thought too , thanks for confirming