#archived-dots

1 messages ยท Page 184 of 1

wet epoch
#

idk, it's not compatible with burst magic i guess

#

what is VertexBuffer ?

#

that might be an issue too

steady blaze
#

ok, i try to set the stuff within the job to Allocator.TempJob again

deft stump
#

If I want to use dots just for access to Havok Physics. What is the minimum amount of dots integration I need to do. i.e. do I need to use the Hybrid Renderer? Or can I use monobehaviour for everything per normal? What about multiplayer (plan to use MLAPI).
@valid haven I believe Havok is almost exlusive for ECS, (don't @ me on that) although i myself haven't played around with it coz I don't need it.
But what I can say about mixing mono + ecs is just dont.
They can't interact with each other.
Think of ECS Unity as another game engine in the same interface as MonoUnity.

steady blaze
#

it stores all the vertices that where already calculated before in x, y and z-directions - to get fast shared vertices with marching cubes

valid haven
#

I thought one of the promises of DOTs/ECS was that you could pick and choose where you wanted to use it?

steady blaze
#

oh! Allocator.Temp seems to work

wet epoch
#

you can communicate between them.. it's just slow and ugly

steady blaze
#

I hope it can last long enough (with Temp)!

deft stump
#

I thought one of the promises of DOTs/ECS was that you could pick and choose where you wanted to use it?
@valid haven I never heard of that.
but if you're talking about the Job System + it's accompanying burst compiler, yes you can use that in mono

But partly ECS + partly Mono is a huge no, in my exp

wet epoch
#

noone does UI in ECS for example though?

#

so you're sorta forced to at times

valid haven
#

that may have been my misunderstanding. So if I use one of the new physics systems and/or the entities package I am all in.

steady blaze
#

ok, will try to set everything inside to Allocator.Temp and then no Dispose in the end?

deft stump
#

basically. you have to be all in, whn using the new physics system/s

wet epoch
#

you could use hybrid objects but i don't see what the point would be

#

you'd likely lose any performance benefits

deft stump
#

It's also a pain in the ass to maintain too

wet epoch
#

yeah

valid haven
#

well there are certain features on the asset store that I am interested in, like the Easy Build System.

#

Also I had thought some funcitonality is still only to be had with monobehaviors, i.e. looking at rendering for example I note quite a few HDRP features are not yet in for DOTs hybrid render.

wet epoch
#

depends entirely on the asset.. but you usually build things with monobehaviours anyway

#

so that one would likely work fine

#

(you create authoring components that convert gameobjects into entities, because there's no real editor for setting up ECS entities directly)

valid haven
#

ya that much I understood. Having not played with it much I am just uncertain how much pain I am in for so was hoping to dip the toe in first ๐Ÿ™‚

wet epoch
#

if it's just to do an expensive job in an existing game, you can still use a burst job

steady blaze
#

it runs now in editor too, but still an error (although drawing the mesh): InvalidOperationException: The native container may not be deallocated on a job. Use [DeallocateOnJobCompletionAttribute] to deallocate a native container safely on job completion.

#

I don't see, where I can add this anymore (see code above)

deft stump
#

the more this kind of conversation of "can I mix ECS with Mono" the more I want Unity to just make an entirely new engine in a new exe file in a new GUI

wet epoch
#

@steady blaze only dispose the collections that you're creating within the job inside the job

steady blaze
#

i need vertices, triangles and uvs after the job

wet epoch
#

you have points.Dispose(); in your job

deft stump
#

Don't dipose stuff inside the job.

#

dispose it outside the job

wet epoch
#

(except the ones you create inside the job)

steady blaze
#

so dispose at the end of execute, the vList, yBuffer and zBuffer?

wet epoch
#

yeah, not voxelweight or points

#

possibly vertexbuffer too.. not sure what that is

valid haven
#

well I guess my first step will be to see how hard it is to convert this Unity Ability System PrototypeProject into DOTs

#

any idea how difficult this will be?

steady blaze
#

no, that just creates more errors

wet epoch
#

considering there's no animator or particles.. about 12/10

#

@steady blaze dispose them outside

valid haven
#

leck - was that 12/10 to me? lol that seems a bit hard ๐Ÿ™‚

wet epoch
#

it would have to be hybrid really

#

unless you want to make your own particle/animation system

valid haven
#

I thought we just said hybrid is a no-go?

wet epoch
#

it's a mess, yeah

valid haven
#

and if you cannot do animations or particles in an ECS project then it seems ECS would be pretty worthless for creating a game at the moment...

wet epoch
#

so basically.. i wouldn't even try to make a game like that in dots

#

particles aren't too bad.. you can just spawn it and forget it

valid haven
#

well that is a bummer. There is a havok feature I really want to exploit.

wet epoch
#

but if you need a gameobject (or multiple) to update every enemy.. you're unlikely to get much benefit from it

steady blaze
#

ok, from outside the job, assigning new nativecontainers it seems it has to be TempJob at least

valid haven
#

I dont really care about that. I want to be able to leverege havok's double percision physics for a larger world without the nonsense.

wet epoch
#

i think there's a lot of capsules in dots games atm

steady blaze
#

the problem is, it does not tell me, which nativecontainer causes: InvalidOperationException: The native container may not be deallocated on a job. Use [DeallocateOnJobCompletionAttribute] to deallocate a native container safely on job completion.

#

ah, I have an idea

wet epoch
#

@valid haven well i guess you could try.. just install entities and havok, and add 'converttoentity' components to your stuff

#

but then you won't be able to do like Physics.Raycast, you'll have to interact with the ECS phyiscs stuff

valid haven
#

hmmm ill play with it and see I guess.

steady blaze
#

hm, no made everything only worth

#

code is now like this, the method to create, schedule and complete job ```
NativeList<Vector3> jVertices = new NativeList<Vector3>(Allocator.Persistent);
NativeList<int> jTriangles = new NativeList<int>(Allocator.Persistent);
NativeList<Vector2> jUVs = new NativeList<Vector2>(Allocator.Persistent);
var terraGen = new TerrainGenerationJob()
{
areaSize = areaSize,
isoLevel = isoLevel,
voxelWeight = new NativeArray<float>(voxelWeight, Allocator.TempJob),
points = points.ToNativeArray(Allocator.TempJob),
vertices = jVertices,
triangles = jTriangles,
uvs = jUVs
};
var jobHandle = terraGen.Schedule();
jobHandle.Complete();

mesh.vertices = jVertices.ToArray();
mesh.uv = jUVs.ToArray();
mesh.triangles = jTriangles.ToArray();
mesh.RecalculateNormals();
meshFilter.mesh = mesh;
meshCollider.sharedMesh = mesh;

jVertices.Clear();
jTriangles.Clear();
jUVs.Clear();

jVertices.Dispose();
jTriangles.Dispose();
jUVs.Dispose();```

#

Job itself: ```
public struct TerrainGenerationJob : IJob
{
// Input
public int3 areaSize;
public float isoLevel;
[DeallocateOnJobCompletion]
public NativeArray<float> voxelWeight;
[DeallocateOnJobCompletion]
public NativeArray<Vector3> points;

// Output
public NativeList<Vector3> vertices;
public NativeList<int> triangles;
public NativeList<Vector2> uvs;

public Vector3 interpolateVerts(int p1, int p2, float value0, float value1)
{
    float mu = 0.5f;
    mu = (isoLevel - value0) / (value1 - value0);
    return Vector3.Lerp(points[p1], points[p2], mu);
}

public void Execute ()
{
    int areaSizeXY = areaSize.x * areaSize.y;
    Vector3 newVert;
    NativeArray<int> vlist = new NativeArray<int>(12, Allocator.Temp);
    Utils.VertexBuffer lastXBuffer = new Utils.VertexBuffer(-1);
    NativeList<Utils.VertexBuffer> yBuffer = new NativeList<Utils.VertexBuffer>(Allocator.Temp);
    NativeList<Utils.VertexBuffer> zBuffer = new NativeList<Utils.VertexBuffer>(Allocator.Temp);

    // 271 lines of calculations
    
    vlist.Dispose();
    yBuffer.Dispose();
    zBuffer.Dispose();

    voxelWeight.Dispose();
    points.Dispose();
} 

}```

#

(moved the VertexBuffer back to Utils, as that does not change anything)

zenith wyvern
#

You're posting way too much stuff with no context. Simplify your problem.

#

If you can't figure it out from all that then create a smaller example

steady blaze
#

it now runs, draws the geometry, but still throws this error: InvalidOperationException: The native container may not be deallocated on a job.

#

Use [DeallocateOnJobCompletionAttribute] to deallocate a native container safely on job completion.

#

but there is nothing left for [DeallocateOnJobCompletion]

#

smaller examples work, but not the real interesting code - i mean, it works now, but not 100%

zenith wyvern
#

Also I don't think you should be disposing containers in a job

steady blaze
#

better outside then? all of them? somewhere i read, Allocator.Temp does not need a dispose? is this nonsense?

zenith wyvern
#

Containers allocated with Temp will auto dispose, you don't need to call dispose on them

steady blaze
#

ok thank you, then i can remove those

#

Maybe you know what the [DeallocateOnJobCompletion] exactly does?

zenith wyvern
#

In Unity go to Jobs->Leak Detection->Full Stack Traces

#

It should give you a better idea what isn't being disposed

#

It does what it says, it disposes the container when the job finishes

steady blaze
#

ok, so i could remove that too, i guess

zenith wyvern
#

I don't really use it anymore since the behaviour is inconsistent with different containers. Calling container.Dispose(jobHandle) does the same thing but works with any container

steady blaze
#

ahh, that fixed it! great!

#

aha ok, so you dispose with jobHandle? the thing is: I want to change how the job is generated, scheduled and finished

first, it should generate, fill in and schedule in Update (when needed), then in every lateUpdate check if jobHandle.isCompleted and only then access the data and assign the mesh, so it does not wait for it.

#

@zenith wyvern Thank you very much!
Maybe can you tell me one or two another things about the Jobs?
With container.Dispose(jobHandle) what does it different than i.e. myJob.NativeContainer.Dispose() ?

#

and second: When calling:
if (jobHandle.isCompleted) is it guaranteed that the jobHandle is not null?

zenith wyvern
#

A JobHandle is a struct

#

When you pass in the job handle to dispose it will dispose the container automatically once the job finishes

#

The docs do a decent job of explaining how the native containers work

steady blaze
#

ah ok, so it is similar to: [DeallocateOnJobCompletion] ? so like some kind of autodispose, but defined outside. but not really sure how to use it, hopefully i will find out. ๐Ÿ˜‰

#

and it seems i need to set a bool (i.e. jobStarted) because (jobHandle.isCompleted) is true every frame, after the job has finished.

#

or can it be set to null maybe?

zenith wyvern
#

It's a struct, so no, it can't be set to null. I use a bool when I'm doing something like what you're doing

#

You could also use a nullable JobHandle ? handle if you really want

dull copper
#

Hmmm. They updated ecs sample repo yesterday to entities 0.14

#

Gotta wonder this logic

#

Previous time they even pushed update only for older entities than one had been out for a while

#

Wonder whats going there, in past they just updated samples to current dots packages right after drop

zenith wyvern
#

What would they have even added new to the samples for .14. I feel like it doesn't really have much new that could be shown in samples

dull copper
#

Didnt watch the commit content but even if there were some minor changes, it would be nice to just know that these are verifed against latest packages

#

I guess the example maintenance priority just dropped once Unity hid the dots packages

#

Would make sense anyway

zenith wyvern
#

That's a good thing I guess, more time to work on dots

wet epoch
#

if i just want to pass a float to read in a static function in a job, is it preferred to use in or ref or neither? (or it doesn't matter?)

#

if it tried to inline it, ref would be faster i imagine (because no copy would be needed)?

odd ridge
#

does anyone use entities and Sprite Renderer? when I try to use it, I get an error and it doesn't work

vale nymph
#

if i just want to pass a float to read in a static function in a job, is it preferred to use in or ref or neither? (or it doesn't matter?)
@wet epoch for just to read I believe in is the best way to go. ref marks it as changed. in is for readonly

wet epoch
#

k i'll use in.. makes more sense anyway, thanks

opaque ledge
#

i dont think Sprite Renderer is supported, you have to go with hybrid component

wet epoch
#

should work with hybrid renderer 0.8 preview 19 according to docs

shy pilot
#

that's the job

wet epoch
#

you getting an error?

shy pilot
#

the error comes when i try to use the randomArray to generate a number

#

on lines 43 and 60

#

all the way up until the job is scheduled the array has the content

#

and after that i can't use breakpoints cause of jobs

wet epoch
#

what error?

shy pilot
#

Index out of range, or the native equivalent of it

#

i'll grab it now

#

IndexOutOfRangeException: Index 0 is out of range of '0' Length.

#

oh, thats interesting

#

its happening on line 44 now

#

hmm

wet epoch
#

that makes sense.. it's the first time it's used

#

but not sure why its length is 0

shy pilot
#

its used on line 43 though

#

the error is on line 44

#

hmm

wet epoch
#

genders[gender] out of range?

shy pilot
#

possibly

#

if i turn use jobs threads off in the editor will breakpoints be hit?

wet epoch
#

i'm not sure.. if you turn off burst i guess it should at least?

shy pilot
#

burst was already off

#

i'm turning jobs threads off and i'll see what happens

wet epoch
#

if not, .Run instead of schedule might let you

shy pilot
#

yeah

#

thanks

#

i'll get back to you in a moment

wet epoch
#

you could just check species before starting the job too

#

not sure if you can assert in jobs?

shy pilot
#

yep turning jobs off worked

#

i am an idiot ๐Ÿ˜†

#

i forgot to add a for loop elsewhere

#

thanks for the help lecks ๐Ÿ˜†

deft stump
#

does anyone use entities and Sprite Renderer? when I try to use it, I get an error and it doesn't work
@odd ridge There's no conversion from mono sprite renderer to ecs sprite render. (unless yu're going project tiny, which I don't know)
You have to go hybrid on this one

wet epoch
#

np

odd ridge
#

@deft stump what do you mean by I have to go hybrid? I also have the hybrid renderer package

dull copper
#

@odd ridge if something isn't supported by dots, you can make "hybrid" approach where you use ECS for things that are supported and use the old monobehaviour rendering for parts that are not supported

#

or whatever functionality you need from the "old" unity

#

meaning in this case, you'd have to sync the entities to gameobjects to move the gameobject based sprites

odd ridge
#

thanks

#

how do I change the framerate of a system? say if I want my system to run at exactly 60fps

deft stump
#

@odd ridge I don't think you can artificially reduce the speed of a system

#

Unless there's a FixedUpdate() equivalent that I don't know of

rancid geode
#

@odd ridge you can take a look on how the FixedStepSimulationGroup updates, btw it runs at exactly 60fps by default

#

there is a utility function that you apply to a group to do that, just don't remember the exact name

steady blaze
#

hm, there is almost no difference in drawing the meshes in regular code than to Jobs.
I tested it, without Jobs and 4096 meshes it is about 9.8 seconds, with jobs about 9.3 seconds from start. Maybe most takes generation of Game Objects from Prefabs and noise-calculation.
But anyway I wonder, i though when starting 4096 IJobs that it would speed up things a little more.

hollow sorrel
#

use profiler to know what is taking longest

#

using burst on mesh generation should be big speedup

zenith wyvern
#

Scheduling 4k jobs doesn't sound right

#

That's going to be pretty slow

steady blaze
#

but ok, it is without burst, don't really know the restrictions of burst. someone said that using another struct (or list of structs) inside execute is the problem.
could use int4 instead, but then I have to assign the values manually each time.

#

it's just for testing performance difference

zenith wyvern
#

Like Scorr said if you really want to test it you should be profiling properly so you actually know what's taking the time instead of just guessing

steady blaze
#

normally it should be like 125 at start of app and then depending on player movement, most times i guess it will recreate about 25 new meshes, when moving over a border

#

can i find what is exactly allowed with burstcompile and what not somewhere?

safe lintel
#

see the burst docs

steady blaze
#

oh, damn can't use int4, as i would need an int5, lol

stone osprey
#

Is there already a way to get all newly created entities since the last frame ?

safe lintel
#

dont think so, would be kind of neat if there was

zenith wyvern
#

If you create them in a separate world then you can get them all in a list with MoveEntitiesFrom

stone osprey
#

Damn... thanks, last time i checked people told me to use state components, which worked... but those mostly require some sort of initial component to work...

amber flicker
#

faster and less effort to create them with a tag?

stone osprey
#

No i actually create them in the same world ^^

hollow sorrel
#

@stone osprey entitymanager.getcreatedanddestroyedentities

stone osprey
#

@hollow sorrel Ahhh... that sounds awesome ๐Ÿ˜„

hollow sorrel
#

@steady blaze structs are fine in burst, but yea you should really profile and check why even without burst its so slow

#

if you try to optimize without profiling youre just gambling

stone osprey
#

Hmmm... can anyone find the documentation of "GetCreatedAndDestroyedEntities" ?

amber flicker
#

plus all the usual things - safeties disabled if profiling, make sure burst has synchronous compilation enabled, don't think you'll be doing anything fast if you're converting at runtime etc @steady blaze

stone osprey
#

Probably im blind, but i cant find any documentation of this method

hollow sorrel
stone osprey
#

Thanks, i probably looked at the wrong version ๐Ÿ™‚

#

Interessting... so you need to pass in a list of ints ?

#

Anyone used that method before ? Could need some help

zenith wyvern
#

I'm not sure but I think it's just saying you should start with an empty NativeList<int> and then make sure to use the same list for any subsequent calls to that function

stone osprey
#

@zenith wyvern Thanks, im gonna give that a try ๐Ÿ™‚

hollow sorrel
#

yea you have to keep track of state yourself, its not so much a 'created since last frame' but more of a diff list that comes down to same result

#

not sure how well it scales at high entity counts, dunno how they implemented it

amber flicker
#

... Is this really easier than just adding a tag to an archetype of the entities you're instantiating I wonder..

stone osprey
#

@amber flicker Not really... i already attach a "Identity" component to each archetype... but in case that someone forgets that one its probably cool to have an solution tracking all entities regardless of that tag

amber flicker
#

how will you know you're not accidentally processing some of their entities they're creating that they don't want you to touch? I'd handle it in conversion - don't rely on them adding a particular component, ensure that if your component is on there, on conversion it also adds the tag.

steady blaze
#

hm, it seems all is running on the same worker.

#

maybe i need another approach: instead of starting the same Job from each of the GOs when marked as "dirty", would it be better to use an IJobParallelFor from a parent object?

#

or will this be useless?

stone osprey
#

@amber flicker Thats also a good idea ๐Ÿ™‚ quick question... when does an entity query update ? Does it already update if we modify a entity... or at the end/start of the frame ?

amber flicker
#

the idea is the query itself doesn't ever update. When your job starts (e.g. OnUpdate) all entities are gathered into NativeArrays and that's what the .ForEach iterates over - I can recommend writing some IJobChunk's to better understasnd how it works under the hood

#

you will get a warning/error if you modify an array inside a lambda as you'd be invalidating the array created at the start of the job

#

to get around that, if you understand what you're doing you can e.g. allocate a temp array of the query results and iterate them

pliant pike
#

I don't suppose anyone knows if there's a way when using an entityquery of getting a specific one of those components when I already have the entity?

tight blade
#

or you can do raw pointer access if youre a mad lad

amber flicker
#

@pliant pike you'll have to iterate over them one way or another.. i.e. a ForEach

pliant pike
#

yeah that's what I figured

#

there's no point in using an enities.foreach then

tight blade
#

thats not the case in ITriggerJobForEach though

#

theres a mapping from entitiy to component you can get for that

#

let me look that up...

#

jesus, why is this so hard to find

pliant pike
#

don't worry about it I'm going to use either Ijob or Ijobparrallelfor and get the entityquery and iterate through it, that should be way easier

#

thanks for trying though

tight blade
#

no im finding this

#

its not about you anymore, Calabi ๐Ÿ˜‚

#

found it in a commit of mine

#

GetComponentDataFromEntity<MyComp>()[entityId]
gets your component

pliant pike
#

ok thanks for that, I think GetComponent is the same as GetComponentdatafromentity though

tight blade
#

huh, I would imagine GetComponent is using the entity manager though and therefor would be unusable in a job

#

I think the latter is allocating space for a reverse lookup on all of them

amber flicker
#

no, it's just masking a call to CDFE

pliant pike
#

it worked fine for me, I think it gets autoconverted

tight blade
#

oh, well

#

thats dumb.

pliant pike
#

yeah no worries thanks for the help, its probably better if I do it all manually anyway

amber flicker
#

oh @pliant pike you edited your question ๐Ÿ™‚ - can't you just use CDFE?

#

or GetComponent as Gearless says

tight blade
#

its always better to do it manually. Entities.ForEach is almost always the worst choice IMO. I only use that when Im trying to explicitly communicate how not involved the system is

pliant pike
#

I did use CDFE(ie GetComponent) I just get nativearray errors

#

and its I'm guessing it being random memory access its probably not the most efficient when I want to do it with a ton of entities

amber flicker
#

Gotta disagree - lambdas are great for most things. @pliant pike try and show some code with a specific error if you can - conceptually it should be fine.

#

One thing I can think of is you need to make sure you don't have the same component type as in or ref

tight blade
#

lambdas are great when they arent rewritten under the hood. lambdas are grat because they are simple, but these arent true lambdas

pliant pike
#
Entities.WithAll<TestObjectAuthoring>().ForEach((Entity inty) =>
        {            
            if (dudents.Length <= 0)
                return;      
 
            for (int i = 0; i < dudents.Length; i++)
            {
                var otherdude = GetComponent<Translation>(dudents[i]);
                var currentdude = GetComponent<Translation>(inty);
                var currdistance = math.distance(currentdude.Value, otherdude.Value);            
                if (currdistance < 1)
                {
                    //Debug.Log("The object is too damn close");
                }
 
            }
        }).Run();```
tight blade
#

theyre macros

pliant pike
#

that's the test job, if I try to run that using schedule or sheduleparallel I get nativearray errors

tight blade
#

lambdas are ๐Ÿ‘ , macros are ๐Ÿ‘Ž

#

at least the current ecs macros are.

amber flicker
#

what exact error? I'm guessing you need to add .WithReadOnly(dudents) to your lambda maybe

pliant pike
#

I tried that it didn't work

#

I feel like the error must be the two GetComponents clashing somehow maybe

zenith wyvern
#

What's the error

pliant pike
#

InvalidOperationException: The previously scheduled job EnvironmentCollisionDetection:<>c__DisplayClass_OnUpdate_LambdaJob0 reads from the Unity.Collections.NativeArray`1[Unity.Entities.Entity] <>c__DisplayClass_OnUpdate_LambdaJob0.JobData.dudents. You must call JobHandle.Complete() on the job EnvironmentCollisionDetection:<>c__DisplayClass_OnUpdate_LambdaJob0, before you can deallocate the Unity.Collections.NativeArray`1[Unity.Entities.Entity] safely.

#

I get a 4 frames warning also

zenith wyvern
#

The code you posted is using Run so the error is from something else if it's a dependency problem

pliant pike
#

yeah the error is from using shedule

amber flicker
#

@pliant pike you're scheduling this job without depending on the EnvironmentCollisionDetection job I guess

pliant pike
#
 Entities.WithReadOnly(dudents).WithAll<TestObjectAuthoring>().ForEach((Entity inty) =>
        {         
            if (dudents.Length <= 0)
                return;          
            for (int i = 0; i < dudents.Length; i++)
            {
                var toppy = GetComponent<Translation>(dudents[i]);
                var currentdude = GetComponent<Translation>(inty);
                
                var currdistance = math.distance(currentdude.Value, toppy.Value);               
                if (currdistance < 1)
                {
                    //Debug.Log("The distance is too damn close");

                }
            }            

        }).Schedule();```
zenith wyvern
#

You're passing a native array around so you need to manually manage the job handles

#

Unity won't do it for you if you're passing in a collection

amber flicker
#

Dependency = Entities...... ).Schedule(Dependency); - for both this and the other job. If they're in different systems you'll also have to get the dependency from the other system

pliant pike
#

that's the only single job though

zenith wyvern
#

I think it's from disposing your container

pliant pike
#

there's no other systems that this depends on or anything

zenith wyvern
#

Complete your Dependency property before you dispose

#

Or pass it into dispose

pliant pike
#

the whole system is just called EnvironmentCollisionDetection : Systembase

zenith wyvern
#

before you can deallocate the Unity.Collections.NativeArray1[Unity.Entities.Entity] safely.`

#

That's the important part

pliant pike
#

if I use tempjob allocator I don't need to manually dispose do I?

zenith wyvern
#

If a job uses a container, Unity needs to know that job is finished before it can safely dispose it. Meaning you need to call JobHandle.Complete or pass in the jobhandle to the container's Dispose method

#

Whether it's tempjob or persistent

pliant pike
#

but If I don't manually dispose then when closing the program I get a different error A Native Collection has not been disposed, resulting in a memory leak. Allocated from: Unity.Collections.NativeArray`1:.ctor(Int32, Allocator, NativeArrayOptions)

zenith wyvern
#

Yes like I said you need to dispose it you just need to make sure Unity knows the job is complete before you do

amber flicker
pliant pike
#

I remembered leahS

zenith wyvern
#

Show the code where you dispose your container

rancid geode
#

if I use tempjob allocator I don't need to manually dispose do I?
@pliant pike if you use Temp you don't need, TempJob you do need

pliant pike
#
        trundles.Dispose();```
#

that's all I do after the job and I still get the errors

zenith wyvern
#

Now just change it to dudents.Dispose(Dependency);

pliant pike
#

HOLY SMOKE !! that worked leahPOG

#

your a genius, thanks @zenith wyvern

amber flicker
#

Do you need any help understanding what's going on @pliant pike ? Or does it make sense now?

pliant pike
#

I think I understand it(maybe not) leahS I just haven't seen it done like or needing that before

zenith wyvern
#
var container = new NativeArray<Entity>();
var job = new JobUsingContainer { Container = container }.Schedule();
container.Dispose(); // <- Dependency error. We're disposing the container before unity knows the job is complete
#

That's a condensed version of what was happening

#

Hopefully that makes a little more sense

#

If I passed in the handle to that dispose, then it would work

pliant pike
#

so Dependency is just a catch all sort of thing

zenith wyvern
#

It's just a job handle

#

SystemBase assigns system jobs to that job handle internally when you schedule them, unless you manually manage the job handles yourself

pliant pike
#

yeah I'm aware of how to do the dependecies manually and use the jobhandles etc

#

to be honest I thought it was all mostly automatic now

zenith wyvern
#

It is until you start using native containers

#

That's why I usually use dynamic buffers if I can get away with it. Then unity will do it all automatically

pliant pike
#

I see, I'll try and remember that, thanks

steady blaze
#

It seems my problem is that all IJobs get scheduled to just 1 worker.

#

The idea was to start one copy of the job from each instance of the GO, when marked dirty.

#

Could it help to use one IJobParallelFor called from a parent GO

#

Anyone an idea? ๐Ÿ’ก

#

Donโ€™t want to try it, if it wonโ€™t help anyway.

pliant pike
#

IJob is only single threaded

steady blaze
#

also more of them?

#

i think, it would be already fast enough to work without jobs, then maybe 1 or 2 dropped frames, when it needs to recreate scenery.

#

Of course nicer with

stone osprey
#

I have that strange problem again... i wrote a system and it does not show up, it wont get updated, even if i put [AlwaysUpdate] above it ๐Ÿ˜ฎ

#

This drives me crazy... any ideas ?

steady blaze
#

So it should help, if a change the pattern to have a NativeList of dirtyAreas in the parent object and then schedule 1 iJobParallelFor for them?

#

Hm, ok, guess I have to try. Need to set all properties needed for the job to public then, I guess.

#

But how to call results in the children-GOs?

steady blaze
#

Maybe I should concentrate on other aspects for now and try to do a better job system later.
on the other side I would like to get rid of unused code soon.

stone osprey
#

What could be an reason that my system does not show up and does not get executed ?

tight blade
#

@stone osprey
possibility 1 - your query isnt getting any hits:
check the entities debugger, there should be an option that says "show inactive systems" then you should be able to find your system in the list and it will show you which entities are caught by the query, which in your case will be none

steady blaze
#

hm, on the other hand, when i just ensure somehow that it does not generate more then one mesh per frame, i should not need the jobs for mesh-generation, maybe for noise-generation

steady blaze
#

also i think it is a bit odd, that if you schedule multiple instances of the same the job, they will all run on the same worker thread.

hollow sorrel
#

that sounds pretty odd

#

how are you scheduling them

steady blaze
#

@hollow sorrel in Update, i check if the Area (isDirty) and then initialise and schedule the job for each area GO

hollow sorrel
#

i mean

#

can we see some code

steady blaze
#

in lateUpdate i ask: if (jobStarted && terraGenJobHandle.IsCompleted)

hollow sorrel
#

like are you scheduling them with a dependency on eachother

steady blaze
#

they get started from each instance that needs to be drawn

hollow sorrel
#

are you combining them all to one jobhandle

steady blaze
#

don't think so

#

55 lines ok here?

#
    {
        if (isDirty)
        {
            startTime = Time.realtimeSinceStartup;
            if (Utils.useJobs)
            {
                DrawCubesJob();
            } else
            {
                DrawCubes();
            };
            
            isDirty = false;
        }
    }

    void DrawCubesJob()
    {
        terraGenJob = new TerrainGenerationJob()
        {
            areaSize = areaSize,
            isoLevel = isoLevel,
            voxelWeight = new NativeArray<float>(voxelWeight, Allocator.TempJob),
            points = points.ToNativeArray(Allocator.TempJob),
            vertices = jVertices,
            triangles = jTriangles,
            uvs = jUVs
        };
        terraGenJobHandle = terraGenJob.Schedule();
        jobStarted = true;
    }

    private void LateUpdate()
    {
        if (jobStarted && terraGenJobHandle.IsCompleted)
        {
            terraGenJobHandle.Complete();
            mesh.SetVertices(jVertices.ToArray());
            mesh.uv = jUVs.ToArray();
            mesh.triangles = jTriangles.ToArray();
            mesh.RecalculateNormals();

            meshFilter.mesh = mesh;
            meshCollider.sharedMesh = mesh;

            jVertices.Clear();
            jTriangles.Clear();
            jUVs.Clear();

            jobStarted = false;
        }
    }```
hollow sorrel
steady blaze
#

to late ๐Ÿ˜œ

#

oops, forget the debug-stuff

hollow sorrel
#

so you got multiple monobehaviours all starting seperate terragen jobs?

#

and they run on same thread?

steady blaze
#

yep

hollow sorrel
#

that looks like there's only 1 job running

steady blaze
#

strange, they are called from 125 different GOs

#

all the same class, but instances

hollow sorrel
#

unless unity profiler is just combining them or something

#

can you debug.log JobsUtility.JobWorkerCount? prob not the issue since other worker threads show up but just in case

steady blaze
#

where to put that code best? in some other object's update or lateupdate?

hollow sorrel
#

just in start

#

just to check if jobs system knows it can use all workers

steady blaze
#

ah ok

hollow sorrel
#

also gotta go for now sry lemme know how it goes

steady blaze
#

JobsWorkerCount: 7

#

oh ok. personally i have now idea, except to call an IJobParallelFor in the parent object and put all "dirty" Areas in a NativeList, but then I don't really know how the area-object can find out, when its index is done and access the resulting data.

#

i will work on other stuff meanwhile: next step: pooling the areas, depending on players position in the world.

#

ah - i think i just have to set a reference from the mesh to the NativeContainers before scheduling the job, then it should update it automatically

#

no? still have to set vertices & triangles when index is done โ€ฆ hmm

slim nebula
#
                var newWorld = new World("My New World");
                var entityManager = newWorld.EntityManager;
                newWorld.GetOrCreateSystem<MuhSystem>();
                // ... do what u want

                var playerLoop = PlayerLoop.GetCurrentPlayerLoop();
                ScriptBehaviourUpdateOrder.AddWorldToPlayerLoop(newWorld, ref playerLoop);

                if (ScriptBehaviourUpdateOrder.IsWorldInCurrentPlayerLoop(newWorld))
                {
                    Debug.LogError("yes");
                }
                else
                {
                    Debug.LogError("no");
                }```
#

hey guys, this code is outputting "no"

#

what is the correct player loop object to pass to AddWorldToPlayerLoop?

stone osprey
#

Is there a limit of how much a buffer can "buffer" ?

low tangle
#

hm thats a new method

#

AddWorldToPlayerLoop

slim nebula
#

is that not the right way to enable "normal" processing of a world?

#

if not, then how?

#
    [DisableAutoCreation]
    public class MuhSystem : ComponentSystem
    {
        protected override void OnUpdate()
        {
            Debug.LogError("boop");
        }
    }```
low tangle
#

it might be, I'm a few versions out of date

slim nebula
#

ah

#

I'm not seeing the debug message in muhsystem

#

I want this system to run in my new world

#

not sure what I'm doing wrong ๐Ÿ˜ฆ

#

or do you know how I can cause a world to process one step/frame/tick manually?

low tangle
slim nebula
#

thanks. I can do that for now in a system I guess until I figure the playerloop thing out

low tangle
#

all my other worlds is done from a singleton monobehaviour because the system setup threw some false memory leak messages before

slim nebula
#

yeah I've seen those :S

#

mostly been ignoring them

#

def not my code. hopefully they will fix

#

not sure if this is the same thing

#

w/e

#

I just realized my system isn't showing up in the entity debugger...

#
                var newWorld = new World("My New World");
                var entityManager = newWorld.EntityManager;
                newWorld.GetOrCreateSystem<MuhSystem>();
                newWorld.SetTime(new Unity.Core.TimeData(1.0 / 60.0, 1.0f / 60.0f));
                newWorld.Update();
#

am I missing something?

#

(sorry, cat stepped on macro keys)

tight blade
#

MAXO!

#

MAXO!!

slim nebula
#

๐Ÿ˜ฎ

tawdry tree
#

MUH SYSTEM ๐Ÿคฃ

slim nebula
#

dont laugh at me XD

#

help me!

#

haha

tight blade
#

oh I get those confused sometimes

slim nebula
#

๐Ÿ˜ฆ

tawdry tree
#

If you looks at the docs for timedata, one is the step and the other is the absolute time, so if this is in a loop of some kind, it should increment the absolute time

slim nebula
#

it's not. it runs exactly once

#

I'm just testing the setup I guess

tawdry tree
#

So the system is never ran?

slim nebula
#

Im expecting newWorld.Update(); to run the system

#

is that not how it works?

stone osprey
#

Sooo... how exactly do queries work ? When i log entities of my query every frame i actually see that there some entities in it... when i pass it to my command buffer for adding a component to them at the start of the next frame, it never happens. I assume that the command buffer uses the updated query and meanwhile something happened to my entities ?

tawdry tree
#

Update should indeed run any and all systems in that world.

slim nebula
#

๐Ÿ˜ฆ

tawdry tree
#

@stone osprey What kind of query? If you make an EntityQueryDesc and save it, you should be able to "reuse" the query.
An EntityQuery, however, is to the best of my knowledge one insatnce of the results of an actual query

slim nebula
#

I tried this and it still doesn't update

                var newWorld = new World("My New World");
                var entityManager = newWorld.EntityManager;
                newWorld.GetOrCreateSystem<MuhSystem>();
                newWorld.SetTime(new Unity.Core.TimeData(1.0 / 60.0, 1.0f / 60.0f));
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();
                newWorld.Update();```
tawdry tree
#

Settime needs to chaneg between each update

#

Pretty sure

stone osprey
#

I can resuse the query... the problem here is the following : "Get query entities, there multiple entities in it, pass that query to a command buffer -> command buffer ignores those because they dont fit to the query anymore"... is there some solution ? The problem here is that the ecb gets called at the start of the next frame and then... the entities changed and dont fit into the query anymore

tawdry tree
#

@slim nebula try this?

const float tickLength = 1f/ 60;
var currentTime = 0;
void DoTick(){
  newWorld.SetTime(new Unity.Core.TimeData(1f, currentTime));
  newWorld.Update();
  currentTime += tickLength;
}
DoTick();
DoTick();
slim nebula
#

yes. once I restart unity

#

TIL not to use while (true)

#

thanks for taking the time to help me

#

(unity still starting)

tawdry tree
#

Oof, yeah while loops can be harsh

#

I pretty much always add a safeguard, even if I think the loop should always have an exit.

var maxIterations = 1000;
var iterationsRan = 0;
while(iterationsRan < maxIterations){
  //stuff
  iterationsRan++;
}
slim nebula
#

ok I tried cs double totalTime = 0; for (int i = 0; i < 2; ++i) { totalTime += 1.0 / 60.0; newWorld.SetTime(new Unity.Core.TimeData(totalTime, 1.0f / 60.0f)); newWorld.Update(); }
but now im tryin urs

#

no I'm still not seeing by debug.errorlog message in the console

tawdry tree
#

That is functionally more or less the same. Pretty sure it should run the system at the first Update(); though, the second was just to be sure

slim nebula
#
    [DisableAutoCreation]
    public class MuhSystem : ComponentSystem
    {
        protected override void OnUpdate()
        {
            Debug.LogError("boop");
        }
    }```
tawdry tree
#

beep boop ๐Ÿค–

slim nebula
#

I dunno. what else can I do?

#

what could be causing this?

#

๐Ÿ˜ฆ

tawdry tree
#

Dunno.
@low tangle (who's DND) seems to have experience with this

#

Out of curiosity, does it work if you capture the reference to the system and Update() that directly?

low tangle
#

yes

slim nebula
#

yes

#

hello june

#

I"m trying to make a world and run a system in it

#

I"m not sure what's going wrong

#

it's a very small amount of code

#

not sure if you might be able to help

tawdry tree
slim nebula
#

it looks like if there's no query, it just skips Update()

low tangle
#

calling update on the world updates all systems in it

tawdry tree
#

Oh yeah, it could be some kinda culling causing it to not run...?

#

The part about custom bootstrap and creating worlds that way does sound potentially relevant, though (ref docs)

low tangle
#

`[DisableAutoCreation] โ€” prevents the system from being created during default world initialization. You must explicitly create and update the system. However, you can add a system with this tag to a ComponentSystemGroupโ€™s update list, and it will then be automatically updated just like the other systems in that list.

`

#

disable auto create disables update as well, unless you attach it to a group

slim nebula
#

how do I attach it to a group? how do I create a group? @low tangle

#

or should I go look that up sorry

low tangle
#

groups are just systems

slim nebula
#

can I make my system a group then?

low tangle
#

create one in the world, then use the method to attach your other system to it

#

no

tawdry tree
#

Groups should have the ComponentSystemBase base class, shouldn't they?
Make a "system" of that class, add it as usual, use group.AddSystemToUpdateList(). The docs actually talk about this kinda thing a bit in the custom bootstrap part under the multiple worlds header - there's also a section on system groups as well.

slim nebula
#

ok but. I dont want this group in my default world, so I would mark it as DisableAutoCreation too right?

#

is that going to cause a problem?

low tangle
#

no

slim nebula
#

ok this is what I got now

#

uh

#

it's not workin

#

I dont see my group or my system in the entity debugger

stone osprey
#

Anyone know how performant this here is ? I cant simply pass the query, because those entities change till its used in the ecb

slim nebula
#

I see my entity tho

stone osprey
#

Any ideas on the code above ? Could this cause significant lag with large amounts ( 200 ) entities ?

tawdry tree
#

Try. Profile it.
Always profile first. If, and only if you find it to be performing poorly should you worry about perf.

#

That or do the lazy route and just add a comment that it is a likely spot to be able to optimize, then forget about it until you potentialyl need to optimize things later.

#

I favor the latter, because it leads to faster development time and at least to me, less worry about the code because you're trying to go past "decent" or "good", and reach for the far off "great" and "perfect" (the latter of which is an oxymoron - the best code is no code, because only with no code can there be no perf impact, no running costs, and no bugs)

stone osprey
#

Alright, thanks ๐Ÿ™‚ I thought it caused my lag spikes... actually some monobehaviours are causing them... good to know that the manual ecb stuff isnt that bad either

tawdry tree
#

I mean, you don't want to do stuff like that all over the place, but in one system, affecting 200 entities of presumably a few archetypes? Should be just fine

steady blaze
#

anyone knows, if it is possible to find out, which index of an IJobParallelFor isFinished?

tawdry tree
#

So.. you want to find out, during the runtime which iterations have finished?

steady blaze
#

yes

tawdry tree
#

That sounds... really sketchy. The whole thing, sure, but individual sub-jobs?
Why do you want this?

steady blaze
#

if not possible, then not possible, but it would be nicer if each object updates when it's calculations are finished, also it should be safe.

tawdry tree
#

If you want each individual iteration to do work separately and then update something, it sounds like you want individual jobs for each of them

steady blaze
#

the thing is: i tried to start multiple instances of a regular IJob from multiple instances of a MonoBehaviour and they all seem to Execute on the same worker thread.

tawdry tree
#

That sounds like a problem in how you run the jobs

steady blaze
#

i posted the code for scheduling and finishing a few hours ago

#

should i repost?

tawdry tree
#

I have not seen it, so sure

steady blaze
#
    void Update()
    {
        if (isDirty)
        {
            startTime = Time.realtimeSinceStartup;
            if (Utils.useJobs)
            {
                DrawCubesJob();
            } else
            {
                DrawCubes();
            };
            
            isDirty = false;
        }
    }

    void DrawCubesJob()
    {
        terraGenJob = new TerrainGenerationJob()
        {
            areaSize = voxelSize,
            isoLevel = isoLevel,
            voxelWeight = new NativeArray<float>(voxelWeight, Allocator.TempJob),
            points = points.ToNativeArray(Allocator.TempJob),
            vertices = jVertices,
            triangles = jTriangles,
            uvs = jUVs
        };
        terraGenJobHandle = terraGenJob.Schedule();
        jobStarted = true;
    }

    private void LateUpdate()
    {
        if (jobStarted && terraGenJobHandle.IsCompleted)
        {
            terraGenJobHandle.Complete();
            mesh.SetVertices(jVertices.ToArray());
            mesh.uv = jUVs.ToArray();
            mesh.triangles = jTriangles.ToArray();
            mesh.RecalculateNormals();

            meshFilter.mesh = mesh;
            meshCollider.sharedMesh = mesh;

            jVertices.Clear();
            jTriangles.Clear();
            jUVs.Clear();

            jobStarted = false;
        }
    }```
tawdry tree
#

Write like this to get C# highlighting:
```cs
(stuff)
```
Also, you can simplify away jobStarted by checking terraGenJobHandle == null, depending on what you prefer.

#

The code seems correct, though, not sure why it's not using multiple worker threads - I would assume maybe some config

hollow sorrel
#

i don't think jobhandles can be null since they're structs

tawdry tree
#

Ah, of course

#

If they're structs then you need to check if they are default, but I think I would prefer a separate bool for it instead then.

steady blaze
#

forget it, i think i tried with the handle anyway

#

any idea, why they won't run in paralllel?

slim nebula
#

@low tangle (I hope you don't mind the ping. If so I will stop) what is the correct way to create the normal base system groups in a new world such that it will run the systems like the default world every frame?

steady blaze
#

yes, really seems to be some kind of config, as the noisegeneration IJobParallelFor can also be found in just one worker

tawdry tree
#

If the parallel job only does one, it's definitely config

#

Check the project settings, I seem to recall there being options about jobs

steady blaze
#

where to change it? ๐Ÿ˜€

shy pilot
#

is it possible to run a physX raycast from inside a job?

#

burst and jobs are two different things

#

jobs settings would be somewhere else

#

ohhhhh

steady blaze
#

i have no idea, where they can be found

shy pilot
#

if you look at the jobs tab

#

in the editor

#

up the top

#

is use jobs threads turned on?

steady blaze
#

where?

shy pilot
#

up the very top

slim nebula
#

woo I think I got it workin. thanks for the help guise

shy pilot
#

like the ugly white bar

#

if your on windows

steady blaze
#

i am on mac and sorry don't know what you mean. and unity 2019.4

shy pilot
#

atr the very very top of your screen

#

it might be yunder jobs

#

or dots

tawdry tree
#

@slim nebula If you want the second world to run parallel (same timestep, and when the default world runs)... You probably need a singleton monobehavior that (possibly) kicks of making the world, but most definitely grabs a reference to it and runs update... in its own Update()
something like

//In singleton monobehavior
World MuhWorld;

//Up to you for where to actually run this
void InitializeWorld(){
  MuhWorld = new World("Muh World");
  var systemGroup = MuhWorld.GetOrCreateSystem<MuhSystemGroup>();
  systemGroup.AddSystemToUpdateList(MuhSystem);
}

void Update(){
  var time = new TimeData(time.Deltatime, time.Time);
  MuWorld.SetTime(time); 
  MuhWorld.Update();
}
slim nebula
#

so there's a step missing

#

something needs to be done to add the group to the world update

tawdry tree
#

@steady blaze @shy pilot Might be a window that needs to be opened? Sounds like it's in a non-default window

slim nebula
#

that part is unclear

#

I was able to get around it like this

#
                var newWorld = new World("My New World");
                var initializationSystemGroup = newWorld.GetOrCreateSystem<InitializationSystemGroup>();
                var simulationSystemGroup = newWorld.GetOrCreateSystem<SimulationSystemGroup>();
                var presentationSystemGroup = newWorld.GetOrCreateSystem<PresentationSystemGroup>();
                ScriptBehaviourUpdateOrder.AddWorldToCurrentPlayerLoop(newWorld);```
#

AddWorldToCurrentPlayerLoop does the thing to add the groups to the world update

#

I'm not sure how to add custom groups to the world update

shy pilot
#

when my editor loads will send pic

slim nebula
#

but now I"m trying to load a subscene into a specific world. I'm not sure how to do that

tawdry tree
#

@slim nebula Well, if you can use the default groups, then that should make it easier. Just plop MuhSystem into SimulationSystemGroup or something

slim nebula
#

yup that's what I did

#

seems to be okay

steady blaze
#

damn, can not find job settings

#

@tawdry tree you have a screenshot?

tawdry tree
#

Nope, haven't opened unity in a couple weeks

shy pilot
#

that's what it looks like on windows

#

should be the same on mac

steady blaze
#

ah ok, that should be menu bar, but i only have burst there

shy pilot
#

hmm

tawdry tree
#

There's also a thing
JobsUtility.JobWorkerCount = someInt;

steady blaze
shy pilot
#

but the screenshot of the profiler implies that the threads are there

#

they just aren't being used

#

is the job in question ijobparallelfor?

steady blaze
#

i tried to Debug.Log(JobsUtility.JobWorkerCount) and it says 7

shy pilot
#

that's a lot less than i get

#

oh wait

#

i'm logging the max

tawdry tree
#

If you do JobsUtility.JobWorkerCount you're gonna want to grab the current computer's core count somehow (pretty sure you can use some default thing in the System.Threading namespace for that...), and set the count to core count-1, and clamped to something sane like no more than 8 worker cores ( beyond that you get diminishing returns and the scheduler becomes the bottleneck)

#

Seems like it already does something like that, hmm

#

What if you download the Jobs package? that should give you the menu element, I think

shy pilot
#

if he's able to make jobs then surely its already there

tawdry tree
#

No, you get the basic IJob at least built-in with no extra packages

shy pilot
#

oh ok, didn't know that

#

does anyone know if its possible to run a raycast with the GO physics engine from inside a job?

steady blaze
#

oh yes, it seems to activate it with the preview package, although i do not get the option in the menu and profiler is strange

tawdry tree
#

Highly doubt it, and even if you could, it sounds very unsafe

shy pilot
#

yeah

#

welp

tawdry tree
#

I do believe there are some kinda raycast job thingies, but they're scheduled from the main thread

shy pilot
#

yeah

#

i've read about them

#

i guess i'll have to do something janky like clone the collider onto an entity

#

and raycast using Unity Physics

north bay
#

Sooo did any package updates drop so far?

steady blaze
#

really strange - it shows no only idle in the workers and seems to be even slower

#

maybe i have to restart everything

slim nebula
#

wtf is this shit

#

some package is using a bootstrap so I can't in my code?

#

wtf

tawdry tree
#

That sounds... not so good
Are you using physics, by any chance?

#

Only Unity DOTS package I know of that uses a second world

north bay
#

I don't think physics uses another world, netcode does use a custom bootstrap

#

Physics stores it's colliders and data inside a collection called PhysicsWorld

tawdry tree
#

Oh, it's a fancy collection? I thought it was an actual world ๐Ÿ˜›

#

Well, I gotta get some sleep, good luck figuring it out

slim nebula
#

I am indeed using physics

#

so I have to modify the physics package code to get this working?

hollow sorrel
#

no

#

check find references to see what's implementing icustombootstrap

slim nebula
#

no references found. it's not in my code. therefore it must certainly be in package code right?

hollow sorrel
#

no unity packages that i know of use custom bootstrap

#

are you using netcode?

#

dunno about that one

slim nebula
#

yes

#

physics and netcode

steady blaze
hollow sorrel
#

@steady blaze what unity version are you using

steady blaze
#

2019.4f12

slim nebula
#

ah ok awesome thanks scorr

#

i dunno how you guys find this shit in the docs so quick. I do search online before I come here ๐Ÿ˜ฆ thanks!

hollow sorrel
#

i guess setting jobthreads from that dropdown is only in 2020+, but it shouldn't really matter because all it does is set jobsutility.workerthreads which you confirmed is already set to 7 at start

#

so guessing that's not the issue

#

dunno what else could be tho, seems really weird

steady blaze
#

really strange, as the job from NoiseGenerator is an IJobParallelFor and i tried different batch counts
maybe it some strange limitation that it does not start with multithreading before the 1st frame is drawn or something like that?

#

really weird as at least the noise-job should run on multiple workers i guess

slim nebula
#

how do I tell SceneSystem not to load a scene in my new world?

#

it seems to be loading entities from my main scene into there which I dont want

#

reeee if I load an empty scene on my other world, it loads the empty scene on the default world

#

whyyyyyyyyyyyyy

#

never mind im dum

#

yeah I dunno how to get my other world to not load the default scene

#

any ideas?

steady blaze
#

ok, maybe it is really some kind of limitation that before the rendering starts (or first frame is drawn or whatever) unity schedules all jobs to one worker.
because when i don't set isDirty to false it redraws the meshes every frame (which does not make sense of course and produces errors), but schedules the jobs to different workers.
(also i think i know why it looks like one long job in the profiler: each time a new job gets started, the following one gets slower, because on the same worker, so after all are started it may show only the longest one.)

So i will simply ignore that for now and move on to pooling the areas and then see what happens if the players triggers generation of new areas.

#

and then i will see if it works as intended (and faster)

#

btw. for burst compile on the terrainJob it gives this error: Unexpected exception Burst.Compiler.IL.CompilerException: Error while verifying module: Invalid bitcast { i32*, i32 } bitcast ([3 x i32] [i32 0, i32 3, i32 8] to { i32*, i32 })

shy pilot
#

is there something special i need to do to get a command buffer to playback after a ijobparallelfor?

shy pilot
#

for some reason it just doesn't execute the structural changes

#

i can't even spawn entities anymore

shy pilot
#

here's the code EDIT: One sec i just gotta clean up some stuff

#

if this works i may just give up on jobs for this task ๐Ÿ˜†

shy pilot
#

it doesn't seem to be

craggy orbit
#

anyone else getting index out of range errors with the new Entities and Physics update (0.16 and 0.5.1, respectively) when trying to raycast in a job? it worked fine before updating

shy pilot
#

Unity.Physics?

craggy orbit
#

yeah

shy pilot
#

umm, no but i will run into that problem soon by the sounds of it ๐Ÿ˜…

hollow sorrel
#

with the new Entities and Physics update (0.16 and 0.5.1, respectively) ๐Ÿ‘€

shy pilot
#

is anyone at all here using pure ecs?

hollow sorrel
#

@craggy orbit where did you find these updates? not showing up for me

craggy orbit
#

i thought they didn't have a pure ECS pipeline yet ๐Ÿค”

shy pilot
#

well

craggy orbit
#

you gotta click the dropdown in package manager and scroll up

hollow sorrel
#

oh wow

shy pilot
#

is this not the correct way to instantiate an entity with pure?

hollow sorrel
#

ty

craggy orbit
#

yeah

shy pilot
#
//Archetype
        //NOTE: Does not include state components
        EntityArchetype creatureArchetype = EntityManager.CreateArchetype(
            typeof(Translation), 
            typeof(Rotation),
            typeof(RenderMesh),
            typeof(RenderBounds),
            typeof(LocalToWorld),
            typeof(SectorEntityComponent),
            typeof(SpeciesIDComponent),
            typeof(HealthComponent),
            typeof(AgeComponent),
            typeof(NutritionComponent),
            typeof(ReproductionComponent)
        );```
#

and then instantiate with this:

#

Entity creature = EntityManager.CreateEntity(creatureArchetype);

craggy orbit
#

it's recommended to use gameobject-based prefabs. there's a lot of Hybrid Renderer components and it's hard to keep track of them all

shy pilot
#

when i do so the entity doesn't even spawn

#

like at all

#

nothing in the debugger

#

nothing anywhere ๐Ÿ˜†

craggy orbit
#

did you try debug logging the result entity? it might be created then instantly destroyed by another system

shy pilot
#

nope, its getting created

#

but has the entity.null attribute

#

according to my breakpoints

#

well, it has entity.null

#

i'm just gonna switch to hybrid

#

oh

#

my

#

aaaaaaaah

#

@craggy orbit your hunch was 100% accurate

#

_<

#

there was a half written system i'd forgotten about

deft stump
#

OH

#

there's an update

#

on entities?

zenith wyvern
#

Lies. Updates dont exist until I see Olento post the patch notes

deft stump
#

^^

#

we need patch notes

craggy orbit
#

yeah patch notes are only local for some reason

hollow sorrel
#

there's a ### Security section that's empty for some reason

zenith wyvern
#

"Root scene conversion" What the heck does that mean

hollow sorrel
#

maybe so you can treat your scene as a subscene instead of having a scene that's empty other than just holding subscenes if you go full dots

#

just guessing

zenith wyvern
#

Could be, in a Project Tiny post they were hinting at a better solution than the awkward subscenes-inside-scenes stuff you have to do now

deft stump
#

Add `IFixedRateManager` interface for fixed-timestep implementations.

ooooo... so we add this interface in the system and we get FixedUpdate() equivalent method implemented

shy pilot
#

has anyone here used mathematics.random?

#

i was under the impression that nextint when called more than once would like, return a unique value

craggy orbit
#

it does

#

if used in a job, you need to get it back out from the job and store it somewhere

zenith wyvern
#

Or provide a unique seed for every job

shy pilot
#

can you not run it more than once per job though?

#

i need to run it 10 or so times

#

from one job

#

doesn't .NextInt imply that you can run it repeatedly and get a new one

zenith wyvern
#

Yes. If I remember right you need to provide a large seed to get better variance early. I don't know much about RNG but that's what I was told

#

By large seed I mean just a bigger number

shy pilot
#

yeah

#

my seeds are generated from a system.random

craggy orbit
#

it's kinda weird but if you're accessing it from an array, you need to copy an instance and reassign that index of the array when you're done with it

shy pilot
#

uh

#

ok

#

๐Ÿ˜†

#

will try that

zenith wyvern
#

It's a struct so all the rules of a struct will apply for it

craggy orbit
#

so iirc you can't do like randomArray[index] multiple times and get different results. you have to do

Random randomAtIndex = randomArray[index];
//do whatever with randomAtIndex however many times
randomArray[index] = randomAtIndex;
shy pilot
#

thanks

dull copper
#

oh, physics got only minor bump on new packages ๐Ÿ™‚

#

also.. they DID land this week so that one staff comment of these landing at the week of 27th was correct after all :p

#

Lies. Updates dont exist until I see Olento post the patch notes
@zenith wyvern I just woke up ๐Ÿ˜„

#

also.. latest package manager on alphas/betas is just so broken

#

it doesn't even give "there's an update" for half the packages, even it can still list them

#

it's not even about some packages being verified or have full release and others not as none of the dots packages beyond burst and math have that ๐Ÿ˜„

#

so basically, collections, dots editor, entities, hybrid renderer, jobs and unity physics packages got bump from ones I have installed atm

#

platforms got a bump the other day and burst updated a while ago as well but not on this bump

#

oh wait... I think I got the package manager logic here, it ONLY shows the upgrade icon for packages that I've manually installed... if it's a dependency that's currently automatically handled, it doesn't show that icon

#

yeah, I guess that makes sense now that I realize that, but I'd rather see some other way to communicate to me if some package is actually installed by dependency in the first place...

#
## [0.11.0 DOTS Editor] - 2020-10-06
### Added
* Added a new backend for inspecting an `Entity`. It is used by default when installing the `com.unity.dots.editor` package, but it can be turned on and off through the `DOTS Editor` preferences menu.
* Entities window: Added autocompletion for component type when filtering entities with `c:...`

### Changed
* Systems window: Now shows a message when no system match the requested search
* Systems Window: Now shows an error message when failing to resolve a component type name when typing `c:mycomponent`
* Updated package `com.unity.entities` to `0.16.0-preview.21`
* Updated package `com.unity.jobs` to `0.7.0-preview.17`
* Updated package `com.unity.properties` to `1.5.0-preview`
* Updated package `com.unity.properties.ui` to `1.5.0-preview`
* Updated package `com.unity.serialization` to `1.5.0-preview`
* Updated package `com.unity.burst` to `1.3.7`

### Fixed
* Entities Window: Fixed an issue where the search filter would not be applied after changing the selected world
* Entities Window: Improved error handling when incrementally updating the view model, fixing native memory leaks
* Entities Window: Now properly unsubscribes to selection change event
* Entities Window: Fixed a null reference issue when selecting an entity
* Systems Window: Fixed an issue where the details section contents keep changing while searching
* Systems Window: Fixed an issue where searching returns the wrong results
* Systems Window: Fixed an issue where the details section can sometimes hide the selected system
* Systems Window: Fixed an issue where deselecting a component would remove the substring from the entire search string ```
#

wonder if they forgot to update the date or if they've had this update just sitting there waiting for next round of updates for a month

#
## [0.14.0 Collections] - 2020-09-24

### Added

* `*UnsafeBitArray.Find` with pos/count search range arguments.

### Changed

* `UnsafeStream` block allocation performance has been improved by ~16% by appending to the start of the per-thread block lists rather than the end.
* Burst package updated to `1.3.7`

### Removed

* `FixedList*.InsertRange`, `FixedList*.RemoveRangeSwapBack`, `FixedList*.RemoveRange`, `NativeString*`, `NativeList.RemoveRangeSwapBack`, `NativeList.RemoveRange`, `UnsafeList.RemoveRangeSwapBack`, `UnsafeList.RemoveRange`, `FixedString*.Format`, `FixedString*.AppendFrom`, `NativeHashSet.TryAdd`, `UnsafeHashSet.TryAdd`.
* `[NativeContainerSupportsDeallocateOnJobCompletion]` attribute from `NativeReference` container. It didn't work properly. Users can use `Dispose(JobHandle)` method instead.

### Fixed

* `FixedList<T>` `Remove` and `RemoveSwapBack` extension methods were modifying copy, fixed by passing `this` by reference to modify actual container.
#

this has even older date

#

package did only get out today though, I did verify it from the package repo

#
## [0.5.1-preview.2 Unity Physics] - 2020-10-14

### Changes

* Dependencies
    * Updated Burst from `1.3.2` to `1.3.7`
    * Updated Mathematics from `1.1.0` to `1.2.1`
    * Updated Collections from `0.11.0-preview.17` to `0.14.0-preview.16`
    * Updated Entities from `0.13.0-preview.24` to `0.16.0-preview.21`
    * Updated Jobs from `0.4.0-preview.18` to `0.7.0-preview.17`

* Run-Time API
    * Added the `TerrainCollider.Filter` setter
    * Removed the `CompoundCollider.Filter` setter as it was doing the wrong thing (composite collider filters should be the union of their children)
    * Added `BuildPhysicsWorld.AddDependencyToComplete()` which takes a job dependency that the `BuildPhysicsWorld` system should complete immediately in its `OnUpdate()` call (before scheduling new jobs). The reason is that this system does reallocations in the `OnUpdate()` immediately (not in jobs), and any previous jobs that are being run before this system could rely on that data being reallocated. This way, these jobs can provide their dependency to `BuildPhysicsWorld` and make sure it will wait until they are finished before doing the reallocations.
    * Added the option to provide a custom explosion filter in 'PhysicsVelocity.ApplyExplosionForce'.

* Authoring/Conversion API

* Run-Time Behavior
    * Changed Graphical Interpolation default to simpler implementation that doesn't try and consider velocities
    * `BuildPhysicsWorld.CreateMotions` now gives Kinematic bodies a zero Gravity Factor (i.e. they will not be affected by gravity)
    * Setting the `Collider.Filter` is now allowed for Terrain colliders as well, as opposed to previously only working for Convex colliders

* Authoring/Conversion Behavior```
#
### Fixes
* Fixed the potential issues if more than one job implements IBodyPairsJob.
* DebugStream.DrawComponent now cleans up its associated GameObject
* Fixed a bug in 'PhysicsVelocity.ApplyExplosionForce' where the provided collider's collision filter could prevent the explosion from happening.
* Fixed a memory leak in the Collider debug display gizmo```
#

jobs package upgrade is marked just as packages bump

#
## [0.16.0 Entities] - 2020-09-24

### Added

* EntityManager method CreateEntity(EntityArchetype, int). Unlike existing overloads of CreateEntity, this new overload takes no Entity array and returns no Entity array, so it avoids waste and bother in cases where callers don't need the actual Entity values.
* Special handling for Cameras and Colliders in preparation for root scene conversion, though they are disabled by default still
* `World.MaximumDeltaTime` now controls the maximum deltaTime that is reported to a World.
* Exception's stacktrace are recorded in conversion logs.
* Add `IFixedRateManager` interface for fixed-timestep implementations. See `FixedRateUtils.cs` for reference implementations.
* Add `ComponentSystemGroup.FixedRateManager` property, to store the current active `IFixedRateManager` implementation.
* Added `SceneSystem.IsSectionLoaded` to enable querying if a specific section of a scene is loaded.
* `EntityQuery.SetOrderVersionFilter()` and `EntityQuery.AddOrderVersionFilter()` which can be used to filter the Order Version independently from the Changed Version of a chunk.
* DOTS naming standards to CONVENTIONS.md
* libcurl Stevedore artifact registration
* Mathematics tests are turned on in CI```
#
### Changed

* Improved performance of `EntityQuery.ToEntityArray()`
* Platform packages updated to `0.9.0-preview.9`
* Burst package updated to `1.3.7`
* Properties packages updated to `1.5.0-preview`
* The job safety system has be moved to NativeJobs as C++ code
* The UnsafeUtility memory allocators have been moved to NativeJobs
* improved performance of EntityQuery.CopyFromComponentDataArray
* changed chunk size from 16128 bytes (16 KB - 256 bytes) to exactly 16384 bytes (16 KB).
* `TypeManager.GetFieldInfo` now takes in a `Type` to return an `NativeArray<FieldInfo>`. The passed in type must be registered to have field information generated explicitly via the `[GenerateComponentFieldInfo]` assembly attribute.
* `IJobEntityBatch` and `IJobEntityBatchWithIndex` now quietly skip batches whose size is zero. This can happen legitimately if the requested `batchesPerChunk` value is higher than the entity count for a particular chunk.
*Removed deprecated `ArchetypeChunk.Locked()` method.
*Deprecated `ArchetypeChunk.BatchEntityCount` property. The `.Count` property should be used instead.
* Removed usage of TempAssetCache for some livelink cases. Now these files are under SceneDependencyCache instead, so there is only one magic directory to deal with until we can remove it completely in future Unity versions.
* Fixed Reduced overhead of `IJobEntityBatchWithIndex` prefiltering by up to 20% if `batchesPerChunk` is 1, or if `EntityQuery` filtering is disabled.
#
### Deprecated

* `FixedStepSimulationSystemGroup.MaximumDeltaTime` has been deprecated. The maximum delta time is now stored in `World.MaximumDeltaTime`. For better compatibility with UnityEngine, the new field applies to both the fixed-rate and variable-rate timesteps.
* `ComponentSystemGroup.UpdateCallback` is deprecated. Instead, the group calls the `ShouldGroupUpdate()` method on its `FixedRateManager` property (if non-null) to accomplish the same effect.
* `FixedRateUtils.EnableFixedRateCatchUp()`, `FixedRateUtils.EnableFixedRateSimple()`, and `FixedRateUtils.DisableFixedRate()`. These functions were used to set the deprecated `ComponentSystemGroup.UpdateCallback` field; instead, just set `ComponentSystemGroup.FixedRateManager` directly.

### Removed

* Old 2020.1 ifdef blocks in LiveLink scene culling code
* Deprecated legacy sort order code in ComponentSystemGroup was removed
#
### Fixed

* Removed GC-allocations in `SceneSystem` and `SceneSectionStreamingSystem` that were happening every frame
* Issue with invalid GUID in SubScene importer causing Player LiveLink to stall waiting for an asset it will never get
* Hybrid component transform syncing was not working when entity order changed
* Hybrid components being editable when in Preview Scenes (by selecting gizmos)
* Fixed an issue in 2020.2 which caused `NativeContainer` min-max ranges to be incorrectly patched when scheduling and `IJobChunk` or `IJobEntityBatch` with a "Single" or "Run" schedule call.
* Fields marked with `RestrictAuthoringInputTo` can now be set to `None` in the inspector
* The Entities package now uses a faster code path for `CreateArchetypeChunkArray()` more consistently.
* Retroactively added a changelog entry that notes a behavior change in `RemoveComponent(EntityQuery, ComponentTypes)`. See 'Change' entry under 0.14.0.
* Generic job reflection data across assemblies would sometimes not work
* Fixed HLOD component throwing out of bounds exception when setup incorrectly against LODGroup.
* Scene section meta data now works in standalone builds again
* Native memory leak in EditorSubSceneLiveLinkSystem when failing to apply patches
* Generic job registration is more robust when generic parameters
* LiveLink will not generate errors on scenes that have not yet loaded scene sections
* Corrected inverted test in `IJobEntityBatchWithIndex` if EntityQuery filtering is enabled.
* `EntityManger.AddComponent<T>(EntityQuery entityQuery)` and `EntityManger.AddComponentData<T>(EntityQuery entityQuery, NativeArray<T> componentArray)` is 2x faster.
* Reduced overhead of `IJobEntityBatch` execution by 5-10% if `batchesPerChunk` is 1.
zenith wyvern
#

Generic job registration is more robust when generic parameters wat

dull copper
#

I guess I could still post netcode and animation ones as they got bumps too

#
## [0.5.0 Netcode] - 2020-10-01

### New features
* Added RpcSystem.DynamicAssemblyList which can be used to delay the checksums for RPCs and ghost components when the set of assemblies are different on the client and server.
* Added to RPC and Command the possiblity to send Entity reference from both client and server.

### Changes
* Change the system ordering to be compatible with latest physics. `NetworkTimeSystem` has moved to `ClientInitializationSystemGroup`. The SimulationSystemGroup runs `GhostSpawnSystemGroup` (client), `GhostReceiveSystemGroup` and `GhostSimulationSystemGroup` before `FixedStepSimulationSystemGroup` where physics is running. `RpcCommandRequestSystemGroup`, `RpcSystem` and `GhostSendSystem` (server) is running at the end of the frame, after all simulation code. Other systems has been moved into one of the groups.
* Created a new `GhostInputSystemGroup` where systems adding inputs to the input buffer should run.

### Upgrade guide
* The systems adding input to the `ICommandData` buffer needs to be moved to `GhostInputSystemGroup`
#
## [0.8.0-preview.3 Animation] - 2020-10-22

### Added
- Added PropertyDrawers for TransformBindingID and SkeletonBoneReference (which is now made public). Both make it possible to set bones from the Skeleton Asset using drag and drop or using the object picker. TransformBindingID is a path to a bone, and SkeletonBoneReference contains a reference to a Skeleton and a TransformBindingID, which represents a bone in the given Skeleton.
- Added SkeletonReferenceAttribute which can be used on TransformBindingID to associate it with a property returning, or a field containing a Skeleton. 
- Added ShowFullPathAttribute which can be used on TransformBindingID and SkeletonBoneReference to show bone names as full paths instead of just the name of the bone itself.
- Added a debugger view for `Rig` IComponentData. This view will display the `BlobAssetReference<RigDefinition>` internal data in the debugger. For more advanced debugging you can also add the DEBUG_STRINGHASH to your project scripting symbols which can be added under `Project Settings/Player`. This optionnal symbol will keep the original string for all hashes, and use this information when the debugger need to display a StringHash. There are currently a few limitations with this system:
  - Since it stores this information into a static class, every domain reload clears the dictionnary.
  - It currently only works in editor mode.
#
## [0.8.0-preview.2 Animation] - 2020-10-05

### Changed
- Added SkeletonAuthoring asset that isolates the animation bindings declaration and authoring from the rig instance in scene. This is the first version of SkeletonAuthoring and this asset will continue to evolve as more workflows are developed around it.
- Added RigAuthoring that uses a SkeletonAuthoring instance to generate a RigDefinition.
... (package upgrades)
- Deprecated the property RigComponent in BoneRendererComponent. A reference to the RigComponent is not necessary anymore.

### Fixed
- Fixed bug when reading input port twist weights in the `TwistCorrectionNode`.
#
## [0.8.0-preview.1 Animation] - 2020-09-28

### Added
- Added `IDeclareCustomRigChannels` interface and `RigChannelCollector` helper to append custom rig channels at conversion time to a `RigDefinition`. In other words, any custom `GameObject` components implementing the `IDeclareCustomRigChannels` in a `RigComponent` hierarchy will be called during conversion to append custom channels.

### Changed
... (upgrades and renamed types)
#
## [0.10.0 Hybrid Renderer] - 2020-09-24

### Added

* Error message when trying to convert SkinnedMeshRenderer that is using a shader that does not support skinning.

### Removed

* HybridRendererSettings asset was removed since memory management for the hybrid renderer data buffer is now automatic.

### Fixed

* Fixed missing mesh breaking subscene conversion
* Fixed chunk render bounds getting stale when RenderMesh shared component is changed.
* Improved Hybrid V2 memory usage during GPU uploading.
* Chunk render bounds getting stale when RenderMesh shared component is changed.
* Reduced Hybrid V2 peak memory use when batches are deleted and created at the same time.```
zenith wyvern
#

Looks like Tiny updated too, no post about it yet though

dull copper
#

I keep forgetting it exists

tame sigil
#

thanks for the update Olento !

steady blaze
#

thanks mainly to @hollow sorrel @tawdry tree and @zenith wyvern ? for the help with Job-System! (sorry if I forgot someone)

#

finally found the problem, why Burst did not work: The Triangle LookupTable was defined as a nested array like int[][]

#

as the Job did access it, burst did not seem to like that, so I changed it to a one dimensional array. So from: public static readonly int[][] TriTable = new int[][] { new int[] { }, new int[] { 0, 8, 3 }, new int[] { 0, 1, 9 }, new int[] { 1, 8, 3, 9, 8, 1 }, โ€ฆ } to:

public static readonly int[] TriangleTable =
{
    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    0, 8, 3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    0, 1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    1, 8, 3, 9, 8, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
    โ€ฆ
}```
dull copper
steady blaze
#

with a large number of areas it starts now a bit faster as without jobs (like with 4096 areas ~7 secs instead of ~9.5)
But I guess it is more a problem of the other stuff going on, like creating the GOs, the Noise is also not fully job-ready, etc.
Also it seems that at Application Start Unity is not able to schedule the Jobs very well.

amber flicker
#

Well.... time to get hyped about the next dots update ๐Ÿ˜…

dull copper
#

yeah this didn't really bring much new functionality

#

for my use cases, it's mainly that small fixed timestep tweak

amber flicker
#

2x improvement for AddComponentData is nice... but imo it's still bad enough you still often need semi-elaborate archetype caching strategies to avoid it. Really disappointing Jobs got no update at all I thought.

deft stump
#

also.. latest package manager on alphas/betas is just so broken
@dull copper do you have a bug where if the package manager get's stuck in "Resolving Packages" for 2 mins, it just fails?

dull copper
#

I'm getting these with the current packages: ArgumentException: UnityEditor.Experimental.TerrainAPI.PaintHeightTool and UnityEditor.Experimental.TerrainAPI.PaintHeightTool have a conflict in the stable type hash. Use the [TypeVersion(...)] attribute to force a different stable type hash for one of them. Unity.Entities.TypeManager.AddTypeInfoToTables (System.Type type, Unity.Entities.TypeManager+TypeInfo typeInfo, System.String typeName) (at Library/PackageCache/com.unity.entities@0.16.0-preview.21/Unity.Entities/Types/TypeManager.cs:392)

#

UnityEditor.Experimental.TerrainAPI.PaintHeightTool vs UnityEditor.Experimental.TerrainAPI.PaintHeightTool ๐Ÿค”

#

it's literally the same thing

#

I do have terrain tools package here too which could be what triggers this

amber flicker
#

smooth upgrade for me

dull copper
#

yeah it did work for my other project where I just upgraded the dots packages but didn't have any terrain stuff

#

it's just.. that error message is nonesense

#

it wants me to put different hash for other but it literally lists the same thing twice

steady blaze
#

maybe also interesting: with a "normal" number of Areas at start (like 5x5x5) it schedules all Jobs to one worker.
Only with a bigger number, so that generation spans over a few frames it starts to assign to different workers.
I guess that's why it is only a little faster with lots of objects. But yeah, hope it will behave different when generating terrain while the game is running (As at Start Jobs don't really seem to speed things up)

dull copper
#

burst background compilation doesn't seem to be particularly multithreaded

steady blaze
#

@dull copper maybe synchronous compilation could help?

#

have no idea, but sounds like it could be that option

dull copper
#

doesnt that just force the compilation before you can play in editor?

#

almost everyone got SSE4 capable system and only minority can do AVX2

#

if I had to omit something from that list it would be AVX2 and just enable all the rest

#

AVX vs AVX2 gains aren't that noticeable even

steady blaze
#

Ok, seems to be so, finally found a better description about the options in the menu.

deft stump
#

Welp I'm also getting the terrain tools errors

#

hopefully unity would update the terrain tools package

dull copper
#

it's coming from that package yes

#

I tried removing it and the error was gone

#

I don't think it stops from using any of these but you get those 6 errors every time you start the editor again, you can clear them

safe lintel
#

nothing like the smell of fresh packages in the morning ๐Ÿ˜‹

deft stump
#

Or each time the editor builds.
Also, Package Manager is broken from 2020.2.0b8 and above.
I dunno why.

#

I'm stuck in b7 for nowbut I see a fix in review already so ๐Ÿคž on b10

safe lintel
#

im stuck on b1 ๐Ÿ˜ personally until at least ui toolkit is fixed

dull copper
#

bit off topic here but is there any trivial way to animate ui elements at runtime yet?

#

I'm aware that the current roadmap says ui anims will come in 2021.2

#

but they've been saying a lot of things in past, there's like no way I'd believe that target will hold

safe lintel
#

thought there was some experimental stuff in the latest versions

#

havent personally used it though

dull copper
#

that slide is like one month old

amber flicker
#

My coming lib will do it with Timeline & code but couldn't you use an existing main-thread tween lib to do it?

dull copper
#

I dunno, hence asking ๐Ÿ™‚

#

I haven't really used UI toolkit at all in my own projects as it's been just too raw

#

if you can move the elements via code now, even that's something

#

it's just, I have no idea what they expose atm

safe lintel
dull copper
#

thanks, I'll check it out

#

I'd really want to avoid the ugui at all cost but worried about some pretty basic functionality missing on new ui's runtime

#

I'm ok if you can code / hack around it to make things move around etc

safe lintel
#

were there updated dots animation samples? the main dots animation repo seems unchanged but was wondering if i missed something

dull copper
#

does it ship examples are part of the package?

safe lintel
#

dots or uitoolkit?

dull copper
#

(anim package you were asking about)

safe lintel
#

well ui toolkit has examples as an importable mini package

dull copper
#

yeah I've seen those ๐Ÿ™‚

safe lintel
#

ah ill have to check but somehow doubting that

dull copper
#

altho I didn't quite understand the ui toolkits runtime samples

#

why didn't they put like actual sample scene for that there

#

I totally felt like I missed something there

safe lintel
#

agreed some of those examples seem a bit abstract in nature, the repo feels more understandable and the builtin examples seem to have more advanced use cases

dull copper
#

ah, got the demo open, yeah this definitely has dynamic elements ๐Ÿ™‚

proper silo
amber flicker
#

that's an easy one - it's expensive to schedule work to run across different threads (I haven't looked at your code)

#

supposedly they're working on optimising the scheduling but we've yet to see any improvements

proper silo
#

Ohhhh ok! So unless the jobs are huge, it is not "worth it" to schedule it?

amber flicker
#

correct - also by default the more cores/threads you have, the slower it becomes

proper silo
#

Understood, thank you!

#

Also, do you know if SystemBase.Dependency is automatically .Complete() at the end of the processing ?

amber flicker
#

I believe .Complete() may be called on all jobhandles at the end of a frame - the Complete call causes a sync point and ensures no further work is done or jobs scheduled until the current work (jobs across threads) is complete. Not sure if that helps

proper silo
#

Yes, it makes sense, thanks once again!

hollow sorrel
#

late reply to entities update but yea seems like not much changed for me either which is unfortunate

#

however they updated packages at same time now which is good

safe lintel
#

just want some animation samples updates, why is this so hard to get

craggy orbit
#

im getting a new error with the package updates today that i wasn't getting before. tracing it back it seems to happen in spots that i do a raycast inside a job, but the bit that throws the error is some internal physics stuff (Broadphase.cs).
"ReadWriteBuffers are restricted to only read & write the element at the job index. You can use double buffering strategies to avoid race conditions due to reading & writing in parallel to the same elements from a job."

#

im guessing it's something on Unity's end. would it make sense to downgrade Physics to 0.5 or....?

#

hmmmm never mind seems it's not directly correlating to the Physics update

lean raptor
#

Is it mandatory to use .Complete() in a JobHandle after use .Schedule() in a IJob or I', allowed to just fire and forget?

safe lintel
#

dont need to complete unless you need the results

#

@craggy orbit mightve been something where although it worked prior, it technically shouldnt have or at least not according to best practises and they only just introduced a proper error for it

lean raptor
#

dont need to complete unless you need the results
@safe lintel I need the results, thought I don't want to store the JobHandle. I mean, the job itself will store its result in a shared array. Will the job be executed even if I never call .Complete()?

craggy orbit
#

yikes. ok, thanks

safe lintel
#

yes the job will be executed, even if you dont use Complete(), as long as you are scheduling

#

but if you need to complete, use it

lean raptor
#

yes the job will be executed, even if you dont use Complete(), as long as you are scheduling
@safe lintel So .Complete() is not compulsory for the job to be executed if I can check its completition in another way?

deft stump
#

there's .IsCompeleted.
you can use that to check if the job has completed

lean raptor
#

But I don't want to store the JobHandle

deft stump
#

Don't @ me, but I believe you need to clear the job anyway or the thread will continue to run even if the intended operation is "done" in a way.
And with TempJob's lifetime, it'll get leaked while the thread is running

#

so either way, you need the JobHandle

lean raptor
#

Ohh, thanks

#

I'm sorry for the @, thought I don't rembember have @ you

deft stump
#

Don't @ me, means "don't quote me on this".

#

I had a similar problem when I didn't .Complete() the job and just disposed the native container.
errors out telling me that I shouldn't even though the operation is done.
That lead me to believe that the thread is still running even when IsCompleted = true.
So .Complete() is needed to safely stop the Job from running and Dipose the native container

lean raptor
#

ohh, ok

steady blaze
#

For everybody that helped me sort out Jobs problems, thanks again and yes! ๐Ÿ˜€ After I finished terrain-generation (Instantiate) and destruction (Destroy) based on Player position (guess it's pooling) the Jobs then finally run in parallel! (in contrast to the behaviour at Application Start, where they all run on one worker - I guess this is because unity needs to do other stuff at Start)

#

it is about 15ms now for generation of 25 meshes using Jobs and about 37ms without Jobs ๐Ÿ˜‰

olive kite
#

so it seems to be much faster to add a new component to an entity than it is change the value on one:

#

where test 1 is eM.AddComponent<TestTag>(entities[0]); and test 2 eM.SetComponentData<TestTag2>(entities[0], new TestTag { Value = 1 });

#

though sometimes it seems to about be the same for some reason

deft stump
#

how many entities are you testing it on?

amber flicker
#

the above is so terrible for so many reasons ๐Ÿ˜ฌ ... sorry ๐Ÿฅด

rancid geode
#

@olive kite are you testing AddComponent on the same entity over and over? Because AddComponent returns early if the entity already has the component (and doesn't actually set the value)

amber flicker
#

Just to add (I said the above so people wouldn't suddenly worry about using SetComponentData) - SetComponentData (in my experience) is more like one or two orders of magnitude faster than AddComponent. Your last two tests in the above also show the same time - no idea what you're really measuring, whether you've done it attached to a build, allowed for warm-up etc etc.

rancid geode
#

Not to mention that AddComponent causes a sync point, while SetComponent does not

olive kite
#

ok thanks, that is really good to know about the sync point. I am using AddComponent on the same entity but with a different component.
@amber flicker they were the same test1 (add component) and test2 (set component) running in OnUpdate() once per frame. maybe it is too small of a sample size though at 100

hollow sorrel
#

@steady blaze nice, glad it works now and seems like good speedup for just jobified
next step is trying to make it work in burst :p

steady blaze
#

@hollow sorrel already runs with burst. the problem was that the Triangle LookUpTable (which is accessed from the Job) was a nested array like: public static readonly int[][] TriTable = new int[][]

#

switched to a regular 1d array, now it works

hollow sorrel
#

oh? as in youre still using a c# [] array?

#

wouldnt think that works with burst or jobs even

steady blaze
#

with a sight distance of 3 (so 7x7x7 areas active) there are noticabe framedrops without jobs

#

the lookup tables are external, access from job works (also with burst). could they be a persistent nativeArray, also static and readonly?

zenith wyvern
#

You can use managed arrays if they're static and readonly, yeah

steady blaze
#

i did it that way, because the (jobified) open source marching project does it the same way

hollow sorrel
#

ah

#

wow you can use static values in burst?

#

thought it needed some special stuff for that

#

neat

steady blaze
#

yes, i think they have to be readonly

#

or const

#

could it speed things up with lookuptables beeing a nativearray?

zenith wyvern
#

I'm not sure

steady blaze
#

ok, I'll leave it, like it is for now. next step would be some better noise, with more settings, a seed, octaves and better results of course.
Of course I will try to do that with jobs too.
maybe have a regular loop for the octaves and always have the most inside loop (setting values to the voxels and iterating through one area) as an IJobParallelFor

safe lintel
#

๐Ÿฅณ ๐ŸŽ† animation samples updated ๐Ÿฅณ ๐ŸŽˆ ๐ŸŽŠ ๐Ÿฆฎ

hollow sorrel
#

what state is animation in rn

#

is it somewhat usable

safe lintel
#

well the samples work

#

I think at a glance it looks like a good amount of functionality, but like almost zero editor tooling

#

I also feel that its further along than they are letting on regarding package is highly experimental imo no more so than any of the other entities packages even way back, but the blocker for me until now is that the samples just werent updated at all(entities has always been updated in tandem with samples) so for a year or so couldnt really follow along with it and develop any understanding as the package kept changing.

  • also the (dots) anim team for whatever reason is far less active on the forums so communication is difficult,
  • far less people using it unlike main entities package in the early days,
  • also only forum for communication also houses discussion on regular animation stuff, kinematica and the new rigging package,
    all these things make learning dots animation almost impossible for a layperson like me
lean raptor
#

This is an odd question, but, ยฟIs possible to fake a JobHandle?
For example, you can create an aritificial Task by using TaskCompletitionSource.
Is possible to do that with a JobHandle.

sour sorrel
#

Sorry I just need to vent a little, the new change in the package removing visibility is complete bs, like why would you do it in the first place? Not only that, some of the packages that are still there DEPEND on the packages now invisible

#

Entities are now invisible in the package manager......

#

Or this one, depending on Collections, Entities and unity Physics which are all unavailable in package manager

olive kite
#

Yeah, I agree @sour sorrel I thought that was a little strange to take out as well

deft stump
#

@sour sorrel they did say the reason for it being hidden is so they could make a new category for alpha/experimental packages.
dunno when is that.
and, I agree, I don't know how this idea of hiding the packages instead of just doing the re-categorization anyway would help with people installing stuff that are experimental and then later on get complained on.
the same thing would happen anyway regardless if they were re-categorized or not

amber flicker
#

is there a way to call Complete() on all jobs updating in a particular ComponentSystemGroup?

olive kite
#

I can't find a way. The jobs could be combined manually in a combinedependencies but i assume that's exactly what you are trying not to do.

frigid onyx
safe lintel
#

whats the actual question, how to parent things using physics? also the last part can happen but i have to assume that manually doing conversion(or creation) of a collider at runtime wont give optimal performance at all

proper silo
#

hello! If lets say in a system I create 100 entities using a commandbuffer and an archetype and initialize one of their component with a value increasing each spawn (0,1,2...99), if after that I do an Entities.ForEach, can I be sure the order will be the same? Will the first entity in the forEach have the value 0, etc...? Or it'll be random ?

proper silo
#

I guess yes if I use .Run() but no if I ScheduleParallel

proper silo
#

Looks like the creation order is the same as the entityInQueryIndex using Run(), Schedule() and ScheduleParallel

shy pilot
#

does anyone here know how to use Unity.Mathematics.Random from the main thread in a system?

odd ridge
#

how do I deallocate a native array on job completion when using Foreach().Schedule() ?

zenith wyvern
#

WithDeallocateOnJobCompletion or pass the job handle from the foreach (aka Dependency) into your container's Dispose method

odd ridge
#

thanks!

#

is there a way to have jobs only use worker threads and leave the render thread alone?

#

I have a costly job which makes my render thread stutter and lag, I want it to be offloaded to secondary threads so that the render thread isn't blocked

odd ridge
#

also, is there a OnStart() for jobs? what if I want to allocate a NativeArray only once at the beginning?

deft stump
#

I think you're referring to systems.

#

best way I can think off is allocating it on OnCreate()

odd ridge
#

yes I was referring to systems, thank you

olive kite
#

Has anyone experienced any issues with raycasts since the latest update? I am getting errors when using raycast inside of .foreach

#

IndexOutOfRangeException: Index 3 is out of restricted IJobParallelFor range [0...0] in ReadWriteBuffer. but there is only 1 index in the list. Works fine without parallel for now

junior fjord
#

My Entities have an IBufferElementData with references to other entities

#

How do I do that from an authoring perspective?

#

I.e. how can I make s.t. I create gameobjects in the editor, then have them reference each other and then convert that to entities referencing each other?
My problem is that in the Convert function I only have access to the other GameObjects, not the their entity representation

wraith bronze
#

Does anybody know how to create your own entity command buffer?

north bay
#

@junior fjord The GameObjectConversionSystem which is passed into the Convert method has a method called GetPrimaryEntity which returns the entity representation of the component that you pass in as a parameter

junior fjord
#

@north bay thank you

#

How would I mark a gameobject in a subscene to not be converted?

#

And do the parenting-child relations of gameobjects in the subscene have any influence in the ecs?

amber flicker
#

@junior fjord I think there's a Convert To Entity (stop) component or smth that you can add to your gameobjects but I can't say how well it works - in particular, it stops converting at that point so it's children would also not be converted.

junior fjord
#

Ah ok but what is the supposed way to group gameobjects in the subscene then? Just for visual effects

amber flicker
#

I guess I probably wouldn't put them in the subscene to begin with? Don't think there's one great answer to this though.

junior fjord
#

Ok, then maybe I am understanding the subscene workflow wrong. I understood it this way: Instead of having GO with ConvertToEntity I put everything in a subscene in the edtior and serialize it to disc -> faster startup time

amber flicker
#

many years away from that unless you only have very simple stuff in subscenes

junior fjord
#

oh ok, then I will stop going into subscenes, thank you

#

what are the subscene usecases today?

amber flicker
#

This is just my opinion but I think it's far away from being a smooth experience. They're currently working on converting 'root' scenes whatever that means and a different prefab workflow. Stuff that's e.g. monobehaviour won't serialize or load any quicker if it's put in a subscene - only the stuff that's converted will be faster. So whether e.g. a ParticleSystem lives inside or outside a subscene I believe it won't be any quicker to load as it still needs to be deserialized. Same for e.g. Animators.

#

Main use-case atm I'd say is for e.g. putting a bunch of meshes in a subscene - this can make up a lot of the heavier content and load directly into ram basically.

#

Rather than trying to get your existing projects and hierarchies working in a subscene, I'd advise stripping out what can be converted (and putting just those parts in subscenes) and then focus on the interfaces between entities & GOs. Kind of vague and (to reiterate, just my opinion).

junior fjord
#

Ok, but putting all the GO that have a ConvertToEntity Component with ConvertAndDestroy activated into a subscene is a good idea then, isn't it?

amber flicker
#

if you want/need to go fast, yes. Though with everything you do that to, you add additional complexity in the interface part.

junior fjord
#

Ok, thank you for the explanation

#

I think I am fine with converttoentity for now then

amber flicker
#

Imo that's fine for now. If you have big self-contained sections that can almost all be converted, subscenes are worth considering. If you heavily mixed content (e.g. Animators, UI, Unity events, pfx etc ) then I think it's very painful right now (and so probably not worth it).

junior fjord
#

Do I understand it right that I need an authoring and a ConvertToEntityComponent?
How would I hinder the entity to have the converted "Transform" Components (Scale, Position etc)

amber flicker
#

Yes, an authoring component won't convert an entity by itself. You can't yet convert a GameObject without the Transform components. The best you can do is write a conversion script that either creates an additional entity or removes those components afterwards. I think they plan on improving this one day.

zenith wyvern
#

I thought if you added the StaticOptimizeEntity component (it's a monobehaviour) it would prevent transform stuff from being added during conversion

#

Could be remembering wrong

odd ridge
#

is there a way to limit the number of threads ECS can use? I want to have ECS use all threads except the render thread

amber flicker
#

oh I think @zenith wyvern could be right about that ... ๐Ÿ‘

#

@odd ridge you can set max number of workers - I could be wrong but I thought the render thread was separate anyway? It appears to have it's own thread in the profiler.

safe lintel
#

@wraith bronze the entities docs have info on how to do that

odd ridge
#

@amber flicker oh sorry, I used the wrong wordings. I want the render thread to have a dedicated CPU core so to not lock the framerate. I will try what you said

safe lintel
#

iirc StaticOptimizeEntity only adds a localtoworld, not translation rotation scale

amber flicker
#

@odd ridge I don't think that's possible but I could be wrong. Nevertheless, I'm not sure how it relates to not locking the framerate.

odd ridge
#

@amber flicker with a heavy ECS load that spreads on all cores, the render thread is waiting on queues which hurts the framerate

amber flicker
#

My expectation is that the render thread is waiting on the main thread for reasons. My guess is by having less workers it will be slower overall. I could be wrong.

wraith bronze
#

i've been looking online quite extensively but can't find any info on it

#

or I am just too dumb to find it ๐Ÿ˜›

#

if you could point to a resource explaining how to implement my own custom entity command buffer, would be greatly appreciated

#

currently doing this

[ExecuteAlways]
[UpdateInGroup(typeof(ServerActiveSimulationSystemGroup), OrderFirst = true)]
public class BeginServerSimulationEntityCommandBufferSystem : EntityCommandBufferSystem { }
#

but throws memory leak warnings whenever I queue commands in here

amber flicker
#

Unsure if you need ExecuteAlways. Also fyi OrderFirst = true may not be working - there was a recent thing on the forums about this. Unsure if it's fixed in entities 0.16. Otherwise that looks basically ok to me. Your errors may be related to what you're trying to do with it in the system?

wraith bronze
#

errors go away when replacing it with another default ecb

safe lintel
#

are you playing back the buffer immediately using .run because you might need to dispose of the buffer

wraith bronze
#

you mean this right? entityCommandBufferSystem.AddJobHandleForProducer(Dependency);

junior fjord
#

is there a way to run code after the authoring is done but before the systems run?

wraith bronze
#

I am doing this at the end of my systems when I have added commands to it

safe lintel
#

ah nevermind i dont think what i said applies in this instance

#

whats the memory leak warning and the code where you use the commandbuffer?

wraith bronze
#

Internal: JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak

amber flicker
#

@junior fjord fyi you can run conversion scripts in one of three phases (before, during & after conversion)

wraith bronze
#

Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 15)

amber flicker
#

my guess is this has little to do with the buffer and that the reason the warning goes away is a timing issue.

junior fjord
#

ah ok. I want to run some code after the conversion is done (the entities exist now), but before the main game starts (the systems)

wraith bronze
#

actually calling ecb.Dispose(); fixes the memory leak warnings

#

I never had to do this before whenever using a default ecb

safe lintel
#

how are you using it? afaik thats only when you create a buffer that isnt connected to a particular system

amber flicker
#

@junior fjord I assume you want to do this at edit-time rather than runtime? If so you can use GetPrimaryEntity(someGameObject) to get another gameobject's converted entity and/or you can have your conversion script run in the after phase I guess.

junior fjord
#

No, I want to do it at run-time. Basically I want to first create all the entities with their components (have done that part) and afterwards run some more scripts that do some work on the already created entities

#

I was not able to find a good representation on what is executed in what order at startup

#

Are the MB startup functions executed after the conversion is done or before?

amber flicker
#

I'd advise against trying to plan around the ordering of MB's & systems at start-up - I believe it changes in editor, when a subscene is open or not and in builds too. What is the actual problem you're trying to solve if you don't mind me asking? Everything that can be done at edit-time is generally a good idea to do. If systems require your entities to be in a specific state, just e.g. add a tag that they require and add it at the first frame after initialization.

wraith bronze
#

how are you using it? afaik thats only when you create a buffer that isnt connected to a particular system
@safe lintel I made a quick test script:

[ServerWorld]
[UpdateInGroup(typeof(ServerActiveSimulationSystemGroup))]
[DisableAutoCreation]
public class NpcDeathServerSystem : SystemBase
{
    private BeginServerSimulationEntityCommandBufferSystem entityCommandBufferSystem;

    protected override void OnCreate()
    {
        base.OnCreate();

        entityCommandBufferSystem = World.GetOrCreateSystem<BeginServerSimulationEntityCommandBufferSystem>();
    }

    protected override void OnUpdate()
    {
        var beginSimEcb = entityCommandBufferSystem.CreateCommandBuffer();

        Entities.ForEach((
            in Entity entity,
            in NpcDeathComponent npcDeathComponent,
            in HealthComponent healthComponent) =>
        {
            beginSimEcb.DestroyEntity(entity);
        }).Run();

        entityCommandBufferSystem.AddJobHandleForProducer(Dependency);
    }
}
#

basicly anything that I add to this buffer doesn't happen, and unity throws memory leak warnings

#

I feel like I am missing a step

#

do I need to manually execute the commands in the buffer or anything?

#

(ignore the DisableAutoCreation attribute, the system is being created from somewhere else)

#

I am using DOTSNET for networking, but I don't think that should influence how a new ecb works.

amber flicker
#

I can't see anything obviously wrong with that as is ๐Ÿค” - so you add beginSimEcb.Dispose(); in the update and no warnings?

wraith bronze
#

No that was a mistake actually, it still throws warnings

safe lintel
#

yep looks like it should work? if it can be extracted into a repro project, id bug report

amber flicker
#

yea... in that case I'm still suspicious it's a timing issue.

safe lintel
#

wait if you use schedule does it also give a warning?

amber flicker
#

oh good point

safe lintel
#

if you are running then i dont think you need that ecbsystem

zenith wyvern
#

It can still be useful to prevent structural changes in the middle of your update

junior fjord
#

I'd advise against trying to plan around the ordering of MB's & systems at start-up - I believe it changes in editor, when a subscene is open or not and in builds too. What is the actual problem you're trying to solve if you don't mind me asking? Everything that can be done at edit-time is generally a good idea to do. If systems require your entities to be in a specific state, just e.g. add a tag that they require and add it at the first frame after initialization.
@amber flicker I am simulating a small economy basically. I have sectors, which I create in the Editor. Now after I start the game, I want to create "Companies" (that belong to sectors). Basically I use the sector-entities as "configuration templates" and randomness to create some companies.
This step of creating the companies needs to be done after the conversion is done (The Sector Entities are created) but before the game actually starts

#

Actually it just needs to be done after the sector entities are created and their components are set, thats it (I need to access the components of the sector entities)

safe lintel
#

no you dont need to create the ecb from a system, you can create an ecb like
var ecb = new EntityCommandBuffer(Allocator.Temp)

and then dispose right after running
ecb.Dispose();

wraith bronze
#

the reason why I want to use a ecb is because other commands like removing/adding components are also stored in a end simulation ecb, so if I immediatly destroy the entities here and now I get errors when the end simulation ecb plays that the entity doesn't exist

zenith wyvern
#

Nothing is jumping out that seems like it would cause an error from just the code you posted. Are you 100% sure this is the source of your error?

amber flicker
#

(aside, I think if you use Allocator.Temp you don't need .dispose)

wraith bronze
#

so my approach is to add/remove components in end sim, and destroy entities in begin sim

safe lintel
#

@wraith bronze if you use .Schedule instead of .Run does it also give the warning?

wraith bronze
#

but since everything is running in serveractivesimulation, i need a custom ecb

#

@wraith bronze if you use .Schedule instead of .Run does it also give the warning?
@safe lintel yes, I am trying ScheduleParallel now

amber flicker
#

In particular I'm wondering if AddJobHandleForProducer is doing anything with .Run()?

wraith bronze
#

tbh I also don't know

safe lintel
#

wonder if its a netcode issue, but im too lazy to test this out

wraith bronze
#

yea if the way I am creating my ecb is correct, i think it's dotsnet complicating things

amber flicker
#

I think entityCommandBufferSystem.AddJobHandleForProducer(Dependency); isn't actually adding a JobHandle. Curious if Dependency = Entites.For..... ).Schedule(Dependency); beforehand makes a difference

wraith bronze
#

it still gives me warnings if I try that

amber flicker
#

๐Ÿ‘ then I'd try and repro this in a new project - feels like something else is going on

wraith bronze
#

anyway thanks guys for helping! atleast I know a little more about what might be the issue ๐Ÿ‘

wooden summit
#

Hey, I'm getting this error when running a job:

InvalidOperationException: The previously scheduled job WorldGrid:UpdateChunkJob writes to the Unity.Collections.NativeArray`1[Cell] UpdateChunkJob.chunkWithNeighbors.NorthEast.cells. You are trying to schedule a new job WorldGrid:UpdateChunkJob, which writes to the same Unity.Collections.NativeArray`1[Cell] (via UpdateChunkJob.chunkWithNeighbors.SouthEast.cells). To guarantee safety, you must include WorldGrid:UpdateChunkJob as a dependency of the newly scheduled job.

Is it possible to just ignore that error somehow? I can guarantee myself It's thread safe

wooden summit
#

๐Ÿ‘Œ perfect, thanks!

fluid kiln
#

Do we have any recent info on Navmesh implementation for DOTS?

safe lintel
#

"Hi, I don't have any news. It's still too early to talk about a preview package."

pliant pike
#

I'm trying to get a flow field path finding system to work in dots

proper silo
#

Imagine I want to do some calculations on 10 000 entities but only on specific condition (if, for example, the player clic a button), is it "the correct way" to add a component tag to those entities that will then be used by a entities.foreach loop, or is it too heavy ?

safe lintel
#

how often is it done, imo if its many times every other frame just having a bool thats enabled/disabled will be better than adding/removing tags. but if the frequency isnt that great, tags might make more sense

tawdry tree
#

Does the condition affect all entities or only a subset?
Or put differently, which entities are affected by the click?
All of them? A certain number? Previously selected entities?

#

If it affects all entities, you should use a singleton entity with the state, or (more dirty, but simpler) put it directly on the system.
If it affects only a subset, it depends on how the subset is selected. For example, can an entity move from a subset to a different one?

proper silo
#

It can be every 1-10 seconds so not something happening frequently frame-wise. And yes it affects every entity (its a grid, with 10k entity each representing a cell, all changes affect all cells), but I feel like adding/removing a tag will be more expensive than just iterating through a DynamicBuffer linked to a singleton for example. What do you think ?

spark glade
#

Man, i just updated entities/etc.. and getting these kind of exceptions all over the place: ArgumentException: Index 2 is out of restricted IJobParallelFor range [11...11] in NativeStream.

#

Some of which I can understand why they would be an exception and require a NativeDisableParallelForRestriction some I really don't understand.

#

Like I have a NativeStream.Writer iniside a IJobChunk and I call MyWriter.BeginForEachIndex(chunkIndex); and that blows up with such an exception...

safe lintel
#

@proper silo actually what hodhandr said, if its a click or something I would get the input data on the mainthread and use that as a field in the job and then drive logic from there

proper silo
#

i see, will try, thanks !

dull copper
#

I thought the point was to cache these, but now it's doing even more work

#

I haven't checked if this is alpha release issue or issue with Burst 1.4 preview

#

hmmm, package manager also only show 1.4.0-pre.1 for me but 1.4.1 is actually out already ๐Ÿ˜„

#

(still happens with Burst 1.4.1 release)

waxen glade
#

I've got a few silly questions perhaps, but as a non-programmer Dots is a bit of a black box.

Currently using 2D render pipeline to make a game that needs to run in browser.

  1. Dots / project tiny is still webgl right?
  2. Can we use dots/ecs with the 2d render pipeline and all the new stuff like 2d lighs?
  3. Can we use some dots / ecs code in an existing project. (to optimise cpu load)
deft stump
#

@waxen glade

  1. ) I believe there is webgl support.
    2.) I'm not sure with project tiny, but with DOTS its currently not supported.
    3.) no. dots/ecs stuff is a pain to interact with mono. you're better off really, choosing one or the other.
waxen glade
#

Thanks!

frigid onyx
#

whats the actual question, how to parent things using physics? also the last part can happen but i have to assume that manually doing conversion(or creation) of a collider at runtime wont give optimal performance at all
@safe lintel

Sorry for the late reply.

I'd build the privatives ahead of time as prefabs / ghosts, so they should be converted with the meshes fine.

Assembling an object out of those primitives and parenting them at runtime is the question.

#

at this point, I'm just going to try it and see what happens.

pliant pike
#

the DOTS way

safe lintel
#

i can see two simple solutions: copy the "parent" transforms to whatever translation/rotation you want as a child(i do this for my ragdoll stuff), or use a stiff/fixed joint
but I think the former might lag a tiny bit because its like a late update, i think plugging it directly into the physics sim would make it more accurate but I dont know how to do this

steady blaze
#

I wonder if Unity.Mathematics is faster than the older Mathf if you use it only in main thread?

amber flicker
#

someone checked and I think on average it is like 10% faster or something

steady blaze
#

Ok, thx

amber flicker
safe lintel
#

so.. anyone had a chance to test out those animation samples? feels like im still at square one for understanding them(cant get rootmotion to work on a simple clip player)

odd ridge
#

I want to make my entity 'walk' on top of the terrain. how do I read the height of the terrain from inside an ecs job?

pulsar jay
#

Is there a dots equivalent to Physics.CheckSphere as I can only find examples for cast sphere?

tiny ore
#

(may not be optimal, but...) wouldn't CastSphere with zeroed direction work the same

#

?

pulsar jay
#

I guess that would work but I would think that it produces a lot of unnecessary overhead

tiny ore
#

ye, probably...

#

Depends on the internal narrow phase implementation.

#

As far as I know, it uses GJK

#

Static Sphere-box and sphere-sphere can be made faster than GJK equivalents I think...

pulsar jay
#

just found that maybe a PointDistanceQuery with the maxdistance of the sphere radius might work

tiny ore
#

But in the general case GJK is really good anyway.

pulsar jay
#

Ill keep it in mind as a fallback then

stone osprey
#

AI... lets say we want to let our mob-entity be controlled by some sort of stupid game ai. Normally those ai implementations use state machines... how do we implement ais in an ecs environment ?

odd ridge
#

if you want to make ai in ecs, it depends what kind of ai you want to use

#

if you are asking how to implement state machine ai in ecs, you can use tags to make a state machine

#

changing the tag would be the equivalent of changing an enum value for a switch in a state machine

stone osprey
#

Just a pretty stupid one... it should wait till a player is nearby and then follow him for attacking ^^ Most statemachines i saw are scripts on their own... but thats not possible in an ecs environment, components shouldnt contain methods ( pure ecs )