#archived-dots

1 messages Β· Page 51 of 1

rotund token
#

82 unity crashs in 4 days

robust scaffold
#

I've been having similar crashes, rarely hard though. Most are asset database dying and corrupting headers

rotund token
#

notice the odd times? outside office hours

#

my 0.51 project rarely crashes at work

#

soon as i finish (or before work) and work in 1.0/2022

#

crash city

robust scaffold
#

I don't know what they're doing with the baker but it's buggy as fuck

#

GOCS may be slow and clunky but it worked flawlessly

rotund token
#

at least half of these seem to be in assetimporter

viral sonnet
#

bakers aren't even that fast

#

good lord tertle, you have the patience of a saint

#

anyway, get rid of f1. crashes will be much less

rotund token
#

you say that, but i may have had less crashes in f1

#

i can see from my crash logs there has been no difference

viral sonnet
#

where are you getting them mostly? domain reloads?

rotund token
#

nearly always asset related

#

i should just go back to working on effects library this nearly never crashes

#

because there are no assets

#

it's all virtual

viral sonnet
#

mh, i guess that's the reason why i'm not having crashes. also no assets other than those that existed for years

rotund token
#

i can see big gaps where i dont crash for a few days

#

and i load up git history and thats me working in effects

#

or updating core library etc

#

projects with no asset conversion

#

soon as i touch something with a lot of assets, instability

#

you've seen this from megacity!

viral sonnet
#

why TIF?

#

lighting is really not great in megacity. everything that's in shadow is totally flat looking (oh and another crash, this time in editor)

#

oh a new one 32 GB are not enough 😦

sharp stump
#

This is the first line of the definition of Baking in the unity 1.0.0-pre docs "Baking provides a system for transforming GameObject data in the Editor (authoring data) to Entities written to Entity Scenes (runtime data)." What in the sam hill is that saying?

viral sonnet
#

i also had a bit of hope that megacity would see a bit of an update. it's been 3 years and it looks identical. that said, it didn't look that great to begin with mainly because of lighting and view distance. there's really no wow effect here sadly 😦

#

and to not sound too negative about megacity. in the previous version i had to disable shadows because it was so expensive. now that's really fast.

#

did anyone open up a subscene and moved something around? that's happening at like 1 fps. opened up Section_00 and moved Wall_Section_00 around.

robust scaffold
viral sonnet
#

hm, why would it bake constantly?

robust scaffold
robust scaffold
viral sonnet
#

most of the vertices budget is achieved through instancing. it's really not that impressive imo

robust scaffold
#

If you need to change something, type the value in directly. It'll still bake on every key stroke but that's far less than on every vector mouse movement.

viral sonnet
#

hm, that constant baking feels like a design mistake.

#

be done, save -> bake

#

we can turn that off, right?

robust scaffold
#

Yeah. Disabling the live baker should be an option. Type internal into the editor version window

#

Then instead of enabling live baking, disable it. That should (should) disable baking until you press play

viral sonnet
#

ok, i hope unity realises that this live baking isn't working out.

robust scaffold
viral sonnet
#

that scene raytraced could be pretty cool

#

(just before crashing i took the screenshot) - i feel like this should go on for about 4 times. that would wow me πŸ˜„

#

but i'm probably unfair here. the scene is REALLY dense with detail

robust scaffold
viral sonnet
#

anyway, i appreciate such a vertical scene. more horizontal would have been still better

#

especially because it's more realistic for a game scenario and there are new challenges

#

loading a subscene is freaking fast. that's for sure

robust scaffold
#

And far more traffic. At least the video I saw of it on the forums had the scene very empty. Or at least only a handful of cars

viral sonnet
#

yeah, overall it's quite a shame they didn't make it more in a blade runner style. the skybox is bland AF

robust scaffold
#

TBF, I think it's only 1 guy. Maybe a team of 2.

viral sonnet
#

i'm pretty sure more than 2 were working initially on the scene. the scene is the same as it was in 2019

#

there was a video about the art of megacity back then. if it was really just 1-2 devs it's very impressive

robust scaffold
#

Oh yea, the initial megacity definitely had an entire small studio behind it. Maintaining it for 1.0 is, my guess, a lot smaller

rotund token
#

and better yet, how many are hidden

viral sonnet
#

the reduced draw calls and how fast it processes a frame on the cpu is certainly an impressive feat. with the heavy use of instancing, the amount of verts don't say much though. there's a lot of repetition.

rotund token
#

5,000 draw calls is still a lot

viral sonnet
#

that's pretty cool

#

not that many batches though

#

a shadow cascade renders in around the same amount of batches (~25)

#

i hope i don't make the wrong assessment but that's my main point here: there's hardly any variation and not really representive of any real game world. the batches count in the stats window seems like total bogus.

#

most games struggle with too much unique graphic prefabs and there's really no good benchmark for this

#

if i see anything on the scale of AC valhalla from any studio i'll shut up πŸ˜…

#

but 80mb of mesh data impresses me just as much as the infinite detail demo that was floating around several yeara ago

#

time will tell how good and far this can be pushed

rustic rain
#

Random colors

#

For example

#

Or batched material that can switch texture by index

safe lintel
#

that live baking is awful on my pc in megacity

robust scaffold
#

Question for the netcode folks because I'm too lazy to test myself, can I delete prespawned ghosts and then unload the scene they're a part of?

#

And question for dots in general, how do I save changes to subscenes that occurred at runtime so that if I reload that subscene, those changes get reapplied.

robust scaffold
#

Also for netcode: how do I sync physics body and mesh changes?

weak delta
#

Hellu, I'm trying to generate a bunch of meshes through the job system and the new advanced mesh api. I got the whole system working with a single mesh data extracted from Mesh.AllocateWritableMeshData(1), which is pretty nice. Now I wanted to generate multiple of those, so my plan was to change that 1, to let's say 10, create a single jobhandle for each of the items on the array, and then via JobHandle.CompleteAll or JobHandle.CombineDependancies(thearray).Complete() run each of the jobs

#

However, im getting an error like this, and I don't quite understand, how is that possible, the error comes from assigning data to the meshdata of the job

#

