#archived-dots

1 messages · Page 246 of 1

rustic rain
#

in stack traces

rotund token
#

that doesn't matter

#

it's the ability to attach your debugger to break point

rustic rain
#

ah

#

I see

#

Can you turn it off?

rotund token
#

in editor? yes

#

feature of 2020.x+

rustic rain
#

where can I find that setting?

rotund token
#

bottom right corner of unity

rustic rain
#

oh, thanks

#

let's see how it'll change perfomance

rotund token
#

(there's a setting in preferences that changes default start unity behaviour)

rustic rain
#

welp, it's 4 times more perfomance

#

but still

#

2.3 times less than build

rotund token
#

do you have jobs debugger + safety off

#

and are you maximized? (to turn of inspector/project/etc drawing)

#

because if you make a mono build vs editor it's pretty much identical code

#

if you are building il2cpp though that's a different thing

rustic rain
#

do I need smth special to disable jobs debugger?

rotund token
#

yep ok so thats off

rustic rain
#

as for now it's unchecked

rotund token
#

turn off leak detection (especially avoid full stack trace)

#

maximize your view

#

and see how it goes

rustic rain
#

240 fps vs 450

rotund token
#

🤷‍♂️ not sure you'd have to profile editor

#

to see what's updating

#

losing 1.94ms/frame somewhere

rustic rain
#

oh oh oh

#

hold on

#

I think I forgot burst

#

I assume

#

builds by default

#

have it on

rotund token
#

yes

rustic rain
#

well, it's 350 now

#

good enough

#

thanks

rotund token
#

this info is really useful to know because testers/qa, management, design etc don't need to have it on

#

and they play the game in editor and complain it's performance is so bad

rustic rain
#

yeah, I was surprised by 10 and 10 on threads

rotund token
#

especially the release vs debug modes

#

maybe keeping safety etc on is important for QA testing but no reason they need to attach a debugger

#

it's one of the best features that was added to 2020.X

#

because it has such a huge effect on performance

rustic rain
#

is there some kind of resource that has info on all of those buffer systems?

#

I guess SimulationEntity is per frame buffers on Start and End respectively
FixedStep is fixedUpdate
but what about Presentation?

#

and Initialization

rotund token
#

theres 3 system groups by default in entities

#

initialization, simulation, presentation

#

fixed executes in simulation but not every frame

misty wedge
#

Is there any way to see the implementation of the Unity.Physics.QueryWrappers? I'm trying to implement a custom collector and some examples would be nice...

#

I assume the ICollector itself holds the e.g. NativeList used to collect results?

candid epoch
misty wedge
#

Yeah, I can look at e.g. CollisionWorld, but I can't find QueryWrappers

karmic basin
karmic basin
#

See this file \Library\PackageCache\com.unity.physics@0.6.0-preview.3\Unity.Physics\Collision\Queries\Collector.cs

misty wedge
#

Thanks!

rustic rain
#

Are rotation quaternions any different in dots?

#

x = math.clamp(x, -90f, 90f); for some reason

#

this won't let camera go above horizont

#

meanwhile bottom clamping is fine

#
                Quaternion rot = rotation.Value;
                float x = rot.eulerAngles.x;
                x -= 15f * movement.deltaMouse.y * delta;
                x = math.clamp(x, -90f, 90f);
                rot = Quaternion.Euler(x, 0, 0);
                rotation.Value = rot;
#

pretty sure, same code worked for GO transform

worn valley
#

They are in radians not degrees

deft stump
#

yup, they take in radians

rustic rain
#

oof

#

x = math.clamp(x, math.PI * -0.5f, math.PI * 0.5f);

#

Now it's locked to horizont

rustic rain
#

pls, any tip in this regard?

#

I have no idea what I'm doing wrong

#

doesn't matter what max clamp value I use

#

it's always stuck on horizon

#

and if you move camera higher

#

it just stutters it back

#

and not stops, before it actually rotates, but instead it moves it back somehow

karmic basin
#

Just so you know, math package comes with quaternion. Can't remember all the differences other than still utilities missing + order of rotations applied different than unity engine Quaternions

rustic rain
#

hm

#

thing is I transform to quaternion

#

using Unity engine

#

math

#

not dots

#

well, I logged angles:
bottom = 90~0
horizon = 0
above horizon = 270~360

finite remnant
#

just to be sure: is this telling me that my job is compiled with burst? im a bit confused because of intelisense

finite remnant
verbal pewter
#

How does changing values in a DynamicBuffer work with jobs? Do you need to use CommandBuffer.ParallelWriter or anything to save changes made to the DynamicBuffer?

karmic basin
#

From a parallel job, yeah

rustic rain
#

Anyone has any tip on character controller?

#

I'm trying to figure out the one in sampe but:

  1. it doesn't even work in sample scene
  2. 700 lines of code I don't understand
karmic basin
#

there are better implementation from the community. Honestly I don't even look at it

karmic basin
karmic basin
# verbal pewter How does changing values in a `DynamicBuffer` work with jobs? Do you need to use...

Something like this without commandbuffer is okay too :

        public void Execute(ArchetypeChunk batchInChunk, int batchIndex)
        {
            BufferAccessor<YourDynamicBuffer> buffers = batchInChunk.GetBufferAccessor(SomeBufferTypeHandleYouPassToTheJob);

            for (int entityIndex = 0; entityIndex < batchInChunk.Count; entityIndex++)
            {
                DynamicBuffer<YourDynamicBuffer> buffer = buffers[entityIndex];
                for(int i = 0; i < buffer.Length; i++)
                {
                    // buffer[i].Value
                }
            }
        }
karmic basin
rustic rain
#

if you can remember at least slightly how to find it

#

let me know pls

karmic basin
#

I would google unity ecs charactercontroller

#

and learn from the 3 to 5 upmost results, should give enough food for thougths 🙂

#

😭 I fell into the trap. Someone can explain why ?

#

So no other way than getting a ptr + length and clear MemClear() ?

coarse turtle
rustic rain
#

any idea about PhysicsUtils class?

#

I can't seem to find any mention of i'ts reference

rustic rain
#

do you guys know why my Capsule collider is Composite?

#

oh wait

#

I forgot to remove GO comps...

#

bbruh

#

I wasted hours into this research...

misty wedge
white island
#

Okay so. I have an interesting problem to solve.
I have a large, multi-level struct with various data types, not all of them blittable, that I need to store as an entity. What these are for is basically, reading a config file and storing the result for quick and repeated access.
How would I go about this the most DOTS-ey way? The best way I came up with was to somehow, flatten the struct into a long list of keys and values, but then I need to figure out how to query that? Maybe I could serialize it into a long JSON string and then unmarshall it when I need to grab the data? but both of those sound inefficient

prisma anchor
#

Anyone know how to create a constraint in physics? All the forums seem to have outdated code.

gusty comet
#

but only if the config data is immutable

white island
gusty comet
#

You mentioned the data is complex with arrays and stuff, and that it's pretty big. This could be a solution

#

You also mentioned some data is not blittable, which is a use case for BlobAssetReference

white island
#

i wouldnt say it's super large (although for data components it is pretty big) it's just pretty complex and not blittable

gusty comet
#

Will a lot of entities be. trying to access the config data?

#

Basically, if you stored the config data in a component, will there be a lot of instances of that component?

white island
# gusty comet Basically, if you stored the config data in a component, will there be a lot of ...

I was pretty vague, so I'll elaborate: Every block type has a config file that determines its properties. Each block entity stores a hash denoting which block type it is, and the data from the config file is stored as a component in its own entity for fast access. The system that works on blocks (it's basically a cellular automata thing) then references the parsed and stored data file, rather than rereading the data file for every block on every frame

#

that may be too much irrelevant information

#

But a cursory glance makes it seem like a blob asset is the right call

#

as these config files are read from disk and simply used to determine behavior, there is no need to mutate them

gusty comet
#

Yes I agree. And one major benefit of BlobAssetReference is data deduplication. The data is hashed, and if another similar one is generated, the reference just points to the first data

white island
gusty comet
#

I don't know enough about deserializing to answer that, sorry

white island
#

Or maybe I’m getting ahead of myself. Maybe I should just read all of them at startup instead of reading them as they are needed to conserve memory

white island
#

i figured it out, I can just Construct it

karmic basin
rustic rain
#

what the

#

why component is empty in inspector

#

ah

#

if you use Properties

#

instead of fields

#

they aren't visible in debugger

misty wedge
#

If I want to modify a collider in DOTS Physics, how would I go about doing it? Since modifying the geometry pointer modifies it for all instantiated entities of that type.

Should I create a new boxcollider each time? Is this performant?

#

I guess this applies:

                // NOTE: this approach affects all instances using the same BlobAsset
                // so you cannot simply use this approach for instantiated prefabs
                // if you want to modify prefab instances independently, you need to create
                // unique BlobAssets at run-time and dispose them when you are done

Seems like quite the hassle though...

#

e.g. if I want to animate a sprite with varying colliders I would need to create a blobasset for each frame of each spriteanimation

#

Also, is storing a NativeCollection inside a BlobAssetReference safe? I swear I read somewhere it isn's supported...

haughty rampart
misty wedge
#

Yeah, that's what I meant

rustic rain
#

maybe just simplify collider? so it's not 60 colliders per 60 frames, but 6 (for example)

misty wedge
#

It's just a hassle to set it up, I don't really have any performance concerns

#

But I think for a 2D game a simple box is fine for all animation frames

prisma anchor
#

@karmic basin Thanks for the reply, I figured it out after some trial and error. Thanks!

safe lintel
#

