#archived-dots

1 messages ยท Page 154 of 1

deft stump
#

so then the problem is... when I only have 1 spawner entity. it works fine.
but then... when I have 2 spawner entity (spawned at runtime). it doesn't work fine. what gives?

#

the video shows it btw.

#

the debugger shows that my BulletSpawnSystem picks up the 2 spawners.
so why isn't anything spawning?

tawdry tree
#

So they have the correct components, but don't do what they should...
If you do a query to get the count for the entities in the system, does it output correctly (debug write)? What about a print line at the top of the inner block of the foreach/loop/job, does it run once per entity?

deft stump
#

WAit...

#

I think I know why...

celest oyster
#

I think I've found the source of the bug

#

SerializeUtility.SerializeWorld(entityManager, writer, out temp);
"out temp" is not providing different referenced objects after passing in entitymanagers with different amounts of entities. It seems like it gets stuck on the first batch of entities sent in. I think that is why my references are getting messed up, thus blobasset problems.

celest oyster
#
        {
            Debug.Log("STARTING SERIALIZEWORLD");
            var ents = entityManager.GetAllEntities();
            Debug.Log("Number of entities in manager: " + ents.Length);

            object[] temp;

            using (var writer = new StreamBinaryWriter(_savedWorldFilename))
            {
                SerializeUtility.SerializeWorld(entityManager, writer, out temp);
            }
            unityMappingTable = temp;
            string outObjs = ""; 
            foreach (object o in temp)
            {
                outObjs += o.ToString() + "    "; 
            }
            Debug.Log("Objects in output temp1: " + outObjs);

            saveCount++; 
        } ``` Is this enough proof for a bug report?
tawdry tree
#

If you can make a minimal repro project with it, definitely

safe lintel
#

hmm cant get urp to work with hybridv2 now

#

was it new unity alpha, entities package, hybrid package, incorrect setup(of a blank urp example project) i swear debugging these kinds of issues literally drains my lifeforce

#

ok consistent crashes, definitely reporting now ๐Ÿ˜ฉ

ocean tundra
#

@safe lintel Did you get that combo of tech to work? I've tried but had the weirdest rendering bugs
Models seemed to randomly swap, rotations confused, scale changed or reset. But no crashes
I quickly swapped back as it didn't seem worth investigating

spark glade
#

... the best part is no ambient lighting ๐Ÿ˜ฑ

#

or did they add that by now?

safe lintel
#

no, I did some tests but I use some straight monobehaviour injected things and I think its just too mind bending a problem for me to handle

spark glade
#

We should have a support group ๐Ÿ˜‚

#

"DotsAnonymous"

ocean tundra
#

haha

spark glade
#

We must be somewhere on the scale close to BDSM... self inflicting pain ๐Ÿค”

safe lintel
#

yeah animation really needs a support group. not even a dedicated thread on the forums ๐Ÿ˜ฉ

spark glade
#

@safe lintel have you seen anyone try the latest drop?

#

Usually that's been me, but I haven't gotten around to it yet

ocean tundra
#

i really want to start doing some graphics stuff, as it looks SOOOO bad but all these issues keep scaring me away

safe lintel
#

i installed it, made some really sad attempts to make it work but i have no clue, absolutely no clue ๐Ÿ˜…

ocean tundra
#

i dont think animation works with URP

spark glade
#

@ocean tundra it "works" but no gpu instancing, hence all your models will happily animate "in sync"

#

I just don't understand why they don't just update the fricking samples when they release a new package version

#

I mean someone must have some code that produces results...

ocean tundra
#

well thats better then i thought

safe lintel
#

even though graphics/hybridrenderer is buggy, at least you got pretty good dev communication on that end. all the recent releases have been minor or just updating dependencies, something more meaty feels due soon

ocean tundra
#

@spark glade when you say "in sync" you mean they all play the same animation at the exact same frame?

spark glade
#

yeah, let me try to find the post...

#

Can't find the unity forum post.

#

But yeah, I tried for many many hours all sorts of combinations of URP/HybridV1/V2/...

#

In the screenshot you can see that all the units in the 50x50 grid animate exactly the same. With HDRP it works just find, aka all animate individually.

#

Haven't tried 0.5.1-preview.1 yet. But will do, probably this weekend.

safe lintel
#

they changed up the way rootmotion is handled though the existing way still works(just marked as obsolete).

#

as one of the main changes

ocean tundra
#

Hey Guys
I'm needing to do this around most of my 'message' related systems (networked RTS game)

/////DO JOBS AND FOREACH's
        messageContainer.WriteJobHandle = JobHandle.CombineDependencies(messageContainer.WriteJobHandle, Dependency);

Can anyone think of a nicer way to show/write that
Maybe a custom Entities.WithMessageJobHandle... that can do that combine bit
or a using statement 'thing'

#

Can we even make custom code to interact with the system code gen?

deft stump
#

if I query 100 entities in a Entities.ForEach()... and put a debug.log message in it.
would I get 100 debug.log messages?

ocean tundra
#

yea you should

deft stump
#

hrmmm

ocean tundra
#

i think in the systems view when you select a system you can see how many entities it will run over

#

but if they are one offs maybe thats not so useful

#

also the systems view is useless to me as i use custom worlds, so that could be wrong/out of date info

plush stirrup
#

we're at our wits end here trying to find a reason behind a strange error that endlessly repeats in the console, but only on one machine in our team. the other people with exact same commit don't have it:

LambdaForEachDescriptionConstructionMethods.ThrowCodeGenException[TDescription] () (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/CodeGeneratedJobForEach/LambdaJobDescription.cs:392)
LambdaForEachDescriptionConstructionMethods.ForEach[TDescription,T0] (TDescription description, Unity.Entities.UniversalDelegates.R`1[T0] codeToRun) (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/CodeGeneratedJobForEach/UniversalDelegates.gen.cs:339)
MyNamespace.MyTestSystem.OnUpdate () (at Assets/Content/Code/MyNamespace/MyTestSystem.cs:47)
Unity.Entities.SystemBase.Update () (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/SystemBase.cs:414)
Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/ComponentSystemGroup.cs:445)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/Stubs/Unity/Debug.cs:19)
Unity.Entities.ComponentSystemGroup:UpdateAllSystems() (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/ComponentSystemGroup.cs:450)
Unity.Entities.ComponentSystemGroup:OnUpdate() (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/ComponentSystemGroup.cs:398)
Unity.Entities.ComponentSystem:Update() (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/ComponentSystem.cs:109)
Unity.Entities.DummyDelegateWrapper:TriggerUpdate() (at Library/PackageCache/com.unity.entities@0.11.1-preview.4/Unity.Entities/ScriptBehaviourUpdateOrder.cs:192)```
#

what could be causing it? it completely cripples editor work for one of the members of our team but we can't find any information about it beyond a vague patch note in Unity 2019.3.15 (we're on 2019.4.1, long past that release)

plush stirrup
#

removing ScriptAssemblies helped but it would've been great if this was communicated anywhere else aside from a one off comment in this Discord dating a few months ago that I was lucky to find ๐Ÿ™‚

#

maybe the error itself should point out the possibility of removing assemblies folder in the Library

ocean tundra
#

@plush stirrup What sort of script assembly is it? asmdef or external dll?

plush stirrup
#

we don't use any assemblies with Entities systems

#

maybe the code generator just hit some sort of an error and filled that folder with output that prevented it from running correctly on the next go

ocean tundra
#

i use a TON of asmdefs

#

no issues so far

#

but i am on 2020.1

#

no clue if that is a important difference

plush stirrup
#

we had some problems with WWise audio library today - their Unity integration is horrifyingly unstable and runs right in edit mode, occasionally popping errors on assembly reload

#

it's not a huge stretch to imagine some error terminating an editor update prematurely, throwing a wrench into what entities codegen was doing

ocean tundra
#

side question, why use wwise for audio? what does that do that unitys normal audio system dosnt do?

#

ps i know almost nothing about audio in games

plush stirrup
#

This is a bit off topic for this channel but there is little choice beyond relying on WWise or FMOD for projects with complex audio, or at least that's the opinion of audio team we rely on. To compare, the difference between capabilities of built-in audio system vs. dedicated third-party libraries is akin to a difference between legacy Animation component and Mecanim Animator system. It's almost a standalone layer of the game with its own logic fully controlled by an audio engineer, where they can set up crazy procedural music responding to inputs we send over, control the mix with ridiculous level of precision etc. The level of audio complexity and polish we get out of it is very nice.

That said, if I could go back in time, I'd seriously consider going with FMOD instead of WWise because WWise Unity integration is just unacceptably bad at times. We avoid using almost all components they've built and only interact with bare minimum of their bootstrap/bank management stuff and it still manages to break frequently. It's a true enterprise grade solution in a sense that only big projects can afford the time to deal with it's bugs and horrible side effects. Just today we had a WWise upgrade script that copied our whole repository (70gb) to a temporary folder without asking to modify a few prefabs (and corrupted said prefabs in an attempt to helpfully "optimize" them). Later in the day WWise script also consumed all space on the drive of one of our team members due to horrifyingly designed recursive directory copy method that just went into infinite loop of creating new subfolders and copying giant banks (this was only stopped by Windows path length limit triggering a hard exception at some point, otherwise the process would've continued running indefinitely).

Sorry for ranting, I'm just salty about what should've been a simple .dll replacement wasting our whole day today. ๐Ÿ˜„

ocean tundra
#

Thanks for the overview. Audio is one of the parts of Unity i know least and i never seem to get round to implementing it

#

maybe ill check out FMod when i want some audio in my game. Also what about that new DSP?? thing unity has in ECS for audio?

plush stirrup
#

I'm very much looking forward to playing with DSPGraph (or what Unity builds on top of it by the time we get there) on our next project

ocean tundra
#

oh they clearly say thats its to replace FMod ๐Ÿ˜›

#

hmmm 0 docs and no update since 2019

plush stirrup
#

sadly that's often the story with these things, I'm not hoping for any updates till late 2020 cycle

ocean tundra
#

yea that bit is VERY out of date

plush stirrup
#

it was demoed with Megacity and not much after that, I think?

ocean tundra
#

yea i think so

#

they probably built it specifically for megacity then have left it since then

plush stirrup
#

oh there was a talk at Unity Copenhagen in Sept 2019, got to track it down

ocean tundra
#

oh well audio is always last on my list ๐Ÿ˜› so hopefully in a year or so they will have it ready

#

@plush stirrup back to your main problem and a side idea to fix it

#

Could you move most of your WWise stuff out into a side project and have it build into addressables and load those?

#

it may keep its errors more managable if you dont have a 70gb sound library

plush stirrup
#

Unfortunately not, it's a very rigid native plugin that only works when used "right". 70gb isn't our audio library size, it's total project size (upgrade script just copied it all for some bizarre reason ๐Ÿ™‚ )
In any case, we fixed it by clearing script folder in Library, so its all good ๐Ÿ™‚

ocean tundra
#

another idea is to wrap all the WWise stuff in a #if define, then you can have that off 90% of the time and have it switch back on during builds and when you need it for sound stuff

#

oh sweet so all happy then

#

70 gb is crazy

#

WTF i just checked mine and im at 6Gb

#

no clue how

#

77k files ๐Ÿ˜›

deft stump
#

are we flexing on project size?

ocean tundra
#

๐Ÿ˜› yup

deft stump
#

kek

#

I'm only 10GB

ocean tundra
#

๐Ÿ˜› nice

#

What does GameObjectConversionUtility.ConvertIncremental() do that the other convert methods dont do?

#

I thought there would be some sort of handle or thing i could wait for or tick to update over many frames

tawdry tree
#

I read this:

This method should have been replaced by codegen
As the magic DOTS codegen failing, which is most definitely a bug (probably in DOTS, possibly in your code doings something very wrong). As for how to fix when different team members with the same unity version may or may not experience it for the same code, there might be some settings in Unity, but I think you need deep, deep help from someone who's familiar with the codegen to even have a chance...

pulsar jay
#

I am still trying to figure out how to represent a grid in the dots world. Right now I have 2 solutions in mind.

  1. The grid is an entity with a grid component and the GridPosition component has an entity field to link to a grid.
    This seems pretty similar to the MonoBehaviour way to me, which might be an indication that its bad for the DOTS world?
  2. Have a SharedComponent referencing a Grid (could be an object) similar to the Material component.
    This might have the advantage of grouping objects by grid although it feels weird needing a pointer to an object in the Shared component in order to change any values (e.g. cell size) easily
tawdry tree
#

What's the use case here?
Just having arbitrary entities placed on a grid? Or some kinda grid-based terrain? (think Minecraft/Terraria)

pulsar jay
#

Placing tiles on a grid with a height offset, so kind of in between

#

We already talked about that a few days ago if you remember @tawdry tree

tawdry tree
#

Oh right, it was that one

pulsar jay
#

But I did not come to a conclusion how to represent the grid specific data like cell size and maybe even translation/rotation of the whole grid

tawdry tree
#

For that, hmm... Probably a singleton entity with grid settings (cell size and such)

pulsar jay
#

now that I think about the translation/rotation bit it might make sense to rebuild the usual gameobject hierarchy with the grid as a parent entity in order to use the translation and rotation systems

tawdry tree
#

You're gonna want a helper to convert between coords anyway, and with that and Translation you don't strictly speaking need anything else. Might want a tag like UsesGridTag

#

Why would you parent them? Do you intend to move the entire grid?

pulsar jay
#

yes there might be multiple grids with different positions/orientations

#

i would not move them at runtime though

#

so I am not sure if this parent relationship would cause any overhead at runtime

tawdry tree
#

That complicates things slightly, but can still work off of Translation+BelongsToGrid(Entity reference to grid entity) and a helper

pulsar jay
#

in gameObject world I just handled it like this:
public Vector3 CellToWorld(Vector2Int cell)
{
return this.transform.TransformPoint(CellToLocal(cell));
}

tawdry tree
#

You'd want a way to generate a matrix for the local directions, which the parenting stuff might help with

#

Then you could convert between world and local pos and back easily and "cheaply"

pulsar jay
#

so right now I have a CellPosition component and the GridPlacementSystem which just sets the position. If the entity is parented to the grid entity the TRS System? (not sure what it was called) should move and rotate it to the correct world position afterwards right?

tawdry tree
#

Maybe? Haven't touched the parenting system, but it should be quite easy to check, no?

pulsar jay
#

yeah I will try that

#

thx

stone osprey
#

Is there some kind of entity listener we can use to trigger a callback once a certain component was added to the ecs ?

tawdry tree
#

There are methods on the Entities.ForEach structure to check for stuctural (ICD) cahnges

stone osprey
#

How do i use them ? ^^ Probably i missed that in the documentation... i basically just wanna execute a piece of code once a certain component was attached

tawdry tree
#

Honestly, the simplest way is to just add a bool HasInitialized on the component, or adding another component (tag) to mark it as done.
I forget what the exact methods are called, just that I've noticed them using intellisense on Entities.

stone osprey
#

@tawdry tree Thanks ! I hope this only gets executed once... i thought theres another way, other ecs frameworks mostly offers listeners getting executed once a component was added or removed which is extremely helpfull

tawdry tree
#

If you want to make 100% sure it's only run once you should add a tag or boolean in the component

#

I don't know if there are listeners. There might be but I haven't seen any (nor have I looked)

deft stump
#

Hodhandr.
If the game is suspended would the systems still run?
what about the plethora of blob assets I made? would they get leaked?

stone osprey
#

i thought about this... but its too dirty for my usecase... i also use ComponentObjects which makes this harder

tawdry tree
#

There is such a thing as EntityChanges, thouhg. I think it's mainly for internal use, though.

#

mfragger - suspended how?

deft stump
#

DOTS game on android. User pressed the home button. Does other stuff. then returns to the game.

#

that kind of suspended

tawdry tree
#

Depends on how unity handles that, but I assume the game is effectively paused. if they switch back in time, anyway; in my experience apps need to reload if you wait too long.

#

Systems will definitely not run.
I know there are events to catch an app being suspended in android, though not sure how accessible they are in unity. I suspect you'll be fine as long as you dispose in the appropriate locations.

stone osprey
#

Is there a way to make structural changes during a schedule ?

tawdry tree
#

During? No.
You would either need to use Run() and do it with the EntityManager afterwards, or use an EntityCommandBuffer

stone osprey
#

Alright, thanks ^^

#

So i tried .WithChanges... didnt worked, printed all entities even if they didnt changed at all :c

opaque ledge
#

because it works on chunks, not on entities

#

lets say you have 5 chunks, each of them has 10 entities in them, you do a WithChangeFilter on it, if one of the entities's data changes, the chunk that entity belongs to will 'increments' version, so all 10 entities in that chunk will be processed, but not other 40

tawdry tree
#

The "dirty" way is probably the best. It's not even that bad

stone osprey
#

@opaque ledge Oh... thats why, thanks ! So theres really no way to listen for newly added/removed components in unity ecs ?

opaque ledge
#

are you aware of system components ? they are designed to work with listening to adding/removing components and creating/destroying entities, so great way to run a system when component is added or removed, kinda requires some work tho

#

i think there should be an example in manual

stone osprey
#

Thats exactly what i need ๐Ÿ˜„

opaque ledge
#

gl^^

stone osprey
#

Im gonna take a look at those, thanks ^^

deft stump
#

does shadergraphed materials work with hybrid v2?

undone torrent
#

why i cannot tryadd on a Nativeashmap inside entities.foreach ? i remove parallel restrictions and i using my own struct as key

#

i think is about race condition

#

but i dont know why tryadd is thread safe

#

or maybe it is about my own struct key ?

tawdry tree
#

What error do you get?

undone torrent
#

it just crash unity

#

i mean it is like a loop or something

tawdry tree
#

hard crash, huh

#

Well... this is what the safety systems are for - stopping you from doing whatever crashes unity here.

#

Disabling the systems ins specifically if you know what you're doing, and know it is safe - TryAdd is clearly not threadsafe, which makes sense because it needs to do a bunch of checks

#

What are you trying to accomplish? You should probably look for alternative paths to your goal

undone torrent
#

i will share u the code

#

wait

#

could u say me the web where i can share code with u

#

please

tawdry tree
#

Pastebin, hastebin and such

#

But if you have enough code that you can't post a snippet here, that indicates you might have something overengineered

stone osprey
#

Anyone familiar with SystemStateComponents ? I wanna use them to detect the creation/removal of entities... the problem here is that when i destroy a entity, all components excluding the SystemStateComponent getting destroyed... that means if i listen for a destroyed entity by its SystemState i know that it was destroyed... but i dont know which components it had previously... any idea how i could get that destroyed component ?

undone torrent
#

i have lot of comments cause i worked on other way before

tawdry tree
#

genar, why do you need the destroyed component? If you just need to know which components were destroyed, you could put that in a SystemStateComponent (I think - a flag enum should do), but if you want the data, capture it before deletion

north bay
#

Those are some big NativeHashMaps

#

Try reducing the initial capacity

undone torrent
#

i run it on schreadule and works, it is about parallel

#

"works ", i get a bust error but at least didnt crash hard

#

burst*

tawdry tree
#

Fist impressions: It's HUUUGE! Consider moving the entire switch case to a static method. Second, this is a good spot fora swicth expression, if you're on 2020

undone torrent
#

i think i am xd

tawdry tree
#

Shouldn't nativeHashSet also be parallelwriter?

#

You are writing to it

stone osprey
#

@tawdry tree Hmmm... thanks, im gonna try to store the components somewhere ^^

undone torrent
#

it is better declare it as removeparallelrestrictions, .parallelwiriter was only a try

tawdry tree
#

genar, this is a good use case for a flag enum, assuming you have a known amount of components you care about

undone torrent
#

hodhandr the main idea of that code it is only create one entity with the same vertex and occluder

#

i mean no duplicates

tawdry tree
#

lmml, there are reasons why you have those restrictions; you're threading in unsafe territory here.

stone osprey
#

@tawdry treeI actually wanna track all added/removed components... kinda like a reactive system, a simply flag is not enough :/

tawdry tree
#

If you're building a mesh, consider building each mesh separately, in a job where each instance of the job has its own array of vertices. Then a second job could do cleanup

#

genar, that sounds overengineered, bad pattern, and likely to cause maintenance or performance issues

stone osprey
#

Performance isnt that nessecary at all... im using the ecs for its maintability due to bad oop experiences... nearly every major ecs framework has methods like "manager.onCreated<PlayerComponent>(callback);"... so if unity does not offer this, its probably time to create such a system on my own using those SystemStateComponents :/ thats why i wanna track all of them

tawdry tree
#

lmml, I haven't gotten quite so far yet, but I am working on a voxel terrain mesh generator. The plan is to do it in two steps, one to generate the mesh (duplicate vertices allowed), and a second to clean that up if needed.

undone torrent
#

i could do the same i guess

stone osprey
#

Another problem here is... i havent found anyway to receive all components of a entity

undone torrent
#

on my case

#

i mean

tawdry tree
#

genar, Do you really need to listen to all changes? I've come to the philosophy that with ECS, you want to make systems as general as possible, while still being specific to your use case... overgeneralizing is a maintainability issue in itself

undone torrent
#

do u allow me to use that idea ?

#

i mean

#

clean after doing all them

tawdry tree
#

I wouldn't share ideas if I didn't want people to be inspired by them, now would I?

undone torrent
#

thx u hodhandr ๐Ÿ™‚

tawdry tree
#

It also makes for more single-responsibility jobs, which is nice

#

And as a bonus, if i later want to generate something that is not terrain, I can use the same mesh cleanup job on that

stone osprey
#

Well atleast i want to have the possibility to listen to all component changes... actually i just need add/remove listeners for a handfull of components, but im in search for a generic solution

tawdry tree
#

If you only need it for a handful of components... just implement it for those, but in an extendible way (so you can easily slot in other components later)

stone osprey
#

@tawdry tree Well... that could work too... the main problem is to detect such changes... im searching till ages, that StateComponent isnt that usefull either, because its only good to track the creation/deletion of entities... not of components

tawdry tree
#

Why do you need to detect changes?

stone osprey
#

Because i wanna react to a newly added component... world.Created<Mob>(() => {Log("Mob spawned"); }) for example... my usecase is a bit more complicated due to the hybrid ecs

#

So i need a way to detect if a component was newly added without a flag... i wanna have clean, flexible, loose coupled code... i made too many mistakes in the past where i needed to rework my whole game

deft stump
#

can you tell us your use case specifically? what you're gonna use it for?

tawdry tree
#

If you're using it for doing first-frame work on newly spawned entities, I'd say just use a tag for that, NewlySpawnedTag or something like that, and have a system running really late remove it the first ECB of the next frame

#

Yes, it causes a structural change, but it would happen rarely, is simple to make, simple to expand, and very loose coupled.

stone osprey
#

Due to my hybrid approach i create gameobjects async using the unity adressable system... once that gameobject was created a callback runs which adds it as a "ObjectComponent" to its ecs representation... Once that GameObject was assigned as a ObjectComponent, my animation system should get a callback in order to get the animator and several other stuff from the gameobject... that would be fucking easy... IF theres a way to listen for newly created/destroyed components :/

deft stump
#

maybe add a tag to it so you can track it with a system?
then remove the tag once the stuff you need are loaded in

stone osprey
#

That could actually work... and i think im gonna do that... but damn, i really wanna have a reactive system, even if its not that performant

deft stump
#

you mean... you want a way to throw an event if there's a struct change?

#

and basically "interrupt" current operations?

#

hrmmm... thinking about it. there isn't a way to do it.
The best you can do is queue it in a CommandBuffer and play it back at one of the pre-built in hooks you can use

orchid gate
#

I think adding and removing components works fine for now, should get better too. Posted by unity guy

You want some sort of a state machine / event system. Right now you think that changing state via AddComponent / RemoveComponent is too expensive, because it moves archetypes.

We have found a similar problem in Dots shooter. But it really depends on the frequency of the addcomponent / removecomponent calls, is a perf issue or not.

That is why we are currently working on adding Enabled state to all components. This way you can enable / disable components from any job safely without changing the structure. Entities.ForEach will automatically do the filtering for you. It will process only the entities that match essentially a disabled component appears as a component that doesn't exist.

Internally this is done via packed bitfields across multiple entities and SIMD bit mask tricks so it will be quite efficient.

In Dots shooter our plan is then that during conversion you setup all possible components (Enabled or disabled) and at runtime you simply enable / disable components. Our game code team also prefers this approach since it will be clearer to have all possible components already present. So its easier to identify a specific type of object in the world...

That sounds like it should solve your problem...

So the question what do you do for now, until this feature lands.

In DOTS Shooter we are simply pretending the functionality exists and are putting a bool Enabled; in each of the Ability System components. And then we do the filtering manually in Entities.ForEach in the first line of code.
It's not optimal but it gets us to a place where we can structure our game code how we want it to be and once native support for enabled / disabled components lands we can simply remove all of the .Enabled bools and let ecs take care of the filtering for us.

deft stump
#

Yes... enable and disable... highly anticipated

#

tags are great, their very lightweight to remove and add. but it's kinda, for lack of a better term, imo, somewhat disrespectful to the hardware if we move entities all over memory.

safe lintel
#

Posted by unity guy heh ๐Ÿ™ƒ

orchid gate
stone osprey
#

Not sure if it works without any issues... but it could be used as some sort of reactive system

tawdry tree
#

I was wondering why Unity kept hanging when running this one system...
Turns out at some point I refactored away the safety guard on my while loop that should stop it from running forever... oopsie

#

I'm saying this because it seems like people think I know what I'm doing ๐Ÿ˜›

deft stump
#

most of the time you do though

tawdry tree
#

I suppose

#

I can almost assure that some of you have worked more with ECS than me
Then again I have a good mind for programming, keep lurking here even when not active, and may or may not start to really grok the whole DOTS thing

#

I suppose I might be at the far side of the Dunning-Kruger hill...

#

Does anyone know the difference between math.distance and math.distancesq?

coarse turtle
#

distancesq does not take the square root between 2 vector positions when calculating the magnitude

#

distance takes the magnitude between 2 vectors and then square roots it

tawdry tree
#

So... both are broken?

coarse turtle
#

?

tawdry tree
#

With "should" it sounds like they don't do what they should. Do you mean "do"?

coarse turtle
#

oh - yes, do not should lol

deft stump
#

Oh new unity beta version.
I wonder if there's a package update too

tawdry tree
#

Does anyone know of a way to name entities spawned using ECB.CreateEntity(EntityArcheType)?

safe lintel
#

dont think you can name entities with ecb right now

opaque ledge
#

yeah you cant, but if you instantiate, newly created entity will have the same name

tawdry tree
#

Spawning from archetype, so that doesn't really help. Oh well, it's not really important, but i figured it might be useful down the line for debugging, since this system quickly makes a couple thousand entities.

storm ravine
#

During? No.
You would either need to use Run() and do it with the EntityManager afterwards, or use an EntityCommandBuffer
@tawdry tree Yes. ExclusiveEntityTransaction ๐Ÿ™‚

tawdry tree
#

Hmm, I don't care about it enough to create a sync point like that

#

But good to know!

storm ravine
#

So... both are broken?
@tawdry tree both works as expected.

tawdry tree
#

They have edited the message, it was a bit poorly worded at first

stone osprey
spark glade
#

Does anyone have a good strategy for making an ECS library and managing the dependencies of systems? I have the following "problem":

My library will provide a bunch of systems with dependencies between each other. The game I'm using has a few system groups set up, let's call them BeforeTheGameStartedSimulationSystemGroup and AfterTheGameStartedSimulationSystemGroup, which I used enable a bunch of systems that are specific to my game. The problem is that the systems from the library obviously don't know about these specialized system groups. So what are my options?

I could disable auto creation of the systems and manually somehow manually add them these custom system groups? Or I make all systems abstract and override them in my game with the respective dependencies?

mint iron
#

you can put these groups into your library, but that might be annoying for users to have a bunch of extra groups, and they still wouldn't be able to order them as needed.

#

i tried at one point to have a system that is essentially a loader for the other library/package systems. It would allow the user to customize where the library stuff should be placed within their project - group/system/before/after etc.

#

i wish this stuff was just built into ECS already :S

spark glade
#

interesting

#

yeah or some UI where one can arrange groups and place systems

tawdry tree
#

Sounds like a pretty specialized use-case, so I can see why they haven't spent dev-time on it...

spark glade
#

My other solution is to have one big monobehavior and manually enable/disable 100 systems instead of just 2 groups :/

vagrant surge
#

i would say leave it as monobehavior

#

to allow people to customize it relatively easily

mint iron
#

i think as this matures we'll see a lot more of the unity marketplace providing ECS systems in packages, where they go in your project setup will matter.

tawdry tree
#

Yeah, but I don't expect this kinda "polish"/QoL until at least v1.0

mint iron
#

true!

spark glade
#

maybe I'll just copy my library code into the project ๐Ÿ˜„ I'm my only user anyway, haha

tawdry tree
#

Beware overgeneralization, hm?

spark glade
#

Or maybe my library shouldn't be a library but more of sample code one would start off of and modify ๐Ÿค”

stone osprey
#

Any possibility to store a struct/class type inside a burst compiled struct ? Is this allowed ?

tawdry tree
stone osprey
#

But it cannot run scheduled anymore, right ?

tawdry tree
#

Well, something like that - it makes everything a massive pain.

stone osprey
#

Damn... i hoped thats the way i could solve the generic problem with reactive systems... currently using ISystemStateComponents you are "forced" to write one reactive system for each component you wanna listen too... too much boilerplate code, i hoped i could use a buffer component in order to safe the component type that changed with the information if it was added or removed... this way it wouldnt require a "Health" -> "HealthAdded", "HealthRemoved" component anymore

#

I wonder how hard it is to automaticly generate those structs... but that would be a huge overkill

tawdry tree
#

You can get an entity's EntityArchetype, which would let you get a NativeArray of the ICD types.
It is itself a struct (probably just an index like Entity), so yo could store the EntityArchetype in an ICD.

#

That would let you compare the before and after, at least if you make some helpers to compare.

stone osprey
#

That could work too... damn, why dont they just provide one by theirself xD

tawdry tree
#

Because that's not where their priority should be at the moment?

#

It sounds like it would be very useful if I needed it, but most people are more concerned with the core APIs and use cases at the moment.
I can't see them not making an official solution to that at some point, but it'll be after 1.0 and likely after the way to turn components on and off mentioned some time ago (4-7 hours?).

mighty whale
#

so i have a problem that i'm failing to find on google

#

it's hard to even put into words

#

i'm learning ecs by doing a minecraft-like game (uninspired i know) and i'm able to generate a flat dirt world but my character is bumped weirdly by the ground when walking

#

basically it's like i was hitting the edges of the cubes even though the world is flat

#

and i'm really lost as to how to fix this :(

#

sorry if this is the wrong channel and thank you for any help you might provide

zinc plinth
#

@mighty whale did you try to use the physics debug component to see if your colliders were good ?

#

and be careful, that thing needs to be a singleton

#

<- learned that the hard way

mighty whale
#

mh i am not aware of the physics debug component ahah, imma try that thanks :D

safe lintel
#

right channel

#

@mighty whale this is kind of a by design thing of unity physics

#

i think its called contact welding which havok has options for, might have to code something for unity physics

#

might be an example of it in the samples repo, there should also be things on the dots physics subforum if you search it

mighty whale
#

thank you for this, adding "contact welding" to my search indeed led to relevant posts ! i would have never found it myself lol

deft stump
#

okay...

#
var arch = dstManager.CreateArchetype(typeof(SpawnerEntityData),typeof(SpawnerNumberData;
dstManager.SetArchetype(entity, arch);
#

this doesn't work now

#

like... am I going crazy?

spark glade
#

How fast is entity GameObjectConversion ๐Ÿค” ...

#
        public void Convert(Entity entity, EntityManager entityManager, GameObjectConversionSystem gameObjectConversionSystem) {
            var stopwatch = new System.Diagnostics.Stopwatch();

            stopwatch.Start();
            var prefabRegistrySystem = entityManager.World.GetOrCreateSystem<PrefabRegistrySystem>();

            for (var i = 0; i < prefabs.Count; i++) {
                var prefab = prefabs[i];
                var prefabEntity = gameObjectConversionSystem.GetPrimaryEntity(prefab);

                /* Extract the entry authoring from the prefab, so that we can use it for efficient lookup when the prefab is needed in other systems: */
                var prefabRegistryIdentifier = prefab.GetComponent<PrefabRegistryEntryAuthoring>().prefabRegistryIdentifier;

                prefabRegistrySystem.Add(prefabRegistryIdentifier, prefabEntity);
            }

            Debug.Log($"PrefabRegistry: {stopwatch.ElapsedMilliseconds}ms");
        }
#

40 reasonably complex prefabs

#

1ms

#

Can that be correct?

tawdry tree
#

Sounds fair enough, it's pretty heavy and something you generally want to do with the sub-scene system or otherwise at start only

spark glade
#

I'm very happy how fast that is. I had never measured it before and came to a point where I'd be 3x-ing the number of prefabs, or go down a more complicated route...

Seems like I can just go the easy way haha ๐Ÿ˜„

#

Another question:

#

Say I have 2 prefabs. They both reference the same mesh.

  1. ECS just keeps the reference to the Mesh, but doesn't clone it or whatever, right?
  2. So memory consumption wise it should only exist once?
  3. SRPBatcher or whatever batcher is at work should be smart enough to properly batch the mesh drawing, right?
tawdry tree
#

1+2: ECS RenderMesh uses Material and Mesh classes, so they're by reference and shared (unless you load it twice)

#

Dunno bout 3

spark glade
#

I guess the easiest to verify 1+2 would be to see if they end up in the same chunk, right? (bc different ISCD for the mesh would force them to different chunk, wasn't it?)

#

Or am I remembering that wrong ๐Ÿค”

tawdry tree
#

Correct

stiff skiff
#

Why does new ComponentTypes take a managed array of ComponentType where most API's return a NativeArray instead

tawdry tree
#

Not sure what you mean by new ComponentTypes, but several APIs take component types by param, meaning you don't need to actually send in an array, you can just give it however many of the thing you need.
Also, NativeArrays has this method:

public T[] NativeArray<T>.ToArray();
celest oyster
#

Has anyone successfully used EntityManager.MoveEntitiesFrom to move entities between worlds lately?

deft stump
#

can someone check my sanity...
why is it...

math.cos(180) = -0.598f

isn't is supposed to be -1?
am I inputting the wrong unit the mathematics library?

stiff skiff
#

@tawdry tree Sadly the conversion from NativeArray to managed array will allocate here

#

Usage of params does allocate a managed array under the hood as well

tawdry tree
#

mfragger: Pretty sure th math lib uses radians. Try with that?

deft stump
#

I tried

#

now the math.sin() is wrong too.

tawdry tree
#

well then

deft stump
#
math.sin(math.radians(180)) = -8.7
math.sin(180) = -0.08

it's supposed to be 0

#

Oh but 90 works!

#

wth

#

and 270 works!

#

but not 180!

deft stump
#

oh ooooh!
I see.
It's a floating point number accuracy!
the math lib is so accurate that it wont return 0.

coarse turtle
#

@stiff skiff https://github.com/stella3d/SharedArray I came across this recently which allows you to implicitly convert between NativeArray<T> and T[]. Looks like it's achieved by pinning a ptr

safe lintel
#

ahh hackweek

wooden canopy
#

hackweek makes me sad, they used to do it super in the open, with video or page with all the hackweek projects

#

now you get 2 o 3 employees telling about their hack week on tweeter

#

*twitter

safe lintel
#

i guess because peoples expectations were high(i mean mine were). like the distributed light baking thing they showed eons ago

wooden canopy
#

I remember one where they enabled c++ scripting, seemed cool at the time

safe lintel
#

*high that it would get rolled into the editor and not be a one off hey check this out lol forget about it actually

wooden canopy
#

now dots seems way better

#

I get why they stopped making them super mega public, but unless you go totally dark not letting anyone publish anything, then a forum thread with huge disclaimers would be nice

safe lintel
#

or maybe its just that it only just ended and they havent had time to write up about it? with everyone working from home its kinda less exciting than making a big show of pictures of everyone collaborating together from a pr stance

stiff skiff
#

@coarse turtle It does this by just always allocating the managed array

coarse turtle
#

ah true

stiff skiff
#

To give some context, im trying an experiment in where I want to merge 2 entities

#

This requires me to take the archetypes of both source and destination entity, and merge their unique component id's into a new list, which is then used to update the archetype of the destination entity

#

After which I copy over the data from each component that was present on the source but not the destination

coarse turtle
#

o i see, so the EntityArchetype - when you grab its ComponenTypes, just returns a NativeArray, but when you create the new archetype from the EntityManager, it uses a managed array, and you want to avoid that right?

stiff skiff
#

Something like that

blissful veldt
#

Heyo, I'm having a really weird issue with unity's IJob system. Anyone here know anything about it?

I'm trying to run several jobs in a priority queue, but when the same type of IJob (a new one of the same struct) finishes, it gives me this error when I try to dispose of it's data.

#

The error occurs in handleFinishedJob when I try to dispose of a nativeArray this job type uses for output

#

If anyone had any insight I'd greatly appreciate it ๐Ÿ™, debugging offers no real help sadly

#

Also, this is the IJob being run here, the error only happens for the second IJob of this type to finish and go through the finish job handler. The first job works fine and finishes and disposes

ocean tundra
#

@blissful veldt I cant follow all the custom bits, but theres a overload of Dispose that accepts a JobHandle, maybe try that one

blissful veldt
#

Any reason why @ocean tundra ? And I'm more than happy to try to help explain any custom bits, I'm just not sure what's really happening.

#

I'm pretty new to the job system.

ocean tundra
#

๐Ÿ˜› I'm just tired so brain is struggling to switch on

blissful veldt
#

I'm just not sure what the overload for dispose does, i should go look ๐Ÿ‘€

ocean tundra
#

Also what is ApetureJobHandle?

blissful veldt
#

Thats the struct thats in the first screenshot. It's a handle I use to hold the job and the job handle and some other data for a few different types of jobs my manager queue uses.

ocean tundra
#

if its a struct make sure your passing it as Ref

blissful veldt
#

I have a manager that handles a priority queue of several different job types.

ocean tundra
#

and the job handle too

#

you probably need to pass the Jobs as ref too

blissful veldt
#

Oh hmmm

ocean tundra
#

So I'm carrying around job handles for native collections for my stuff, and i ran into issues with structs vs class and copying the handle around instead of keeping its reference

blissful veldt
#

Ah yea that's probably it then, I just need to figure out how the heck to keep the reference

ocean tundra
#

i made a 'container' which is a class

blissful veldt
#

lol dang, i'm trying to avoid classes because of garbage collection

ocean tundra
#

and made it return ref's of its job handels

#

my things are long lived so that wasnt a issu

#

i never destory/create new containers they last the lifetime of my game

blissful veldt
#

mine are like, 900 tiny jobs

ocean tundra
#

the job handles inside change a ton tho

#

hmmm yea that would be tricky

#

but also is it a pre optmization? gc is annoying but if your mostly in the dots world you should have tones of frame time left for the progressive gc

#

are you making 900 per frame?

#

or is it mostly 1 offs

blissful veldt
#

it's mostly one offs, it adds the like 900 chunks around the player to start (voxels) and then as they move it adds walls of chunks

#

theres differnt jobs for loading the block data, meshing the data, and activating them in unity space

#

so the job type and distance to player play into priority

#

Jobs have to finish on the main thread though don't they? So GC would have to happen there?

ocean tundra
#

yea

blissful veldt
#

I've had issues with voxels and objects over structs and garbage collection in the past, so I guess i'm not sure it'd be a problem but, i have a feel

ocean tundra
#

you might be able to get it to work with structs as containers

blissful veldt
#

yea i just need to ref eveything... time to find out out to go through a dictionary by reference ๐Ÿ’ฆ

ocean tundra
#

i just found it annoying but pretty sure my issue was a i am assigning a field the container

#

and i think that is what 'breaks' the ref to the same item

#

if you have a single system that contains all the handles/containers and only ever use them from that i think it will be fine

blissful veldt
#

I think what may be breakign it is i'm calling complete in a foreach loop

ocean tundra
#

change that to a for

#

foreach is slower

#

and i think the in magic makes a copy

blissful veldt
#

wait, so i think i just need to make this a ref

#

because that marks it complete, and then... wait no, if the issue was it wasn't marked complete because it's not a ref that wouldn't matter

#

I mark it complete right before I dispose without storing it again ๐Ÿ˜•

ocean tundra
#

yea that should be ref

blissful veldt
#

Wait, I'm a bit confused how the jobHandle needs to be passed by ref

#

isn't it a struct? or is there weird unity magic that lets it store a reference type?

#

because as long as the one I send had Complete() called on it, why does it matter that it's a copy of the original handle?

ocean tundra
#

i mean your custom handle thing needs to be a ref

blissful veldt
#

I'm not sure why though

ocean tundra
#

hmm do you need the completed one out of it again?

blissful veldt
#

if i copy it it should copy the completed one right?

#

This is how I run them and check for completion:
these both run in Update()

#

getJobFor() returns a new ApertureJobHandle

ocean tundra
#

wait. schedule is where you get the job handle from

blissful veldt
#

Yea, that happens inside my AppetureJobHandle when schedule is called

ocean tundra
#

but you dont have it

blissful veldt
#

It's a wrapper function

#

It's scheduling the job, and storing the handler in that AJH, then storing the newly modified AJH struct in a new dictionary... so it should be fine without being passed by ref right? ๐Ÿค”

ocean tundra
#

yea i think so

blissful veldt
#

and then I take the value that was put into that dictionary, modify it again by running complete() on the struct's stored jobHandle, and run a function on the modified one

ocean tundra
#

maybe just to be safe print the hash code of the jobhandle on lines 53 and 55

#

to confirm it gets set

blissful veldt
#

i didn't know you could do that

ocean tundra
#

just debug.log(handle.gethashcode

#

everything in c# has a hashcode

#

ive never really messed with reflection and stucts no clue if that has any effects

#

tho cant you just schedule on the IJob without the generic magic method?

#

im guessing unity dosnt like that?

blissful veldt
#

yea, IJob doesn't have Schedule in it

#

it's dummmmb

ocean tundra
#

but wont the extention methods work on IJob?

#

oh

blissful veldt
#

they don't ๐Ÿ˜ฆ

ocean tundra
#

no i see

#

cause your passing it as IJob

#

it loses the 'struct' bit and gets boxed

#

yea confusing

#

nice solve tho

blissful veldt
#

yeh, it's weird.

#

thanks lol, took a bit of searchin

#

now i just need it to work XD

ocean tundra
#

but that reflection bit wont be nice for performance

#

you could probably cache the making generic method bit in a static

#

and i think you can pass null to invoke instead of a new empty array

#

for the parameters

blissful veldt
#

it's silly there's not just a default lol

ocean tundra
#

yup

#

i ran into similar issues trying to genericly add IComponents to a entity

#

very annoying

blissful veldt
#

yea, i'm still trying to think of a better fix than the reflection

#

the static is a neat idea, but i'd need to make it some kind of array or dictionary with all of the potential job types

ocean tundra
#

yea optmize after it all works

blissful veldt
#

i could make it a static array that expands when it encounters a new job type, would mean only the first job is slowed ๐Ÿค”

#

yee

#

I'm going to test with passing the handle to Dispose ands check the hash code on the handle while debugging through, I'll let you know what happens

#

yea it looks like between me setting the handle :

#

and me calling complete on it

#

the hash changes ๐Ÿ˜ฆ

#

Guessing unity uses the hash to find the job it's managing

ocean tundra
#

theres some sort of pointer under the hood, but i dont know what sort of magic they do

blissful veldt
#

wait...

ocean tundra
#

but if its changing somehow means your getting a copy made

blissful veldt
#

it changes as soon as i'm out of the function apparently... i'm confused

ocean tundra
#

whcih function?

#

is its your generic one your calling via reflection

blissful veldt
#

the reflection i think, one sec

ocean tundra
#

hmmm

blissful veldt
#

so the bottom watch value is before I schedule anything, so it's a default handler

#

job handle gets set

#

back outside the function, the value didnt' change

#

is it because i'm using invoke?

ocean tundra
#

honestly dont know

#

your setting a bool in the invoke method right?

#

has been scheduled

#

what value does that have

blissful veldt
#

oh yea... I am, and that seems to set

#

but it's also a bool so there may be some weird voodoo

#

I'm going to try this

ocean tundra
#

if that dosnt work maybe see if you can strip it wayy back

#

remove the container

#

use a set of nativelists

#

that the index's all match to 1 job

#

and use pattern matching on the job schedule

#

theres also native queues which may be a better fit

blissful veldt
#

it looks like it's working! ๐Ÿ˜„

#

well, at least this part is

#

wait what do you mean "use a set of nativelists
that the index's all match to 1 job" ?

ocean tundra
#

it wont work with a queue

#

basiicly you could have 5 native lists for each type of data you need, index 0 of all those lists are for the same job

#

it would be a bit of a pain tho

blissful veldt
#

Hmm, maybe

#

same hash value on the out side too!

#

steaaadddy

#

WOO! That seems to have fixed it

#

๐Ÿ˜„ Thanks so much @ocean tundra ! Couldn't have done it without you

ocean tundra
#

@blissful veldt SWEET!!!

blissful veldt
#

Wait, can jobs not output booleans?

#

Does it HAVE to be in a native array?

#

Or does storing jobs in a dictionary not save a link to them correctly? It looks like the job has a different value when it's running Execute for job.GetHashCode() than when I call schedule() on it.

#

I think i may be misunderstanding how to store jobs and get output from them

ocean tundra
#

@blissful veldt Jobs can only output data in native collections

#

make a native array size 1

warm panther
#
A Hybrid Renderer V2 batch is using a pass from the shader "Hidden/Internal-Loading", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer.```