Are each of those meshdata not independent from each other? (so that modifying one doesn't affect the others), or must it be done another way? (instead of passing the mesh data to the job, pass the mesh data array as a whole)

#

As for reference

devout prairie
#

annoying that there is no OverlapBox or OverlapSphere in unity.physics, only OverlapAabb

devout prairie
#

unless i'm being an idiot and missing something in the api

robust scaffold
#

Yea... it's annoying

devout prairie
#

some of the colliders have this stuff, but i'm not even sure why/what..

robust scaffold
#

To be honest, I don't know if those work

devout prairie
#

say i wanted to do simple overlap box regularly, using different sizes.. i'd have to create a box collider each time for that? i must be missing something here

devout prairie
weak delta
#

No worries, and thanks ☺️

grizzled nexus
devout prairie
#

should be clearer in the docs, i literally searched the whole package in vs and still couldn't find that

#

just happened to see this in the forum:

grizzled nexus
#

I looked through the physics documentation and saw something that I did not notice before

#

and now I'm wondering how to use it

misty wedge
#

What do you mean?

grizzled nexus
misty wedge
#

... to all the underlying query algorithms ...

#

You can use the algorithms without using their implementation of the state system that makes them actually do something

#

(Collision / Physics World)

#

That's why the bit about ... directly if desired without allocating memory...

#

is there

#

Basically it's written in a way that lets you reuse their algorithms to write your own implementation of a physics system if you want

#

Any idea what's up with this? [Worker0] 2 entities in the scene 'ClientAndServer' had no SceneSection and as a result were not serialized at all.

robust scaffold
misty wedge
#

I feel like sometimes something breaks with netcode prediction.

#

Everything worked, and then suddenly the delta time in the prediction loop isn't correct anymore for some reason. Then I stashed, it worked again, popped the stash, and it worked again...

#

And when this behaviour pops up, it always runs faster on the client than it should

rotund token
pliant pike
#

yeah I'm pretty sure I used that

rotund token
#

Also there is overlap box

#

OverlapBox(float3, quaternion, float3, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)

#

And capsule

#

And they even added sphere even though it's a duplicate

#

OverlapSphere(float3, Single, ref NativeList<DistanceHit>, CollisionFilter, QueryInteraction)

devout prairie
#

yeah i just hadn't spotted these methods in World.. it's specifically OverlapBox i wanted just for a simple oriented box check

misty wedge
#

I can't decide if I should flatten my graph for runtime execution or if I should keep node state for things like sequencer or repeat nodes...

tired mulch
#

Is there a way I can only get the entities with a specific component that is disabled in my IJobEntity Execute method?

misty wedge
#

You want a specific component to be disabled?

#

(and for it to skip entities with that component enabled?)

tired mulch
#

I already have it disabled. I just want a system to only find the disabled ones, in contrast to the enabled ones

misty wedge
#

Yes, that's what I meant

tired mulch
#

Yee

misty wedge
#

I would use an IJobChunk and disable enable-filtering

#

then check if the component is enabled, and if it is, skip the entity

tired mulch
#

ah alright, thanks

#

Is a workflow of enabling and disabling components often a reasonable approach in general?

#

In contrast to using tag components etc

misty wedge
#

Depends on what you are doing

#

It doesn't require a structural change, while tag components do

tired mulch
#

Indeed

misty wedge
#

In general if you often change the enabled / disabled state use an enabled component, if it's very rarely use a tag

#

The advantage of tags with rare changes is you have better chunk utilization

#

Since the disabled entities still reside in the chunk

tired mulch
#

Right

#

Very new to ecs, and have done OOP my entire life, so I'm testing about and thinking about what system should be responsible for what etc

#

It's interesting though

#

Are there any approaches to running jobs or update components on Entities that resides on another Entity's buffer?

#

Like operating on the components for each Entity in the Child buffer for a parent as an example

misty wedge
#

Sure, just get the buffer and iterate over the entities in it. If you want to do it in parallel you will have to chain jobs since the lookups don't allow parallel access

#

(unless you disable safety and are very careful)

tired mulch
#

I see I see

rotund token
robust scaffold
#

Hrm, NativeArray.Length prompts float vectorization yet DynamicBuffer.Length doesn't????

viral sonnet
#

use asNativeArray with a DB and it should

robust scaffold
#

Trying that now

#

There we go, yea it's odd.

viral sonnet
#

i think the reason is that it's not clear whete the starting pointer is on a DB. it first has to evaluate that

#

see getPointer method

robust scaffold
#

Burst doesnt recognize this for loop as a memcpy operation. Annoying.

rotund token
#

Isn't there a native array.copyfrom method you can use

safe lintel
#

am I failing to find it or are there zero mentions of companion objects in the entities docs?

rotund token
#

wouldn't surprise me if there was no mention of it

robust scaffold
#

Using an intermediate var improves unrolling?

balmy thistle
#

We have always been at war with companion objects

robust scaffold
balmy thistle
#

might think they alias

#

also hoist the length variable into a constant

robust scaffold
#

Burst should recognize that nothing aliases, or at least nothing on both sides of the equal sign.

robust scaffold
robust scaffold
balmy thistle
#

I'm not sure how good the analysis is that m_Length won't change in the scope of the loop

robust scaffold
#

Burst in my experience seems really good at recognizing things that happen with NAs and only NAs. It's these dynamic buffers that are so problematic.

rotund token
#

doesn't NativeArray Length

#

already get wrapped in this

robust scaffold
#

Not immediately returning the length.

#

I dont know if jetbrains decompiler can show attributes though

rotund token
#

hmm it might be because it's built into unity

#

not part of collections

robust scaffold
#

I dont think NAs throw with 0 sized initialization? Maybe? Never tried it.

rotund token
#
        {
            get
            {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
                AtomicSafetyHandle.CheckReadAndThrow(m_Safety);
#endif
                return CollectionHelper.AssumePositive(m_ListData->Length);
            }
#

for example native list

robust scaffold
#

You can have a 0 sized NA.

rotund token
#

but i feel like this would be handled for NA

rotund token
robust scaffold
#

Assume positive returns >= 0. I'm assuming >= 1.

rotund token
#

i know

rotund token
robust scaffold
rotund token
#

they look like they're initializing from dynamic buffers converted to native arrays

robust scaffold
#

Yea, and then the pointers come from the NA. I'll stick the for loop into a static method to make sure.

robust scaffold
covert lagoon
#

Where?

robust scaffold
#

Here

covert lagoon
#

πŸ€”

#

Where was that announced?

robust scaffold
#

Forums.

covert lagoon
#

Found it, thanks.

robust scaffold
#

Yea, it might have something to do with aliasing.

#

Just stuck [NoAlias] everywhere and it 4x unrolled.

rotund token
#

was literally about to suggest you to do this

#

because i just tested it myself with NoAlias

robust scaffold
#

I wish more of unity objects had native array access points.

robust scaffold
#

This does result in a 4x float unroll.

#

I wonder what is the maximum number of properties allowed in a IJE?

#

But yea, I think this is where I start using aspects to wrap all the Atm buffers...

robust scaffold
#

@rotund token Have you done any benchmarks on seeing if either of these methods are faster?

#

The former reuses the boolean condition and burst compiles it into a VP operation but just 1 op per packed float. The latter unrolls into 4x VP comparison operations but requires recomputing the boolean check again and again.

#

WallCheckOdd()

#

WallCheck()

rotund token
#

i find my intuition always wrong on similar stuff -_-

robust scaffold
#

I trust yours more than mine

#

Im leaning towards WallCheck() for 128 byte cache line wide operations vs just 32 byte per packed operation.

#

This is the oddest comparison check I've ever seen. No clue what burst is doing here. The previous samples were when Flags was a byte, this is Flags as an int.

#

Tertle, if you're up for more benchmarking...

#

Flags as a byte results in identical burst as if Flags was a bool so I'm assuming that the 2nd burst sample from above with a byte is faster than the 3rd using an int.

rotund token
#

working atm unfortunately

#

would love to look at some burst stuff, been ages

viral sonnet
#

eww new discord font

viral sonnet
#

and back to old font. Better Discord is great πŸ˜„

devout prairie
#

dummy question time:

#

i'd like to get an array of values for a specific key from a nativemultihashmap

#

so that i can use indexing on it to query values ( rather than using the enumerator )

#

the problem is nativemultihashmap only has a method to return the entire value array for all keys

#

and i'm not sure how to get a start index on that array for the specific key

#

is there some way to just get a nativearray of the values for a specific key?

frosty siren
#

Should I process NativeArray.Copy in parallel? Is there any performance gain?

devout prairie
#

so i can't think of it in terms of being a 'dict of arrays', because it's not that

dense crypt
#

I've been thinking about this over the weekend a bit and I'm not sure I follow. Do you mean that you store these containers in components? If so is that allowed, I thought you couldnt put native collections in components?
Or do you have some global state thing? If you wouldn't mind could you provide a very small example? πŸ™‚ Trying to implement a similar system but getting stuck on where to store these containers to manage dependencies

viral sonnet
#

sure, i got to watch the kid for a bit. afterwards i can show you how it's done. and yeah, nativecontainers are allowed now in IComps since managed DisposedSentinel is gone.

viral sonnet
#

it's not stored in sequence so NA is only possible with copying

dense crypt
viral sonnet
#

the same concept works with icomp class

weak delta
#

Can someone explain this bug?

#

It works fine without burst, doesn't like it when I enable burst compilation

safe lintel
#

dang woke up all excitied for the dev day q&a and then saw it wasnt today 😒

balmy thistle
#

Is there a specific question you're looking to ask?

safe lintel
#

I have a few, also hoping to see other answers to questions that I hadnt thought of

weak delta
#

When is it?

balmy thistle
#

The 8th

weak delta
#

nice

viral sonnet
# dense crypt I've been thinking about this over the weekend a bit and I'm not sure I follow. ...

Here's my setup:

I have a write system that has a disabled OnUpdate, running in an Initializatio group

public partial struct SpellCastSystem_CreateWriteStream : ISystem```

In there I have structs that hold NativeContainers that are accessed from other systems for reading and writing
```public struct SpellJobData : IComponentData
    {
        public ParallelList<CreateSpellData> createSpellsParallelList_SpellCastJob;
        public ParallelList<CombatEvent> combatValueParallelList_SpellCastJob;
        public ParallelList<ThreatEvent> threatValueParallelList_SpellCastJob;
        
        public ParallelList<DelayedSpell> createDelayedSpellsParallelList;

        public void Clear()
        {
            createSpellsParallelList_SpellCastJob.Clear();
            createDelayedSpellsParallelList.Clear();
                
            combatValueParallelList_SpellCastJob.Clear();
            threatValueParallelList_SpellCastJob.Clear();
        }

        public void Dispose()
        {
            createSpellsParallelList_SpellCastJob.Dispose();
            createDelayedSpellsParallelList.Dispose();
            
            combatValueParallelList_SpellCastJob.Dispose();
            threatValueParallelList_SpellCastJob.Dispose();
        }
    }```
(just change struct to class in 0.51)
    
OnCreate handles allocation and OnDestroy just Disposes.
#

The struct is then added to the system entity via
state.EntityManager.AddComponentData(state.SystemHandle, spellJobData);
(Not available in 0.51, just create an entity yourself instead)

Now the important part:
Set the singleton dependency of read and write in OnCreate of a system. That makes sure the system has the right dependencies. Works for read and write.
For example:
SystemAPI.GetSingletonRW<SpellCastSystem_CreateWriteStream.SpellJobData>();
(SystemAPI doesn't exist in 0.51, GetSingletonRW works just as well)

In OnUpdate just get the singleton then:
var spellJobData = SystemAPI.GetSingleton<SpellCastSystem_CreateWriteStream.SpellJobData>();

Then the different containers can be used for jobs.

#

to get managed IComps use the extension method for it, which you can access via this.GetSingleton

dense crypt
viral sonnet
#

yeah sure

weak delta
#

Does anyone have an example of using the advanced mesh api in a more complex way than what the docu does? Trying to modify multiple meshdata in a job, where the parallization is achived per vertex instead of per mesh.

mystic mountain
frosty siren
#

How can I get NativeArray<TComponent> from EntityQuery without generic parameters?

dense crypt
frosty siren
# dense crypt What do you want to get? if you wanna use dynamic component you need IJobChunk a...

In general I want to get whole component data array and copy it as is to ComputeBuffer. So if I know <T> I can do EntityQuery.ToComponentDataArray[Async](Allocator, out JobHandle).
And it seems there is no overload for non-generic (ComponentType based) method.
I seek for such method overload because every time we use generic methods with EntityManager/EntityQuery it creates ComponentType inside. But I already have one, and I don't want to rewrite whole code hierarchy or rewrites dots source

dense crypt
# frosty siren In general I want to get whole component data array and copy it as is to `Comput...

Yeah in this case you need access to the Chunk to pull out NativeArray<byte> of your components. I suppose you can do it using manual chunk iteration directly in OnUpdate, but here's how you would do it in a job:

protected override void OnUpdate()
{
    var copyJob = new CopyJob
    {
        Dynamic = GetDynamicComponentTypeHandle(ComponentType.ReadOnly(123)),
    };
    copyJob.Schedule(default);
}

public partial struct CopyJob : IJobChunk
{
    public DynamicComponentTypeHandle Dynamic;
    
    public void Execute(ArchetypeChunk chunk, int chunkIndex, int firstEntityIndex)
    {
        var byteArray = chunk.GetDynamicComponentDataArrayReinterpret<byte>(Dynamic, 456);
                //Do whatever
    }
}
frosty siren
oblique cosmos
#

Does a documentation about the new transform system exist somewhere? If so, where might one find that?

dense crypt
frosty siren
pulsar jay
viral sonnet
#

apparently it is. but i haven't seen it in action nor had time to learn it

frosty siren
#

what happened with NativeParallelMultiHashMap in 1.0? Can't find in changelog or in upgrade guide?

#

it just NativeMultiHashMap 😞

safe lintel
viral sonnet
delicate swan
rotund token
weak delta
#

In theory I should be able to do it per mesh, but that means rewriting everything

#

And now everything is parallelized, per mesh and per vertex, so i think it's the way to go

delicate swan
delicate swan
true mirage
#

How to call the native list method not the IEnumerable one?
IndexOf
It says there is a box allocation because of conversion between NativeList and IEnumerable

weak delta
#

But i think i cant do it because the advanced mesh api requires to be called from the main thread

delicate swan
delicate swan
#

You don't actually have to call .Complete on jobs to finish them, scheduling is enough to get them run, calling .Complete is just a way to force the main thread to halt until the jobs done

true mirage
#
 public static int IndexOf<T, U>(this NativeList<T> list, U value) where T : unmanaged, IEquatable<U>
        {
            return IndexOf<T, U>(list.GetUnsafeReadOnlyPtr(), list.Length, value);
        }

Generic with T and U !

#
items.IndexOf<TSource,TSource>(item)

WTH

#

Now, it works

weak delta
misty wedge
#

Can I rely on the backing field of an auto property to be at the field offset the auto property is at in the struct in a burst context?

misty wedge
#

Or should I explicitly define the property with e.g. a private struct field

robust scaffold
misty wedge
#

FieldOffset does nothing if I don't set the structlayout to explicit right?

robust scaffold
#

This attribute is used when System.Runtime.InteropServices.StructLayoutAttribute, with LayoutKind.Explicit passed to its constructor, is applied to a class or structure to specify the offset of each non- static or constant member within the unmanaged representation of that class or structure.

#

So yea, without Explicit, it does nothing.

misty wedge
#

Alright, guess I'll implement the property then

robust scaffold
#

I mean, you can try it and see if it works

misty wedge
#

Someone over in the C# discord said it might not work on mono

robust scaffold
#

I just use direct fields every time and skip any ambiguity or C# managed nonsense but if it works, go ahead.

misty wedge
#

Not sure how burst handles this

rotund token
misty wedge
#

Yeah I think I'll just do it manually to be safe

robust scaffold
#

Huh, how do I have an aspect with dynamic buffers? Just not possible?

#

Oh wait, i just dont use refRX

gusty comet
#

Does com.unity.entities.graphics not exist anymore? Trying to get DOTS set up after a long hiatus and I'm just at a loss for how to properly set up the project. I'm getting "unable to find package with that name"

robust scaffold
#

Are you on 2022.2 F1?

gusty comet
#

...I've managed to launch the project in 2021.3 despite freshly installing 2022.2 for this purpose

#

thanks πŸ˜…

viral sonnet
#

oh you need an element, nvm then πŸ˜„

#

i think IndexOf just does a for loop, might put it in a hashmap when it's called in a hot path

true mirage
#

First, NativeList then test HashMap πŸ™‚

#

Another big problem for me is code duplication when I use job system.
I cannot use Delegates (Func/Action), interface, inheritance :/

#

For example my path finding template is similar but with different delegate (func arguments) for weight calculation, obstacle check, target check, node extension, etc.

#

In OOP approach, I can send Func arguments with different implementation to that FindPath method

PathResult result1 = FindPath(...,CalculateWeight,CheckTarget,CheckObstacle);
PathResult result2 = FindPath(...,CalculateWeight2,CheckTarget2,CheckObstacle2);
rotund token
#

There are plenty of different ways to handle this in dots

#

You can literally pass function pointers if you want the same workflow, though they aren't going to be as efficient for small delegates

#

Probably better to use helper structs and interfaces

true mirage
#

Send refs to structs?!

rotund token
#

FunctionPointer<MyDelegate>

true mirage
rotund token
#

it's not inefficient

#

well it can be

#

it has the overhead of a native call

#

so if it's something like

    [MonoPInvokeCallback(typeof(Process2FloatsDelegate))]
    public static float MultiplyFloat(float a, float b) => a * b;```
#

then yeah it's not going to be that efficient

#

but if you have a bunch of logic in there it's not really an issue

#

anyway an alternative is just make it generic/interfaces

true mirage
#

To have less changes, I test FunctionPointer first, Cool and then if it is not desirable, change my way

rotund token
#
            where TW : unmanaged, ICalculateWeight
            where TT : unmanaged, ICheckTarget
            where TO : unmanaged, ICheckObstacle```
true mirage
#

In these methods, there are bunch of conditions to check if the current node is target or obstacle

rotund token
#
        {
            float Calculate(int x, int y, int z);
        }

        public interface ICheckTarget
        {
            bool Execute(Entity target);
        }

        public interface ICheckObstacle
        {
            bool Execute(Entity obstacle);
        }```
#

you can put anything you want in there

true mirage
#

Some conditions require scriptable objects stats.
I think switching to Job system can propagate changes in my entire codes

rotund token
#

well obviously you can't* read SO directly

true mirage
delicate swan
#

Wait, are arbitrary struct methods accessible in burst compiled job code?
I thought only static function calls were allowed, which is how Native* types got around that,

rotund token
#

Not sure what you mean?

delicate swan
#

Like, I thought you couldn't use actual real instance methods from an interface struct in burst (because the arbitrary code that could be run and burst being all pre-compiled look ahead optimization stuff).
The predefined native types have static extension methods for sugaring, but arbitrary non-static methods on structs was a no-go

robust scaffold
#

You can even have managed classes sent into a (non-bursted) job using a GC pointer.

delicate swan
rotund token
#

(technically you can even call managed class methods inside burst if you want to get real dirty)

robust scaffold
rotund token
#

you can do a lot with
Marshal.GetFunctionPointerForDelegate

#

but not something you should be doing anyway

delicate swan
#

I was so deep with blinders on, I was trying to get source generators to work so I could create a switch that linked fixed length strings to static methods on particular structs, all sorts of overcomplex, glad I saw gladiators question, thanks for all the info on this

rotund token
#

I'm getting so many burst corruptions and crashes atm

#
This Exception was thrown from a function compiled with Burst, which has limited exception support.
0x00007ff7026706fd (Unity) burst_signal_handler
0x00007ff809428b4c (ntdll) RtlDeleteAce
0x00007ff8094012c6 (ntdll) RtlRaiseException
0x00007ff809450f4e (ntdll) KiUserExceptionDispatcher
0x00007fff921e84cf (9c33427477f2fcf9f52aa87bcd77068) Unity.Physics.Systems.CreateJacobiansSystem::Unity.Physics.Systems.CreateJacobiansSystem.OnUpdate (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.physics@1.0.0-pre.15/Unity.Physics/ECS/Base/Systems/UnityPhysicsSimulationSystems.cs:271)```
basically this, but for every system. turning burst off, no errors. clearing library, no more burst nulls
#

all my function pointers corrupt randomly

#

maybe related to this changelog

With the relaxation in Unity 2022.2 or newer that we can call CompileFunctionPointer from a background thread, we now use this mechanism in Burst to handle Direct Call methods, resulting in a cost saving during Domain Reload.

delicate swan
#

Ok, I'm running into type constraint issues, might as well get outside opinions about how to do this before I go down another rabbit-hole;
I'm trying to create some sort of <Identifier, BucketOfCode> map that basically creates an entity with a specific archetype given a specific user-input identifier, be it a string, number, whatever
The problem is I want it to be job system / ecb accessible, and while writing no-local-side-effect methods is fine, I'm having trouble actually creating the data-representation that satisfies the job system type constraints, if its even possible.

rotund token
#

how many combinations of user inputs are there

delicate swan
#

and id + a hashmap of named float values that represents settings for the archetypes components,
my goal was to have a interface or something that essentially took the proper data in and applied all the proper ecs components and settings from the named float map, for the matching identifier

#

So like, if I had a string id of "common.box" and a settings map of {"a":1.0}, the creation map would grab the logic for the matching identifier, which would do something like entity->addComponent(CommonBox {a = settingsMap["a"] })

delicate swan
rotund token
#

i'm just trying to figure out if you had a fixed set of user created stuff
but it doesn't sound like you do

frosty siren
#

does idiomatic foreach only executes on main thread?

rotund token
#

yes

frosty siren
#

so if I want to use ISystem in 1.0 the closest API for Entities.ForEach is IJobEntity?

delicate swan
rotund token
frosty siren
devout prairie
#

i wish for the love of god unity would fix the damn search function on both A) the package docs and B) the forums