You can set the collider to be unique in the physics shape authoring and then just modifier the collider. Doubt making a new collider per frame is efficient at all @misty wedge

misty wedge
winter depot
#

I stepped away from my full ECS project for some time to work on some other things, around 6 months ago I attempted to update packages but found compatibility issues, I am attempting to revive this project but once again seeing major issues with the package dependencies... Its looking like I need to be running "Jobs" package that's over a year old now. Is this accurate?

misty wedge
#

I'm on:

Burst 1.6.0
Entities 0.17.0-preview.42
Physics 0.6.0-preview.3
Collections 0.15.0-preview.21
Mathematics 1.2.5
Jobs 0.8.0-preview.23
NetCode 0.6.0-preview.3
#

for reference

rustic rain
#

anyone has any idea how to create Capsule collider?

#
            var col = new PhysicsCollider()
            {
                Value = CapsuleCollider.Create(new CapsuleGeometry()
                {

                })
            };
#

I'm not sure

#

how to assign fields in this struct

#

Radius is obvious

#

but

#

Vertex0
Vertex1?

#

I basically need to copy this collider

#

but make radius different

winter depot
misty wedge
#

I assume Vertex1 and Vertex2 are the two vertices used to span the capsule

rustic rain
#

well, thing is I have no idea how to manipulate them xD

#

I found some examples

#

any idea what does it mean?

misty wedge
#

I'm not sure what you mean?

rustic rain
#

I need to create collider

misty wedge
#

It's setting the vertex values with the X coordinate equal to armlength / 2, all other values 0

rustic rain
#

capsule of heigh2 and radius 0.4

#

but I don't know relation between that and vertexes

misty wedge
#

So like this?

rustic rain
#

yeah

#

radius is 0.4 tho

#

not diameter

misty wedge
#

Ah, my bad

#

Probably this:

new Unity.Physics.CapsuleGeometry
{
    Radius = 0.4f,
    Vertex0 = new float3(0, 1, 0),
    Vertex1 = new float3(0, -1, 0)
};
karmic basin
#

@rustic rain

rustic rain
#

wha

#

why I can't see those comments

#

bruuuh

#

it's decompilation for some reason...

karmic basin
#

Wait you decompiled the assembly through a program ?

rustic rain
#

no

#

I just press ctrl and click on whatever I want to open

karmic basin
#

okay good

pulsar jay
#

Some IDEs might show a decompiled version. Others might find the package source and display the real file content

#

Is this both VSCode?

karmic basin
#

vscode here

pulsar jay
#

Not sure if vscode understands packages correctly atm

#

It might not find the correct source

misty wedge
#

@rustic rain if you want to convert the exact settings to a collider I assume formula would be something along the lines of (not tested):

Vertex0 = center + orientation * (0, height / 2, 0)
Vertex1 = center + orientation * (0, -height / 2, 0)
karmic basin
#

Actually works pretty well for me. I just open the folder and it's linked fine

coarse turtle
#

you can generate the .csproj files for embeded packages and browse the source code in vscode or w/e ide you want

rustic rain
#

oh, center and orientation

karmic basin
#

@rustic rain they usually include Tests, often a good idea to have a look Library\PackageCache\com.unity.physics@0.6.0-preview.3\Tests\PlayModeTests\Collision\Colliders\CapsuleColliderTests.cs

pulsar jay
#

Can anybody help with this (probably burst related) crash?

#

The method Void _mono_to_burst_Hash64Long(Byte*, Byte*, Int64, Byte*, UInt64 ByRef) must have MonoPInvokeCallback attribute to be compatible with IL2CPP!

rustic rain
#

I'm confused

pulsar jay
#

The crash seems to happen in EntityQueryImpl_GetSingletonEntity. Does the game just crash if the singleton does not exist?

karmic basin
rustic rain
karmic basin
#

there's a dedicated DOTS physics Component

#

to help debug

rustic rain
#

well, anyway
I cast this collider in system, it's not attached to any entitiy

karmic basin
#

okay never tried if it draws them at runtime

pulsar jay
safe lintel
#

@pulsar jay are you not using RequireSingletonForUpdate in conjunction with GetSingletonEntity?

coarse turtle
#

new details on batch renderer group

worn valley
#

Heck yeah. New update!!

safe lintel
#

In the coming year, the Hybrid Rendering team will land improvements to the Hybrid Renderer package to use this interface ecs second class citizen to gameobjects 🥲

rotund token
#

well entities won't support 2022.1 for a while so hybrid renderer can't really support it till entities does

rustic rain
#

yay, I finally made dots character controller that is not shit kek

#

implementation makes me worry tho

#

when character stuck in corner, it tanks 1 ms of cpu main thread

#

lol

haughty rampart
last jasper
#

how is dots and webgl these days?

#

I've been out of the loop for ~6 months I suppose

safe lintel
#

@last jasper actually the same as it was 6 months ago

last jasper
#

any particularly newsworthy stuff since that forum post about providing more updates?

safe lintel
#

latest stuff is in that thread unfortunately

white island
#

ok so I have this code to create a blob here

public struct RawBlobStruct
    {
        public BlobArray<ParsedRawData> Arr;
    }

    public static BlobAssetReference<ParsedRawDeserializationStruct.RawBlobStruct> CreateRawBlobAsset(ParsedRawData data)
    {
        using var blobBuilder = new BlobBuilder(Allocator.Temp); //new builder
        ref var parsedRawBlobAsset = ref blobBuilder.ConstructRoot<RawBlobStruct>(); //ERROR HERE

        var arrays = blobBuilder.Allocate(ref parsedRawBlobAsset.Arr, 1);
        arrays[0] = new ParsedRawData();

        BlobAssetReference<ParsedRawDeserializationStruct.RawBlobStruct> blobAsset = blobBuilder.CreateBlobAssetReference<RawBlobStruct>(Allocator.Persistent); //create reference
        blobBuilder.Dispose();
        return blobAsset;
    }

but it gives me this error: error Assets\Scripts\Mono scripts\ParsedRawDeserializationStruct.cs(66,9): error ConstructBlobWithRefTypeViolation: You may not build a type RawBlobStruct with Construct as RawBlobStruct.Arr[].General.name.m_HashMapData.m_Buffer is a reference or pointer. Only non-reference types are allowed in Blobs. What on earth does this mean?

prisma anchor
#

has anyone seen these errors when adding a component data to a gameobject? Further investigation leads me to believe I'm setting up InputActions wrong

safe lintel
#

@white island Only non-reference types are allowed in Blobs sort of self explanatory, your ParsedRawData hashmap or hashmap.buffer is a reference or pointer type which you cant have inside of blobs

#

Blob assets can contain primitive types, strings, structs, arrays, and arrays of arrays. Arrays and structs must only contain blittable types. Strings must be of type BlobString (or a specialized unmanaged string type such as ).

white island
safe lintel
#

not sure tbh, try it

white island
# safe lintel not sure tbh, try it

Well that's what im using that causes the error. Here:

public enum Types
    {
        Block,
        Creature,
        Fluid
    }

    public enum BodyParts
    {
        Arm
    }
    public struct ParsedRawData
    {
        public GeneralData General;
        public PropertiesData Properties;
        public BehaviorsData Behaviors;
        public NativeList<BodyParts> Anatomy;
    }

    [System.Serializable]
    public struct GeneralData
    {
        public FixedString32 id;
        public NativeHashMap<FixedString32, FixedString32> name;
        public NativeHashMap<FixedString32, FixedString32> desc;
        public FixedString32 texture;
        public Types type;
    }

    [System.Serializable]
    public struct PropertiesData
    {
        public NativeList<FixedString32> tokens;
        public int hardness;
        public NativeHashMap<FixedString32, int> species_stats;
        public NativeHashMap<FixedString32, int> lifecycle;
        public NativeHashMap<FixedString32, int> stats;
        public NativeList<FixedString32> custom_props;
    }

    [System.Serializable]
    public struct BehaviorsData
    {
        public NativeHashMap<FixedString32, NativeList<FixedString32>> behaviors;
    }

    public struct RawBlobStruct
    {
        public BlobArray<ParsedRawData> Arr;
    }
rotund token
#

you can't use any native container in a blob

honest plinth
raven grail
#

Is there any info on what's the current workflow to get skinned mesh animations on DOTS? I'm trying to animate some character models but all the info I found online is not very clear, contradictory and/or appears heavily outdated

pulsar jay
rustic rain
#

Hmmm

#

I have player controller, that modifies character controller component for player body

#

and I have NPC controller

#

that also modifies character controller comp, but for npcs

#

and thing is, they will never write in same components

#

Dots is angry about dependencies

#

is there any way to make it ingored?

#

or how do I combine those dependencies considering my PlayerController runs on

#

ForEach

#

while npc run on IJobChunk

rotund token
#

how are you scheduling them

rustic rain
#

for player

#

for npc

rotund token
#

are you not using a systembase for npc?

rustic rain
#

I use JobComponentSystem

rotund token
#

why

#

(you should never use that anymore)

rustic rain
#

oh

rotund token
#

anyway the issue is you're not passing inputDeps into your ScheduleParallel()

#

as a dependency

#

if this was a systembase you'd pass in Dependency instead

rustic rain
#

ok, I'll try to rewrite it for SystemBase first

#

annoying part

#

most tutorials

#

use deprecated stuff

#

kek

rotund token
#