Might be the better question for this channel, on second thought.
#

How can I prevent this nuisance?

tawdry tree
#

What rendering-related packages are you using?

warm panther
#

Universal RP 9.0.0 preview 14, Hybrid renderer 0.5.2 preview 4

tawdry tree
#

Are those compatible?

#

Sounds like possible incompatability

warm panther
#

I think yes. The error occurs only when I instantiate an entity that was declares using IDeclarePrefabs, and only when that is the first time. The entity in this case even uses my own shader graph, but any shader that hasn't been loaded yet won't work, because the cyan colored "dynamically loading" shader is the one that doesn't work with the SRP batcher.

deft stump
#

so... shader graphed materials aren't fully supported yet?

warm panther
#

Not sure, what's not supported is dynamically loading them.

#

while the shader loads, the renderer barfs.

#

NEW QUESTION ๐Ÿ˜„ In Hybrid Renderer V2, on Universal Render Pipeline, how can I add a second directional light (can be a vertex light) without manually writing my own Lit shader?

#

The other loses the blue fill light as soon as it becomes an entity.

opaque ledge
#

@deft stump its supported, check hybrid renderer manual

#

there are 2 version of hybrid renderer, v1 and v2, its supported in v2, not in v1

gusty comet
#

hey guys does NativeList still exist? i was trying to use it as i was following a tutorial on dots pathfinding but it seems NativeList doesnt exist