#

it's like being back in 1998

devout prairie
#

it's an additional layer

viral sonnet
#

IJE and IJobChunk are not that far apart as they once were. (still prefering IJC)

devout prairie
#

doesn't return everything on the forums generally

safe lintel
#

I wish we didnt have package docs split into a million different places. old unity manual was so much better than having to type in com.unity.xpackageblahblahblah

#

also package doc format still doesnt read as well as the old docs imo

devout prairie
#

searching something in package docs works for me maybe 50% of the time, half the time it's just blank

safe lintel
#

yeah that too unfortunately

robust scaffold
#

The search in package docs really needs to be by content and not by section title. Burst is pretty bad in that regard (along with missing docs in the first place)

devout prairie
#

kindof crucial if they want adoption, devs can hit the ground running and not have to hunt down basic info

robust scaffold
#

Burst actually lost the docs for valuetuple support. Burst still does support it but you'll need to go back to 1.5 docs to find out the limitations

misty wedge
#

Does burst build a jump table for a pattern matched enum?

robust scaffold
misty wedge
#

Did you test with a pattern matched switch?

#

I don't know if they are handled differently πŸ€·β€β™€οΈ

#

And I can't find anything in the docs

robust scaffold
#

It's something ya gonna have to code and then inspect. Let me find my old switch statement

#

This compiled into something that resembles a jump table. It was noticeably different from a if else branch.

#

As for pattern matching? Maybe not. The enum itself was a bitflag table.

misty wedge
#

I'm not an assembly guru, but this seems too short

#

for this

#

