#IJobEntity code gen doesn't like conditional using

1 messages · Page 1 of 1 (latest)

calm jackal
#

The job

        [WithChangeFilter(typeof(EntityDestroy))]
        [WithAll(typeof(EntityDestroy))]
        [BurstCompile]
        private partial struct DestroyJob : IJobEntity
        {
            public EntityCommandBuffer.ParallelWriter CommandBuffer;

            private void Execute([ChunkIndexInQuery] int chunkIndexInQuery, Entity entity)
            {
                this.CommandBuffer.DestroyEntity(chunkIndexInQuery, entity);
            }
        }```
Doesn't actually use netcode
But the system has a conditional using on it
```cs
namespace BovineLabs.Core.Destroy
{
    using Unity.Burst;
    using Unity.Entities;
#if UNITY_NETCODE
    using Unity.NetCode;
#endif

    [UpdateInGroup(typeof(DestroySystemGroup), OrderLast = true)]
    public partial struct EntityDestroySystem : ISystem```
And the source generator for the job has generated this
```cs
namespace BovineLabs.Core.Destroy {
using Unity.Burst;
    using Unity.Entities;
#if UNITY_NETCODE
    using Unity.NetCode;partial struct EntityDestroySystem  {
[global::System.Runtime.CompilerServices.CompilerGenerated]
partial struct DestroyJob : global::Unity.Entities.IJobChunk
{```
@thorn void more fun edge cases, don't even know how you solve this ^^ but hope the holiday goes well!
#

It fails because it's wrapping the last using, if it's changed to

    using Unity.Burst;
#if UNITY_NETCODE
    using Unity.NetCode;
#endif
    using Unity.Entities;```
works fine
thorn void
#

Sounds like a fun issue for future Dani to solve, this Dani is indeed having a blast teaching gamedev during their vacay congaparrot

warm fern
#

Can i copy NativeHashMap by value over multiple systems? can i edit it by value? do i need to query a singleton every tick to modify it?

calm jackal
#

this seems completely unrelated to this thread

warm fern
#

Sorry, wrong thread. I trought i was on general discussion

calm jackal
#

still happens in 1.1 ;'(