warm panther
#

[QUOTE="Tim-C, post: 5875384, member: 15376"]Hi. Universal RP + hybrid currently does not support more than the main directional light. We have to make some new systems to pass the per object light index list through to renderer. This is high on our priorities and being worked on.[/QUOTE]

stone osprey
#

How do i add multiple components using the command buffer ?

opaque ledge
#

how do you mean ? you just call the commandBuffer.AddComponent multiple times

stone osprey
#

Thanks ! Thats what i meant... but i thought theres another solution ^^

#

Hmm... any idea why some of my systems have the tag "not run" in the ecs debugger ?

#

Does that mean they crashed ? Shouldnt they run always ?

stone osprey
#

@opaque ledge Are you sure that the command buffer .AddComponent works after another with multiple different components ? Somehow only the first component gets attached https://prnt.sc/t7h0ub

Lightshot

Captured with Lightshot

#

"Added" gets added... while the state component does not get added at all :/

opaque ledge
#

yep, i am pretty sure

#

are you calling these from main thread ?

stone osprey
#

yep

#

OnUpdate in Systembase

opaque ledge
#

its better to use EntityManager directly then

#

command buffer is designed to work with jobs

#

tho i am not sure why your state component isnt being added, can you change the code to StateComponent being added first and "Added" component second ?