(at least it doesn't look like an if else branching scheme)

robust scaffold
misty wedge
#

Is there no way to search? pensive

robust scaffold
#

At the bottom of the inspector, there's a search bar

#

press enter to move through the matched keywords

misty wedge
#

I think I'm blind, I don't see a search bar

robust scaffold
#

Are you on burst 1.6?

misty wedge
#

1.7.4

robust scaffold
#

At the very bottom

misty wedge
#

I don't have that 😬

robust scaffold
#

I think the search actually came 1.8... It was decently recent.

misty wedge
#

What version are you on?

robust scaffold
#

1.8.2

misty wedge
#

Guess I'll update πŸ€·β€β™€οΈ

viral sonnet
#

burst has been stable so far for updating

robust scaffold
#

TBH, burst has never crashed on me. It's always whatever they're doing in DOTS land.

misty wedge
#

There was a pretty serious bug in 1.8.0 iirc where the burst cache sometimes didn't refresh correctly

robust scaffold
#

True, that was also 1.7.1. Very annoying

misty wedge
#

The reason I was asking is because I am probably going to end up with a lot of cases in that switch statement, and wanted to know if that could be an issue

robust scaffold
misty wedge
#

I also always make sure to write all of the other code so slow that these tiny optimizations would never matter in the first place jamcat

robust scaffold
#

Learning the little optimization tips here and there and it'll all add up in the end.

misty wedge
#

It's just a hobby for me so it's more about understanding, but you're right πŸ‘

robust scaffold
misty wedge
#

Yeah that's kind of the fear I have. I love games, but I also love working on my own stuff πŸ€·β€β™€οΈ

#

Maybe one day after I've rebooted the same project for the 50th time jamcat

robust scaffold
#

Because I dont know how to continue a git repo after switching primary folders...

misty wedge
#

wdym?

#

Naming entities?

robust scaffold
#

Yea. I think it's a toggle. I want it turned on so that entities aren't just Entity(21213,321)

misty wedge
#

I used to name them a long time ago, but there was an issue where the naming function wasn't allowed in a build

robust scaffold
#

Just for now, I need to make sure my buffer generated properly.

#

Oh yea, it's not allowed in build but I need to check in editor.

misty wedge
#

Is there a toggle or something now? It doesn't even show the name for me if the entity is derived from a prefab entity

robust scaffold
#

This but I've never seen this work...

#

It's not disabled or anything.

misty wedge
#

And the text is supposed to replace the Entity(Index,Version) drawer wherever that appears or what?

robust scaffold
#

yea

misty wedge
#

It also doesn't work if you call EntityManager.SetName?

#

Because that works for me

robust scaffold
misty wedge
#

Weird

#

It even works in referenced fields for me

robust scaffold
#

No clue then. I must have disabled something

misty wedge
#

I've had this happen too

#

I noticed that this coincides with the prediction breaking, I just missed the error message yesterday

robust scaffold
#

I thought it was just havok (because despite having the package, I forgot to enable it...)

misty wedge
#

No, I think it just stops syncing the data back to the client, and since I use delta time in my prediction loop the client starts running "too fast" since it's not getting the old elapsed time from the synchronized buffer

robust scaffold
#

ah, no clue then

#

Yea, now that i zoomed way in to verify sliding, havok vibrates a lot more when moving physical objects. It can function with netcode but definitely not the best with it sadly

misty wedge
#

I still use character controllers with everything since I don't want to deal with physics πŸ˜…

#

luckily my project is 2D, so it's mostly very simple

robust scaffold
robust scaffold
misty wedge
#

I looked at it a bit, but it was way too overkill for what I'm doing, so I kind of hamfisted together my own

#

It works pretty well now, but I had no idea what I was doing so it was mostly trying stuff out until it works

robust scaffold
#

Yea. I hacked together my own controller using a dynamic and a slightly smaller kinematic body to prevent players from directly pushing players (really jank over netcode) but it doesnt work if a player uses another object in between to push.

misty wedge
#

Yeah I don't have any of those physics interactions, that's why my controller is really simple. You can't push stuff at all

robust scaffold
#

I was thinking about using the dots controller but yea, it was completely overkill. My camera just follows the XY position, none of that orbiting stuff.

misty wedge
#

The only reason I really went for a character controller is back then netcode had no support for physics at all, if it did I might have tried getting physics to work

robust scaffold
#

I want to use it since it mentions that the player it purely kinematic but can respond to dynamic bodies allowing a player to not get pushed by anything but still get blocked by walls but it's just too big.

misty wedge
#

Yeah I basically just have kinematic bodies

#

My collision cases are also relatively simple, since I usually have walls at right angles

robust scaffold
#

Can your kinematics hit other kinematics? 3D kinematic just results in them phasing through each other

misty wedge
#

You mean like two players walking into each other?

robust scaffold
#

yea

misty wedge
#

It will be like hitting a wall. I've not tested it much, but I think that's how it works since I had an issue when benchmarking my pathfinding where some actors would get stuck because two actors would walk along a path in opposite directions and "meet" in the middle, and then just keep walking against each other

robust scaffold
#

Huh, are you using dots physics?

misty wedge
#

Yeah

#

(the non-havok version)

#

This is what happens if you walk against another actor

robust scaffold
#

I will need to do some tests again because when I tried kinematic - kinematic, it just phased through

misty wedge
#

The colliders are just small spheres

robust scaffold
#

Huh, mine phases through. What are you setting to move?

misty wedge
#

What do you mean?

robust scaffold
#

Here's my movement code. I'm setting linear xy

misty wedge
#

I only use dots physics for collisions, the entire decollision stuff I wrote myself (thats the hacky bit I mentioned earlier)

robust scaffold
#

ah

misty wedge
#

Like I said, I went this route because back then netcode had 0 support for any kind of physics stuff

#

Might be tricky to add more interactive stuff like pushing, but I can live without it for now

#

A lot of my collision cases are also relatively simple, for example walls are often at right angles locked to a grid

robust scaffold
#

Mine's gridded as well. Although i'm just using a static cube for every tile.

misty wedge
#

I'm basically doing the same, since ECS has no support for tilemap collision of any sort. So all collidable objects are ghosts synced by the server

robust scaffold
misty wedge
#

I need the entities anyway since e.g. building walls can have HP and be destroyed, so it works well enough for me

robust scaffold
#

This is maybe the one occasion where I do recognize that making colliders a blob asset is logical.

misty wedge
#

I thought they even have the option to make them unique now?

#

I set the collider for non-actor entities dynamically at run time, so I haven't looked at the authoring for physics shape in some time, but I remember seeing that there

#

Although I guess it's still stored in a blob

#

But at least it's easier to modify if you need it πŸ€·β€β™€οΈ

robust scaffold
#

Yea, it's just a unique blob asset

misty wedge
#

I'm off to sleep πŸ‘‹ have a good one

robust scaffold
#

Does anyone know how to get a RO dynamic buffer in an aspect?

#

Ah, using the [ReadOnly]

gusty comet
safe lintel
#

nothing official

#

what shader did you use? shadergraph should support a skinning node cant remember the name, for a custom shader essentially need a skinmatrices buffer for any custom shader to work and skinning function

gusty comet
#

I tried making a URP shadergraph shader and adding the Compute Deformation and Linear Blend Skinning nodes. Neither seemed to work.

#

I don't necessarily mind writing a custom solution. But gameobject proxies are a non-starter for performance reasons, and I'm not entirely sure where to even start otherwise.

safe lintel
#

there should be a deformable skinned mesh with that, but are you looking for animations to be played and a converted animator?

gusty comet
#

Yeah animations are all I'm needing out of it. Don't even necessarily need an animator controller on them if I can manually push updates instead.

safe lintel
#

best bet is a 3rd party solution, theres a post on the dots animation forums about community efforts

#

basically all that happens currently is a skinned mesh that is rendered in dots, but nothing else. you would have to manipulate the various buffers yourself to make anything move.

gusty comet
#

Would be nice to avoid that rabbit hole, but I am curious about whether the granular control over that system could allow for some extra optimization.

viral sonnet
safe lintel
#

man I dont get it. spent a number of days getting terrain to render while subscenes were open(either through meshes or custom shader work or duplicating the gameobject) and for some reason they are visible in subscenes now after some inexplicable change

#

live conversion should be on to my knowledge

viral sonnet
robust scaffold
#

In the preferences near where you can clear entity cache, there should be a toggle between runtime and authoring scene mode.

safe lintel
deft ridge
#

Does anyone know how to find an entity in selection.activeObject

#

In version 0.51, I saw that the api could use the EntitySelectionProxy, but 1.0 had been made private

#

And Selection.activeObject as EntitySelectionProxy is not valid

deft ridge
#

it was 0.51

#

is was 1.0

rustic rain
#

ah

#

reflection it is then

deft ridge
#

Even if that's the case Selection.activeObject as EntitySelectionProxy is not valid

#

i try use .asmref by

#

Unity.Entities.Editor

rotund token
#

asmref should work fine for this

#

i'm not exactly sure why they made this internal, it limits 3rd party debugging tools

deft ridge
#

Yes, it limits third parties

#

After my tests, Even with the EntitySelectionProxy, when you click on entities Hierarchy instead of system and obj Selection.activeObject as EntitySelectionProxy Still invalid

#

And confused why do they need to display system

deft ridge
#

seemingly This is a gross hack to work :<

#

in asmref

late mural
#

just making certain noise.snoise() returns a number between 0 and 1 right?

trail valve
#

Hi guys, when I use a container with type NativeHashMap<FixedString64Bytes, NativeArray<Entity>> in Entity.Foreach().WithReadOnly(container ).ScheduleParallel. It throw this error

InvalidOperationException: The Unity.Collections.NativeHashMap`2[Unity.Collections.FixedString64Bytes,Unity.Collections.NativeArray`1[Unity.Entities.Entity]] AbilityPoolManagerSystem_69C715D_LambdaJob_0_Job.JobData.abilityNameToLevelPrefabs can not be accessed. Nested native containers are illegal in jobs.

Anyone know what does this mean and how to fix it? Thank a lot

#

one more strange thing, I already used this container NativeParallelHashMap<Entity, NativeHashMap<FixedString64Bytes, ModifierDataAggregator>> in ISystem combine with IJobEntity, it's working well

rotund token
#

nest native containers are not allowed

#

you're putting a native array inside a native hash map which is not allowede

#

however good news for you is there is a NativeMultiHashMap

#

which serves this purpose, 1 key many values

#

(could be called NativeMultiParallelHashMap depending on your version)

trail valve
#

thank, but I'm still confuse that I already use nest native container in ISystem and IJobEntity, it still work well

#

here is demo

late mural
rotund token
#

-1 to 1 is pretty common for noise generators

late mural
rotund token
#

Sometimes they'll slightly exceed this though depending on generator

late mural
frosty siren
#

is it possible to use ISystem with injected EndSimuldationCommandBufferSystem?

crystal zephyr
#

Hello everyone,
can somebody help us with that problem? We discovered a lot of crashes on Android devices with that Backtrace:

pid: 0, tid: 0 >>> com.x.y <<<