no reason to use componentsystem/jobcomponentsystem over systembase anymore (except for conversion systems which still inherit from componentsystem but i'm hoping 0.50 does away with that)

rustic rain
#

well, so

#
    protected override void OnUpdate()
    {
        Entities
            .WithAll<ZombieBodyTag>()
            .ForEach((ref CharacterControllerComponent controller, ref Rotation rotation, ref Translation translation) =>
            {
                float3 targetPos = float3.zero;
                float3 deltaDistance = targetPos - translation.Value;
                float3 direction = math.normalize(deltaDistance);
                float magnitude = ((UnityEngine.Vector3)deltaDistance).magnitude;

                float mod = math.min(magnitude, 2f);
                controller.CurrentMagnitude = mod;


                quaternion targetDir = quaternion.Euler(direction);
                targetDir = UnityEngine.Quaternion.Lerp(rotation.Value, targetDir, 1f);
                rotation.Value = targetDir;

                controller.CurrentDirection = ((UnityEngine.Quaternion)rotation.Value).eulerAngles;

            }).ScheduleParallel();
    }
#

now I schedule NPC like that

#

let's see if it'll keep erroring

#

oh, no errors

#

ok

#

poggie woggie

rustic rain
#

ok, so

#

what are my options if I want to make a target finder job?

#

Basically I have NPC's query

#

and I want them to chase another NPC's query

#

chasing closest one

#

the most straight forward solution - ForEach inside ForEach

#

but I think that's not compatible with burst

candid epoch
#

you can execute an query and that will return a nativeArray of entities. you can pass that into your entites.ForEach

rustic rain
#

excecute query? With what method?

#

or from what class

#

I remember I saw smth similiar

#

I just need to know where to find it

candid epoch
#

you can basically create a query with GetEntityQuery(defineWhatYouWantHere) and then call ToEntityArray

#

imo the docs a pretty good for the most part. it just takes some time to connect it all together

rustic rain
#
        NativeArray<Translation> translations = targetQuery.ToComponentDataArray<Translation>(Allocator.Temp);

        Entities
            .WithAll<ZombieBodyTag>()
            .WithNone<HasTarget>()
            .ForEach((in Translation translation) =>
            {

            }).Schedule();


        translations.Dispose();

So just like that?

#

and then I use translations inside foreach?

candid epoch
#
        NativeArray<Translation> translations = targetQuery.ToComponentDataArray<Translation>(Allocator.TempJob);

        Entities
            .WithReadOnly(translations)
            .WithDisposeOnCompletion(translations)
            .WithAll<ZombieBodyTag>()
            .WithNone<HasTarget>()
            .ForEach((in Translation translation) =>
            {

            }).Schedule();
#

pretty much yes. just some tiny things you could improve, see code above

#

(added the WithReadOnly because i assume you only need the data readonly, this allow for more optimizations in the background)

rustic rain
#

yeah

candid epoch
#

apologies if i added some typos, wrote that from memory

verbal pewter
#

I'm getting the following Burst exception that I'm having trouble debugging: Burst error BC1020: Boxing a valuetype RockMine.C4.Core.EntityCommandBufferWrapper to a managed object is not supported. The type EntityCommandBufferWrapper implements an IEntityCommandBuffer interface that I created so that I could use the same code no matter if the job is single or multithreaded (I have another EntityCommandBufferParallelWriterWrapper type that also implements the interface). That's the only unique thing about it; I don't think that should be causing issues, but I thought I'd mention it in case.

#

The frustrating thing is that the line the exception refers to doesn't even have any mention of EntityCommandBufferWrapper.

#

Any thoughts on what could be causing this? The only mention I could find online of error BC1020 said that it's caused by calling Debug.Log, but I've removed all those references. Not sure what could be going on.

rustic rain
#
            var buffer = bufferSystem.CreateCommandBuffer().AsParallelWriter();

            Entities
                .WithAll<HasTarget>()
                .ForEach((Entity entity, int entityInQueryIndex) =>
            {
                buffer.RemoveComponent<HasTarget>(entityInQueryIndex, entity);

            }).ScheduleParallel();


            bufferSystem.AddJobHandleForProducer(this.Dependency);

Do I need to dispose of anything in this case?

#

EndSimulationEntityCommandBufferSystem

#

it keeps giving me this

karmic basin
rustic rain
#

oh

#

how do I get dependency then?

karmic basin
#

And IIRC I had strange warnings for container I allocated but never actually used, should keep an eye open for such a thing too 🙂

#

Entities.ForEach will return a JobHandle

rustic rain
#

doesn't seem so

karmic basin
#

Yeah Im dumb dumb

#

I meant the schedule 😛

#

SOrry

rustic rain
karmic basin
#

okay im clearly wrong lemme check again the doc

#

dammit xD

#

Oh I see

#

only the overloaded calls with a dependency themselves return a JobHandle

#

so this means the Dependency in SystemBase is already updated for you 🤔

#

I guess

#

So nevermind what I told you xD

#

I'm still learning everyday with that dependency chain management 😛 sorry for that

rustic rain
#

Am I even doing everything correctly?

#

I basically want to remove HasTarget

#

from all entities

#

aka find targets again

pulsar jay
karmic basin
#

Well for now looks like you remove HasTarget immediately. You surely need another condition fullfiled before removing

pulsar jay
#

Was confusing to me as well as in some cases Unity is doing some magic dependency management and in other cases it doesnt

rustic rain
#

thing is

#

it doesn't work

#

my entity has HasTarget comp it was assigned once

#

and it's never changed

karmic basin
pulsar jay
#

are you sure that there isnt any other sytem adding it again?

rustic rain
#
    EntityQuery targetQuery;

    EndSimulationEntityCommandBufferSystem endSimulationEntityCommandBufferSystem;
    protected override void OnCreate()
    {
        var queryDescription = new EntityQueryDesc
        {
            All = new ComponentType[] { ComponentType.ReadOnly<Translation>(),
                                        ComponentType.ReadOnly<PlayerBodyTag>() },
        };
        targetQuery = GetEntityQuery(queryDescription);

        endSimulationEntityCommandBufferSystem = World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
    }
#
    protected override void OnUpdate()
    {
        NativeArray<Translation> translations = targetQuery.ToComponentDataArray<Translation>(Allocator.TempJob);
        var buffer = endSimulationEntityCommandBufferSystem.CreateCommandBuffer().AsParallelWriter();

        Entities
            .WithReadOnly(translations)
            .WithDisposeOnCompletion(translations)
            .WithAll<ZombieBodyTag>()
            .WithNone<HasTarget>()
            .ForEach((Entity entity, int entityInQueryIndex, in Translation translation) =>
            {
                float curDistance = float.MaxValue;
                int ind = int.MaxValue;
                for (int i = 0; i < translations.Length; i++)
                {
                    float distance = math.distance(translation.Value, translations[i].Value);
                    if (distance < curDistance)
                    {
                        curDistance = distance;
                        ind = i;
                    }
                }

                if (ind != int.MaxValue)
                {
                    var comp = new HasTarget()
                    {
                        Position = translations[ind].Value
                    };
                    buffer.AddComponent(entityInQueryIndex, entity, comp);
                }

            }).WithBurst().ScheduleParallel();

        endSimulationEntityCommandBufferSystem.AddJobHandleForProducer(this.Dependency);
    }
#

my second system is supposed to add updated comp

#

but maybe I'm wrong?

#

or maybe I need to get entity query on update?

pulsar jay
pulsar jay
karmic basin
#

Ok I see. I'm still figuring this out, recently physics dependencies backfired at me. That's confusing sometimes

pulsar jay
pulsar jay
karmic basin
#

Exactly 🙂

rustic rain
#

nah

#

keep getting this

#

EntityManager.RemoveChunkComponentData<HasTarget>(query);

#

I tried this

#

no allocation warnings

#

but still no comps get removed

#

system that adds them is disabled

pulsar jay
rustic rain
#

oh

#

lul

pulsar jay
# rustic rain keep getting this

I am also getting these warnings in some cases. But I suppose it is connected to me doing wierd stuff with entities during edit mode

rustic rain
#
            query = GetEntityQuery(queryDescription);
            EntityManager.RemoveComponent<HasTarget>(query);

#

ok, this works

#

oof, these errors make me sick

#

float dot = UnityEngine.Vector3.Dot(targetDir.eulerAngles.normalized, currDir.eulerAngles.normalized);

#

I guess

#

I'm supposed to do smth else for it?

haughty rampart
#

1 - shouldn't use Vector3.Dot()

verbal pewter
#

Essentially, if I have a helper class that's meant to be used by both jobs that run on the main thread and in parallel, it seems like I have to create two implementations of the helper method: one that takes an EntityCommandBuffer, and another that takes an EntityCommandBuffer.ParallelWriter. That seems absurd, but is it the kind of absurdity that comes with working with DOTS?

coarse turtle
#

i think the only time you can use an interface as an argument is when it's generic and has constraints with unmanaged types. Otherwise interfaces can be boxed into an object.

verbal pewter
coarse turtle
#
public static void Foo<T>(T value) where T : unmanaged, Interface { }
verbal pewter
verbal pewter
# coarse turtle ``` public static void Foo<T>(T value) where T : unmanaged, Interface { } ```

Looks like it won't be possible. The following error is being thrown: The type 'RoadGrowthStrategySystem.Test' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T2' in the generic type or method 'RoadGrowthStrategySystem.Expand. The only field I have is an EntityCommandBuffer field, which means that one its fields is nullable.

#

Well, was worth a shot.

coarse turtle
#

I guess it's the EntityCommandBuffer's DisposeSentinel which is causing EntityCommandBuffer to not be entirely blittable

rustic rain
#

hm

#

how to get CollisionWorld collisionWorld = buildPhysicsWorld.PhysicsWorld.CollisionWorld;
this into my ForEach loop?

#

I get error that wants me to put ReadOnly tag onto it

#

but I'm not sure how I can do that on local variables

rustic rain
#

ok, looks I just can't do character controller paralleled

#

any idea about ComponentDataFromEntity?

#

I'm trying to rewrite code from IJobChunk

#

to SystemBase

#

and it uses this container

#

to check for collisions

#

ComponentDataFromEntity<PhysicsCollider>

#

I assume I don't really need it

#

but question is, how can I access PhysicsCollider of any entity in world

#

by Entity?

#

let's say this NativeArray<PhysicsCollider> ColliderData = query.ToComponentDataArray<PhysicsCollider>(Allocator.TempJob);

safe lintel
#

you dont need to rewrite a chunk job for SystemBase

#

anyway for foreach use .WithReadOnly(collisionWorld)

rustic rain
#

oooh

rustic rain
#

yaaay

#

400 lines of code

#

turned into 200

rustic rain
#

Hm, is camera stacking a thing in dots?

white island
#

?

safe lintel
#

you should probably read up on managed and unmanaged types @white island its really a fundamental part of dots

white island
coarse turtle
#

well the question is why do you need a dictionary and list in a blob? Since blobs are linear data in memory, if you want a dictionary like behaviour, then you can add in hash function so that you can get the index within the blob array. If you want a list - that's pretty much only an array in blob assets.

safe lintel
#

I guess its never spelt out but as tertle said, you cant use nativecontainers for blobs, for that you have BlobArray(and you can have nested blob arrays afaik unlike nativecontainers). Nativecontainers - your goto for burst job array/list/collection functionality

rustic rain
#

what are my options besides camera stacking (as it seems, it's not possible with dots) for weapon overlay?

#

I mean, gun that character holds in first person

safe lintel
#

@rustic rain in urp you can do the render object feature to change the fov(example in universal rendering example repo), for hdrp theres a shadergraph of doing something similar in the FPS sample, but last time I tried it with hybridrenderer, it broke

rustic rain
#

change fov? for what?

safe lintel
#

oh, because how it works is to make your weapon so small it resides inside any collider's radius so it never clips through geometry

rustic rain
#

oh

#

you mean, put it way too close?

safe lintel
#

apparently thats how modern games tackle this

rustic rain
#

I'm also considering hybrid approach

#

where cameras will be GO

#

will actually simplify a lot of things

#

yeah, I think I'll go with hybrid approach

#

doubt dots has anything as pog as current GO camera does

safe lintel
#

thats really the only option for cameras currently 😉

rustic rain
#

well, I used conversion thingy

#

for simplest thing as being local to entity container

#

it works fine

white island
coarse turtle
#

i guess I need some context - if it's from a file why do you need it to be a blob asset? I imagine you can just stream the file into memory and just read the memory address

rustic rain
#

what is better:

  1. updating transform of camera inside of Update()
  2. updating transform of camera from system
    ?
safe lintel
#

I think its better organization to update your gameobjects from systems, ie your systems control the gameobjects but functionally I dont think it matters

rustic rain
#

kek

#

I thought way smaller

safe lintel
#

the only thing that bugs me about this approach is shadows are sorta on or off with something so small, you dont get a more nuanced partial shadow casting if you do this(or if theres a solution for it, I dont know about it yet)

rustic rain
#

damn, I didn't think of it

#

that lightning

#

will not affect overlay elements

#

like gun and hands

#

allthough

safe lintel
#

i mean it does but you dont get that transition time when moving into shadow or light as you would with a normally scaled object

rustic rain
#

I mean for stacking approach

#

when actual gun and hands will be far away

#

from ingame environment

rotund token
white island
coarse turtle
# white island it's a deserialized YAML file I use to determine behavior in my game

yea I guess ymmv, but i think about it more like - if it's from a single file, read it into a static readonly field and you can use it in system logic. But if it's a serialized dictionary, then it probably makes more sense to transform the dictionary into a persistent NativeHashMap (either through a custom yaml deserializer or pretty much copy the dictionary's contents into a NativeHashMap). Imo it doesn't really make sense to bind it to an entity if it's some global kind of data.

white island
#

Basically, each entity is a certain kind of object, and each kind of object has a configuration file. So I am deserializing the YAML file into this struct and then storing it as a blob asset, and then each entity keeps track of what kind of object it is by storing a BlobAssetReference

coarse turtle
#

I can only think of these 2 ways from the top of my head. Pretty much your blob struct can contain a method which acts as your key accessor like in a dictionary and perform a similar hash look up, or keep it simple - loop and do a find in the BlobArray to get the correct entry.

#

Either way you'll still need to do some data transformation on the managed dictionary -> some blob compatible struct

white island
#

You mean, flatten the dictionary?

coarse turtle
#

yea pretty much.

#

You'll have a single bucket + potentially a hash function to do your value look up given a key. (If it's just an array, your index would be the key)

safe lintel
#

has anyone done any subscene loading via LoadSceneAsync? I keep getting a nativearray was disposed error when doing this but resuming play it ends up loading

white island
rotund token
rustic rain
safe lintel
#

@rotund token yes

coarse turtle
rotund token
#

you should really load all subscenes using RequestSceneLoaded

#

not any direct method on scenesystem

#

unignore me i was right the first time

#

buffer.AddComponent<RequestSceneLoaded>(entityInQueryIndex, entity);
just add that to your subscene entity to load it

#

i think you should only use LoadSceneAsync for your first set of scenes

#

otherwise you get issues

#

(been a while since i've played with this, but this is how my scene management system works and i vaguely remember having issues)

safe lintel
#

just twiddling my thumbs for an editor restart but appreciate the info 🙂

rotund token
#

i have a bounds system for loading/unloading subsystems
Loading

            this.Entities
                .WithNone<RequestSceneLoaded>()
                .ForEach((Entity entity, int entityInQueryIndex, in SceneSectionData sceneData, in LoadWithBoundingVolume load) =>
                {
                    var boundingVolume = (AABB)sceneData.BoundingVolume;
                    var maxDistanceSq = load.LoadMaxDistanceOverrideSq > 0 ? load.LoadMaxDistanceOverrideSq : loadMaxDistanceSq;

                    foreach (var ltw in playerPositions)
                    {
                        var distanceSq = boundingVolume.DistanceSq(ltw.Position);
                        if (distanceSq < maxDistanceSq)
                        {
                            buffer.AddComponent<RequestSceneLoaded>(entityInQueryIndex, entity);
                            return;
                        }
                    }
                })
                .ScheduleParallel();```
Unloading
        this.Entities
            .WithAll<RequestSceneLoaded>()
            .ForEach((Entity entity, int entityInQueryIndex, in SceneSectionData sceneData, in LoadWithBoundingVolume load) =>
            {
                var boundingVolume = (AABB)sceneData.BoundingVolume;
                var maxDistanceSq = load.UnloadMaxDistanceOverrideSq > 0 ? load.UnloadMaxDistanceOverrideSq : unloadMaxDistanceSq;

                foreach (var ltw in playerPositions)
                {
                    var distanceSq = boundingVolume.DistanceSq(ltw.Position);
                    if (distanceSq > maxDistanceSq)
                    {
                        buffer.RemoveComponent<RequestSceneLoaded>(entityInQueryIndex, entity);
                    }
                }
            })
            .ScheduleParallel();```
#

basically just add/removes RequestSceneLoaded to load/unload

white island
safe lintel
#

ok so I was getting errors(a nativearray was disposed etc) inside of LoadEntitySceneAsync

// old
foreach (var s in EntityManager.GetBuffer<ResolvedSectionEntity>(sceneEntity))
    EntityManager.AddComponentData(s.SectionEntity, requestSceneLoaded);
// replaced with 
for (int i = 0; i < EntityManager.GetBuffer<ResolvedSectionEntity>(sceneEntity).Length; i++) {
    var s = EntityManager.GetBuffer<ResolvedSectionEntity>(sceneEntity);
    EntityManager.AddComponentData(s[i].SectionEntity, requestSceneLoaded); }
#

but that fix resolves it(?) not that im happy about moving another unity package into my packages folder

rotund token
#

haha yeah i can see why the unity code breaks

coarse turtle
rotund token
#

they're hardly the same

#

the GC can move reference types in memory

#

a pointer always going to point to the same location

coarse turtle
#

yea

#

im just going to remove that last sentence 🙃

rustic rain
#

LocalToWorld
what is 4x4 matrix in this component?

#

I basically want to extract position out of it

#

oh nvm

#

it has property for it

#

lul

white island
#

Man, I really dont know what to do here with this dictionary thing... I can't avoid it...

coarse turtle
white island
coarse turtle
#

copy the content over from the dictionary once it's deserialized into memory?

#

generates GC sure, but it's a quick solution

#

unless you write your own deserializer/use a compatible library i'm not really sure of an out of the box solution

whole inlet
#

I have a prefab that has a light source in it, when I use the "convert to entity" component to create an entity of it in my scene - I see my prefab model, but the light source is missing - does the unity dots package support the light source at this moment? or is there something else I need to configure before it shows up?

rustic rain
#

none of light sources worked for me in subscene, I assumed there's no light in entity world

rotund token
#

HybridEntitiesConversion supports lights in subscenes

#

and supports baked data

floral lynx
#

Is DOTS good for huge numbers of game objects? Any good tutorials out there to get me up and running in a short time frame?

I need for game jam.

rustic rain
#

and up to date

#

I'd say, dots is good for strategical kind of games

#

personally I think, RPG, FPS and similiar genres are way better be done in classic OOP

floral lynx
#

This is for Kaiju Jam.

We're building procedural cities out of tens-of-thousands of cubes.

We want each "cube" to be destructible etc.

Is DOTS appropriate for this?

rustic rain
#

it's perfect

#

if you have smth that is same

#

and there's a lot of it

karmic basin
#

I'm afraid you're gonna burn all the short amount of the jam fighting with DOTS, and not achieve a lot

rustic rain
#

oh yeah

#

be aware

#

dots is not even beta

#

kek

floral lynx
rustic rain
#

do hybrid

#

do whatever it is you want for shitload of objects with dots

#

while keeping link to your GO world

#

you don't even have to use entities

#

jobs + burst

#

can be enough

floral lynx
rustic rain
#

if it's cpu overhead of processing those draw calls

#

(not logic)

#

you might want to consider indirect gpu instancing

floral lynx
#

I'll look into all that. Thanks man 👍

floral lynx
#

All rendering, can't seem to get it down :/

karmic basin
#

Unless you especially want to use the game jam to learn DOTS. But if you do, don't expect to finish your experiment

#

Or divide scope by 3 🙂

#

oh lord yeah didnt see that rendering graph

floral lynx
#

This is with both batching off, and GPU instancing & receive shadows off on all materials.

#

~150 batches per second frame?

rustic rain
#

I can't say for sure but

#

as far as I know

#

dynamic batching can't be as good

#

as manual batching through code

#

I was able to make simple mesh drawing with 40k meshes for almost free (for CPU) by storing buffer of precalculated matrices on GPU

#

and then just accessing that buffer by index

#

had to make a special shader for it, but in the end perfomance was magic

pliant pike
#

I have kind of a weird question does anyone know if its possible to convert a gameobject mesh frozen part way through an animation into a full entity

#

I know we can't use animations in dots yet, I'm just wondering if I couldn't do some kind of stop motion method where I flip through a bunch of mesh's 🤔

safe lintel
#

But you can use animations in dots (though its harder than gameobjects) 🙂

pliant pike
#

you can, how so

#

no worries I just found a couple of tutorials although, it may be too complicated for me leahS

left zenith
#

So I have Unity.NetCode installed on a clean project with Havok and Unity Physics both installed as well, for some reason it seems to be throwing the following exception when I enter playmode

#

Should I uninstall Unity Physics if I want to use Havok? Is that the issue?

#

Or do I need to downgrade one of my packages?

#

The error was coming from Havok, so I guess I'll just stick to Unity Physics for now

haughty rampart
safe lintel
rotund token
#

i think it's totally that

#

(scroll like 3-4 comments down for fix)

#

kind of annoying i have to be the one to tell the community the fix instead of unity just stickying a post or something 😐

safe lintel
#

dont they have tests to catch something like this? 😩

left zenith
#

That didn't work for me with Havok installed again, don't know if that makes a difference. Apparently the bug actually exists in netcode. This worked, though. https://forum.unity.com/threads/2020-3-16f1-physics-world-history-objectdisposedexception-cannot-access-a-disposed-object.1158956/#post-7525850

rotund token
#

oh this is the physics history world one is it

#

should have looked at stack closer

#

yeah that broke back a few versions ago

#

i really should make a post with all known issues in dots packages

left zenith
#

Yeah me too really, I just figured it was one of the physics libraries since that was at the top of the stack trace

#

and when I uninstalled both physics packages it didn't throw the error anymore, but once I installed Unity Physics package again it did, prompting me to just google it 😆

prisma anchor
#

I am trying to make constraints so that my player doesn't move in the Z. But nothing seems to be happening. Any suggestions?

    public sealed class PhysicsConstraint : MonoBehaviour, IConvertGameObjectToEntity
    {
        public bool3 Linear = new bool3();
        public bool3 Angular = new bool3();

        public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
        {
            var worldFromA = new RigidTransform(
                dstManager.GetComponentData<Rotation>(entity).Value,
                dstManager.GetComponentData<Translation>(entity).Value
            );
            RigidTransform bFromA = math.mul(math.inverse(RigidTransform.identity), worldFromA);

            var joint = PhysicsJoint.CreateFixed(new BodyFrame(worldFromA), new BodyFrame(bFromA));
            joint.SetConstraints(new FixedList128<Constraint> {
             new Constraint
                {
                    ConstrainedAxes = Linear,
                    Type = ConstraintType.Linear,
                    Min = 0,
                    Max = 0,
                    SpringFrequency = Constraint.DefaultSpringFrequency,
                    SpringDamping = Constraint.DefaultSpringDamping
                },
                new Constraint
                {
                    ConstrainedAxes = Angular,
                    Type = ConstraintType.Angular,
                    Min = 0,
                    Max = 0,
                    SpringFrequency = Constraint.DefaultSpringFrequency,
                    SpringDamping = Constraint.DefaultSpringDamping
                }
            });

            dstManager.AddComponentData(entity, joint);
        }
    }```
honest rapids
#

Total DOTS newbie here. I was reading about ECS today and I'm considering starting to use it. I was confused about one point, though. It said objects with all exactly the same values are grouped together in memory, and I assume this grouping makes it go faster in some way. The problem in my mind is, there's almost no real-world situation, other than perhaps "zeroed" objects in an object pool waiting to be used, in which you'd ever need a lot of objects in a game that all have exactly the same values. I imagined a bullet hell game with tons of bullets bouncing around. Almost never would all the bullets be in the exact same position on the screen. So my question is, in a situation like this, is DOTS still faster? Or is there some point where the overhead of moving thousands of non-identical objects whose values change every frame into new group after new group after new group isn't worth the benefit anymore?

left zenith
#

If I'm using Havok Physics for Unity, do I still use a rigidbody and just add the Physics Step component and it just works?

safe lintel
#

havok uses the exact same conversion and components as Unity Physics

haughty rampart
#

bullet has position, collider, damage for example. all bullets are together. what values these components hold is totally irrelevant

#

also from your last sentences, i think you haven't really understood dots

honest rapids
#

Fair enough. You're probably right, I don't. I want to make a 2D action game with multiple enemy types and upgrades that affect how the player's projectiles work. Let's call it something like Nova Drift. Lots of player projectiles and lots of enemy ships means lots of moving objects and many-on-many collisions. Is Unity2D+DOTS+Collision Layers the best tool for the job or not?

haughty rampart
#

it certainly is

honest rapids
#

It's kinda spooky because whenever I look at a unity forum thread about it it's always game devs describing pretty ubiquitous gameplay situations and then debating the pros and cons of hackey workarounds in the most abstract terms with no example code. 😨

haughty rampart
#

most of the time you can easily grasp what they're talking about

honest rapids
#

Updating a thing more than once per frame is a common theme

haughty rampart
#

usually you don't update anything more than once per frame

#

like 99.99% of the time

honest rapids
#

No, I'm saying usually when somebody cares enough to ask a question about DOTS in a forum thread, it's because their design compels them to update something more than once per frame, which necessitates hackey workarounds.

#

And my brain is like "I understand the problem but not the solution. That could be me someday, stuck implementing hackey workarounds!"

haughty rampart
#
    • it doesn't
    • most questions are not about updating more than once per frame
#

the only* thing needing hacky workarounds is a hybrid workflow.

honest rapids
haughty rampart
#

and that has to do what with your example? i can see 0 correlation

#

your system sounds way simpler

honest rapids
#

You're assuming I've described everything I'd ever consider adding to the game. I'm a solo dev, and I'm still in the planning stages of the project. It's not like I'm bound to a design doc yet. My point is the examples people come up with that require hackey workarounds are all surprisingly pedestrian features I've seen in games before. Enemy-targeting. Pathfinding. Modifiers that modify other modifiers. The classic First-Person Camera controller. Examples like these make me worry that DOTS might be too fragile to make games with. Not even cutting-edge, AAA games, but game archetypes that have been performant since the 90s.

#

I'm hoping this is more of a perception problem than a legitimate concern. I won't know until I try. And it's true that this is the opposite of survivorship bias-- I'm only hearing from the people who've managed to paint themselves into a corner.

deft stump
honest rapids
#

Working my way through a slide set. This actually sounds a lot like one way I did things way back in the heady days of Flash Actionscript. Make an array of object references, make an array of X positions, make an array of y positions, make an array of xSpeeds, make an array of ySpeeds, iterate through them all every update. OOP came years later.

#

Except it seems like a lot of the array work has been abstracted away by ECS. Nice!

#

My EntityID was just the i in a for-loop... which I suppose also served as a fixed-length object pool by default. Other than that, it's pretty similar, conceptually.

honest rapids
#

Actually, that reminds me. One of the things I needed to unlearn when coming to Unity from Flash, like 10-15 years ago, was unity doesn't like for (i = 0; i < enemyCount; i++) when iterating through gameObjects. It needs foreach instead. Was that a consequence of Unity's OOP system, I now wonder?

safe lintel
#

fairly certain thats not a thing

honest rapids
#

I'm trying to remember.

#

I remember now. In really old pre-OOP Flash, like AS1 or AS2 or something, I fell into the anti-pattern of not using an array at all to iterate through my MovieClips, but rather giving them a name that had the string literal value of i at the end. I'd name them like enemy[i] or something, I don't even remember how to do it now, and it would come out like enemy1, enemy2, etc. at runtime. And then access them the same way after object creation. I asked how to do that in Unity, and they were like "dude what are you doing just use foreach."

#

Everything was these bodged-together tricks you learned from a friend online. There was a formalized discipline, but it wasn't involved in the flash scene. You had to check out a library book on AS1 coding or whatever if you wanted to learn from academic sources, and even that would be full of little mini-examples. Maybe one or two full game projects, if you were lucky. It was a more primitive time. Not even sure if W3Schools even existed back then. Was that Web 2.0? If it did exist, teenager me sure didn't know about it. I was in full-on cowboy mode. I'm not sure if I've gotten better since then or if Google has just made my bad habits more scalable. Probably a little bit of both.

#

Gonna go out on a limb and say the fact that I'm researching DOTS before using it is probably an improvement.

rustic rain
#

what gets bursted by default? entities loops and IJobs?

#

OnUpdate of systembase doesn't?

rotund token
#

only jobs that you add attributes to (and function pointers)

#

entities.foreach/job.withcode will by default code gen to a job with the burst attribute unless you tell it not to

#

and ISystemBase onupdate is burstable (function pointer rules)

rustic rain
#

any tip how to make smth like weapon equipping with systems?
basically an animation of weapon equipping is what breaks my mind

#

let's say I have shotgun, I want to equip rifle, I want some animation of switching to happen

deft stump
karmic basin
devout prairie
# rustic rain let's say I have shotgun, I want to equip rifle, I want some animation of switch...

it's stuff like this that ends up being a little bit more of a headache with full dots/ecs compared to just gameobjects with components and classes.. with dots if you're keeping EVERYTHING within the framework of jobs/systems and adhering to sync-points you are basically having to manually build systems that do stuff in little modular chunks..
so for example with a mono/component you maybe have a method called SwapWeapon that has a bunch of code that destroys or hides the old weapon, instantiates the new weapon, updates the characters weapon stats etc.. this makes things really easy but at a relatively huge performance cost compared to an efficient ecs/dots system.. the dots version would probably have maybe 2 or 3 separate jobs, one which takes inputs, sees that a swap weapon is requested, and passes that request onto another system, which maybe tells an ecb to destroy the existing weapon, and instantiate the new one, and maybe applies new values.. there would then more than likely be a whole other system dedicated to character animation which would then run the weapon swap animation..
so the problem is, it could all be seen as over-optimization, you might be easier just keeping it gameobjects and components.. i'd say you have to be pretty brave and committed to go down the dots route for stuff like this.. personally, i've done it, and it definitely has it's advantages, but depending on your situation might not really be worth the hassle

rustic rain
#

I'm fine with hybrid approach

#

I have my gun models and cameras as GO anyway

#

for sake of camera stacking of urp

karmic basin
#

You'll find you'll have a hard time using 2D with DOTS

devout prairie
rustic rain
#

at this point I'm not sure what to use dots with kek

#

in FPS shooter

#

I mean

#

with only about 50 enemies simultaneously

#

I guess it still makes threading way easier

#

for AI

#

pathfinding

devout prairie
#

it's going to be interesting to see how dots evolves over the next year or two.. it is such a conflicting paradigm with the old way of doing things, it's like chalk and cheese, i'm curious how unity will encourage or suggest or help people to integrate it or transition to it.. i think it's hard to decide how and where to use it until you've actually worked with it for some time and even then mixing dots with mono stuff is a headache in itself and adds an extra layer of complexity

devout prairie
# rustic rain with only about 50 enemies simultaneously

50 characters probably means in terms of using Animator etc you're probably not hitting any huge bottlenecks so yeah.. dots does make multithreading 1000x more accessible and bursted jobs are incredible performance gains, so yeah using for AI stuff, targeting, anything that's doing a lot of iterating and processing in bulk would benefit a ton from it

rustic rain
#

personally dots is perfect for tycoons, simulators and etc

#

not for rpg's

#

or simple shooters

#

Still

#

I don't want my game even, if it's simple to run on single core

#

I want to use jobs+burst at some point

devout prairie
#

hehe well yeah and, in some ways no, as i say there's stuff in shooters that can benefit hugely from dots and burst

#

other thing i find interesting with dots is just the potential not just to spawn 140 billion cubes and all that, but actually to just build apps/games that are 100x more efficient

#

i genuinely think we're going to see a squeeze on the cost of energy and penalties for devices/apps/whatever that consume more than their fare share and aren't efficient

#

maybe that's a few years out, but i think it's going to be imporant

#

classic unity or mobile game is the typical, play for an hour use 80% battery and really bad memory/storage efficiency

rustic rain
#

hm

#

if I do some expensive calculation in OnUpdate of my system

#

does it mean, that I'm stopping execution of all systems until I free main thread?

worn valley
#

OnUpdate is always run on the main thread. But if you schedule a job inside that it won't run on the main. It's basically the scheduling call. You are supposed to set up jobs there and then check for whenever those jobs are done in a later update or next frame

rustic rain
#

I mean

#

If one of my systems

#

Runs some code itself, not scheduling

#

and if it's code expensive

#

and will take let's say 0.5ms

#

will that mean that all systems will be stopped

devout prairie
rustic rain
#

can you schedule without burst tho?

#

or more like

#

can you schedule

#

job with reference type

#

inside

devout prairie
#

usually i do WithoutBurst if i'm accessing something that's a class or mono ( something outside of ecs )

#

one way is say for example you need to access the cam's transform inside a burst job, get it first and then use those values inside the job

rustic rain
#

I can't schedule tho

#

it gives me this error

#

I have to run

rustic rain
#

maybe I should do it from GO instead

#

so my system queue isn't clogged

#

how do I get info from system then

#

hm

devout prairie
#

well there's different approaches to that..

#

you could have for example an entity that represents your camera or GO that you want to push values to.. it could have some component that collects the values.. so in your burst job/system you apply the values to that entity/component, and then later on the main thread you just copy the values from the entity/component and apply to your gameobject

rustic rain
#

I already have them

devout prairie
#

other way is to use an entity with a buffer of data you later apply to gameobjects.. another way is you have a NativeArray which collects the data and later copy to GO's

rustic rain
#
        Entities
            .WithAll<PlayerCameraHolderTag>()
            .ForEach((ref Rotation rotation, in LocalToWorld ltw) =>
        {
            camera.transform.SetPositionAndRotation(ltw.Position, ltw.Rotation);
        }).WithoutBurst().Run();
#

here's how I do it rn

devout prairie
#

tbf, if you're only iterating one object and applying it once, it's kinda negligable

#

if you were doing something like that say 10k times, then it'd be worth looking at it

rustic rain
#

it's singleton entity

#

I think

#

I'll just access entity manager

#

outside of system loop

devout prairie
#

tbh a lot of player stuff that only ever has a single object could just be done as mono's or whatever

#

the benefit of jobs/ecs is where you have a lot of something to do, or some computationally intensive stuff like finding nearest enemy from a long list of enemies etc

rustic rain
#

well

#

world entities can only interact with entities

#

they don't know nothing about game objects

#

so I keep player entity as entity

#

thus it helps

#

with having character controller

#

and etc

devout prairie
#

yeah i mean it's def possible and useful to keep your player code inside a system loop, and use entities for it, that can be referenced by say other ecs systems or code

rustic rain
#

so, how do I access Entity components from my GO?

karmic basin
#

You can use entities package

#

and through the entitymanager, or foreach lambda and such

karmic basin
#

Actually did a quick test and not the lambda but can still put it in a system and access it, or call ToArray() on a query and iterate the container, and so on and so on...

#

And for the EM, you access it through the World.

graceful mason
#

I think I can, but Scriptable Objects play well with DOTS?

deft stump
#

nope

#

convert them into blob assets

graceful mason
#

that was the plan

#

if im starting from scratch, I shouldnt use them at all? Just use AuthoringComponents or something instead?

#

Just wanna be able to let my designers create objects and stuff

coarse turtle
#

depends on scope I guess. I find scriptable objects nice when you have a custom editor window. So I use them pretty often for designer folks to customize data - then stash the data into a blob asset on conversion

haughty rampart
#

best of both

honest rapids
rustic rain
#

I disagree, 2D is just dimensions

#

if you have 2D rts

#

you're gonna love it

#

if it's 2D platformer with bosses...

#

well

#

hard time

honest rapids
#

I'm confused. Why would game genre make a difference? You have things doing stuff to the other things every frame. The only difference I can think of is inputs. And I guess RTSes might have some kinda build or movement queue if you get really advanced with it.

coarse turtle
#

Don't really know, I'm kind of building a platformer with dots and it works? I use my own custom physics system instead of Unity Physics.

I think it's more of understand how data is transformed and what data requirements you need that trips ppl up when building a game in an ECS/DOTS fashion 🤔

karmic basin
#

I mean there's no 2D support yet, right ? You'll have to handle everything yourself. Last time I checked you had to texture a quad mesh to render something.... Project Tiny is discontinued, right ? Maybe I lost track and that's not the case

#

maybe not discontinued, sorry wrong choice of wording here, but releases are slow ?

safe lintel
#

havent done any 2d games but have to imagine there are a lot of convenience stuff that you would miss making a 2d game in dots, 3d dots is already pretty bare bones but theres really nothing for explicit 2d(sprite) conversion unless you use tiny which as mr.k notes looks kinda abandoned

coarse turtle
#

yea - no 2d IK unless you roll your own 😦

rustic rain
#

handling 2D seems easy

safe lintel
#

how much was involved in making your own custom physics @coarse turtle ?

coarse turtle
#

I think it took me a few weeks?

#

It's pretty much setting up how I wanted to handle collision contacts and how that information was being passed around that took up most of my time, but otherwise it was fairly straight forward

safe lintel
#

heh i feel thats the amount of time it took to repurpose the unity physics character controller 😩

coarse turtle
#

lol, yea I tried looking at that and I closed the example 😦

#

but I don't really support like everything that like unity 2d physics comes out of the box

#

just the stuff I need so, n sided polygons and everything has to have a rigidbody 👀

#

no such thing as a collider only

rustic rain
#

Entity entity = cameraHolderQuery.GetSingletonEntity();
I assume that's legal to use ONLY if query has only 1 entity?

coarse turtle
#

Yea

rustic rain
#
        var desc = new EntityQueryDesc()
        {
            All = new ComponentType[] { ComponentType.ReadOnly<PlayerCameraHolderTag>() }
        };
        cameraHolderQuery = world.EntityManager.CreateEntityQuery(desc);
#

query should be created only once right?

#

per world

coarse turtle
#

Yea

#

it does a look up internally to find the best matching query if you attempt to create the query again

rustic rain
#

damn, I just realised

#

that if I assign camera position without running all other jobs for positioning it

#

I'm 1 frame behind

coarse turtle
#

isn't that fine?

wooden canopy
#

I am not a fan of only getting all the transform stuff updated in one system at one point

rustic rain
#

idk, I kinda aim for fast paced game

wooden canopy
#

like, read input, turn player entity, now the weapon who is a child is one frame behind, spawn the bullet, its a mess

#

not sure yet what is the proper way

#

in some tests I ended up making the transformsystem run at multiple points

rustic rain
#

my read input is always ahead of systems

#

because it's in mono

#

kek

#

my controllers run in special group

wooden canopy
#

but I would love to have a formal static helper utility that allow you to change some transform in the whole hierarchy for an entity

rustic rain
#

player controller is unique

#

tho

#

cause it's running outside of fixed step

wooden canopy
#

sure, for a ton of stuff handling in on a system is fine, but sometimes I would like to pay the cost of updating the transform inlne, like it happes with regular GO

devout prairie
devout prairie
# wooden canopy like, read input, turn player entity, now the weapon who is a child is one frame...

yeah this is what i was hinting at earlier today.. basically with dots, to conform to sync points and still have things update within a single frame, and do all the same stuff that a monobehaviour takes for granted, you kinda have to reinvent the wheel in a way.. what you end up with is a bunch of jobs or systems that all do specific separate tasks, being really careful about what data is being updated and being really specific about the order of things within the frame and in relation to ecb's and sync points

#

there are currently some annoying little caveats with parenting, you mentioned child objects being a frame behind.. it is possible to fix that problem though.. basically i ended up with a manual parenting system that does it

safe lintel
#

@wooden canopy couldnt you just introduce a counter that starts and then when its 1 frame, then spawn the projectile after the transform system and next frame occurs?

prisma anchor
#

Is it common to get Access Sharing violations when saving scripts while using DOTS? I have to kill Unity several times for it to stop

safe lintel
#

maybe once every other week I might get something like that? certainly not a common occurence though

prisma anchor
#

hmm. I wonder if its because I wake my computer up

north bay
prisma anchor
#

yea, i'll try closing it next the the errors happen

rustic rain
#

hmm

#

I wonder how to handle different weapons shooting

#

like, some guns do full auto, while other will only shoot one per click

#

while making system for each seems like a really bad design

night cargo
#

why would it be bad design to have a system for each?

#

Your system only runs if Weapon, WeaponAuto and WeaponEquiped are there on the entity.

wooden canopy
# safe lintel <@!305114736784179200> couldnt you just introduce a counter that starts and then...

Perhaps that might be what is needed if I wanted to make a simulation for a million units, but if you are making something more normal, and you still like what ECS brings to the table in terms of architecture and organization, then I think it stops making much sense.
Some stuff is super reasonable to have delayed and processed in a mega optimal way, but for other stuff you want stuff to be more instant.

#

For example, a common choice is should new entities start being processed the instant they are created or should they be delayed to the next systems update.
In the overwatch gdc talk they mention that at first they delayed entity creation, but ended up changing to have it work in sync, because it solved a ton of difficult to fix bugs related to 1 frame off issues.
Unity went with an intermediate solution, you delay the changes until you reach a sync point.

coarse turtle
safe lintel
#

I just use a bool for if its a single shot vs auto 🤔

safe lintel
# wooden canopy Perhaps that might be what is needed if I wanted to make a simulation for a mill...

suppose you could predict the future position based on current velocity and spawn it there? I dont do any delay for my bullet instantiation and tbh im not really sure if its noticeable at regular fps movement speeds(im not making overwatch 🥲 ). if you were doing a anything else moving faster like involving cars then maybe this is more of a big deal, or maybe im not seeing how important it is 🙂

devout prairie
# wooden canopy For example, a common choice is should new entities start being processed the in...

i might be wrong but i think maybe you're kinda mixing a few different problems together.. having 1 frame delay is actually a matter of choice it's not a rule or something fundamental.. you have a bunch of pre-defined sync points with ECB's, it's your choice whether you instantiate something at an early sync point, then change some data at a later sync point, then do something else at an even later sync point, all within the same frame..

#

the kinda default way of thinking is, you have one system that say spawns some bullets and sets positions etc on them.. whereas you might have one system to spawn them, then a separate system at a later sync point which grabs all shoot positions and sets bullet translations to those positions etc..

#

so it's kindof an architectural problem/decision

#

maybe with overwatch they were restricted to one sync point within a frame, or maybe the problem they were having was that instantiating objects and those kind of structural changes were causing a lag if they tried to do it all in one frame

deft stump
#

I found this gold mine of a video

#

time to dive deep into intrinsics in burst

coarse turtle
rustic rain
#

Is there a way to have entity prefab without keeping an entity in subscene?

#

Basically I want to have a lot of scenes

#

And I don't want to manually add all prefabs to them

#

Instead I want global prefabs

#

static or smth

rotund token
#

an entity prefab is really just a regular prefab

#

why do you need to add them to all scenes

#

is this because you're destroying worlds on every scene change?

rustic rain
#

not really, it's because I have unique subscenes

#

and I want to contain only relevant to this exact subscene data in it

#

excluding anything that is common

#

between several subscenes

#

ok, nvm

#

it was easier than I thought

#

I just didn't know what blobAssetStore is

rustic rain
#

InvalidOperationException: The BlobAssetReference is not valid. Likely it has already been unloaded or released.

Hmm, any idea on this?

#

happens on spawning prefab

#

after I added physics body and shape to it

#

here how I spawn it and get prefab

rotund token
#

You can't dispose the blob asset (store) until you're done with it

rustic rain
#

yep

rotund token
#

Keep a reference, dispose in ondestroy

rustic rain
#

yeah, I wonder how to organize it

misty wedge
#

Is there an advantage to using BlobAssetReferences instead of plain structs if I don't plan on putting them in entities?
e.g. instead of a NativeHashmap<Key, StructType>, using a NativeHashmap<Key, BlobAssetReference<StructType>> ?

rotund token
#

no

rustic rain
#

I'm guessing world space coordinates are absolutely same for entities world?

rustic rain
#

In order to create any sort of raycasts and etc I need to run system between those systems below, right?
UpdateAfter(typeof(ExportPhysicsWorld)), UpdateBefore(typeof(EndFramePhysicsSystem)

#

I assume physics world doesn't exist in entities world

#

and it just gets created as temporary step

rotund token
#

no

#

it exists permanently

#

you can raycast anywhere

rustic rain
#

oh

#

why those dependencies then?

#

to Create changes in physics world?

rustic rain
#
[BurstCompile]
public static class PhysicsUtils

If I do this, does it mean that all methods in that class would be compiled with burst?

#

(to avoid putting attribute on all methods)

misty wedge
#

Is it safe to have a native collection containing a struct that contains a native collection, as long as all data is only ever read?

haughty rampart
misty wedge
#

That's odd, since it seemed to work. I had a custom Entities package that removed some safety code which blocked you from using generics in BlobAssetReferences. Everything worked, but after adding that safety feature back in it is complaining about a NativeHashmap<Key, Struct>, where the struct contains a NativeList.

I assumed it would work again if I used unsafe collections, but I thought I would ask

haughty rampart
#

yeah unsafe collections would probably work,....but i've had plenty of native collections not being disposed despite thinking that i would so, if you can make it plug and play with aliases or so to have safety features when writing new code.....maybe that could work

#

or unity would just remove the fricking class and find a dots solution for it XD

misty wedge
#

Yeah it didn't seem to dispose correctly when I stopped playmode, but creating a bunch and disposing them again worked fine, atleast the safety system wasn't complaining.

haughty rampart
#

also, i've found another 'problem' with native collections. at least in a kinda niche project of mine

#

1 - native collections can at max have int.MaxValue elements.
2 - that's not even true, because they can only contain int.MaxValue = <structSize> * elements elements

#

this makes it incredibly difficult to work withlong values and a long count in dots

#

or....anything really you have to do more than int.MaxValue amount of times

misty wedge
#

One thing I really have difficulty with in DOTS is nested containers of immutable data, I still have no solution that I really like

#

e.g. something like

struct DataContainer
{
  NativeHashMap<SomeKey, SomeData> MyLookup;
}

public NativeHashMap<AnotherCoolKey, DataContainer> Data;
#

which isn't allowed by the safety system

haughty rampart
worn valley
#

I've solved this by making everything flat and then using a int2 to tell the start and length of each nested thing

#

It gets annoying but it's really good for DOTS stuff

coarse turtle
#

the other way which doesn't really care about linear memory layout is pointer to the unsafe container 👀

NativeHashMap<key, UnsafeHashMap<T, U>*>

haughty rampart
#

if anyone has any idea how to gracefully get around the int.MaxValue limitation in dots, that would be appreciated

coarse turtle
#

UnsafeUtility.Malloc uses a long although i guess you'd be rolling out custom containers

pliant pike
#

I think you can do nested containers fine with Blobassets

#

but then you can't change the data once its created

#

I have a question I don't suppose anyone knows if theres a simple burstable way of turning on and off the rendermesh

#

it doesn't seem to allow me to manipulate the rendermesh at all, so maybe there is another way I don't want to have to destroy and create the entity's when I just want to manipulate the rendering of them 🤔

misty wedge
misty wedge
pliant pike
#

can you not use your own custom struct

#

public struct myhasmap(int key, int somedata) etc

misty wedge
#

That's what I mentioned earlier

misty wedge
#

The safety system doesn't let you do that

rustic rain
#

Is there anywhere an explanation how to use BelongsTo and CollidesWith outside of fancy editor?
In code it's just uint

pliant pike
#

really, in a blob it should be fine

#

you could always use an int2 if not

misty wedge
#

On the topic of blobs, what happens if a component has a BlobAssetReference, and you serialize then deserialize the world?

pliant pike
#

that I do not know

misty wedge
#

Also, if you can have nativecollections inside blobs, what is the point of blobarray<T>? Since then you could just use NativeArray / NativeList...

pliant pike
#

can you use nativearrays in Blobs? 😕

misty wedge
#

I mean, you just said I could eaerlier

misty wedge
#

Since the blobified struct contains a nativecollection

pliant pike
#

I meant you could use structs of any types, except for unmanaged data

misty wedge
#

Then I'm back to my initial problem of not having a good solution for complex nested immutable data

karmic basin
misty wedge
#

Yes you can index 50 different blob arrays to recreate your data, but its a hassle with a lot of boilerplate

rustic rain
#

how do I do that?

karmic basin
#

Need to add your layers to this asset

rustic rain
#

BelongsTo = (1 << 5),

#

let's say this

#

is that gonna make collider belong to Projectile?

pliant pike
#

I mean you can have blobarrays in blobarrays

karmic basin
#

in the struct you can i.e. say BelongsTo = (1u << yourLayer1) | (1u << yourLayer2)

rustic rain
#

and how do I define myLayer1

misty wedge
rustic rain
#

so simply index from 0 to 31?

karmic basin
#

it's the index of the layer, like you said

rustic rain
#

what about

#

belong to all

#

or collides with all

misty wedge
#

~0

pliant pike
#

wouldn't you need to do that anyway, plus blobarrays are really efficient to do that sort of thing with

karmic basin
#

~0u to *inverse all zeros , so ALL

rustic rain
#

0u would be nothing?

misty wedge
#

I guess you could write a helper method to search through the array 🤷

pliant pike
#

depending on the size of the list that might take longer than just going through the whole list

karmic basin
misty wedge
#

Maybe Ill go with that, even if it seems kind of clunky

rustic rain
#

so, pls double check me

#

that would be

misty wedge
#

Converting ScriptableObjects to ECS-usable data in general is something I have trouble with

rustic rain
#

belongs to Projectile (layer 5)

#

collides with "not player" and with "enemies"

#

or wait, I think that's not legal

karmic basin
#

so just want to collide with layer 1 ?

rustic rain
#

with Enemies

#

only

#

yeah, it's simple one

coarse turtle
#
uint layer = 1 << 0; // This is 1;

// I think this looks redundant here
CollidesWith = ~layer | (1 << 1);

~layer = flip all bits, so the least endian bit is going to be 0, while every other bit is 1
| (1 << 1) = this is going to be 2, which is specified by ~layer when you bitwise OR the values
rustic rain
#

no need for help here

#

Just need some practice I guess

#

I assume it comes down to either: exluding all unwanted or gathering all wanted

#

Ok, this one needs help

            Entity camera = GetSingletonEntity<PlayerCameraHolderTag>();
            LocalToWorld ltw = EntityManager.GetComponentData<LocalToWorld>(camera);

            float3 from = ltw.Position;
            float3 to = UnityEngine.Camera.main.ScreenToWorldPoint(new float3(0.5f, 0.5f, 10f));

            CollisionFilter filter = new CollisionFilter()
            {
                BelongsTo = (1 << 5),
                CollidesWith = (1u << 1)
            };
            RaycastInput input = new RaycastInput()
            {
                Start = from,
                End = to,
                Filter = filter
            };
            if (collisionWorld.CastRay(input, out RaycastHit closestHit))
            {
                UnityEngine.Debug.Log(closestHit.Position);
            }
#

I'm trying out simple raycast

#

from camera position to middle screen position

#

that will only hit colliders with layer "enemies"

#

so I get LocalToWorld of camera container entity

#

grab it's position

#

get world point from center of screen with depth of 10 units

#

and cast ray that belongs to projectile and collides with enemies

#

yet, it doesn't hit

#

(no debug log)

#

is there any obvious mistakes here?

#

my layers for reference

coarse turtle
#

I'm wondering if the from and to positions are long enough to hit something

rustic rain
#

I'm trying them point blank

coarse turtle
#

try CollidesWith = ~0 to see if it hits anything at point blank

#

i haven't used the physics system enough to know the caveats

rustic rain
#

I tried

#

it does

#

it hits even when I look at sky

#

I guess it hits player

#

since camera is attached to player collider

coarse turtle
#

oh so if you do ~(1 << 0) - it doesn't hit the player right?

rustic rain
#

let's see

#

bruh, C# is funny

#

forces me create variable

#

to use ~

#

ok

#

it doesn't collide with player no

#

but doesn't collide with anythin

#

oh oh

#

looks like I failed at smth

#

when I look exactly like this

#

I get collisions

coarse turtle
#

yea sorry don't know enough about the caveats of Unity Physics package

karmic basin
#

Both sides have to want to collide

#

check layers for enemies too

#

oh didnt see you got collisions... from the side ?

rustic rain
#

it seems like it's not dots related question, but rather screen to world question, to avoid crosspost I moved it to #archived-code-general

karmic basin
#

float3 to = UnityEngine.Camera.main.ScreenToWorldPoint(new float3(0.5f, 0.5f, 10f)); screenspace is supposed to be in pixels, not between 0 and 1, right ?

#

yeah...

#

Try Screen.width /2 ?

#

you're shooting half a pixel from the bottom left corner :p

rustic rain
#

damn

#

it's ViewPortToWorldPoint

#

not scren

#

lol

karmic basin
#

oh haha nice catch

rustic rain
#

yay, I'm getting my hits

#

finally

karmic basin
#

now that gives you between 0 and 1 🙂

#

Nice

rustic rain
#

what is better approach at assigning collision filters?

#

rn I have demo scene full of GO Colliders

#

do I have to go through all of them

#

and switch colliders onto physics shapes?

#

also not particulary certain how to get mesh from probuilder into physics shape

#

I don't think it's even possible in editor

karmic basin
#

make a prefab ? and apply override to all

rustic rain
#

well yeah, that works for building in future xD

#

not rebuilding existing

karmic basin
#

oh i see you put a bunch non-prefab

#

try ctrl+click each one from the hierarchy

#

when they have same components you can mass-edit

rustic rain
#

what about pro builder meshes tho?

karmic basin
#

can't answer sorry

rustic rain
#

hm

#

does conversion system uses anything else otherwise?

#

to apply those filters

#

I guess I can make authoring script

#

that will edit collider

rustic rain
#

lul

#

it appears Pro Builder has some sort of script that attaches reference of it's mesh

#

to Mesh Collider of GO

#

then you can copy it and paste into Physics Shape

#

xD

rustic rain
#

F, it resets

rustic rain
#

oh, nice find

#

I never knew it was a thing

#

apparently I'm not supposed to ignore them

#

as some core features are hardcoded on those layer indexes

#

IF I use helper classes ofc

#

oh, nvm
It's 3rd party utility class lul

rustic rain
#

Any idea if you can use Jobs/Burst without unity editor? As Mod for other unity game I mean, assuming said game has no such packages

rotund token
#

the basic jobs are built into the unity editor so as long as it's not stripped, all the logic for executing the workers would be there

#

as for burst hmm not sure

#

the burst mod documentation says you need to call
BurstRuntime.LoadAdditionalLibrary(burstedAssembly);

#

i have not looked at what this method does

#

i think in theory you could probably replicate this layer and get it to work

rustic rain
#

Do you also happen to know whether you can implement ITriggerEventsJob through SystemBase?

#

I kind of really dislike syntax of implementing JobComponent systems

#

navigating through file is hell

rotund token
#

you can use any job in systembase

#

nothing stopping you using normal jobs in there

#

just use
Dependency = new MyJob {}.ScheduleParallel;

#

i barely use entities.foreach

#

most of my jobs are just jobs in systembase

rustic rain
#

I mean, if there's an easier way to iterate through trigger events

#

similiar to Entites.foreach

rotund token
#

ITriggerEventsJob is the only default way to do it

rustic rain
#

I see

rotund token
#

the samples have a state version which puts events in a buffer

rustic rain
#

yeah, I remember that one

#

you need to add that sample system

#

to get stateful events

#

so, is that it?
You are forced to iterate through literally all trigger events?

#

is that even paralleled?

honest rapids
#

Are there any DOTS or ECS example projects to learn from? I look on the Unity Asset Store and all that comes up is pixel art and third-party implementations of general ECS concepts.

rustic rain
#

moetsi dots tutorial is also great to begin

#

I personally found it the best beginners source of info for dots

honest rapids
#

I... is this official? The name kind of makes it sound like Unity Team released this.

#

Unity: Owns the entire Unity Asset Store. Also Unity: provides necessary official resources via github. smh. -_-

rustic rain
#

github one is unity

honest rapids
#

I guess it's because they feel DOTS/ECS is too fluid right now to clutter up the asset store with example projects that will just be deprecated later?

rustic rain
#

dots is still alpha or smth

haughty rampart
#

pre alpha really i guess

karmic basin
#
  • not gonna complain having the source open on github :)
#

But yeah official mainstream examples will come way later