stone osprey
#

I did... then the entity has the "StateComponent" attached... but is missing the "Added" component :p

#

I actually need those buffers in order to add the "Added" component at the start of the frame and remove it at the end :/

#

It gets strange... even if i attach the state by entitymanager and the added by the buffer... only the first one gets added to the entity

opaque ledge
#

hmm, any errors ?

stone osprey
#

Nope :/ Checked all my systems... disabled them... nothing

#

Damn i hate such issues

#

Anyone else ever had the problem that a command buffer somehow only adds the first added component to the entity ?

#

This drives me crazy... i cant find the damn issue

#

This also doesnt make sense

#

That throws a exception that its not possible to call .AddComponent because newEntity is not a EntityQuery

#

But .AddComponent(entity) exists

amber flicker
#

try .AddComponent(newEntity, typeof(Added));

stone osprey
#

@amber flicker Thanks ! But it tells me that this method does not exist in the command buffer

amber flicker
#

how about .AddComponent(newEntity, new Added());?

#

also that should have worked - is Added not an IComponentData?

stone osprey
#

thanks ! That worked ๐Ÿ™‚

amber flicker
#

hmmm ok

stone osprey
#

But the previous issue still exists... only the first component in the buffer gets attached

#

I start to hate dots... instead of using a query... im gonna loop over all entities to add them... i wonder if this works

