#archived-dots
1 messages · Page 42 of 1
I just schedule ije. Wat handle should I add?
are you passing it a dependency?
last time u tell me that ije.Schedule() it will auto gen the dependency and I dun need to care about how it works.
yes
thats what i wanted to check
that you hadn't pass it something
it's like most common cause of htis
passing it a dependency but not handling the return
are you doing a getsingleton or something?
No getsingleton
This is the next exception
Weird. I dun think I use NativeText. Seems like it's unity stuff?
does anyone know what causes
error CS0839: Argument missing
when adding a query to an IJobEntity schedule|parallel?
it works most of the time then i get these random cases of it not working
that's pretty huge! so the main optimization comes from the query that doesn't even execute a chunk?
haven't tested where it comes from
it's just better
solved it myself
sorry to ping @proud jackal
.ScheduleParallel(query); // fine
.ScheduleParallel(this.query); // Exception with no info - error CS0839: Argument missing
need to test this then. you have written IJE right?
yeah i've converted about half my IJC to IJE
pretty much all the ones that were only IJC only because of change filtering
the rest have other chunk level stuff
gonna look at the codegen then. i'll preserve the IJC for now
how much are actually filtered for you in these tests?
IJC change filter -> query.changefilter
0.09-0.11 -> 0.07-0.09 (reliable and benchmarkable)
IJC -> IJE
0.07-0.09 -> 0.06->0.08 (this is too small to say for certain any difference and I don't understand why it would be)
^
first test here with some info
again performance wise it's minor it's just more convenience
i've deleted 600 lines of code today
Ok, thanks!
Haha, no worries. Was still working on some fixes for JobEntity schedules for exp-1.0, the one you likely ran into is most likely gone a few week after, but was present in 0.50 as well :3
^ might be interesting as well
@rotund token Btw last time u mention there's easier way to remove those Translation, Rotation, LocalToWorld at Baker using GetEntity() method. How to do that?
Some very interesting wind simulation on OpenGL. Wonder if that can be migrated to Burst
https://nickmcd.me/2022/10/01/procedural-wind-and-clouds-using-gpu-accelerated-lattice-boltzmann-method/
GetEntity(authoring, TransformUsageFlags.ManualOverride);
i have a script that does this (and its children optionally)
Oh just call tat GetEntity() then only AddComponent should work?
i suggest reading the documentation on TransformUsageFlags
but yes pretty much
/// Use this flag to specify that you want to take full manual control over the transform conversion of an
/// entity. This flag is an override: When it is set, all other flags will be ignored. The transform system will
/// not add any transform related components to the entity. The entity will not have a parent, and it will not
/// have any children attached to it.
/// This is different from None, because None will result in removing any previously added transform components during incremental baking.
/// </summary>
ManualOverride = 1 << 5,```
how would i deal with flipping an entity with a hierarchy of spriterenderers in transforms V2 ? Atm im using NonUniformScale.
Does EntityQueryMask.MatchesIgnoreFilter(entity) same with HasComponent(entity) check?
yes. essentially a way to do multiple HasComponent checks at once.
so i feel like this heavily plays into the issues that baking is having atm
the value in the asset is actually 4 but baking workers reading old data during the bake
if i open subscene, it goes to 4
if i close subscene and reimport, back to 0
has like a cached old version of the scriptable object
im struggling with that too. i am never sure whether the changes i made in baking pipeline actually got applied to all my cached scenes
what i'm seeing is, in unity editor if you make changes to a scriptable object and don't save the asset file
and do an assetdatabase load asset etc you can still read the latest version before the save
but the bakers well they don't have access to this cached unsaved version
until you save
oh well scriptable objects always act weird
yeah
going to test gameobjects afterwards
might be time to replace my SO settings pipeline
they'll need to find a workable solution at some point though. ScrObjects are just way too handy to not use with DOTS
well @robust scaffold i took this a little further ^_^'
UI based buffer capacity overriding
i have other reasons to do it
my SO settings have the baking built into them
whereas every other baking object in my project exists in a standalone authoring assembly
i don't like how the setting SO have the authoring data in my runtime assembly
oh alright. couldnt you just have a singleton Entity that has the scrobject data baked?
i have a subscene which i load for every level where some settings get baked into.
thats what i do actually
{
[SerializeField]
private InputDefault core;
/// <inheritdoc/>
public override void Bake(IBaker bake)
{
bake.AddComponentObject(this.core);
bake.AddComponent<InputCommon>();
}
}```
okay then we got the same issues
but the Bake is still on the settings
yes i do the same
i have a lot of tooling built around this
so I'd need to figure this all out
hmmmmmmmmmm
i've just realized i have no reason for these settings files to exist in the runtime assembly
they can just be moved to the authoring assembly
🤔
yep since the data is baked already
aaaaaah BakingSystem queries ignoring prefabs by default is my nr. 1 bug source.
its rendering !!!
@gentle gyro
holy hell this was a lot of pain
@gentle gyro turns out it was in fact "bad code stripping or some type that should not have made it to the build". AndyWWWW on the forum suggested I try adding a link.xml which resolved my issues.
<!--Preserve entire assembly-->
<assembly fullname="Unity.Entities.Graphics" preserve="all"/>
</linker>
Quest 2 is rendering Entities 🙂
@rotund token @rustic rain anyone of you experimented with instantiating gameobjects before any bakers run and have those gameobjects then baked?
If i have a unit prefab with a list of abilities and i need each instance of a unit to have their own instances of prefabs (prototypes) of abilities i currently have to create those prototypes at runtime.
What i would like to do is when baking the unit prefab to spawn each ability prefab as a child to the unit and afterwards bake this hierarchy. so at runtime if i would then instantiate a unit entity the abilities would be instantiated with it and all references id set at baking between unit and ability would be remapped.
nah, I didn't.
I decided to go another way
In SubScene I create prefabs, tons of them
hold on (got busy)
so basically SubSCene will contain authoring data for procedural generation
settings, with prefab entities stores
and then in runtime I Instantiate them
Generation itself is done by SystemGroup
yep works for your usecase.
which runs only once with manual "Update"
Why do you need to instantiate them as go instead of entities?
because i cannot instantiate entities in baking. doing it with createadditionalentity would be a huge PITA
and instantiating the prototypes at runtime is just a lot of code overhead. i need to patch references that could be baked
and why do you need to instantiate smth?
sure i could just add those abilities as children inside a unit prefab but that would create a big hierarchy in editor which is completely useless
my reason to instantiate was graphics that needs to be converted
Baking is just the wrong time to do this imo.
Just generate it in editor before baking?
i need an instance of each ability that the user can use that is used to instantiate the actual abilities. because those prototype abilities can be buffed by stats for example. and i dont want to apply each buff everytime i spawn an entity. instead i want to apply buffs to prototypes and then instantiate those
generate in editor before baking is what i want to do. but i dont want it saved into scene files for example
why does graphics make a difference?
because graphics conversion is the most painful
by creating them manually you mean by doing CreateAdditionalEntity?
every Ability has a hierarchy of subabilities that are a pain to setup.
what kind of hierarchy?
Why not save it into the scene?
#archived-dots message
actually just this reason
i just prefer to hide stuff that noone is supposed to touch in the scene
I'd just use custom dynamic buffer
You can just give it go flags that hides it?
I just realised
that I need a custom way to setup hieararchy inside Hieararchy window
this is whats on a unit
this is how a very simple ability looks like
i didnt know about them! now the only other concern would be that if someone edits the list of abilities on the unit then the hidden hierarchy gets updated accordingly
should be no problem with OnValidate right?
could use that
could use a serialize callback
could use a custom editor window
Not sure best approach
Validate probably easiest
but validate will be annoying if you edit it in prefab. you actually only want it to change if you save changes to the prefab i guess
on the other hand its not something that is touched that often.
Still i think this is a usecase where instantiating from prefabEntities inside baking would be the best solution if it was possible
Just doesn't seem what baking is designed for
hmm but i am actually "baking" a unit. every unit needs prototypeabilities at runtime not at edittime. and i could bake that into the entityprefab of the unit
Well you're wanting to create authoring data not runtime data?
Though out of interest why is this easier?
no i want to create runtime data out of authoring data.
I mean, why is creating the go hierarchy easier than the runtime
at runtime i cannot just spawn a Unit and it is correctly setup with all the prototypes it needs. i need to spawn every prototype and patch references to the unit. everytime i spawn something
if it was baked into the unit prefab id only need to instantiate the unit entity and everything is setup
its not much easier. it would happen alot less often.
thinking about it i could also setup a prototypeunit at runtime that has the prototypeabilities spawned already. so instead of spawning a unitprefab + abilityprototypes i could spawn just a unitPrototype. still a pain to setup
COOL!
This is of note!
????
😐
ive never seen anything like this before
is the plan to replace SystemBase with ISystemBase entirely ?
no
sometimes you just need to do some managed work
but you should aim to replace it as much as possible
it makes considerable difference to performance as your systems start to add up
So use the interface as much as possible, why are the majority of the docs in systembase
1.0 or 0.51?
probably because it's newer (ISystem that is)
but 100% entitie.foreach is not sticking around?
99%
Been strongly suggested to switch off it but I don't believe I've seen a outright confirmation it will definitely be removed
It's reasonably easy to switch from efe to ijobentity at least
you think theyll do the switch for us when EFE is deprecated? probably not right?
probably not but who knows
You probably wouldn't want it anyway
Codegen is not usually that pretty to look at
i am forced to look at it way too much already when searching for usages of structs/classes in rider... is there a way to hide the codegen stuff in IDEs?
I had the opposite issue today, rider no longer shows the codegen for me
In fact I couldn't even find via notepad++ any reference of my ijobentity gen
Not sure how it was even working
interesting. For me it looks like this in search. clutters alot of the useful information.
this is EFE though. maybe something is different with IJE codegen?
sry for late followup. had to leave. its indeed just EFE that is showing. one more reason to update to IJE asap
🤣 😂
What's the best ECS solution currently, is it DOTS (Entities)? 2D bullet hell game
no 2D rn.
YOu'll need some custom code to make 2D viable with ECS
generally though
I don't see any point to use anything but DOTS ECS in Unity
oh, i thought it doesn't really matter and u can use it for everything
yeah
by custom code I meant a couple constraints to physics
that will lock bodies in 2D space
that's fine, i didn't expect physics to be a part of ECS anyway
basically i just need ECS architecture that i can work with
does IJE automatically add RequireForUpdate to query that is generated? or do i have to use the version where i specify the query and RequireForUpdate the query i wrote?
no
you need attribute
[RequireMatchingQueries]
for it to work
otherwise it's only registered as Dependency
ah thx. i have to say i dont like that i need to use so many attributes :S
testing aspects, what's this supposed to mean?
copy/paste from the doc https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/aspects-create.html
works with IAspect only. no idea what that's about 😄
just use IAspect
undocumented changes it is
do you know what the type is for then?
aspects are currently the way out of the create/update madness of ComponentTypeHandle.
but i rather wait for proper SystemAPI calls 🙂
I think they just changed the interface to no longer require the generic type parameter. Forgot to update the docs before release
Are they? There is an Aspect.TypeHandle.Update() method
interestingly IAspect uses GetNativeArray in its codegen. seems like there's no real consensus what to use inside unity 🙂 IJE gets the pointers (which is a bit faster)
yeah, when you define the Aspect, it just requires 1 line in create and 1 line in update which is nice. i really don't like the boilerplate around that right now
yeah so that's the same as ComponentTypeHandle, right?
I agree that there should be SystemAPI calls to do the caching for you
yep, it doesn't do anything different really. just codegens the whole thing to save typing
soon(tm)
I wonder if they are going to add a SystemAPI.CreateAspectLookup and SystemAPI.CreateAspectTypeHandle calls. Aspects need some love imo
Yeah, but you also have to create, cache, and update it
ah, right
And the fact that the type is created in codegen makes it awkward to use. I'd rather see an AspectLookup<> and AspectTypeHandle<> generic types instead of the codegen'd ones
Maybe its not possible though
Hey! New to dots and struggling a bit to build my boids project...
I have primitive cubes in both SampleScene and my SubScene that are visible, however none of my entities are visible. Anyone know what i could've done wrong?
Im using the URP template with these player settings:
I've also tried building via the BuildConfigurations from the ECS SystemSamples github page, but after reading through this chat it seems that it might be deprecated 😅
had no time to watch it live 😦 hope the vods are available and findable soon
Seems like you can already go watch vod
where? i only see the keynote on youtube
I watched the keynote, but the not the sessions yet.
Main announcement was 1.0 pre-release in the 2022.2 tech stream
Anyone already tried to build unity navmeshes from entities at runtime?
31:30 in roadmap for dots stuff
You have to sign up for unite, there's a virtual event (free)
ah i didnt
Still can
New racing demo and megacity getting an update
Not much here in the roadmap
And a quick mention of animation
DOTS is on right now...
i can only see the keynote. where can i find the rest? 😄
DOTS has ended but look at the link right above. You have to register but it's free
If you register you can still watch it on replay...
guess i found it. bit hard to find
All the talk recordings can be found here btw: https://unity.virtualeventsite.com/agenda/
Well lots of bug fixes and upcoming changes confirmed by unity staff. There is live Q&A session happening on this discord so all the unity staff are there answering questions.
https://discord.com/channels/489222168727519232/1034475484492337292, then filter by the DOTS tag
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
then filter by the DOTS tag
nice
am i rthe only one getting this from the vimeo videos?
cant view the other talk recordings either 🤷♂️
ok my ipad plays them so i guess something messed up with my desktop 🥲
🥲 Is that known issue? Any idea how to fix it? Now I can't enter play mode anymore
@raw mica My unity bug ticket is IN-21766. Thanks for all the help!
Thanks! No problem, when I'm back at my desk I'll take a look to see if anything stands out
👍 have a good evening!
just as a final sidenote, i tried upgrading to 0b13 and increasing the amount of entities im spawning to 100000, however the build runs silk smooth so i don't think the entities are being simulated. this also gave me these warnings. I believe the last one is due to me using a RewindableAllocator world.UpdateAllocator to create a nativearray of all boids.
from my debugging there seems to be a random leak in i believe it was the animator that's causing the random tempjob allocations (i dont even have any animators in this library) #archived-dots message
Just woke up. Is there anything important I missed in Unite? Quick glance at the agenda shows just the generic 'what is dots'
For some reason, using ComponentLookup<LocalToWorld> is returning a LocalToWorld that is completely reversed. For example, a cube that is clearly above (0,0,0) and seems to be at (0,5,0) instead shows (0,-5,0)
Basically, the renderer shows the cube above ground, but all ComponentLookups are wrong
Also @rotund token neat editor. Now that buffer sizes are 0, all I want now is resizable chunks and, most importantly, editor stability...
What does the entity inspector show for the L2W?
The correct value, which is a positive number for the y value
i'll get right on it
The L2W is reversed
You are now unity. Chop chop
I'm calling var currentPosition = TransformLookup[positionEntity].Position;
and currentPosition is opposite of the editor and where the cube is displayed
Using ComponentLookup but with Translation seems to give the correct value
Try LTW.c3.xyz
but I'd rather work with absolute positions
Thanks, though even if that works, it seems like a workaround. I'd like to know if I'm configuring something wrong
I'm certain I'm misusing something somewhere
Position is encoded in the 4th row xyz values. Should be identical to .Position.
Right, but I'm already using Position
Yea, so this just makes sure you're getting the raw values.
It's really weird, since the Editor and what's rendered seem to be correct, but accessing L2W results in perfectly reversed values
I see, so the raw values might be correct, but one of these raw values might be corrupting the rest?
Like, where the Scale is stored might be messe dup?
Maybe the scale is -1 for some readon
No, L2W translation values are completely independent from scale and rotation
gotcha
Do you see anything that's wierd? Right now L2W gives -4.412
for the y value
No, there is a parent though. Is the parent up side down?
I traversed through the hierarchy and nothing has any rotation
This is in a subscene btw
These values are pulled at the very end of presentation so if those values are what you see in the inspector, they should be what you get in the component lookup. Unless multiple things are touching it during update
I should mention that I use GetEntity(authoring, TransformUsageFlags.ManualOverride); several times in the hierarchy, including the parents of this entity, to remove all unused transform data
This is the authoring I use
public sealed class Positionless : MonoBehaviour
{
}
public sealed class PositionlessBaker : Baker<Positionless>
{
public override void Bake(Positionless authoring)
{
var validPositionless = GetComponent<PositionlessException>() == null;
if (validPositionless)
{
GetEntity(authoring, TransformUsageFlags.ManualOverride);
}
}
}
The entity with the wierd behavior has the PositionlessException, so it keeps its transform
but all its parents have their transform data stripped
nevermind, that's not the issue
sorry for the false lead
No clue. You're gonna have to dive into your code for all instances that touch L2W and see if it's doing any negative multiplication.
Okay. That can be dug up easy, because this is the only job that touches TransformAspect
void Execute(
ref TransformAspect transform,
in PositionMoveCalculatedSpeedComponent speed,
in PositionMoveDirectionComponent direction
)
{
transform.TranslateWorld(direction.Direction * speed.Speed * DeltaTime);
}
direction.Direction is confirmed to be correct
speed.Speed too
perhaps I'm not using the right TransformAspect method?
I recommend using translation component directly rather than any aspects as the specific math to this is a bit murky
Sure. So use Translation/Rotation for writing, and L2W for reading?
I just read and write from T/R. L2W is too big to load directly into Jobs.
I see. What would you do with parented transforms though?
I don't have any.
I do recall there was a component that would cause the transform systems to write from L2W back to Rotation/Translation
Okay, writing to Translation fixed the issue, even though elsewhere I'm still reading from L2W
nothing really but take a look at https://discord.com/channels/489222168727519232/1034475484492337292
so v-rising does the obvious for colliders. have a seperate BVH that never updates on a server 😄
now why it even updates static colliders is another mystery
i don't work in AAA so massive worlds are not a concern to me personally but i still wonder how unity actually planned of devs using a fully stateless physics engine when the first dev that uses it in a big project scraps the idea
Static bvh don't update if the change filter for static colliders don't change IIRC last time I dived into the source
Now that change filter breaks incredibly easy but there is at least one check
I think it triggers on l2w changes.
the bvh gets rebuilt even with no l2w changes
yeah i'm aware of the change filter
but i think my test case uses static rigid bodies ^^
It early returns if the change filter returns nothing so it is working as intended.
The job still runs since the filter is computed asynchronously of course so the execution should be a lot shorter than if it actually regenerates the bvh
it will still run the CreateRigidBodies job
You're gonna have to remind me what that is.
pretty much what it's named ^^
and that also runs for entities that just have a shape and are static
i haven't found out what's up with that
I don't remember the construction of shape data but if the rigid body is necessary for collisions, there has to be some job that converts shape to collision detection capable data. As they might not have it cached.
You still need to convert individual vertices to WS points for proper collisions and that's not cached (stateless nonsense) so it makes sense this runs every frame, if that's what it's doing
I don't knowbwhat custom tags are though so eh
my point is just, and was in the past, no job needs to run all the time for static colliders and creates the same data over and over again. stateless nonsense or not. now i know the stunlock team thinks alike 🙂
their talk outline was basically, it's great having the source of packages so we can change it
Yea, if you're willing to maintain it manually as well
The problem with netcode is that it's fundamentally state synchronized as well, so there's 0 reason for a stateless physics engine. Although with the last q&a, one of th3 netcode guys said that havoc was working with netcode
v rising is still on 0.51 and will probably stay on that version. i mean there's very little reason to upgrade for them. no idea what they use for netcode. i don't think anything from unity
would be interesting though why they chose for or against netcode
probably same deal as us
netcode probably wasn't even released or was just an early release when they started/needed it
so just rolled their own
but yeah little chance they upgrade (we won't either) since they've released
ecs will be production ready with 2022.2 release?
Should be but still long time to go. Will go through pre-release stage for quite some time first I believe
i guess it depends on your definition of and/or requirements for production ready
studios have already published games with ecs, so to them it's already production ready
the ecosystem around dots is not production ready for sure. and it will take a while until it is even after official 1.0 DOTS release
Shader [Universal Render Pipeline/Lit] does not support skinning Does anyone know how to fix this ?
Hello !
I just begin to look at experimental ECS 1.0.0.
I would like to prototype a mesh processing library in ECS to make a procedural modeling system. My first idea is to turn any mesh primitive (vertex, face, edge, etc...) in an entity to be able to take advantage of the query system of ECS. But i'm not sure about the efficience of it because it's going to create a very large amount of entity to represent a single mesh. What do you think about this ? Does somebody already work around this with ECS, or would have some advice to give ?
I'm not clear on what your library should do but one entity pre vertices/edge/face, does seem like a bad idea. I would look into native containers and the Graphics.DrawMeshInstanced API.
Thanks, that's what I thought.
What I want to achieve is a kind of modeling library able to do some basic mesh operations : Add/Remove vertices/faces, extrusion, bevel... And the library must be able to attach some custom arbitrary datas to mesh elements, a little bit like in Houdini
(the library is not supposed to be used for rendering, only for mesh operations)
I have not worked wit hte mesh api but I'm sure other people have. I would suggest looking at the DOTS Graphics sub forum and search for key terms to try to find interesting post to get you started.
I will to it ! Thanks !
I'm don't know if ECS is a good fit for it. It's just a pretext to experiment with dots
Entities can be useful to batch the rendering of same mesh/material or perform some culling or LOD. But generally speaking, mesh manipulation you are better using the jobs, native Collection and burst packages. they are also part of DOTS.
For entities, I am making a tutorial series that takes you through the fundamental principles while working toward a tower defence prototype.
My first prototype was only based on Job/Burst, I wanted to look if ECS would be interresing. I already made a project with ECS two years ago and really like it, and I wanted to take my hand in the new features of the 1.0 release 🙂
It started with 0.51 a few weeks before 1.0-exp release. so I had to document the migration from 0.51 to 1.0 after 3 episode but the first episodes are still relevant as far as the concept description goes.
https://www.youtube.com/watch?v=N-xoBFi2YF0&list=PL6ubahbodJ3N2udo4n9yGQcpbWnqdgYnL
Haha, I looked you videos 2 days ago ! Thank you for this great content !
Thanks for the compliment. glad you enjoyed !
next will be will be on animating using hybrid approach 😉 should land tomorrow I think.
Perfect ! This is the content I'm looking for ! I have trouble understanding the hybrid approach at this time !
EntityManager.AddComponentData(entity, component);
when doing that
and component is of type IComponentData
how do you use RegisterGenericComponentType?
trying to find documentation on it
public List<IComponentData> SomePredefinedComponents;
public void Foo()
{
var component = SomePredefinedComponents.First();
EntityManager.AddComponentData(entity, component);
}
sample code
i've tried adding [assembly: RegisterGenericComponentType(typeof(ConcreteType))]
but still throws the error
are you having issues in editor or build?
Is there any way to disable physics catch up? It is hard trying to figure out what causes performance issues in the first place if it is overshadowed by the physics trying to catch up
It is doing 5 physics steps per frame:
Yeah
If you remove rate manager
From fixed step
But beware of funny physics due to low fps
oh well
i guess i'll just hard cast everything for now
deal with figuring out how to generically do that some other day
You mean remove it in the groups cs file?
code is much more ugly thou
No
Just get reference to system
And overwrite it's field
Ah thx. Will try that
Are you using il2cpp
?
Fine of you only want to target Windows
Which imo is a bit restrictive these days
It seems like ParallelCreateContactsJob is just taking a lot of time:
is there any way to debug these contacts?
Usually just too many colliders close together
I swear physics has been getting slower in this worst case every release since 0.17
Maybe the large world scaling is improving instead?
But it seems to me that lots of close colliders really suffers these days
. net supports multi now, no?
Renamed from core to just . net
As symbol of merging everything
That might be the problem. Is there any way to mark runtime instanced entities as static so it wont check collisions between environment entities?
i tried to spawn spaceships at the float3.zero(using unity.physics) - 10 works, 100 chuckles but eventually works 1000 is never ending story xd, but tbh my comp is weak cpu 4c,4t and older gpu also - but didnt try this using pre-1.0 versions of dots so cannot compare
Yea. Make them static using the physics body or disable collider filters
any idea if collider.Clone() will clone the whole compound collider
just to save me loading the vs project and actually checking
I think it does, as the compound collider is just one single PhysicsCollider object ( child entities do not have their own PhysicsColliders' )
managed to fix this by adding a 1 second delay before spawning any entities!
realized none of my entities spawn for the first 10-20 updates or so for some reason
heres the system. no clue if im doing anything wrong and causing this behaviour or not
@raw mica this fixed my problems from yesterday regarding IN-21766, thanks again for all the help!
Hi all, just wanted to make sure you saw some of the stuff from yesterday around DOTS:
- in the keynote - https://unity.virtualeventsite.com/agenda-unite-2022/keynote-unite-2022/ - we announced that DOTS/ECS 1.0 will be published as pre-release alongside Unity 2022.2 Tech Stream later this year. As it will then be in pre-release, it is approved for production use and will be supported like our other pre-release packages. It will come out of pre-release alongside Unity 2022 LTS in 2023. We also highlighted a number of developers already using DOTS in production.
- in the product roadmap session - https://unity.virtualeventsite.com/agenda-unite-2022/understanding-unitys-2023-roadmap/ - we had a deeper dive into DOTS and talked about some of the features we're excited about.
- Stunlock talked about their use of DOTS in V Rising in a dedicated session - https://unity.virtualeventsite.com/agenda-unite-2022/stunlock-and-unity-why-source-access-to-dots-is-a-game-changer/
- Supergaming discussed how they scaled MonoBehaviour and GameObjects through DOTS - https://unity.virtualeventsite.com/agenda-unite-2022/dots-scaling-monobehaviour-and-gameobjects/
- usTwo talked about how they used DOTS in Alba: A Wildlife Adventure to deliver an open world game on low-end mobile devices - https://unity.virtualeventsite.com/agenda-unite-2022/making-alba-building-a-performant-open-world-game/
- We also updated the landing pages for DOTS, and streamlined them down to two: https://unity.com/dots and https://unity.com/ecs - on both you'll find refreshed info about DOTS and ECS, along with links off to other creators already using DOTS and docs, etc
You are using the wrong time. Use var deltaTime = SystemAPI.Time.DeltaTime; or var deltaTime = state.WorldUnmanaged.Time.DeltaTime;
uhm, was b13 reverted? i only see b10 as latest.
No?
huh, weird. 2023 is also behind. i'm still on hub2
That SS is from hub3
time to upgrade then 😄 hub3 was annoying me so much with default collab and "waiting for changes..."
Collab? Never had those notifications
I've disabled and locked away as much of that nonsense in Unity as possible. Imagine working with other people *shivers*.
Solo dev best dev. Nothing like pressing control-A and backspace with 0 consequences.
Collab was straight up garbage. i'm glad they cancelled it. even a 100mb project took ages to load. and with hub3 it was enabled by default. you could only disable it in some meta file. and hub3 reenabled it also. that was the case for several versions. collab wasn't the only problem. android sdk not working was on my list too, so i stayed at v2 because that worked fine and v3 did nothing better. probably still isn't
Report bug so they will fix v3 👀
i reported that 2 or 3 years ago. didn't bother to test again though. pretty sure it's fixed now.
Anyone getting really annoying baker issues in b13?
[Worker0] InvalidCastException: Specified cast is not valid.
Unity.Entities.BakerDataUtility.AddBaker (System.Type type) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities.Hybrid/Baking/BakerDataUtility.cs:91)
as well as
[Worker0] Exception thrown during SubScene import: System.ArgumentException: Schnozzle.Networking.Systems.ClientServerBootstrapSystem+ClientServerBootstrapSystem_6811EE8F_LambdaJob_3_Job must already be filtered by ComponentSystemBase or ISystem
at Unity.Entities.TypeManager.FilterSystemType (System.Type type, Unity.Entities.TypeManager+LookupFlags lookupFlags) [0x0004c] in com.unity.entities@1.0.0-exp.8\Unity.Entities\Types\TypeManagerSystems.cs:670
I need to restart unity and delete the auto generated folders, then it will work again. Very annoying
well at least I'm not alone
Most annoying when it requires clearing cache and then restart
Barely work on project due to that
Yeah + exo 12
downgrade to b9 if you value your sanity
just only write code and don't actually have anything in your game!
Do chunks lay in memory next to each other ?
I know that the chunk components lay in memory next to each other... but i wonder if chunks are also close to each other, or since each chunk is a block of allocated memory they are allocated all over the place and basically distributed
if you batch create a lot of entities with same archetype the chunks are allocated next to each other. outside of that, they are randomly in memory
Thats interesting... i actually thought that all chunks of an archetype lie next to each other... since that provides the best iteration speed, all chunks next to each other will cause less cache misses when we move from one chunk to the next one.
However having chunks randomly in memory is better for fast allocs since we dont need to copy all chunks to the new allocated area like a huge array. We can just append a new chunk.
Interesting design choices 😮
if that was the case chunks would work like a list. the bigger it gets the longer it takes to alloc
and nobody likes random spikes
Yeah right, that would make adding/removing entities a nightmare. However the iteration speed would be slightly better ^^ But i guess thats not worth the cost here
exactly, that's why it's important to get as much chunk capacity out of an archetype
in parallel i don't think it'd change iteration speed much if at all
@stone osprey Stunlock Studios did a talk at Unite, I think that talked about how they wrote a custom chunk defragmentation system
Damn ecs architectures are just so interesting ^^
Chunks actually allocate a block of memory which basically stores the different arrays next to each other. Would it make any difference if the arrays wouldnt be next to each other ? As far as i know modern cpus are capable of loading multiple cache lines, therefore
var cmp1 = new T[];
var cmp2 = new T1[];
for index <= 10k; index++{
var myCmp1 = cmp1[index];
var myCmp1 = cmp2[index];
// Entity logic
}
Should be as fast as having one block of memory and acessing it in the same manner... or am i wrong ? This is more like a lowlevel question, i just realise ^^
Is there a way to determine if a native collection has been deallocated? I am getting this error ObjectDisposedException: The Unity.Collections.NativeArray[Unity.Mathematics.int2] has been deallocated, it is not allowed to access it but I really just want test to see if it has been deallocated before trying to access it.
that's basically the logic behind AoS and SoA. entities uses SoA and is the same as your example just that they chop it up into 16k chunks otherwise you have the long alloc or copying problem
According to the recent Q&A, clear the entity cache, delete the 2 auto-generated folders in Assets related to entities, delete the burst cache, and you might be able to play again without having to restart editor. It's iffy.
did you have this problem in b8 or b9 too?
Maybe? I can't remember.
Roslyn Generate Monobehavior
did the Create->ESC -> Runtime component type menu move?
This was actually part of 0.51 and previous version and the first thing that jumped to my eyes when upgrading. I guess they were forgotten when moving from conversion to baking.This isn't actually hard to do using ProjectWindowUtil.CreateScriptAssetFromTemplateFile.
The script template feature is part of the Unite 2022: Speed up your workflow: 20 tips in 20 minutes talk at 15:25
https://unity.virtualeventsite.com/agenda-unite-2022/speed-up-your-workflow-20-tips-in-20-minutes/
awesome thank you Wayn
Can anyone hint me what SystemHandle type idea is?
I am trying to use state.EntityManager.GetComponentDataRW<T>() but instead of Entity it wants SystemHandle.
That is inside ISystem and I am trying to burst it
Each system has its own entity now
The overloads that take system handle are just for accessing this specific system owned entity
How do I access a component that I can write to with EntityManager?
you want ref of component struct?
[GenerateTestsForBurstCompatibility]
public static unsafe ref T GetComponentReference<T>(this EntityManager em, in Entity entity)
where T : struct, IComponentData
{
var access = em.GetCheckedEntityDataAccess();
var typeIndex = TypeManager.GetTypeIndex<T>();
access->EntityComponentStore->AssertEntityHasComponent(entity, typeIndex);
access->EntityComponentStore->AssertNotZeroSizedComponent(typeIndex);
if (!access->IsInExclusiveTransaction)
access->DependencyManager->CompleteWriteDependency(typeIndex);
// var ptr = access->EntityComponentStore->GetComponentDataRawRW(entity, typeIndex);
var ptr = access->EntityComponentStore->GetComponentDataWithTypeRW(entity,
typeIndex,
em.GlobalSystemVersion);
return ref UnsafeUtility.AsRef<T>(ptr);
}
Would SystemAPI.GetComponent and then SystemAPI.SetComponent work here?
SystemAPI.GetComponentRW wants SystemHandle also
I am not even sure what this code is doing, there is something wrong if this is how much code I need to set data to component
It's extension method
Put it into static class
And use it right from entity manager
Yes, but GetComponent doesn't. You would read the data, change it, then set it with SetComponent
I do not understand how. I have the component and the entity. I do not have SystemHandle
C# ` [BurstCompile]
private static void CheckCollision(ref SystemState state, ref Entity projectileExplosionPrefab, ref Entity collidedEntity)
{
if (state.EntityManager.HasComponent<ProjectileComponent>(collidedEntity))
{
LocalToWorld projT = state.EntityManager.GetComponentData<LocalToWorld>(collidedEntity);
Entity fxEntity = state.EntityManager.Instantiate(projectileExplosionPrefab);
var fxT = state.EntityManager.GetComponentDataRW<Translation>(state.SystemHandle);
fxT.ValueRW.Value = projT.Position;
SystemAPI.GetComponentRW<Translate>(fxEntity);
state.EntityManager.DestroyEntity(collidedEntity);
}
}`
state.EntityManager.GetComponentDataRW(state.SystemHandle);
you have the state so you should have the handle
Here is the code I am working on. When a projectile collides I want to spawn a prefab with FX in the position of the collision.
var component = SystemAPI.GetComponent<ComponentTypeHere>(entity); component.CoolValue = 10f; SystemAPI.SetComponent(entity, component);
Here's what I was suggesting. Probably not optimal but should work?
Honestly, I could care less for performance at the moment when I cannot get basic stuff to work 🙂
@naive eagle I am getting this: Assets\Scripts\Systems\ProjectileCollisionSystem.cs(49,17): error CS0120: An object reference is required for the non-static field, method, or property 'ProjectileCollisionSystem.__Unity_Transforms_Translation_RO_ComponentLookup'
[BurstCompile]
private static void CheckCollision(ref SystemState state, ref Entity projectileExplosionPrefab, ref Entity collidedEntity)
{
if (state.EntityManager.HasComponent<ProjectileComponent>(collidedEntity))
{
LocalToWorld projT = state.EntityManager.GetComponentData<LocalToWorld>(collidedEntity);
Entity fxEntity = state.EntityManager.Instantiate(projectileExplosionPrefab);
Translation translation = SystemAPI.GetComponent<Translation>(fxEntity);
translation.Value = projT.Position;
SystemAPI.SetComponent<Translation>(fxEntity, translation);
state.EntityManager.DestroyEntity(collidedEntity);
}
}```
Get and SetComponent generate code that use ComponentLookup, which doesn't seem to play nicely with your static function. Try making your function non-static?
Thank you. That fixed it. I have no idea how people are suppose to know this. I guess a lot of internal workings knowledge will be needed to work with ECS.
The generated code part I read from the docs (https://docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Entities.SystemAPI.GetComponent.html#Unity_Entities_SystemAPI_GetComponent__1_Unity_Entities_Entity_), but yeah it would be hard to know how to fix that error if you've not seen it before
What does "entity associated with a system." mean? I do not understand this.
Systems query for certain entities, they can be in different architypes.
Hi,
It looks like a ComponentData could have UnsafeList as field. What is the recommanded pattern to allocate/deallocate this Unsafe Lists ? On a Monobehaviour objects we had the Destroy() method that was perfect for this kind of deallocation, but we don't have such events in ECS. How to avoid memory leaks ? Is there a dedicated SystemGroup that could handle this ?
Thanks !
Up to you depending the use case of component
Generally you want to use dynamic buffer for lists
I would have use DynamicBuffer, but I want to have a List of ComponentData which is not allowed with DynamicBuffer, UnsafeList seems like the only one solution for it
(to be honest, I don't really know what i'm doing)
Just use wrapper
Ibuffer element with only field - icomp
Then you can interpret arrays as component
That's sounds good ! Thanks 🙂
For code clarity
I am still getting this exception:InvalidOperationException: Expected simulation type: UnityPhysics, current simulation type is: NoPhysics Unity.Physics.SafetyChecks.ThrowInvalidOperationException (Unity.Collections.FixedString128Bytes message) (at Library/PackageCache/com.unity.physics@1.0.0-exp.12/Unity.Physics/Extensions/SafetyChecks.cs:271)
I have PhysicsStep added to a gameobject inside subscene and I still get this error.
Do you have NoPhysics selected on that PhysicsStep? Do you have multiple PhysicsStep objects? You don't need any if you're just using the default values
Nope its PhysicsStep. Nope, only one (I added it because of this problem).
anyone looked into burst compiling the scheduler of a generic job type?
for example, IJobNativeParallelHashMapVisitKeyValue<TKey, TValue>
Burst compiles concrete jobs as different variants. IJob<T1> and IJob<T2> in combinatoric increasing quantities.
unity basically removed all their generic jobs so I have no reference so i've had no luck handling custom jobs and i'm not even sure it's possible
Generic custom jobs should still work. I've done jobs with generic type handles but nothing that reached deep into execute.
i looked at this a few months ago and looking at it again today
the issue is basically the way reflection data is setup for jobs
internal static void Initialize()
{
if (!(IJobExtensions.JobStruct<T>.jobReflectionData.Data == IntPtr.Zero))```
is done within a burst discard
This was back in 2020LTS though, there was a big change to the job scheduler that may have changed things
you couldn't even run job scheduling in burst back then
yea, generics might still have to do a typeof() call which isnt burstable
they do a typeof call
internal static void Initialize()
{
if (!(IJobExtensions.JobStruct<T>.jobReflectionData.Data == IntPtr.Zero))
return;
IJobExtensions.JobStruct<T>.jobReflectionData.Data = JobsUtility.CreateJobReflectionData(typeof (T), (object) new IJobExtensions.JobStruct<T>.ExecuteJobFunction(IJobExtensions.JobStruct<T>.Execute));
}```
but it's all done in a burst discard
so it's already setup before the burst actually runs
i might need to try manually set this up outside of burst which is a bit gross
Seems like it. If you want a custom job scheduled in burst, gotta use burst discard. I think this is for all jobs right? JobStruct is a wrapper around the job itself so even IJobs needs this discard in the scheduling.
Is there any difference with how they're doing schedule by ref?
random call in a constructor to
JobNativeParallelHashMapVisitKeyValue.GetReflectionData<RemapLinks, Entity, UnsafeList<SavableLinks>>();
well it stops unity crashing
System.InvalidOperationException : The UNKNOWN_OBJECT_TYPE NativeListDisposeJob.Data can not be accessed. Nested native containers are illegal in jobs.
doesn't like my nested containers though
even though it's not native
I thought the IJobs targeting MultiHashMaps were dead and buried.
not in my library
i have a copy that i've maintained for years
super useful
but this isn't just related to those, i have other custom jobs
i'll probably just rewrite this to be a bit more unsafe
and instead just pass in the index to the key/value pair
but so much grosser \
custom jobs have been so useful for me over the years, bit sad they are somewhat dead to me now 😦
Dead?
Wait, all generics are dead?
im pretty sure you can't schedule any generic job from burst
without pre-initializing the reflection data
well, burst scheduling isnt that much of an issue...
Full burst systems are nice but, from my admittedly very limited experience, I'm job thread limited and, if I crank up quality settings, GPU bottlenecked.
And scheduling doesnt seem to have a significant impact on the performance of the system anyways. 0.1ms at most.
Not since 2022 at least.
ugh
Yeah that's about how many systems we have at work
and i think ~1500 jobs
loading up a previous message, 501 system 1400 jobs 2 months ago
m_DependencyManager->GetDependency
179/frame - Median 1.23ms, Mean 1.24ms, Min 1.02ms, Max 1.41ms
m_DependencyManager->AddDependency
171/frame - Median 0.20ms, Mean 0.24ms, Min 0.17ms, Max 0.48ms
JobHandle.ScheduleBatchedJobs
171/frame - Median 0.62ms, Mean 0.61ms, Min 0.47ms, Max 0.69ms
scheduling taking 0.61ms/frame (note the only 179 actions average, it's because we slice our systems over 3 frames)
but yeah projects grow big
Get dependencies are from just reading from state.Dependency right?
yeah
GetDependency is start of system
Add dependency and ScheduleBatchedJobs happens end of system
wow, hrm. That's concerning
the schedule batch jobs should be improved a lot in 1.0 but we can't test
i'd expect that to be halved
get dependency should be significantly improved by ISystem
which this project only has about 20 of (still 0.51 and most of it was written before it was even available)
also this is on a 3900X so a decent CPU
point is really just that
0.1ms here and there
grows after and suddenly is noticeable after 3+ years
Hrm, you got me concerned about my own systems. I got 3 ISystems that are unbursted due to requiring actions with classes and other managed components. Basically my render upload systems and input system. Both requiring execution every frame at least, the inputs happening multiple times depending on the physics.
Do you have burstable alternatives to these systems? I've been trying to find a burstable GPU buffer upload method but both ComputeBuffer and GraphicsBuffer are classes.
Short of using my own C++ DLL to compile in extern calls. Which is probably equivalent to [BurstDiscard].
I was wondering if someone with more experience could give me some input regarding getting data from a mono behavior in Update and passing it to a system.
do I just use EntityManagerin my monobehaviour ?
do we have some live link or conversions ?
Yes. World.DefaultGameObjectInjectionWorld.EntityManager
so we just update an entity in OnUpdate using World.DefaultGameObjectInjectionWorld.EntityManager with the data we want.
Yes. Assuming you do not have multiple worlds (e.g. using dots netcode)
what if the data is from AudioListener.GetSpectrumData() and constantly streaming in ?
Then set the data every frame
For a single entity, no. For many, probably. Although if you're using MB driven update, you might be better off not using Entities.
what do you mean not use Entities
You can leverage the Job system without needing entities. Just use a pile of NativeArrays or whatever collections you need.
The Entities package. Not use DOTS but instead just parallel processing.
oh, ok.. so I just need read only data from spectrum data for entities, as in the rest of the game is in ECS
Oh, why not do it in a SystemBase then?
Query the spectrum data in systemBase?
Yea. Pull the data from whatever audio stream you have then set the data in your relevant entities all inside a systembase class
sounds like a good plan, ty KornFlaks
Hi @robust scaffold. I believe u are using dots netcode. Do u know how to make auto connect work at 1.0? Previously it's working at 0.51 but I'm not sure how to make it work at 1.0
ArgumentException: System.ArgumentException: Unknown Type:`{0}` All ComponentType must be known at compile time & be successfully registered. For generic components, each concrete type must be registered with [RegisterGenericComponentType]. This Exception was thrown from a function compiled with Burst, which has limited exception support.
How to fix this? I just rename some asmdef then get this error
Try full recompile
if I have a MyMonoBehaviour used by Baker<MyMonoBehaviour >
what happen do data created in Update() Awake etc
especially if the baker uses data from a var that is set in let say start()
Am I not supposed to use any of the MonoBehaviou event methods to set data that my Baker needs to pass on?
Just try and check
Add logs
And close some subscene
MB events will not be called so the data is uninitialised, either default values or null
only thing called by bakers is the Bake method
the interesting case is when the [ExecuteInEditMode] attribute is used. no idea what's happening then
from some error messages in the past a new instance is made with reflection so the attribute will not do anything, unless statics are used 😄
yes
Why is the baker constantly called during runtime?
wait look like if you change the editor runs, so audio clips will just wreck it
pretty sure awake is called
aLSO have a same feeling about OnStart
but better check with log messages
just tested, no it's not
is there a way to get data from a gameObject in the main scene into subscene ?
that's really not meant behaviour
so whatever hacks you'll have to use to achieve that - beware
it's not worth it
ok, thank for the warning
the issue with subscene is it doesnt support a lot of components
so you need to keep them out of the subScene and try get the data some other way
eg put an audio clip in a subScene, it just loop and loop game running or not
Is there a way to access the current entity in the new idiomatic foreach?
that's the first time I ever hear about it
.WithEntityAccess()
just tell what happened xD
Thank you!
Unless it's ECS based framework
it won't be converted
you need to create your own bakers
and own audio framework
my suggestion is to use FMOD since it's audio API is Burst compatible
that ok, I just need a ref to it for authoring some other buffers
that why im trying to keep it outside the subSecene and grab a ref
just save it in managed component then
what do you mean
class MyComp : IComponentData
Do you know if Wwise's is?
it will be serialized
never heard about it
FMOD is compatible because it's API is c++ extern functions
those can be called inside Burst
It's the other big audio engine alongside FMOD
ok let me try it
have you ever worked with AUDIO IDEs? Reaper, FL studio and etc?
hmm last i heard (was 18 months ago)
wasn't supported using build configurations which is required for 0.51
should be supported in 1.0 though
no i have not
Yea, really had trouble getting those two to work together,
@rotund token is your company using cloud build?
private void Ignition()
{
int port = _port.value;
if (port is > ushort.MaxValue or < ushort.MinValue)
return;
// * Spin up the main scene and kick off sub-scene loading.
SceneManager.LoadScene("Scenes/SampleScene");
ClientServerBootstrap.AutoConnectPort = (ushort)port;
if (ClientServerBootstrap.RequestedPlayType == ClientServerBootstrap.PlayType.Client)
// * From CSB source code:
// ? "In the editor, the 'editor window specified' endpoint takes precedence, assuming it's a valid address"
ClientServerBootstrap.DefaultConnectAddress = NetworkEndpoint.Parse(_address.value, 0);
// * Clients and server auto-connect using the properties set in ClientServerBootstrap.
// ? Neat, isn't it?
switch (ClientServerBootstrap.RequestedPlayType)
{
case ClientServerBootstrap.PlayType.ClientAndServer:
ClientServerBootstrap.CreateServerWorld("ServerWorld");
ClientServerBootstrap.CreateClientWorld("ClientWorld");
break;
case ClientServerBootstrap.PlayType.Client:
ClientServerBootstrap.CreateClientWorld("ClientWorld");
break;
case ClientServerBootstrap.PlayType.Server:
ClientServerBootstrap.CreateServerWorld("ServerWorld");
break;
}
}```
Does anyone know of a use-case for system entities? I thought about using it for output data of a system but the inability to pass them into a job seems to be a no-go.
It's just a way to access them
Their handle
I'm thinking of similar approach
Create some kind of burst compatible type manager
Which will register any type by jndex
And then you can create type specific entities to access it
For now I have this for NativeReference
Really pog feature
Getting that "Loading Entity Scene failed because the entity header file couldn't be resolved" whenever i make some asset change even when just add a new script - clearing cache sometimes helps but usually not - need to restart Unity or open subscene or else game wont play - pretty annoying bug which was first reported back in 2020 or 2019 but not fixed till now
Well, that error will always occur if something in the subscene failed to bake.
And now 1.0 is just a nightmare
yeah still annoying
But right now, the baker is broken. And the issue is already known and being fixed by the time 1.0 pre comes out
I don't even know whether it's a good thing I can't code 😅
If you really dont like it, downgrading to 0.5X and going back to the GOCS baking workflow is your only option.
I've just accepted my mediocrity.
I meant that I literally can't
I'm away from home and the only laptop I have is back from 2010
Not even compatible with Rider kek
notepad gaming
imagine the intellicomplete
you got control-F, that's all you need
but more seriously, use VSCode. Im pretty sure that is the bare minimum and works on a fermented potato.
You wont get any code completion or linting but it's mildly useful
I dont even have unity open most of the time I code now. Not having it open means the baker bug and other corruption doesnt occur
It restarts quickly for me
So that's what I do
I have no assets basically aside from code
restarting is annoying though
I got used
I'm getting such an error
The system NSprites.SpriteRenderingSystem writes NSprites.PropertyPointer via SyncPropertyByQueryJob`1 but that type was not assigned to the Dependency property. To ensure correct behavior of other systems, the job or a dependency must be assigned to the Dependency property before returning from the OnUpdate method.
SyncPropertyByQueryJob looks like
[BurstCompile]
internal struct SyncPropertyByQueryJob<TProperty> : IJobChunk
where TProperty : unmanaged
{
// this should be filled every frame with GetDynamicComponentTypeHandle
[ReadOnly] public DynamicComponentTypeHandle componentTypeHandle;
public int typeSize;
[WriteOnly][NativeDisableParallelForRestriction] public NativeArray<TProperty> outputArray;
public void Execute(ArchetypeChunk chunk, [NoAlias] int chunkIndex, [NoAlias] int firstEntityIndex)
{
var data = chunk.GetDynamicComponentDataArrayReinterpret<TProperty>(componentTypeHandle, typeSize);
NativeArray<TProperty>.Copy(data, 0, outputArray, firstEntityIndex, data.Length);
}
}
The job is really simple, it just takes DynamicComponentTypeHandle through GetDynamicComponentTypeHandle(compType) and just copy data to output native array. There is no problem with ranges or something like this. Also I set Dependency property right, so no handle lost in nowhere 🙂 I can't figure out why error says that this job WRITES to component, because it actually writes nothing, it is even has [ReadOnly] attribute on DynamicComponentTypeHandle componentTypeHandle field. If i add [NativeDisableContainerSafetyRestriction] then just console is clear, no errors. Also this error appears only if i schedule more then one of such a job.
Also i see no way to get actually readonly DynamicComponentTypeHandle through GetDynamicComponentTypeHandle(compType), there is no overload with readonly option, so maybe system think i'm writing something.
So what can be wrong?
Can you create dynamic handle with read only argument?
I think that's it
Quick glance, you dont need [NoAlias] on those int parameters. NoAlias is only for pointers.
Cant you just do a ComponentTypeHandle<TProperty>?
as i mentioned, i see no method overload or another group of methods to get dynamic handle with readonly argument
Then it seems like it's write access
hmm, will try to
whooooooooah, i've found error. That's a story!
What I do is caching ComponentType from Type gathered with reflection, so I have little boilerplate code with type registration. And there is really no overload of getting DynamicTypeHandle with readonly argument, because passed ComponentType already have this argument by itself. It works the same way with SystemBase.GetComponentTypeHandle<T>(bool isReadOnly), it just creates ComponentType depending on bool argument AddReaderWriter(isReadOnly ? ComponentType.ReadOnly<T>() : ComponentType.ReadWrite<T>());
I didn't know about that, and I was registering my component types like new ComponentType(type, ComponentType.AccessMode.ReadOnly), but after little refactoring (which was not noticed by me) registering became just type which is regular Type, so implicit cast was happening and it seems it goes with ReadWrite access, so all my dynamic handles was created with ReadWrite access
I'm trying to create a DOTS/ECS project, but on Unity 2021 LTS, after importing com.unity.rendering.hybrid, I get errors saying tha there is no definition for <something> in JobsUtils. I've also tried Unity 2022.1, but it straight up gives an error upon creating the project (something about Shadergraph). For both attempts I've used the 3D (URP) template. What am I doing wrong?
What version of Entities
Version 0.51.1-preview.21
Out of interest, on a new project why would you start on an old version instead of starting with 1.0?
0.51 is more stable
Well, on Unity 2021 LTS, that seems to be the latest supported version. And, as I mentioned, on Unity 2022.1 (which I suppose supports Entities 1.0), the 3D (URP) template gives me errors straight away. And I do want to use URP.
I'm using urp right now, with custom shaders of course, but it works
Speaking of 1.0, has anyone found a good way of referencing gameobjects in systems without Singletons?
You need to use 2022.2b6+
2022.1 is not supported
I want to spawn a healthbar UI with my entities, but UI has to be managed, and doesnt work in ECS land
You can add a the prefab reference to a managed component in a baker
Prefabs everywhere
Are you sure? When i try that it throws errors saying that a IComponentData can only contain unmanaged refs
You need a class icomponentdata
using a class also throws an error
So I have to install another version... Again... Great!
wait
Use AddComponentObject
That's not required for class icd
There are overloads for it
ah cool, couldn't remember off the top of my head
That worked for me
Using "AddComponent" doesnt work with classes it seems
In the baker there's no overload of AddComponent<> with a Managed ICD sadly.
@jolly palm as an alternative you can make it a pure ecs entity and get around that by making the healthbar a quad and making a shader to adjust the uv space "fill"
I was legit debating that
Well actually by using Render textures with ui toolkit
but both seem like overkill. Or rather that a more susinct solution would exist
oh in baker yeah no overload
i think it's coming next version
just EM has the overloads atm
When are we supposed to use AddComponentObject then?
for adding UnityEngine.Components and the like?
well its more involved doingthe shader setup but its way way faster and can plop them everywhere
AddComponentObject existed before class ICD did! and yeah exactly what you say
you can attach anything
addcomponetnobject(int[])
addcmoponentobject(material)
etc
most common case is, AddComponentObject(Transform) and there is special handling for this
with transform access etc
Sigh. I just wish it was a bit faster to setup things in ECS. Once you get things going it is certainly faster, but the initial setup is a slog
IMO that's just experience
I find ecs very fast to setup things these days
i wont say it's flawless and some things do need work
but it's really not that bad
(and obviously a bunch of features missing which is the biggest issue)
(animations please!)
it really isn't that bad
But its still quite involved to setup compared to traditional gameobjects
see i don't believe so
ANIMATIONS PLEASE
i can game jam a project faster in ecs than i can in gameobjects now
i've been using it approaching 5 years
and i think it takes longer to learn than gameobjects
which has been a hurdle for our studio
ECS is certainly complex.
But it is so much more effective!
It solves what I would consider to be the largest problem im modern videogame development.
It makes it easy for objects to be interactive
And videogames are all about interactivity
Uhhh.... Different question.
When using "AddComponentObject", it looks like the system can no longer access it with "GetComponent" or "GetSingleton"
need to use EM to get component objects
Use GetSingletonEntity + EntityManager.GetComponent I think
if it's an ICD you can use EM.ComponentData, otherwise if you attached some arbitrary data you need to use GetComponentObject
Ok. I understand why it works like that, but that is way too involved just to get a GameObject reference into a system.
I can see why all the tutorials just use singletons...
I just pass in the name and use GameObject.Find(name)
wait does that work for systems?
No reason why it wouldn't
Still not a great solution because you are using magic strings
right
Ideally you use a Config Entity class or something with a ScriptableObject
So there is a "URPMaterialPropertyBaseColor" struct for modifying colors of entities. But can this be used to modify materials directly? Or are materials still part of managed space
What I really am asking is can I use a job to modify material properties
i think there's a urp color demo but i'm afraid that won't work in burst jobs
i've read something about it though. maybe scan the forum for that property
If I have RequireForUpdate() on a query with enableable components that when calculated == 0, and the job itself does not run, is the system still supposed to run? If so is there a cleaner solution than early out on update because I was kind of thinking that was the point of enablable components
Filters aren't factored in for require for update
Unfortunate. So early out still I guess
It would require a sync point to complete previous jobs that were changing the enabled bits
To know if they were enabled or not
You can't know if the components are enabled on main thread until all jobs that could change them have finished running
So this is not really something you want to do
Learning that most of this is not something I want to do 😦
They will be filleted (efficiently) when the job is running
They do whole chunk filtering if nothing is enabled, then per entity filtering
I guess I misunderstood, I thought they didn't require sync point, and I thought ISystem was not on main thread, only SystemBase was. So I thought that we had some magic where a system wouldn't run if a query didn't have enabled bits. I guess only prevents the job itself, which I am not getting to that point because I am early out anyway. Probably just flawed logic again on my part on how I wrote systems
Isystem is on main thread, it's just burst compiled
That's the only real difference
(except obvious struct / class limitations)
hey, does 0.51.1 not work with unity 2022.1.21f1?
wait, something much worse has gone wrong lol, every single package, even non ecs ones are deciding to throw a hissy fit, how unusual
Material Overrides is what you should use for that: https://docs.unity3d.com/Packages/com.unity.entities.graphics@1.0/manual/material-overrides.html
No
Nothing works in 2022.1
0.51 for 2021.3
fascinating, thanks for the info!
1.0 for 2022.2
Thank you! I was searching for that but couldn't find the official documentation
Oh wow, I just brainstormed a valid reason to use ISCD. Reusable read-write buffers for repeated large scale diffusion simulation.
Problem is that chunk utilization is gonna be garbage, 24 entities at most per chunk. But weighed against a reusable 16MB array per thread, hrm.
God, dynamic sized chunks cant come soon enough. Maybe in 2 years at this rate
gameObject.hideFlags = HideFlags.HideAndDontSave
Gives this error when Entities Hierarchy is on editor
seems like a virtual (ecb) entity o_O
Just noticed the index went crazy lol
hi there does the ''Warning: failed to fetch saved variables from player prefs'' and '' Error building player: 2 errors'' related? Im kinda new to unity and I cant really understand what those forum and discussions are talking about when I search for help online
you mean stable diffusion? for anything like that i'd go back to 0.51 and just increase the const chunk size 🙂
but he'd probably want unmanaged iscd
true, yeah such a pain we can't turn off the 128 limit :/
Diffusion as in the chemical transport. Not the AI.
Yea. Despite all the bugs, job accessible ISCD makes 1.0 entirely worth it.
we could invest some time into hacking out the limit. i'm pretty sure it's not a big deal if you don't use enabled comps
well seems to be easy enough. there's TypeManager.MaximumChunkCapacity and the rest is in EntityComponentStore.cs line 2494 with a maxCapacity = math.min(maxCapacity, cType.MaximumChunkCapacity);
hacking this out should get rid of the cap
Annoying, 2020.3 felt pretty much rock solid for 0.5+, moved over to 2021.3 to get access to some newer stuff and it's just so much buggier.
Feel a bit like a rabbit caught in headlights, do i finally take the leap to 2022.2 and 1.0, invest the time into transitioning everything over, or is that going to be just as buggy or more
The interaction between the pre-release releases and beta editors has been a little rocky, although it's mostly been various manifestations of the same thing.
The good news is that the further along Entities packages get to full release, the better integrated the testing gets, so I expect the situation to improve as we go on.
1.0 is a burning trash fire at the moment. If you think 0.51 is buggy, 1.0 makes it look rock solid. Dont upgrade unless you really want a feature that it brought in.
Hi everyone, how can I bake to a specific world in 1.0?
This is how I did it in 0.51
public class ConvertToEntityInPhysicsSimulationWorld : ConvertToEntity // ConvertToEntity is deprecated
{
void Awake()
{
var worlds = World.All;
World physicsSimulationWorld = null;
foreach (var world in worlds)
{
if (world.Name == WorldNames.PhysicsSimulation)
{
physicsSimulationWorld = world;
break;
}
}
var system = physicsSimulationWorld.GetOrCreateSystem<ConvertToEntitySystem>();
system.AddToBeConverted(physicsSimulationWorld, this); // No longer possible
}
}
might want to look at netcode and how they did it.
okay, I'll have a look 👍
I'm having an unreasonable amount of trouble getting custom shader properties to work with multiple objects.
[MaterialProperty("_Fill")]
public struct HealthShaderFill : IComponentData
{
public float Value;
public Entity AttachedHealthEntity;
}
This code works at changing the material property, but only 1. I have multiple instances of a material and other instances don't appear to work. (the Value is forced to 0)
The shader declaration is set to Hybrid per instance
The Value does show correctly in the Entity inspector, but the material does not reflect the proper value
Has anyone else dealt with using IComponent Material property overrides?
Found the issue.
Components with Material Property overrides cannot have other fields in them. The documentation doesn't mention this clearly, and it didn't give me an error so I thought it was ok.
Interestingly, if you also use the MaterialOverride monobehaviour, then you DO get an error that extra fields are not allowed.
How is the BakingSystem created? It has [DisableAutoCreation]
You inherit from it
Yea that would be one way to use it, I assumed that the BakingSystem was created by default.
com.unity.netcode seems to always bake to the default world from what I could find. Did you find any magic for baking to a different world?
Perhaps this works by baking from within a subscene which is configured to load to a specific world. I'll have to look more into this.
Yea, the only world currently being baked is the baker world. Then netcode copies that for all worlds needing instancing then cleans the entities of their world specific components
Good to know :)
I have a new problem, I can't access the entity from a idiomatic foreach
public partial struct CleanUpStrobeLightsSystem : ISystem
{
private EntityCommandBuffer ecb;
public void OnCreate(ref SystemState state)
{
ecb = SystemAPI
.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>()
.CreateCommandBuffer(state.WorldUnmanaged);
}
public void OnUpdate(ref SystemState state)
{
foreach (var strobeLight in SystemAPI.Query<StrobeLightSSCD>().WithNone<IsSelectedTag>().WithEntityAccess())
{
ecb.DestroyEntity(strobeLight.Item1.strobeLightEntity);
ecb.RemoveComponent<StrobeLightSSCD>(strobeLight.Item2);
}
}
Assets\Scripts\ECS\Default\Systems\Interaction\CleanUpSelectionLightsSystem.cs(25,70): error CS1061: 'QueryEnumerableWithEntity<StrobeLightSSCD>' does not contain a definition for 'Item2' and no accessible extension method 'Item2' accepting a first argument of type 'QueryEnumerableWithEntity<StrobeLightSSCD>' could be found (are you missing a using directive or an assembly reference?)```
try
foreach (var (strobeLight, entity) in SystemAPI.Query<StrobeLightSSCD>().WithNone<IsSelectedTag>().WithEntityAccess())
{
ecb.DestroyEntity(strobeLight.strobeLightEntity);
ecb.RemoveComponent<StrobeLightSSCD>(entity);
}
That fixed it, thank you 🙂
Hi, I'm having issues with catching physics events. I am constantly getting a weird error. I've tried many things and didn't fix the error / never got a response.
namespace Systems.Bullets
{
[BurstCompile]
[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
[UpdateAfter(typeof(PhysicsSimulationGroup))]
public partial struct CollisionJobs : ISystem
{
[BurstCompile]
public void OnCreate(ref SystemState state)
{
state.RequireForUpdate<BulletData>();
}
[BurstCompile] public void OnDestroy(ref SystemState state){}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
// Setting up
Simulation simulation = SystemAPI.GetSingleton<SimulationSingleton>().AsSimulation();
EntityCommandBuffer ecb = new (Allocator.Temp);
// Determining the type of event to handle
foreach (CollisionEvent collision in simulation.CollisionEvents) {
Entity a = collision.EntityA, b = collision.EntityB;
if (SystemAPI.HasComponent<BulletData>(a)) {
BulletPhysicsAspect aspect = SystemAPI.GetAspectRW<BulletPhysicsAspect>(a);
if (SystemAPI.HasComponent<BulletData>(b))
HandleBulleted(ref ecb, collision, aspect, SystemAPI.GetAspectRW<BulletPhysicsAspect>(b));
else
HandleGroundHit(ref ecb, collision, a, b);
}
else if (SystemAPI.HasComponent<BulletData>(b)) {
HandleGroundHit(ref ecb, collision, b, a);
}
}
// Playing back
ecb.Playback(state.EntityManager);
}
[BurstCompile]
public void HandleGroundHit(ref EntityCommandBuffer ecb, CollisionEvent cEvent, Entity a, Entity b)
{
ecb.DestroyEntity(a);
// TODO handle bounce
}
[BurstCompile]
public void HandleBulleted(ref EntityCommandBuffer ecb, CollisionEvent cEvent, BulletPhysicsAspect a, BulletPhysicsAspect b)
{
float damageA = a.properties.damage;
float damageB = b.properties.damage;
float dif = damageA - damageB;
if (dif <= 0) ecb.DestroyEntity(a.entity);
if (dif >= 0) ecb.DestroyEntity(b.entity);
}
}
}
errors
you are processing the foreach on mainthread while the physics simulation isn't done yet
best to put it all in a job and schedule it
any reccomendations on how to do this?
You should not have burst compile on random methods
Your Handle methods is what I'm talking about
I guess, but thats not quite the issue
It's not I didn't even read your error log yet
Ouch, yeah I guess I won't bother for now. It's only really drive on physics joints that I'm interested in.. Tbh the problems with transitioning from 2020 to 2021 ( ecs 0.51 ) seem to be more the editor itself, lots more crashes and seems to be a little slower compiling.
what you can do if you are bored is at least transitioning to bakers. pretty mindless task but worth it to do sooner than later. bunch of if defs so you can stay in the same codebase
Haha yeh that's the part I'm least looking forward to as currently not using subscenes at all, converting at runtime
I got it to work, but without jobs, when I tried adding it in a job (IJob, ICollisionEventsJob) I got a lot of errors, even when depending on simulation.FinalJobHandle. Eventually I did this:
Simulation simulation = SystemAPI.GetSingleton<SimulationSingleton>().AsSimulation();
simulation.FinalJobHandle.Complete();
```and fixed the issue.
If you can educate me on how to do this in a job I would greatly appreciate it! I think the main problem was that I used SystemAPI in the job without a reference of SystemState. But I can't get a reference of SystemState in the job so I'm clueless on how to check for components / get them in jobs like this
Can you show your example of doing it with a job?
Im no longer on my pc, but it’s almost the same as this
But then it gets executed in a job
were you passing simulation.FinalJobHandle to the job?
When I scheduled the job I put it as the depend on parameter
were you combining it with your local dependency?
if you were doing it this way you probably need to do something like
state.Dependency = JobHandle.CombineDependency(state.Dependency, simulation.FinalJobHandle)
and then pass that ot the job
but the easiest way is just to implement ICollisionEventsJob
private struct CollisionEventsJob : ICollisionEventsJob
{
[ReadOnly] public PhysicsWorld World;
public unsafe void Execute(CollisionEvent collisionEvent)
{
}
}```
Il look into this tomorrow when I get on my pc
{
World = SystemAPI.GetSingleton<PhysicsWorldSingleton>().PhysicsWorld
}.Schedule(SystemAPI.GetSingleton<SimulationSingleton>(), state.Dependency);```
so yeah, there's a specific job for this
My main issue was that I got a bunch of errors because I used SystemAPI in the job
yeah you can't do that
systemapi can only be done inside a system
not in jobs, not in monobehaviours, etc
And I don’t know how else I can check if the entity has a specific component
you pass in a ComponentFromEntity<T>
thanks for the help, il look into it tomorrow
Is there any reason the function is unsafe?
Alright, thanks for your time
Is there a way to enable the component on an entity while scheduling it parallel without disabling safety?
what job
IJobEntity
if you're using lookup though you'll always need to disable safety
:[
no operation on that is safe in parallel
what if 2 separate threads wrote to same entity
{
var delegates = ReflectionUtility.GetAllAssemblyWithReference(this.GetType().Assembly)
.SelectMany(t => t.GetTypes())
.Where(t => t.IsClass && t.IsAbstract && t.IsSealed) // Find all static classes
.Where(t => t.GetCustomAttribute<BurstCompileAttribute>() != null)
.SelectMany(t => t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
.Where(t => t.GetCustomAttribute<BurstCompileAttribute>() != null)
.Select(m => (MethodInfo: m, Attribute: m.GetCustomAttribute<MigrateAttribute>()))
.Where(m => m.Attribute != null && m.Attribute.From != 0)
.Select(m => (Key: m.Attribute.From, Migrator: (MigrateDelegate)Delegate.CreateDelegate(typeof(MigrateDelegate), m.MethodInfo, false)))
.Where(m => m.Migrator != null);
foreach (var (stableHashKey, migrator) in delegates)
{
this.migrators.Add(stableHashKey, BurstCompiler.CompileFunctionPointer(migrator));
}
}```
look at this monster
I've rewritten most of my save library to be unmanaged which means my old migrators just don't work
So I have to dynamically grab function pointers for them all now instead
Before
public class TestMigrator : ComponentDataMigrate<TestMigrator.Before, TestMigrator.After>
{
public override ulong From => 1392796844747678277;
public override ulong To => 17841778420484547873;
protected override void Migrate(ref After newComponent, in Before oldComponent)
{
newComponent.Value = oldComponent.value;
newComponent.NewValue = 5;
}
}```
After
```[BurstCompile]
[MonoPInvokeCallback(typeof(MigrateDelegate))]
[Migrate(1392796844747678277)]
public static bool TestMigrate3(ref SystemState systemState, ref Deserializer deserializer)
{
var migrator = new ComponentDataMigrate<Before, After>(ref systemState, ref deserializer, 17841778420484547873);
while (migrator.MoveNext())
{
var (from, to) = migrator.Current;
for (var i = 0; i < from.Length; i++)
{
to[i] = new After { Value = from[i].Value, NewValue = 5 };
}
}
return true;
}```
it didn't turn out as bad as expected
looks pretty sleek
but yeah i've also had some issues migrating stuff to ISystem
still haven't solved my il2cpp marshaling issue
just gonna ignore it for now 
Are there any Baker<T> methods for having an Entity destroy itself during baking? Something other than BakingOnlyEntity, since I want to be able to insert some logic to decide if the Entity should destroy itself
Otherwise, would the only other option be to have a BakingSystem do that?
Oh, and adding BakingOnlyEntity (the component, not the authoring) to an Entity with children, but not to the children, would cause these warnings to appear. Something about missing Parent component GUIDs
i have a feeling destroying the entity owned by authoring causes issues
I see, so it's better to do it in a BakingSystem?
Another question is: how can I access the Entity from SystemAPI.Query<T>()? It only every returns the components
What I'm saying is you might have issues here
There's a WithEntityAccess()
Thanks, WithEntityAccess seems to be it
What's your recommended way of deleting an Entity during baking?
Don't 😅
Generate new ones instead I guess?
(You'll have to test this though, I've never had or considered a case where I wanted to delete an authoring entity so I haven't personally tested. Just heard it doesn't work and causes issues)
I'm not sure how to do that. I'd like to delete entities because my Authoring hierarchy, in order to be easily configurable, has a lot of disabled GameObjects or empty "folder" GameObjects.
I have a "Soldier" with every possible type of Authoring in its pre-conversion hierarchy, even for stuff it doesn't need, like Spear, Sword, Bow, Helmet A, Helmet B, etc. In order to easily configure new Soldiers, I just enable and disable the stuff it needs and doesn't need. However, this doesn't work well with the new baking system, since disabled GameObjects are still converted
Also, I'd hate to have a bunch of dangling "folder" GameObjects/Entities
Do you still remember where you read that? I'd like to take a look myself
Right, I tried it before and having a custom DestroyImmediately authoring/baker/system didn't cause any issues as long as I was using a custom DestroyImmediatelyComponent. However, if I use the pre-existing BakingOnlyEntity component, and let its related systems do the work, I get these weird warnings related to missing GUIDs in Parent
public struct Delete_BakingEntity : IComponentData { }
[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
public partial struct RemoveDefaultComponentsBakerSystem : ISystem
{
public void OnCreate(ref SystemState state)
{
}
public void OnDestroy(ref SystemState state)
{
}
public void OnUpdate(ref SystemState state)
{
var ecb = new EntityCommandBuffer(Allocator.Temp);
foreach (var (_, entity) in SystemAPI.Query<Delete_BakingEntity>().WithEntityAccess())
{
ecb.DestroyEntity(entity);
}
ecb.Playback(state.EntityManager);
}
}``` simplest form
I'll reimplement DestroyImmediately to take care of those folder GameObjects, but for easily disabling and enabling GameObjects in a transparent way, that I haven't solved yet. By transparent I mean in a way that's easy to see and minimize mistakes
Yep, that's what I'm doing right now, except I also perform a small check inside Baker<T>
he seems like he has a hierarchy though, would this not cause issues with the elements being added to LEG etc
i haven't continued reading 😄
maybe one of the filters just happens to filter it out while LEG is being setup
there should be a good case for it to delete authoring entities. anything with LEG or because of laziness isn't it ^^
i use it to destroy an entity that serves as a converter to blob data. haven't found any other way
would need some testing. might just work with leg setup running afterwards
disabled GOs get a Disabled comp so it shouldn't even be necessary to delete them
I’d like to still delete them to avoid wasting memory. Especially since they won’t ever be enabled again the way I’m using the@
Just remove query with Entity manager
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var dependsOn = new JobHandle();
var scalableFloatMagnitudeJob = new CalculateScalableFloatMagnitudeJob().ScheduleParallel(dependsOn);
var attributeBasedMagnitudeJob = new CalculateAttributeBasedMagnitudeJob()
{
CasterLookup = state.GetComponentLookup<CasterComponent>(true),
AffectedTargetLookup = state.GetComponentLookup<AffectedTargetComponent>(true)
}.ScheduleParallel(dependsOn);
var calculateMagnitudeJob = JobHandle.CombineDependencies(scalableFloatMagnitudeJob, attributeBasedMagnitudeJob);
var applyStatModifierJob = new ApplyStatModifierJob();
state.Dependency = applyStatModifierJob.ScheduleParallel(calculateMagnitudeJob);
}
How can I do this in the correct way? Because .ScheduleParallel must have a JobHandle param
}.ScheduleParallel(dependsOn);
change that to state.Dependency
you've just completely overridden the systems dependency handle
Currently I'm thinking the most straight-forward way to have multiple worlds with the new baking and subscene workflow is to
- Not use
UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP - Create and destroy additional worlds depending on which scene is loaded
- Add
[DisableAutoCreation]to all systems, except the ones I want in the default world - Have systems in the default world which move entities with certain tags from the default world to other worlds where they are needed
Is that a good way to go about this?
Sounds awful
suggestions? ^^
Create all worlds manually
Or use custom world bootstrap
To create all additional worlds in it
How can I set up the editor world manually?
Why do you need manual editor world?
Isnt the editor world responsible for doing the subscene / baking stuff?
Idk, but I don't see any reason to touch it
I tried not touching it while keeping my custom default world initialization logic and it doesn't work
What doesn't work?
GameObjects within subscenes aren't converted to entities
What compiler attribute did you use?
I used UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP_RUNTIME_WORLD only
Isn't there attribute to disable automatic world creation?
Not systems
Besides
You don't even need this
Just do your custom world creation using intetface
Custom Bootstrap
#UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP_RUNTIME_WORLD disables generation of the default runtime World.
Good idea, I'll give it a try 👍
In my project I have a system which instantiates an Entity prefab through a ECB. The instanced enteties appear both in the entities hierarchy and in the game view, but not in the scene view. What could be the cause for this?
I think I know what this could be caused by
Let me check, my editor is currently busy crashing
Make sure this is set to Runtime Data
Thank you very much! It was set to Authoring Data!
I'm now using ICustomBootstrap for the default world but conversion of GameObjects to Entities is still now working. Something missing from my code perhaps?
public class CustomBootstrap : ICustomBootstrap
{
public bool Initialize(string defaultWorldName)
{
Debug.Log("Bootstrapping Default World");
var world = new World(defaultWorldName);
World.DefaultGameObjectInjectionWorld = world;
var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(world, systems);
ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop(world);
return true;
}
Seems good
Appending needs compiler if though
Feels like you're doing smth wrong with baking
After upgrading to 1.0 I'm getting this error constantly running in the editor:
Leaked BatchRendererGroup: Native object doesn't have a handle in the scripting domain. Potentially indicates a problem with domain load/unload.
2022.2.b13 and I'm using Vulkan
You need some setting for domain reliaf