backtrace:
#00 pc 0x000000000014bc24 /data/app/owUsh5iYJ-TixM9pCZZB3Q==/com.x.y-RklAZwOgND4TL3mbHgNN-w==/lib/arm/lib_burst_generated.so (Unity.Entities.ChunkIterationUtility._mono_to_burst_RebuildChunkListCache+66)
#01 pc 0x000000000014bbdd /data/app/owUsh5iYJ-TixM9pCZZB3Q==/com.x.y-RklAZwOgND4TL3mbHgNN-w==/lib/arm/lib_burst_generated.so (e3caa53b77215624d27495c08356903b+4)
#02 pc 0x00000000035a13c0 /data/app/owUsh5iYJ-TixM9pCZZB3Q==/com.x.y-RklAZwOgND4TL3mbHgNN-w==/lib/arm/libil2cpp.so (EntityQueryData_GetMatchingChunkCache_mE98F4FC1F9B2C7729C2AA005F3B2BFA5DE77BA95)
#03 pc 0x00000000036125e4 /data/app/owUsh5iYJ-TixM9pCZZB3Q==/com.x.y-RklAZwOgND4TL3mbHgNN-w==/lib/arm/libil2cpp.so (EntityQuery_get_IsEmptyIgnoreFilter_m628A520DC22266879360F1FA17B36ACFFD14CDE6)
#04 pc 0x00000000035bc120 /data/app/owUsh5iYJ-TixM9pCZZB3Q==/com.x.y-RklAZwOgND4TL3mbHgNN-w==/lib/arm/libil2cpp.so (SystemState_ShouldRunSystem_m39E8A42D74D2EAD90C3B100E6BFC971282A58D82)
#05 pc 0x00000000035bb728 /data/app/owUsh5iYJ-TixM9pCZZB3Q==/com.x.y-RklAZwOgND4TL3mbHgNN-w==/lib/arm/libil2cpp.so (SystemBase_Update_m795994EE60C054DFA78C313A60ED025B2668C9B4)
#06 pc 0x00000000015293d8 /data/app/owUsh5iYJ-TixM9pCZZB3Q==/com.x.y-RklAZwOgND4TL3mbHgNN-w==/lib/arm/libil2cpp.so (ComponentSystemGroup_UpdateAllSystems_m78B1AA9EAF07133497E9BA556B592AC93935441C)
...
Any ideas what we could do wrong? It comes from the main loop.

rotund token
#

in 1.0 yes

#

you just grab the singleton

rotund token
crystal zephyr
#

I am on 0.51

#

with Unity 2021.3.13

rotund token
#

usually safety stops this but in builds it's turned off so this is the weird type of errors you usually see

frosty siren
rotund token
#

99% of the time it's either an ECB like, SetCompoennt when an entity doesn't have a component or ComponentFromEntity on an entity that doesn't exist

#

you really need to get your hands on a dmp though

#

i believe backtrace can upload you these

#

but it's still hard to narrow down from this unfortunately

#

as the issue is most likely deferred from previous system

crystal zephyr
#

I was wondering the most because it came from ShouldRunSystem so from the update loop.

frosty siren
rotund token
#

EndSimuldationCommandBufferSystem.Singleton

#

that's how ECBS work in 1.0

frosty siren
#

thank you, will see

rotund token
#

var commandBufferSystem = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>();
var commandBuffer = commandBufferSystem.CreateCommandBuffer(state.WorldUnmanaged).AsParallelWriter();

#

you also don't need the old AddHandleForProducer if you use the singleton, safety is handled by dependency system

frosty siren
#

🀩 so many new things

frosty siren
rotund token
#

every system has an entity

#

but ECBS systems don't use the actual system entity

#

they create a new one for this singleton

#

πŸ€·β€β™‚οΈ

frosty siren
#

ok, I see

#

so we have chunk per system now

rotund token
#