#

Dots is fucking me up... this works for some reason

amber flicker
#

so... I'm not sure how involved I want to get ๐Ÿ˜„ but just to say.. you should have a large preference for queries where possible, also be careful when using buffers - e.g. the create calls return entities but they don't yet exist in the default world so you shouldn't create references to them.

#

ok.. one more thing if that change worked

#

consider that any structural change may affect your query results for the buffer to act upon

#

e.g. psudeo code myQuery = typeof(Bob); buffer.Remove<Bob>(myQuery); buffer.Add<Something>(myQuery); - that last .Add will do nothing as there are no more bobs ๐Ÿ™‚

stone osprey
#

That could be the reason... my "newEntities" query involves entities without State and without Add... once the first AddComponent was fired, it involes State/Add and the second component does not get attached... fucking hell @amber flicker You saved my day, thanks xD

amber flicker
#

Awesome - may you go forth and spawn many entities

stone osprey
#

Thanks, thats what im gonna do ๐Ÿ˜„ this is the way

#

Does anyone here knows if i can attach ObjectComponents via a command buffer ? Probably not because ObjectComponents run on the main thread right ?

opaque ledge
#

nope you cant

#

you have to use EntityManager

amber flicker
#

can you add class-based ICDs? I think you can? Possible alternative for component object at any rate.

#

though I could be wrong - maybe you can't use them with ecbs - never tried and they wouldn't be burstable

stone osprey
#

how do i pass a entity query via a array ? everytime i try to either pass a query or a nativearray it somehow clears itself and ends up being empty

#

I basically wrote my own system with 3 queries... those gonna get used inside the onupdate method... a derived system uses them but all queries are empty but only in the derived part... passing query or data doesnt work too because its getting cleared

#

Anyone ever experienced something similar ?

#

Im still stuck with that shit... when i try to pass a damn query which is full of entities... its getting cleared during the passing....

#

var count = entities.CalculateCount(); | Count = 100.... | myMethod(entities) -> Count = 0

#

I already googled, read the damn documention but i cant find anything about this

#

Event the cached queries are empty

tawdry tree
#

What are you trying to do here? Pass an array of EntityQuerys? Or just in general pass some recipe for getting a specific (but arbitrary) set of entities?

amber flicker
#

maybe you want to pass the query.ToNativeArray rather than the query itself? Sharing code and as Hodhandr says, what you're trying to do here would help.

mint iron
#

whats new? ๐Ÿ˜›

opaque ledge
#

burst 1.3.3 came ๐Ÿ˜›

#

1-2 random fix

mint iron
#

wooo!

#

topher still slaving away on his tile map demo? can't wait to see that

opaque ledge
#

been a while since i saw topher's last post

deft stump
#

New burst?

#

Nice

#

Time to immidiately install

#

And break development because it might break unity

mint iron
#

im trolling joachims forum posts for news ๐Ÿ˜„

#

"BlobAssets can not reference other blob assets. It is not supported because it would mean that blob assets are not immutable / memory ready anymore. " - Joachim_Ante

deft stump
#

So i cant do blob asset within a blob asset?

mint iron
#

apparently not, and he's keeping to the blobAssets are only for immutable data but a lot of people are not using them that way, i guess if you go to the dark side you're on your own.

#

they have to be at conversion/storage time of course, to be able to get loaded in a subscene.

deft stump
#

Hrmmm... I dont understand though.
Since all it would store is the referrence to the other blob asset.

tawdry tree
#

You could totally make a system (non-ECS) where you'd give your blob assets some kinda ID; and you could then have a blob asset store such an ID to refer to other blob assets.

mint iron
#

"Looking at the C++ code it looks like JobHandle.CombineDependencies implicitly automatically kicks off jobs that haven't been scheduled yet." - someguy "I agree it shouldn't be doing that and i'll figure out what we can do about it." Joachim_Ante

#

https://forum.unity.com/threads/so-i-was-using-ecs-the-wrong-way-story.877138/#post-5768368

"When you have small entity/chunk counts, the overhead of scheduling can be higher than just executing the code with .Run(). Do note, that we are doing a lot of work in order to make that not be so...

Specifically we are:

  • Adding support for completely bursted struct based systems. So a system itself can be burst compiled.
  • Doing a bunch of optimizations in IJobChunk & JobScheduler to reduce overhead." - Joachim_Ante
safe lintel
#

my game runs faster when i disable all jobs than with jobs enabled ๐Ÿ˜…

opaque ledge
#

what do you mean disable all jobs ?

#

you mean jobs debugger ?

safe lintel
#

yeah

#

it also runs faster when i reduce the job count to 1 worker in a build, havent found how to disable jobs in a build

#

๐Ÿคท

#

oh i mean Use Job Threads being disabled not the debugger

vagrant surge
#

@safe lintel scheduling ECS jobs is like 99% overhead

#

on simple systems

#

the core ECS burst execution is stupid fast

#

but it gets boggled down by huge overhead on a per-system basis, due to checking dependencies with stuff

mint iron
#

wonder if it would be worth just writing your own version of systems without any checks

safe lintel
#

admittedly im not scaling up my entity count too much, still too dependent on monobehaviours for character stuff to be able to do it in a way that yields benefits from dots

#

i also wonder what perf would look like if I explicitly set the order of all my systems, i lazily let unity figure out the majority of it

dull copper
#

also even when you actually get gains from jobs, it's possible your gains diminish the more worker threads you throw at it

#

unity job system by default schedules work on all worker threads which is your cpu hw thread amount -1 (and main thread)

#

this is very inefficient on my testing, even for basic built-in DOTS stuff like physics or hybrid renderer both benefit from reduced worker amounts

#

I've gotten really side tracked lately so haven't gotten any demo for this done yet but I'll try to get it out

#

that being said, last Unite Now for Unity Physics did mention they are looking at letting Unity Physics run things using x amount of threads and that they allow this for Havok Physics (I don't even know if it has anything to do with Unity jobs on havok as it probably does it's own threading)

#

they wouldn't even consider this if they didn't know of this bottleneck already

#

I haven't really seen any practical gains past ~4-5 worker threads

safe lintel
#

yeah there are a lot of little gotchas currently

dull copper
#

vs 23 max it would assign by default on my cpu

mint iron
#

yeah i shudder now when i hear people talking about multi-threading their code. I think best case scenario you set things up so you have the option easily down the line if neccessary - which Unity ECS does a great job of allowing. But otherwise ignore it.

dull copper
#

I want to make bigger world prototype using DOTS so I'd need to figure this one out

#

my main issue here is that stock DOTS system suffer with default design currently

#

it definitely shouldn't be like that with "performance by default"

#

even if you have older, say 4 core 8 hw thread cpu, maxing the workers probably does give you worse results than just limiting the workers to half of what unity would assign to it

#

of course the issue will not be as clearly visible but everyone should be able to tell they are not getting more perf and that they are consuming more cpu

mint iron
#

from my tests 4 seemed to be the magic number, more or less would be worse once past the threshold of gaining any benefit at all from parallel

wary ibex
#

How can I check for whether all values in a bool3 are true?

dull copper
#

yeah, 4 is a good compromize

mint iron
#

math.all

wary ibex
#

ty

dull copper
#

I can't remember if it was unity physics or hybrid renderer but one of these worked best with ~4 workers and other with 0-1 workers

wary ibex
#

I hope whoever designed these packages with small cases is deeply ashamed

dull copper
#

if you mean new math lib, this was thoroughly discussed in miles long forum thread when it arrived

#

it really split opinions

wary ibex
#

theres no excuse for it

#

this is C# not javascript

mint iron
#

here we go! hehe

wary ibex
#

even in javascript they have camel case classes lol

dull copper
#

how I read it through the lines, there were one or two staff members (Acton etc?) who really wanted to keep the lowercase thing

#

it had to be someone with big authority

wary ibex
#

yeah I agree. Because its so stupid, I dont see any other way for this to actually be authorised

dull copper
#

that being said, if you write a lot of math, it's actually faster to use it like it is now as it's tad faster to type

mint iron
#

personally im for using the official standards from the people who make the langauge, makes sense you know.

safe lintel
#

i kinda like the lowercase ๐Ÿ™ƒ

deft stump
#

imo, I don't particularly care.

coarse turtle
#

ikr looks like shader functions to me ๐Ÿ‘€

safe lintel
#

i do feel its helped me feel more comfortable modifying shader stuff

dull copper
#

I don't mind either anymore, just find it weird that Unity now has three different conventions

safe lintel
#

totally subjective

stiff skiff
#

Yeah the math library was kept as close to hlsl as possible I think

mint iron
#

i could get behind that too @dull copper if they chose something and stuck to it, but half the unity core APIs and objects still use lower case public members, the other half are to standard.

dull copper
#

old stuff used pascalCase, new C# packages use CamelCase which I think comes from .NET standards etc... and then there's the math lib oddity

safe lintel
#

i also agree that the standards are just all over the place ๐Ÿ˜„

coarse turtle
#

waiting for snake_case to drop ๐Ÿ‘€

dull copper
#

I can totally understand the shift to move toward more standard way but the math lib then broke the convention again

#

all old Unity API also uses british english where new stuff uses american

mint iron
#

lmao

dull copper
#

behaviour, colour etc

wary ibex
#

is there any AddForce equivalent in dots?

dull copper
#

I believe this is because Unity was originally a danish company and we learn british english at schools at EU

#

I dunno if there's any helper function for that somewhere

#

there are some for impulses

safe lintel
#

theres a physics utility class, cant rememnber the exact name

dull copper
#

but force is really just impulse * deltatime

wary ibex
#

im getting started with dots and I noticed setting PhysicsVelocity.Linear gets rid of gravity, like with RIgidbody.Velocity

dull copper
#

I still can't get around that libs "PhysicsWorld.ApplyAngularForce()"

#

angular force...

#

that's torque

mint iron
#

@dull copper hows your game going btw?

dull copper
#

been bit slow lately haven't done much unity work in few weeks now

#

this week has been pain as I'd really need AC here

#

it's really hard to make any creative work when it's near 30 degrees celsius at the desk

#

used to have movable AC but it broke down, should totally get another one

wary ibex
#

whats your game about?

dull copper
#

cars

#

๐Ÿ˜„

wary ibex
#

๐Ÿ˜„

dull copper
#

Unity Physics samples have joint scripts in the ECS samples

#

there aren't all very efficient but you can fix them and do custom joints yourself

wary ibex
#

yeah I was taking a look at that

safe lintel
#

it does have configurable joints

dull copper
#

there's also conversion from some joint types but I haven't tried it as I prefer to setup these myself and not rely on conversion

safe lintel
#

i use it for converting gameobject ragdoll character joints to dots joints personally, had to modify some stuff because hierarchy wasnt supported and im still not sure if it is right now with inject

wary ibex
#

hmmm

dull copper
#

talking of dots samples, wonder how long till we get that dungeon generator

mint iron
#

i was mentioning that earlier, topher has gone missing

dull copper
#

it does cover some of the custom joint things briefly

wary ibex
#

nice thanks

#

I havenโ€™t seen it. I am basically starting learning DOTS today ๐Ÿ˜„

safe lintel
#

also just checked and its been like 6months since dspgraph was updated

dull copper
#

com.unity.ui.runtime has been a while (sitting still) too

#

I kinda wished that would have gotten more traction

safe lintel
#

is that elements/toolkit?

dull copper
#

it's basically ui elements for runtime

#

so.. for your game itself

#

I can't wait to not have to use ugui

mint iron
#

anyone tried it for game UIs?

safe lintel
#

ah yeah, i was fiddling around with the github package but figured its too early to attempt to rely on that

dull copper
#

I don't like even the idea of having gui in scene

#

yeah it's way too early still

#

there's like no animation even

mint iron
#

ugh

dull copper
#

animation was on the roadmap but since there hasn't been any actual package update and dev repo is not public, there's no telling where it's going atm

#

visual scripting integration ๐Ÿ˜„

#

I hope they don't wait for that to release first

#

dots ui stuff is still a question mark

safe lintel
dull copper
#

I'd love that pie menu for probuilder

#