(let me just 100% check this, it was the case in the exp and i'm pretty sure still in the pre. though i bought this up and they said yeah it probably should use the system entity)

rotund token
#

so it's all the same chunk

frosty siren
#

how then GetSingleton<TSystem> works?

rotund token
#

singleton is unique to command buffers

#

they are just components that exist within the command bfufer systems

#

systems don't have their own singletons by default

#

singleton is just the name of the IComponentData

#

and it's stored within the ECBS so it appears as ECBS.Singleton

frosty siren
#

should I get this singleton in OnUpdate or OnCreate? Seems like in OnUpdate?

#

good new code-gen magic, but now I'm unsure in every place how things will behave πŸ™‚

rotund token
#

SystemAPI.GetSingleton in update is standard

crystal zephyr
#

Sounds like updating from 0.51. to 1.0 is fun 😦

rotund token
#

the upgrade is not that fun

rotund token
#

but something has written past where it should

#

and corrupted a chunk

frosty siren
pulsar jay
#

Is anybody here using VFX graph with Entities? If so how do you mange your VFX effects from systems?

frosty siren
rotund token
#

What do you mean sorry?

pulsar jay
#

I am currently using a system with a NativeQueue of VFXCommands which works well for triggering one of effects with an expiration time from any system in parallel. But I havent figured out a good way to handle effects that should be started and stopped manually yet

frosty siren
hushed lichen
#

Hi. I'm working in 0.51 and having an issue with getting a DynamicBuffer from a component on an entity and passing it on to a job that's querying on other components. But when I try to access the buffer in that job, I get an error saying [job].JobData.[buffer] has been deallocated.
Any idea how I can solve this? It's for an exam project πŸ˜…

turbid dawn
#

Hello ^^
We are working on an exam project with DOTS and we are having difficulty reseting the scene we are doing this right now:

DefaultWorldInitialization.Initialize("Default World",  false);
            SceneManager.LoadScene("DOTS Tornado", LoadSceneMode.Single);
            World.GetExistingSystem<TornadoSystem>().Enabled      = false;
            World.GetExistingSystem<ParticleSystem>().Enabled     = false;
            World.GetExistingSystem<ConstructionSystem>().Enabled = false;
            World.GetExistingSystem<BuildingSystem>().Enabled     = false;
            World.GetExistingSystem<UpdateCameraSystem>().Enabled = false;

In addition, Is there a way to maybe reset only the subscene?

weak delta
#

How can I use an Animation Curve inside a job?

mystic mountain
hushed lichen
#
[BurstCompile]
public partial struct PlayerDirectionJob : IJobEntity
{
    public float3 hitPos;
    public int col;
    public int row;
    public ComponentDataFromEntity<NonUniformScale> nonuniforms;
    public DynamicBuffer<BoxesComponent> boxes;

    public void Execute(in Player player)
    {   
        // Find closest box coords in hitPos direction
        int gridX = (int)math.round(hitPos.x);
        int gridY = (int)math.round(hitPos.z);
        int boxIndex = col * gridX + gridY;

        if (boxIndex >= boxes.Length) return; // Just testing, ensuring that we don't attempt a non-working index
        
        // return;
        // Use box coords as index into buffer
        BoxesComponent box = boxes[boxIndex];
        Entity boxEntity = box.entity;

        // Use calculations from original code for height value of parabola and the parabola parameters
        NonUniformScale boxScale = nonuniforms[boxEntity];

        //    boxTranslation.y; // use for height calculations of parabola, see original code in Player


        // Set parabola params...


    }
}
pulsar jay
#

It is far from perfect but might be good enough for some use cases

hushed lichen
#

Occupied right now so I cant test it but maybe my group can. Thanks!

weak delta
pulsar jay
weak delta
#

Could you explain/link me to somewhere where it explains how to do that?

#

Im trying to do it with blob data and such

rustic rain
#

blob data works

weak delta
#

Im still getting errors like this

System.IndexOutOfRangeException: Index {0} is out of range Length {1}
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffcef9f5c48 (6a63da8ee91863ab52920bba7815e94) [Blobs.cs:780] Unity.Entities.BlobArray`1<System.Single>::Unity.Entities.BlobArray`1<float>.AssertIndexInRange 
0x00007ffcef9f5c77 (6a63da8ee91863ab52920bba7815e94) [Blobs.cs:796] Unity.Entities.BlobArray`1<System.Single>::Unity.Entities.BlobArray`1<float>.get_Item 
#

Not sure why tho

mystic mountain
weak delta
#

There's no way to do that with native arrays?

rustic rain
#

you can

#

just make an array of whatever you want

weak delta
#

But then, if i make a native array of wathever i want, it cannot be read at the same time from multiple jobs

rustic rain
#

it can

#

attach [ReadOnly] attribute to field inside job

#

so safety don't swear on you

weak delta
#

Im getting errors like the one shown before, but with native array

#

It says that it cannot get read access to the native array

rustic rain
#

no erorrs/no code = no help

weak delta
#
System.IndexOutOfRangeException: Index {0} is out of range of '{1}' Length.
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffd18ca5c93 (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.FailOutOfRangeError 
0x00007ffd18ca5bda (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.CheckElementReadAccess 
0x00007ffd18ca5cd8 (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.get_Item 
#

The error is this one

#

The code could be simplified as

[MethodImpl(MethodImplOptions.AggressiveInlining)]
    public static Sample4 GetFractalNoise<N>(float4x3 position, int seed, float4 persistance, Settings settings, SampledAnimationCurve curve) where N : struct, INoise{

        ...        

        Sample4 value = Sample4.Remap(curve.EvaluateLerp(sum/amplitudeSum), ...);
        return value;
    }
#

where

#
public struct SampledAnimationCurve : IDisposable
{
    public NativeArray<float> FunctionModifier;
    /// <param name="samples">Must be 2 or higher</param>
    public SampledAnimationCurve(AnimationCurve ac, int samples)
    {
        ...
    }
 
    public void Dispose()
    {
        FunctionModifier.Dispose();
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public Sample4 EvaluateLerp(Sample4 time){
        int len = FunctionModifier.Length - 1;
        float4 floatIndex = math.clamp(time.v,0f,1f)*len;
        int4 floorIndex = (int4)math.floor(floatIndex);
        int4 ceilIndex = math.min(floorIndex+1,len);
        
        float4 lowerValue;
        lowerValue.x =  FunctionModifier[floorIndex.x];
        lowerValue.y =  FunctionModifier[floorIndex.y];
        lowerValue.z =  FunctionModifier[floorIndex.z];
        lowerValue.w =  FunctionModifier[floorIndex.w];

        ...

        return new Sample4{
            v = math.lerp(lowerValue, higherValue, math.frac(floatIndex)),
                  ...
        };
    }
}
weak delta
rustic rain
#

does it happen without burst?

weak delta
#

nope

weak delta
rustic rain
weak delta
#

Mmmmm

#

@winter onyx any idea?

mystic mountain
weak delta
#

The native array is there, and it's initialized way before any job is called, and removed after all the jobs are called

#

Let me check however, just in case

#

It happens randomly, can't be sure why

mystic mountain
weak delta
#

I tried that too, and I feel like the problem comes when accessing the array at the same time with two jobs. The thing is I'm not sure how can I make it accessible everywhere always, being readable

winter onyx
#

so that you have real stacks

weak delta
frosty siren
#

what the advantages of using WeakObjectReference<TUnityObject> instead of just using managed IComponentData except that 1st can be used in unmanaged data?

robust scaffold
robust scaffold
weak delta
#

Errors don't appear without burst

robust scaffold
robust scaffold
weak delta
weak delta
#

Actually, the error with native array is

#
System.IndexOutOfRangeException: Index {0} is out of range of '{1}' Length.
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffd18ca5c93 (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.FailOutOfRangeError 
0x00007ffd18ca5bda (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.CheckElementReadAccess 
0x00007ffd18ca5cd8 (1559e67c07d3fa3f234957e8a168a8e) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.get_Item 
#

But with burst doesn't appear

pliant pike
#

it basically means it doesn't exist at the time its' being read or isn't being allocated properly

viral sonnet
weak delta
#

Mm, it's allocated persistent, and created before jobs are scheduled. Is then disposed after objects are completed

#

Im starting to think it's a unity issue rather than on my code

weak delta
pliant pike
#

I don't think its that specific

#

jobs can run when you least expect them or can have strange behaviour sometimes Onstartrunning() can run more than once a frame

#

I don't know maybe they've changed that or fixed that stuff now though

weak delta
#

Mmmm, then I don't get it, the object is created before any job is scheduled, and disposed after all the jobs are completed

pliant pike
#

are you sure, and how exactly are you allocating it, what about the source of data that is being allocated to that nativearray

weak delta
#
private void Update() {
        UpdateVisibleChunks();
    }
    void UpdateVisibleChunks()
    {
        ...

        ScheduleJobs();
        WaitForChunksToFinish();
    }
    public void ScheduleJobs()
    {
        if(newChunks.Count > 0)
        {
            ...

            SampledCurves curves = new SampledCurves(WorldSettings);
            
            ...

            NativeArray<JobHandle> MeshList = new NativeArray<JobHandle>(newChunks.Count, Allocator.Persistent);
            NativeArray<JobHandle> ListsOfJobs = new NativeArray<JobHandle>(newChunks.Count, Allocator.Persistent);
            
            ...

            JobHandle FinalJob = JobHandle.CombineDependencies(ListsOfJobs);

            GenerationCalls.Add(new GenerationCall{
          ...
                curves = curves,
            });
        }
        newChunks.Clear();        
    }
    public void WaitForChunksToFinish()
    {
        if(GenerationCalls.Count > 0)
        {
            for(int i = GenerationCalls.Count-1; i >= 0; i--)
            {
                if(GenerationCalls[i].Job.IsCompleted)
                {
                    GenerationCall call = GenerationCalls[i];
                    call.Job.Complete();
                    Mesh.ApplyAndDisposeWritableMeshData(call.meshDataArray, call.targetMeshes);

                    ...

                    call.curves.Dispose();
                    GenerationCalls.RemoveAt(i);
                }
            }
        }
    }
#

This is the basic structure

#

Where

#

public struct SampledCurves: IDisposable{
    public SampledAnimationCurve ElevationCurve;
    ...
    public SampledCurves(WorldSettings_SO WorldSettings_SO)
    {
        //Generate all settings
        ElevationCurve = new SampledAnimationCurve(WorldSettings_SO.ElevationMap.FunctionModifier, 255);
        ...
    }

    public void Dispose()
    {
        ElevationCurve.Dispose();
        ...
   }
}

#

And

#

public struct SampledAnimationCurve : IDisposable
{
    NativeArray<float> FunctionModifier;
    /// <param name="samples">Must be 2 or higher</param>
    public SampledAnimationCurve(AnimationCurve ac, int samples)
    {
        FunctionModifier = new NativeArray<float>(samples, Allocator.Persistent);
        float timeFrom = ac.keys[0].time;
        float timeTo = ac.keys[ac.keys.Length - 1].time;
        float timeStep = (timeTo - timeFrom) / (samples - 1);
        for(int i = 0; i<samples; i++)
            FunctionModifier[i] = ac.Evaluate(timeFrom + (i * timeStep));
    }
 
    public void Dispose()
    {
        FunctionModifier.Dispose();
    }

    [MethodImpl(MethodImplOptions.AggressiveInlining)]
    public Sample4 EvaluateLerp(Sample4 time){
        int len = FunctionModifier.Length - 1;
        float4 floatIndex = math.clamp(time.v,0f,1f)*len;
        int4 floorIndex = (int4)math.floor(floatIndex);
        int4 ceilIndex = math.min(floorIndex+1,len);
        
        float4 lowerValue;
        lowerValue.x =  FunctionModifier[floorIndex.x];
        lowerValue.y =  FunctionModifier[floorIndex.y];
        lowerValue.z =  FunctionModifier[floorIndex.z];
        lowerValue.w =  FunctionModifier[floorIndex.w];

        float4 higherValue;
        higherValue.x = FunctionModifier[ceilIndex.x];
        higherValue.y = FunctionModifier[ceilIndex.y];
        higherValue.z = FunctionModifier[ceilIndex.z];
        higherValue.w = FunctionModifier[ceilIndex.w];

        return new Sample4{
            v = math.lerp(lowerValue, higherValue, math.frac(floatIndex)),
            dx = time.dx,
            dy = time.dy,
            dz = time.dz,
        };
    }
}
#

WorldSettings_SO.ElevationMap.FunctionModifier is an animation curve

#

To just go further, the sampled curve is used like:

#
        JobHandle WorldWithFlatens = DisplacePersistance.jobs[(int)elevationSettings.noiseType](vertices,persistance, elevation,
            elevationSettings, sampledCurves.ElevationCurve, 
            offset,generationSettings, Persistance);
#

So that

#
[BurstCompile(FloatPrecision.Standard, FloatMode.Fast, CompileSynchronously = true)]
public struct DisplacePersistance<N>: IJobParallelFor where N: struct, INoise {

    ...
    [ReadOnly] SampledAnimationCurve outputAnimationCurve;

    float2 offset;
    int seed;

    public void Execute (int i) {
        ...
        Sample4 noise = GetFractalNoise<N>(..., outputAnimationCurve);
        outputNoise[i] = noise;
    }

    public static JobHandle Schedule (..., SampledAnimationCurve outputAnimationCurve,...
    ) => new DisplacePersistance<N>() {
        ...,
        outputAnimationCurve = outputAnimationCurve,
    }.Schedule(vertices.Length, generalSettings.Resolution, dependency);

}
weak delta
#

There should be all the code that makes use of the object, through the whole hierarchy

rustic rain
#

how you do it

weak delta
rustic rain
#

this could be the reason

#

why smth is invalid

#

job is a struct, just value. As it gets scheduled, it won't ever get updated by job system

weak delta
#

Since the job is made of multiple steps, it's easier to have a class containing the whole process and fields there. I then can create multiple instances of that class and schedule multiple jobs.

#

And the job is being obtained as a delegate, so actually what DisplacePersistance.jobs is returning is just the delegate of Schedule of a job

rustic rain
#

πŸ₯΄

weak delta
#

Basically, it's calling a static Schedule and returning a jobhandle

rustic rain
#

JobHandle = Scheduled job

#

this is rather confusing tbh

#

why can't you just return job struct instead?

#

and avoid this overcomplicated solution with delegate

viral sonnet
#

yeah, get rid of the MonoBehaviour

#

and stick to a system + job chain

#

is the actual error happening in Mesh.ApplyAndDisposeWritableMeshData?

safe lintel
#

is AnimationCurve the unityengine managed version?

#

also I agree, its quite a rabbit hole to try to follow how that all fits together

spring hearth
#

May i ask a little question on why/how SystemHandle can be converted into Entity
coz i can pass a SystemHandle param on method like
SystemAPI.GetComponent<ComponentData>(SystemHandle _systemHandle)
while it is supposed to pass an Entity param to GetComponent<T>(var param)

viral sonnet
#

easiest to answer when looking at code /// <summary> /// An identifier representing a system instance in a particular world. /// </summary> [StructLayout(LayoutKind.Sequential)] [DebuggerTypeProxy(typeof(SystemDebugView))] public struct SystemHandle : IEquatable<SystemHandle>, IComparable<SystemHandle> { internal Entity m_Entity;

#

SystemHandle just calls GetComponent(handle.m_Entity) internally

#

and every system has a SystemHandle now because every system has its own entity that you can add components to

#

(visible in entities hierarchy)

weak delta
weak delta
weak delta
# viral sonnet yeah, get rid of the MonoBehaviour

There's only one MonoBehaviour and is the one that starts the whole chain of jobs and deals with the end results. I'm not using Dots per se, just Burst and Jobs, and that is the plan. I haven't found yet a reason to go full into dots for my current needs

weak delta
spring hearth
spring hearth
robust scaffold
#

Ha, they fixed the memcpystride documentation

#

On a side note, has anyone managed to get BurstDiscard to work when calculating a returned value using managed objects?

rotund token
#

What are you expecting to happen there?

#

In burst that method just won't exist

#

It's not going to just switch to mono and execute it or something

true mirage
#

Is using Vector3/Vector3Int OK in terms of performance in jobs?

#

or I should use something like int3, float3?

safe lintel
#

Ideally use the types from the mathematics package as burst has optimizations for them

true mirage
#

@safe lintel thanks and what about defining static readonly fields in struct (jobs)?

public struct A{
 public static readonly NativeArray<Vector3Int>.ReadOnly MainDirections;
 //...
}
#

I would like to use them outside

#

Adding readonly can affect performance?

robust scaffold
robust scaffold
rotund token
#

Static readonly [] is supported in burst though

true mirage
robust scaffold
#

Behold, my incredibly overengineered and hyper optimized way to calculate within circular range boolean.

true mirage
#

Is it worth changing all my vector3int fields?

robust scaffold
true mirage
robust scaffold
true mirage
#
 int3 right =(int3) math.right();
robust scaffold
true mirage
rotund token
#

anyone used
GhostAnimationController

#

in netcode?

robust scaffold
rotund token
#

there's this whole animation prediction loop for ghosts as far as i can tell

#

completely undocumented

#

except the scripting api

robust scaffold
#

It's fully hybrid, relying on a companion GO, so ewww.

rotund token
#

you know, the only real way to do it atm

#

they have this whole

robust scaffold
#

There are repos out there that attempt to do vertex transformations using a dynamic buffer but yea, unfortunately

rotund token
#

GhostPresentationGameObjectEntityOwner

#

for managing gameobjects

rotund token
#

they don't really do blending between animations etc

#

they're great for static details in world that need animations

robust scaffold
#

True. I am very interested in seeing how unity does this when they release the dots version...

rotund token
#

GhostPresentationGameObjectAuthoring

#

GhostPresentationGameObjectSystem

#

full hybrid system here

#

works very similar to my hybrid system

robust scaffold
rotund token
#

hey it just works

#

nice

robust scaffold
#

magic

#

or just good coding / tests. I dont know the difference frankly

rotund token
#

one difference is you can see the gmaeobjects in scene

#

and select them

robust scaffold
rotund token
#

yeah i actually have a toggle for these for my camera/cinemachine baking

#
                                                   UnityEngine.HideFlags.NotEditable |
                                                   UnityEngine.HideFlags.DontSaveInBuild |
                                                   UnityEngine.HideFlags.DontSaveInEditor |
                                                   UnityEngine.HideFlags.DontUnloadUnusedAsset;
        public static HideFlags HideFlags { get; set; } = HideFlagsDefaults;```
#
        {
            var flags = CinemachineCreationSystem.HideFlagsDefaults & (ShowCameraGameObjects
                ? ~HideFlags.HideInHierarchy
                : CinemachineCreationSystem.HideFlagsDefaults);

            CinemachineCreationSystem.HideFlags = flags;

            var queryBuilder = new EntityQueryBuilder(Allocator.Temp).WithAll<Transform>().WithAny<CinemachineVirtualCamera>();

            foreach (var w in World.All)
            {
                if (w.GetExistingSystem<CinemachineCreationSystem>() == SystemHandle.Null)
                {
                    continue;
                }


                var query = w.EntityManager.CreateEntityQuery(queryBuilder);
                foreach (var entity in query.ToEntityArray(Allocator.Temp))
                {
                    w.EntityManager.GetComponentObject<Transform>(entity).hideFlags = flags;
                }
            }
        }```
that toggles their visibility so i can debug stuff when needed
#

i was about to merge and add the same toggle to my hybrid stuff

#

it's very useful though because 99% of time i want them hidden unless i'm debugging something

robust scaffold
#

Yea. Would be nice if companions had the same toggle.

#

Well, it's only 2 clicks instead of 1 to get to the CGO but still.

rotund token
#

yeah but it's annoying when you want to switch between 2

#

to compare

robust scaffold
#

True. Companion workflow is just ugh

true mirage
#

How can I define an efficient empty NativeArray like Array.Empty?

#
 var nativeArray = default;
 var nativeArray = new NativeArray<int3>();
 var nativeArray = new NativeArray<int3>(Array.Empty<>(),Allocator.TempJob);
 var nativeArray = new NativeArray<int3>(Array.Empty<>(),Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
rotund token
#

var nativeArray = new NativeArray<int3>(0, Allocator.TempJob);
is more efficient than Array.Empty

#

but it kind of depends

#

if you need to pass it to a job

#

then just make a 0 size array

true mirage
#

or default?

rotund token
#

it won't create a safety handle

#

so it will complain

true mirage
#

It causes Allocator set to invalid (0)

rotund token
#

default is fine if you aren't passing it into a job

#

and just read length field to check for 0 length

#

before accessing

robust scaffold
safe lintel
#

what actually happens to runtime authoring gameobjects visiblity in a scene with an open subscene and the Scene view mode is set to Runtime Data? how does unity actually hide the visibility?

robust scaffold
true mirage
#

I want to return an empty one

#

Is NativeArrayOptions.UninitializedMemory wrong to replace it with the default value Clear?

#
 var nativeArray = new NativeArray<int3>(0,Allocator.TempJob, NativeArrayOptions.UninitializedMemory);
robust scaffold
safe lintel
robust scaffold
safe lintel
#

"because companion GOs are not rendered in runtime scene view" but this part, how is this done? are we even on the same page because these arent "companion" gameobjects per se, they are the authoring gameobjects which dont exist during standalone, and exist in a inbetween place during various editor modes

robust scaffold
# safe lintel "because companion GOs are not rendered in runtime scene view" but this part, ho...

Now this is what I think happens from my very brief code dive. If authoring game view is enabled, the standard monobehavior update loop in editor mode occurs, resulting in monobehaviors (i.e. renderers) experiencing OnUpdate() and thus rendering. If runtime game view is set, then that monobehavior loop is disabled in favor of the entities.graphics DOTS update which will then use the baked entities and their data to render.

safe lintel
#

oh boy, messing around with the subscribing of internal update events doesnt sound fun

robust scaffold
#

I tried making sprite renderer companion GOs (since they're standard MB renderers) work when the subscenes are closed and yeaaaa, I'm not that good.

true mirage
#

I have a static utility class with Vector3Int called VoxelUtility. It contains bunch of methods like Calculate specific Distance, Convert spaces, Calculate chunks, etc.
I would like to have it for both Vector3Int and int3 :/

robust scaffold
true mirage
#

I think now, after adding job system for some sections of my game, I should convert all Vector3Int to int3 and it will be OK

#

If in some situations, I need Vector3Int, I can convert it

#

For example here,

  var point = hitInfo.point + 0.01f * ray.direction; //point is vector3, convert it to float3 and call that method
var voxelIndex = VoxelUtility.WorldPointToLocalVoxelIndex(point, worldSetting.Origin,
                    worldSetting.VoxelSize, worldSetting.ChunkSize);

I call it in many places in jobs and outside job.

 [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static Vector3Int WorldPointToLocalVoxelIndex(Vector3 worldPos, Vector3 origin, Vector3 voxelSize,
            int chunkSize)
safe lintel
true mirage
#

int3 == int3 returns bool3 :/ So, I have to use Equals. Love Rider decompiler, help me a lot

rotund token
#

yep equals or math.all()

robust scaffold
#

I swear to god...

robust scaffold
#

Today on "I don't math", I find myself looking up the distance formula between 2 points...

mystic mountain
#

Do we now have to specify with WorldSystemFilters for systems in groups instead of just relying on the groups specification?

misty wedge
#

e.g. adding a system to PresentationSystemGroup won't add it to the server in netcode since the server doesn't even have that group, even without specifying a WorldSystemFilter

mystic mountain
#
    [WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation)]
    public class ServerSpawnSystemGroup : ComponentSystemGroup
    {

    }
     [UpdateInGroup(typeof(ServerSpawnSystemGroup))]
     public partial class ClientSpawnSystem : SystemBase
     {
...
     }

This threw me warnings

misty wedge
#

What's the warning?

mystic mountain
#

A system ClientSpawnSystem could not be added to group ServerSpawnSystemGroup, because the group was not created. Fix these errors before continuing. The system will not be added to any group and thus not update.

robust scaffold
#

Systems will not inherit world filters using update in group sadly.

mystic mountain
misty wedge
#

I thought you didn't need to, but I guess I always did it anyways πŸ˜…

#

my bad

robust scaffold
#

Well, you wouldn't need [WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)] with a system in PresentationSystemGroup.

#

Systems updating in PSG do inherit the client world filter but that I think is the only case.

misty wedge
#

Ah okay, I was wondering since iirc I do do that

#

or not I guess

robust scaffold
misty wedge
#

I guess I just always assumed it would work πŸ€·β€β™€οΈ

mystic mountain
# misty wedge

Should you not use WorldSystemFilterFlags.Presentation there anyway now? πŸ˜…

misty wedge
#

I don't want the system in the default world presentation group

#

It's the "gameplay" player camera system

rotund token
mystic mountain
#

Ok, so think I found it. It's a second parameter of the filter aka [WorldSystemFilter(WorldSystemFilterFlags.ServerSimulation, WorldSystemFilterFlags.ServerSimulation)]

rotund token
#

^

devout prairie
#

where is the dots q&a thing announced?

devout prairie
#

?

robust scaffold
#

No, the forum category right next to the arrow...

devout prairie
#

haha damn.. why in the hell could i just not see that 😐

#

i think the unity forum just annoys me by default ( ux not the content )

balmy thistle
#

Yeah it's kind of a sleeper this go around

devout prairie
#

i think that's fair enough tbh, really positive that it's happening in any case

robust scaffold
shrewd lion
#

Hey! Does anyone know if using dots can solve the problem with jittering when far away from the origin?

Also does anyone know if the physics engines use double precision? Either havok or the other? Because this is also crucial

Afaik the problem is in gameobject, transform has a 32 bit float for each axis, but with dots can't we make it a double?

balmy thistle
#

there's no out of the box solution, it's a problem we're aware of though

#

it's more feasible to replace the transform system with v2 although for my money I wouldn't just leap to 64 bit precision components, it's not the most robust solution and is a pretty heavy performance tax

shrewd lion
#

Im not familiar with that, what is v2?

balmy thistle
#

Transform System V2

robust scaffold
#

Ive been trying for a few hours now but apparently compute and graphics buffers can not be used inside a managed component data in build.

robust scaffold
#

Well, nothing I'm doing is fixing this error, I'm gonna leave it here in case someone else stumbles upon it as well:

ArgumentException: Cannot find TypeIndex for type hash 9863318080490280432. Check in the debug file ExportedTypes.log of your project Logs folder (<projectName>/Logs)
Where that type hash is just a managed component data containing a single ComputeBuffer:```csharp
public class LightBuffer : IComponentData, IDisposable
{
public ComputeBuffer Value;

public void Dispose()
{
    Value?.Dispose();
}

}``` It works in editor, but not in build.

rotund token
#

sounds like it's generating a different stable hash in editor/build?

#

i don't recall how managed components generate their stable hash

robust scaffold
rotund token
#

i would have assumed the same way as unmanaged

robust scaffold
shrewd lion
rotund token
robust scaffold
#

ughhhhh, scene header corrupted again. it's getting more frequent for some odd reason

robust scaffold
rotund token
#

ahhh

#

stable hash?

#

or type index?

#

stable hash should not change

#

unless you make changes to component

robust scaffold
#

Type index.

#

It says "type hash"

rotund token
#

oh interesting

#

ok doesn't work on class

#

type hash is the stable type hash

#

yeah that shouldn't change

#

that's weird

#

though again not sure how managed ones are generated i need to look

#

but it seems to be the problem that it isn't stable

robust scaffold
#

Also, is there a way to force create a new entity query using the same types as another one but without a change filter?

#

Ugh, i'll just use a tag component.

rotund token
#

use entitymanager create on the second one

robust scaffold
rotund token
#

it will be disposed when the world disposes

robust scaffold
#

Alright

crystal zephyr
#

Sorry it's me again our crashing problem.
Now we have a crash at this line --> Unity.Entities.ArchetypeListMap.Add(Unity.Entities.ArchetypeListMap* this, Unity.Entities.Archetype* archetype)

Can we even influence that?

#

(Unity.Entities.ArchetypeListMap.Add(Unity.Entities.ArchetypeListMap* this, Unity.Entities.Archetype* archetype) -> void_2e84ca6994a85ec51b0f713f958f6ce4 from Unity.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null+56

Unity.Entities.ArchetypeListMap.Resize(Unity.Entities.ArchetypeListMap* this, int size) -> void_2e84ca6994a85ec51b0f713f958f6ce4 from Unity.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null+124

Unity.Entities.EntityComponentStore.CreateArchetype(Unity.Entities.EntityComponentStore* this, Unity.Entities.ComponentTypeInArchetype* types, int count) -> Unity.Entities.Archetype*_2e84ca6994a85ec51b0f713f958f6ce4 from Unity.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null+2168

Unity.Entities.EntityComponentStore.GetOrCreateArchetype(Unity.Entities.EntityComponentStore* this, Unity.Entities.ComponentTypeInArchetype* inTypesSorted, int count) -> Unity.Entities.Archetype*_2e84ca6994a85ec51b0f713f958f6ce4 from Unity.Entities, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null+46

rotund token
#

hmm you could have hit archetype cap

#

do you do a lot of structural changes?

frosty siren
#

I believe I've saw somewhere BakingType attribute. I guess this attribute mark type which shouldn't be accounted by runtime TypeManager or something to tell Entities that particular type is for baking world only. Though where can I read about this attribute?
Can't find it in docs / changelog / upgrade guide

rotund token
#

there's also TemporaryBakingTypeAttribute which is often more useful

#
    /// Attribute that indicates that the component should be removed at the end of each baking iteration.
    /// </summary>
    /// <remarks>
    /// Components decorated with the [TemporaryBakingType] attribute are stripped
    /// after each baking iteration, so you can use them in baking systems
    /// to identify entities that a baker has modified during the current baking iteration.
    ///
    /// Components with the [TemporaryBakingType] attribute are not exported in the runtime data.
    /// </remarks>
    /// <seealso cref="BakingTypeAttribute"/>
    public class TemporaryBakingTypeAttribute : Attribute```
#
    /// Attribute that indicates that a component should persist in the baking world, but shouldn't be exported with the runtime data.
    /// </summary>
    /// <remarks>
    /// During incremental baking, components with the [BakingType] attribute persist in the baking world.
    /// This allows baking systems to process entities which haven't been modified during the current baking iteration,
    /// but which are dependencies to the final result of the baking.
    ///
    /// Components with the [BakingType] attribute are not exported in the runtime data.
    /// </remarks>
    /// <seealso cref="TemporaryBakingTypeAttribute"/>
    public class BakingTypeAttribute : Attribute```
frosty siren
#

can't catch difference

#

oh ok, difference is in where/when baking comp should be removed. BTW what is baking iteration? How they can be controlled?

rotund token
#

there is iterative baking

#

when your subscene is open and make a change

frosty siren
#

The current way of how exclude default transform components after conversion is just remove them in custom baking sys?

frosty siren
#

how can I add component as chunk component in baker?

stone osprey
#

How exactly do archetypes/chunks increase their memory capacity when entities are becoming too large ?
And when does this happen ?

Do they always ensure that atleast like 100 entities fit into one chunk ? Or do they just step up from 16KB to like 32KB and then 64KB ?

#

Cant find anything about that, but i heard like a dozend times that chunks incrase capacity for big entities

calm edge
#

Can anyone give me some info about the costs of casting a collider in ecs physics vs adding it to physics world and handling events?

#

The docs suggest casting is expensive, but compared to what?

mystic mountain
#

How do you organize code for your NetCode projects?

dense crypt
#

Looking for some design advice here: Say I have a generic Health component and I can put this on random entities, Characters, props, doors etc. How should I handle the special cases where specific things "die"? I.E a character has to play a death animation, the door has to swap model to a broken one, props might just disappear but spawn some "explosion" particle effect.

Would I handle all of these in a single system as multiple different jobs running on different components/aspects? So maybe I end up with 10-20+ jobs in that system, depending on how many different 'things' can die in special ways? Or do I make a system for each type?

stone osprey
#

Like

Entities.ForEach((in Entity entity, ref OnDeathPlayAnimation odpa, ref AnimationController ac) => {
    ac.SetTrigger(odpa.Trigger); 
    // Some other stuff, its just pseudocode
});
pliant pike
#

Does anyone know if theres a math function for mathf.approximately?

robust scaffold
#

I just do math.abs(a-b) < 0.01

pliant pike
#

yeah I did try looking through the massive list, I guess the manual way is the best way, thanks a lot

blissful bobcat
#

Is dots enviroment going to work on unity 2021.3.11f1 ?
Im facing some new editor errors after importing com.unity.entities here:

Library\PackageCache\com.unity.collections@2.1.0-exp.4\Unity.Collections\NativeParallelHashMap.cs(111,36): error CS0117: 'AtomicSafetyHandle' does not contain a definition for 'SetNestedContainer'

dense crypt
stone osprey
robust scaffold
robust scaffold
#

Also, DOTS Q&A is open, write your questions on the forums!

blissful bobcat
robust scaffold
blissful bobcat
#

Actually i made it to work properly on unity 2022.2.0b8 although this unity version crashes on ubuntu when i try to enter or download a project from the cloud so im trying to change the version to manage to use dots on ubunto

#

Maybe I'll try 2022.2.0b16 beta on ubuntu and see if it works

robust scaffold
robust scaffold
blissful bobcat
robust scaffold
dense crypt
blissful bobcat
#

It workes on windows though

blissful bobcat
stone osprey
hushed lichen
#

You can also just toggle Enabled on it

dense crypt
#

Thanks for both suggestions, still on 0.51 so will go with bool approach, but for 1.0 I'll be using enabled πŸ˜„

hushed lichen
#

I've only worked in 0.51 so far - a new course started this semester, currently working on exam project - and we were advised to either use a tag or toggle enabled. By some of the guys from the DOTS team πŸ™‚

urban ore
mystic mountain
urban ore
#

I suppose what I don't really understand is how the call to singletonArray (using ToComponentDataListAsync) changes the dependencies versus just using SystemAPI.GetSingleton.

mystic mountain
rotund token
#

I'm not sure what your issue is?

#

Are you getting an error or something

mystic mountain
warped fog
#

I remember hearing that Ixion used DOTS in their game; it just released today.

urban ore
urban ore
#

Ah, I understand now.

#

Or are you wondering about the "restructure the data dependencies" part?

mystic mountain
urban ore
#

Yes, I believe so.

#

In my case, I think I've resigned to just doing all the singleton modifications in a separate system group and just accepting the sync point. I'd assume you can manually configure the dependencies, but I don't really know how. And my use-case is a library so I don't want to force people to have to deal with that.

#

Did you try manually setting up the dependencies?

mystic mountain
urban ore
#

I think the main problem here is that the automatic dependency management doesn't really work with singletons. Since they're obviously a separate entity. I could be totally wrong about that, I'm just not that familiar with the automatic dependency management.

#

Well, you'd have to sort out which jobs are reading the singletons, and which are reading/writing them. And then just order the dependencies appropriately. If you kicked off all the jobs in one system, maybe it would be obvious how that would be done?

robust scaffold
urban ore
# mystic mountain Not sure what this means tbh^^

To put that another way that might be clearer - Just merge Systems A, B, C into one SuperSystem. And you can see how you could just set up the job dependency on each job so they happen in the right order. No sync point.

#

I assume doing that is possible between separate systems. I just don't know how.

mystic mountain
urban ore
#

Yes, correct.

#

Which is, I think, a bit of a gap in the automatic dependency management system.

#

To elaborate on that, "data dependencies" presumably means component dependencies. And thus, the automatic component dependency management system. But that system does not operate on the most common use-case for singletons where you pull a singleton into the job's context while the job is operating on another entity type (like you have in System C), AFAIK. If you're only using the singleton component in queries directly on the singleton component, then you don't need to restructure anything. It just works normally. So I think the documentation is just inaccurate.

#

I think it might mean "restructure the job dependencies manually", which is what I suggested.

mystic mountain
#

Is it only IJobChunk that supports generic?

rotund token
#

Anything except IJobEntity should be fine for generics

#

It's just code gen doesn't handle generics well

mystic mountain
devout prairie
#

one of my questions for the Q&A was going to be if there is a roadmap for physics - is there already an existing roadmap somewhere for unity physics i can look at?

mystic mountain
devout prairie
#

i guess i'll ask the question

weak delta
#

Is it possible for a race condition to appear on readonly lists?

#
System.IndexOutOfRangeException: Index {0} is out of range of '{1}' Length.
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffcf5805db3 (6cc6969db45f06c2133de7c391f7015) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.FailOutOfRangeError 
0x00007ffcf5805cfa (6cc6969db45f06c2133de7c391f7015) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.CheckElementReadAccess 
0x00007ffcf5805df8 (6cc6969db45f06c2133de7c391f7015) [unknown:0] Unity.Collections.NativeArray`1<System.Single>::Unity.Collections.NativeArray`1<float>.get_Item 
0x00007ffcf5804e31 (6cc6969db45f06c2133de7c391f7015) [SampledAnimationCurve.cs:57] SampledAnimationCurve::SampledAnimationCurve.getValue 
0x00007ffcf5804ab8 (6cc6969db45f06c2133de7c391f7015) [SampledAnimationCurve.cs:38] SampledAnimationCurve::SampledAnimationCurve.EvaluateLerp 
0x00007ffcf580d6ba (6cc6969db45f06c2133de7c391f7015) [Noise.Job.cs:44] Noise.GetFractalNoise<Noise.Perlin2D`1<Noise.Perlin>> 
0x00007ffcf5827aff (6cc6969db45f06c2133de7c391f7015) [DisplacePersistance.cs:32] DisplacePersistance`1<Noise/Perlin2D`1<Noise/Perlin>>::DisplacePersistance`1<Noise.Perlin2D`1<Noise.Perlin>>.Execute 
0x00007ffcf5827c65 (6cc6969db45f06c2133de7c391f7015) [unknown:0] Unity.Jobs.IJobParallelForExtensions.ParallelForJobStruct`1<DisplacePersistance`1<Noise.Perlin2D`1<Noise.Perlin>>>.Execute(ref DisplacePersistance`1<Noise.Perlin2D`1<Noise.Perlin>> jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) -> void_b35d890588629bdec7fa050c06b58eee from UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null 
0x00007ffcf5827606 (6cc6969db45f06c2133de7c391f7015) 3abde48db1478a857c1e18670cc1cb18
#

I'm still trying to fix this issue, that appears only when burst is enabled

#

If someone understands it and can pinpoint what's happening would be really cool

robust scaffold
weak delta
#

Could you explain further what you mean by overrunning your buffers?