but yeah, that UI stuff was teased years ago already

safe lintel
#

did you see the dots timeline package?

#

at least thats kinda there and in development

dull copper
#

yes, but haven't tried it

odd bay
#

I need ui elements to come out sooner

#

ugui feels so clunky to work with

worn stag
#

there will be dedicated timeline for dots?

#

or just dots support in existing timeline

#

how are you track packages after bintray dropping by unity?

safe lintel
#

do you mean timeline the unity feature or timeline as in roadmap?

worn stag
#

unity feature

#

for cutscenes

safe lintel
#

theres a package for converting it

worn stag
#

cool

safe lintel
#

for keeping track i just type in the package name here, not really a good alternative yet

#

also this package is super early and not mentioned anywhere

#

i dont even remember how i found it

worn stag
#

i imagine

#

waiting for all dots animation features like compositor and timeline

#

tried new state machine in compositor recently but with no luck. pretty complicated without documentation

safe lintel
#

yep kinda painful waiting

#

i want to progress doing more stuff for my project, but i really dont want to do anything more with mecanim/unityengine stuff, dots is there and working but beyond my understanding, so twiddling my thumbs waiting for updates, examples, dev communication which are all sparse

mighty whale
#

Hi can we put multiple PhysicsCollider in a single entity ?

#

it seems like a simple question but im struggling to find the answer on google for some reason

wary ibex
#

@safe lintel

it does have configurable joints
would you mind saying how you got configurable joints in ECS?

dull copper
#

@mighty whale they mentioned that will be possible in the future on the Unity Now talk

#

I haven't checked if it already works on newest Unity Physics package or not

#

ah, it's in

#

    It is now possible to create a compound collider by adding multiple PhysicsShapeAuthoring components to a single GameObject.
    It is now possible to convert a GameObject with multiple Joint components on it```
#

(Unity Physics 0.4.0)

mighty whale
#

ok ty, and is there any other way that we could have 2 discontinued hitbox for one entity ? To be clear I don't need to know which hitbox is hit so it can be 1 hitbox, the thing is that hitbox could be made from cubes that are not touching each other

#

i hope it's not too confusing...

dull copper
#

I don't see why not

safe lintel
#

@wary ibex i think all joints get turned into ecs "configurable" joints when conversion takes place, the input data determines what their limits etc are. the video explains a bit more but if you take a look at the code you can see how it happens

#

ie Unity.Physics.Hybrid\Conversion\LegacyJointConversionSystem.cs if you want to use the builtin conversion

#

hmm the "official" joint authoring components seem to only exist in the samples?

#

im stepping out now but ill be back in a bit

#

๐Ÿฆฎ dogs gotta walk ๐Ÿ™‚

wary ibex
#

thanks! I forgot about the video ๐Ÿ˜„

wary ibex
#

What are these mutable interfaces? Any place I can read about them? Couldn't find anything on google

safe lintel
#

basically ignore jointdata you create a PhysicsJoint( IComponentData)

wary ibex
#

I was able to do this

var constraints = hinge.GetConstraints();
var constraint = constraints[0];
float targetRotRad = math.PI / 4;
constraint.Min = targetRotRad - 0.01f;
constraint.Max = targetRotRad + 0.01f;
hinge.SetConstraints(constraints);```
which I think is the intended usage
#

this is nowhere near the functionality of a ConfigurableJoint though ๐Ÿ˜„

safe lintel
#

are you using the physics sample joint authoring components?

wary ibex
safe lintel
#

yep thats the stuff

wary ibex
#

hmm

#

I think I'll need to write the TargetRotation and all other motorised joint implementations

wary ibex
#

Is it not possible to edit component values in runtime?

ocean tundra
#

@wary ibex What do you mean by edit values? like in the inspector?

ocean tundra
#

how bad is the cost of scheduling jobs?
I'm trying not to optimize too early but I could rewrite some of my core systems to be a job per player
I would like to support 16 players which would mean 16 jobs per game 'thing' (Position/Health/Rotation ect) to sync over the network
So alot of jobs

hollow sorrel
#

it's not free and 1 job per game thing per player doesn't sound worth the trouble

#

job schedule overhead is around 0.05ms per job last i checked so wouldn't bother scheduling more unless the job takes longer than that to complete

#

actual number depends on cpu but still

ocean tundra
#

yea thats kinda what i was thinking

#

also i just remembered chunk based jobs so they might be better if i do need more performance

#

that and chunk change versions would probably have much better performance

hollow sorrel
#

doesn't 16 players * game thing mean you're just updating 16 positions etc or am i misunderstanding

ocean tundra
#

of no, 'thing' is basically a component i want synced over the network

#

replace thing with component and hopefully it makes more sense

hollow sorrel
#

yea but still 16 doesn't sound like even version checking would be worth it

#

wouldn't most of that fit in one chunk anyway

ocean tundra
#

oh its a RTS

hollow sorrel
#

ahh i see

ocean tundra
#

so its 16 players * number of units * networked components

#

or something like that

hollow sorrel
#

makes sense

wary ibex
#

@ocean tundra yes in the inspector

zinc plinth
#

hmm, how can I make an entity a parent of a go going through conversion ?

tawdry tree
#

So you have an entity...
And you have a gameobject.
And you want to convert the gameobject, and want it to be a child of the entity when done?

zinc plinth
#

yep

tawdry tree
#

You would need to search for that entity and use a custom converter

dry dune
#

just discovered LinkedEntityGroup buffer that allows to link few entities and instantiate/destroy whole group with the owner, so sad that it is not documented, such useful thing
how many things there left to discover...

scarlet inlet
#

Would the performance of IJobParalleFor and IJobParallelForBatch be the same whe nBurst is used?

#

I have this gut feeling that IJobParalleForBatch would be faster, but I have never verified

scarlet inlet
#

just did a quick test and IJobParallelForBatch seems indeed much faster

ocean tundra
#

@wary ibex You cant, the inspector dosnt allow editing of entitys and components

ocean tundra
#

Is there any way to customize the entity component inspector yet?
I would like to setup a Guid inspector and a bitmask inscpector

opaque ledge
#

no i dont think so, at least not officailly

ocean tundra
#

maybe in a few updates

opaque ledge
#

well, it will come eventually, tho not sure tomorrow or 2 years later ๐Ÿ˜„

ocean tundra
#

๐Ÿ˜›

spark glade
#

Anyone knows how to access the GenerateAuthoringComponent from code?

Basically I'm trying to have a script that generates prefabs and I want to add a bunch of components to those prefabs. Some of them being Components with GenerateAuthoringComponent.

#

If it's my own hand written AuthoringComponent, there is no problem:

var prefabRegistryEntryAuthoring = instance.AddComponent<PrefabRegistryEntryAuthoring>();
prefabRegistryEntryAuthoring.prefabRegistryIdentifier = unitDefinitionLevel.PrefabRegistryIdentifier;
#

But if It's one with GenerateAuthoringComponent like:

[GenerateAuthoringComponent]
public struct Shadow : IComponentData {
    public float scale;
}
#

Then there doesn't seem to be an authoring component I can reference from my code:

#
    var shadowAuthoring = instance.AddComponent<Shadow>(); // ???
#

That might just be a limitation of the GenerateAuthoringComponent workflow, but I'm wondering if there is a way that lets me avoid writing a dozen or so "dummy" boilerplate authoring components.

#

๐Ÿค”

ocean tundra
#

@spark glade Could you add them to the converted prefabs?

#

or must be added to the GameObject version?

spark glade
#

yeah i can add them through the editor

#

Just no idea how to add them through code, because the Shadow : IComponentData doesn't extend MonoBehavior.

ocean tundra
#

there should be a new type

spark glade
#

And there doesn't seem to be a ShadowAuthoring that Rider can find

#

Maybe I could inspect an existing prefab somehow ๐Ÿค”

ocean tundra
#

Yea just noticed that

#

they must make them in some sort of unreference assembly somehwere

spark glade
#

Wow, so if I check the prefabs it references a GUID: e1d46917ee1a417e8a7f2a2a9a384210

Debug.Log(AssetDatabase.GUIDToAssetPath("e1d46917ee1a417e8a7f2a2a9a384210"));
yields
Assets/Scripts/Game/Components/Shadow.cs

ocean tundra
#

I have no clue how unity are hiding it from your code

#

its namespace should be the same as your type, its name is appended with Authoring and it should have the same scope

#

but it does get a DOTSCompilerGeneratedAttribute put on it

spark glade
#

Must be some black magic tricker, sigh

ocean tundra
#

wait

#

its a post processer...

#

so it runs after your code has compiled

#

so the type does exist

#

but your code cannot see it

spark glade
ocean tundra
#

you should be able to find your authoring types via reflection

#

it should be in the same assembly as your type so something like this should work

#

Shaddow.GetType().Assembly().GetType(nameof(shaddow)+"Authoring")

spark glade
#

๐Ÿ˜ฑ

ocean tundra
#

if you have namespaces it may be slightly different

spark glade
#

Hm... yeah I'm gonna write those myself I think Never a fan of reflection.

#

It's a ticking time bomb

#

๐Ÿ˜„

ocean tundra
#

haha

#

sometimes

#

its very usefull

#

just never use it when you need performance

spark glade
#

Haven't tried it the 3.0 Beta of Odin yet, but their team is working on making the Entity view less ugly ๐Ÿ˜„

#

Hopefully it'll come to Unity without the need of such extensions

ocean tundra
#

Ooo i do like Odin

spark glade
#

Best $50 I've spent fo far ๐Ÿ™‚

ocean tundra
#

yea so good

#

my 2nd most used asset

#

๐Ÿ˜›

dull copper
#

@spark glade there is "dots editor" package but it only works for peeking the values when things are placed in dots subscene

#

or @ocean tundra, whoever that question applied for originally

mint iron
ocean tundra
#

@mint iron oh that looks great

wary ibex
#

any idea of when this will be implemented?

dull copper
#

well, everyone expected it to be on next physics package one version ago already so...

#

but you can also apply impulses to your joint setup manually just fine

#

basically you can build motor functionality with them

wary ibex
#

@dull copper you apply impulses to the body, and not the joint, right?

#

I believe Iโ€™ll also need to write the forward kinematics code which the motor would handle, at least if it has a โ€œtarget rotationโ€ setting which Iโ€™m also expecting

dull copper
#

to the bodies yes

eager jungle
#

Hi guys, quick question regarding EntityManager.Exists. How is it possible for an entity after its been destroyed with an ECB to still "exist" but already have no component?

storm ravine
#

For example ISystemStateComponent can prevent full destroying until this ISystemStateComponent will be removed directly, for example you have entity and A, B, C components where C is ISystemStateComponent and until you directly not remove C - entity wouldn't be destroyed fully, but all other component will be removed

eager jungle
#

hey tanks, i don't use ISystemStateComponents, i knew about that and checked specifically

#

or maybe a builtin one?

storm ravine
#

You don't - unity does for some systems ๐Ÿ™‚

eager jungle
#

does parenting use that?

storm ravine
#

Yes

eager jungle
#

ok, problem solved then... kind of

storm ravine
#

PreviousParent : ISystemStateComponentData, Child : ISystemStateBufferElementData

eager jungle
#

im reviewing a peer code, and he's using a routine to destroy all parents, shouldn't the root destroy be also destroying all children?

storm ravine
#

But ususally it can be only 1 frame and depends when you destroy entity

eager jungle
#

(it is actually one frame only, yes)

storm ravine
#

im reviewing a peer code, and he's using a routine to destroy all parents, shouldn't the root destroy be also destroying all children?
@eager jungle if LinkedEntityGroup buffer used for root - yes it will destroy all childs (well not childs technically as you can populate that buffer by yourself, but default prefab conversion populate LinkedEntityGroup with childs for you)

eager jungle
#

we have a simple mesh hierarchy (depth =4), whith convert and destroy on root, we're calling Destroy on an ECB on the root entity , and the children are not destroyed

storm ravine
#

Show EntityDebugger and inspector for root entity (after conversion)

#

I supopose it's just hierarchy object on scene? Not converted prefab?

eager jungle
#

in scene, correct

storm ravine
#

Well then I'm sure on 100% your entity haven't LinkedEntityGroup ๐Ÿ™‚

eager jungle
#

no LinkedEntityGroup component

storm ravine
#

Yep

#

as it's added only for prefabs from DeclareReferencedPrefab

#

Well you can add it by yourself in Convert for your root

eager jungle
#

ill do that, but that is kinda weird behaviour ^^

storm ravine
#

Just simple MB with IConvertGameObjectToEntity and add LinkedEntityGroup in Convert and add all child's AND (important) root itself to that buffer

#

Or use DeclareLinkedEntityGroup on root GO

eager jungle
#

how am i supposed to recurse in the entity children from the convert?

storm ravine
#

GetPrimaryEntity in root Convert, or as I told above - conversionSystem.DeclareLinkedEntityGroup in Convert

eager jungle
#

im going to use DeclareLinkedEntityGroup , but im curious, about GetPrimaryEntity. Am i supposed to use that by passing the GameObject children? and recurse the go?

#

oh there is a child component, i missed it sorry

storm ravine
#

GetPrimaryEntity return you other entity which will be converted, this not necessary child, it can be different entity, different prefab from IDeclareReferencedPrefabs etc.
DeclareLinkedEntityGroup simpliest way to add and populate LinkedEntityGroup from root

eager jungle
#

yea, seems to be working

#

not solving the one frame delay after deletion, but makes more sense

storm ravine
#

And wouldn't as it's by design how ISystemStateComponent works ๐Ÿ™‚

eager jungle
#

yea sure, i mean, it make sense now im fine with that

#

thanks for your help, very appreciated

storm ravine
#

Np

scarlet inlet
zinc plinth
#

that's less than 0.005ms, don't think it matters that much >.>

scarlet inlet
#

haha

#

what about now

#

this fallbackallocation is eating up a lot of time

#

it's even more than that

deft stump
#

wow

storm ravine
#

@scarlet inlet answered to you on forum about ComponentDataFromEntity, but ask here as it's faster ๐Ÿ™‚ Why you need ComponentDataFromEntity by ref? ComponentDataFromEntity is a native container which itself only store pointer (and 3 utility fields and 2 of them even readonly) it's already access EntityComponentStore "by reference" through pointer ๐Ÿ™‚

scarlet inlet
#

I meant returning the components from it by ref

storm ravine
#

By the same reason as any native container works

scarlet inlet
#

I don't think there is a valid reason for both scenarios tbh

#

my guess is that when they designed the native containers, returning by ref was simply not available

#

ComponentDataFromEntity is not even a native container is it?

storm ravine
#

It's native container

scarlet inlet
#

the code was so simple

#

I'll check iot again

storm ravine
#

It works with pointers directly

scarlet inlet
storm ravine
#

This is why it's not ref allowed. You accessing pointers and converts it to structs, you not working with structs directly for ref return structs.

scarlet inlet
#

what?

#

I don't see your point

#

Unsafe.AsRef is there for this reason

#

to transform a pointer to a ref struct

storm ravine
#

Ah yes

scarlet inlet
#

I use it continuously in svelto

storm ravine
#

agree with that

#

Yep completely forgot about that

scarlet inlet
#

there is a huge cost in this copy

#

performance by default is less trustworthy when I see this kind of stuff

#

there is a new havok component that has inside a stack based 128bytes array

#

I have to change this data every frame, which now means copy it

#

instead to modify it directly

storm ravine
#

Well problem here is Burst I suppose

scarlet inlet
#

nah it works fine with burst too

#

again I do this kind of things continuously

#

this data is native, not managed

#

isn't it?

#

actually, now I wonder if it's true, because I do use a lot of native memory nowadays, b ut I am not sure if UECS does the same

#

I would be surprised otherwise

storm ravine
#

Yeah it works with burst fine, just checked (never tried it before with burst)

scarlet inlet
#

ah you meant the Unsafe.AsRef itself

#

haha you would be surprised how many things I do inside burst compiled code haha

storm ravine
#

I wouldn't as I'm tried many s**t in burst just for own interest ๐Ÿ˜„ I not tell you that it's not possible (It was just guessing of root of the problem), I tell you I just not tried ๐Ÿ˜„

scarlet inlet
#

anyway everything insude Unsafe is safe as it's just a wrapper to existing IL code

storm ravine
#

Yep

#

Unsafe inside unsafe gives you safe ๐Ÿ˜„ minus to minus = plusBrows

scarlet inlet
#

hehe

storm ravine
#

anyway everything insude Unsafe is safe as it's just a wrapper to existing IL codัƒ
It's not even IL wrapper *explicitly * but just plain pointers routine which IL friendly

scarlet inlet
#

M_R on the forum raised a valid point

storm ravine
#

Yep I saw

last jasper
#

For a [GenerateAuthoringComponent] IComponentData, is there a way to access the generated monobehaviour from the gameobject prefab? like GameObject.GetComponent<SomeComponentAuthoring>. Primarily interested in editor functionality, not runtime, so performance isn't critical.

#

(specific use case is generating some textures for cards in a card game, based on the components on the card entity prefab)

storm ravine
#

And reflection of course

last jasper
#

Thanks Eizenhorn - it seems the answer is no for now, you have to write your own authoring component

north goblet
#

I've just recently started learning Unity, and today I just found out about DOTS and the fact that you can make a game with no gameobjects at all (and it's apparently much faster that way).

Since I'm just starting out, should I push myself to learn how to do things the DOTS way right from the get-go, or should I make a few complete games without it first? Are there 'bad' things about the gameobject way that you have to unlearn when progressing to DOTS?

coarse turtle
#

I would say make a few prototypes with gameObjects since that workflow is still largely in place with the Editor. The biggest hurdle to overcome with migrating from gameObjects to entities is really the mindset from OOP -> DOD. Once you get the hang of that you can start utilizing entities much more easily.

north goblet
#

Okay, thank you! I wasn't sure if the two approaches are so different that learning one would screw me up on learning the other. DOTS seems pretty intimidating. But hopefully it won't once I get better at working with gameobjects

coarse turtle
#

Yea, also the workflow for DOTS is still a WIP - so improvements to come along the way

north goblet
#

Ahhh, gotcha

scarlet inlet
#

Hello, me again

#

I have been profiling for days with ECS .10. I had to update to .11

#

and this appeared

#

please save my soul, because it's now in despair

#

what is this, where does it come from and why does it allocate so much?

#

(there is obviously something wrong)

pulsar jay
#

Is it possible to iterate over ISharedComponentData entities and access its data?

scarlet inlet
#

@pulsar jay yes

pulsar jay
#

Unity tells me: "This is only supported when using .WithoutBurst() and .Run()"

storm ravine
#

please save my soul, because it's now in despair
@scarlet inlet well I haven't fallback allocations in my code (only my manual mallocs)

#

Unity tells me: "This is only supported when using .WithoutBurst() and .Run()"
@pulsar jay inside job (and burst especially) - no

#

On main thread - without problems

scarlet inlet
#

@pulsar jay I don't use it inside burst

#

EntityManager.GetAllUniqueSharedComponentData(groups);

pulsar jay
#

mhh. thats sad. why does it prevent me from burst and jobs?

scarlet inlet
#

I don't know I use shared components only for one specific reason, grouping entities

#

so I can do

#

@storm ravine let me check I am not sure it's a fallback allocation case

#

I don't even know what UnitySynchronizationContext is, I have never seen it before

#

I have seen some threads talking about it tho, last year, showing the same problem

pulsar jay
#

Maybe my approach is not good then. I am still trying to represent a grid and thought sharedcomponentdata would be great for that

scarlet inlet
#

it's grouping entities inside a cell?

#

if so I guess it's fine

#

everything is about grouping can be solved with shared components

#

but you will need to iterate over the groups separately

storm ravine
#

@scarlet inlet this UnitySynchronizationContext is part of internal jobs scheduler if I'm not wrong. How many jobs you're scheduling? Is there any for loop where you scheduling many Job's?

pulsar jay
#

I have a grid positioning system that needs the per entity cell position (cellpositioncomponent) and the grid data (grid size etc.)

scarlet inlet
#

@storm ravine it wasn't showing until I updated havok and ecs today

pulsar jay
#

I thought it would be great to store the grid data in a sharedcomponent so I can have multiple grids and acces its data in the system

storm ravine
#

@storm ravine it wasn't showing until I updated havok and ecs today
@scarlet inlet Well I haven't that but I'm not using Unity DOTS\Havoc Physics

amber flicker
#

sounds like it could be related to the havok change in that case? they talked about changing it from many small jobs to one larger one I think?

scarlet inlet
#

I am in direct contact with the Havok team, if that's the case they will tell me something. I will need to dig in it more

#

which doesn't make me happy

#

@storm ravine thank you for telling me what it is, it's a pointer at least