#archived-dots
1 messages ยท Page 24 of 1
i'm itching to install 2022.2 and try things out but i'll wait for the samples i think
interested in improvements to physics
does anyone know if Bootstrap mechanics have changed?
I create an additional world and add systems to it:
this worked before, but now seems to not do anything.
my created ServerWorld is entirely empty
heya guys, I've annotated an editor script method with [BurstCompile], but i cannot see it in the burst inspector. something i'm missing?
Had to dig a bit https://docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Transforms.LocalToWorldTransform.html says this
If this component is present, TransformToMatrixSystem will use its value to compute the entity's LocalToWorld matrix
And as Graphics only relies on this matrix it works with both systems
Yeah, as far as I can tell. Sorry I have not been tracking that
eh, I'll just wait for migration guide on transforms in manual
nvm guys. i think i'm stupid. haven't used jobs in a while ehehmmm
seems AddSystemsToRootLevelSystemGroups now calls each system's OnCreate immediately.
previously it wouldn't, which made dependency injection before OnCreate possible.
that seems not doable anymore, hmmm
The naming is inconsistent we don't have a NativeMultiParallelHashMap but just NativeMultiHashMap as we don't have a different single threaded optimized version. We'll fix this in a new release
Meaning it will be renamed back to NativeParallelMultiHashMap? ๐
hey, chiming in quickly since unity is present: i remember reading something about first assigning a job to a variable and then calling var.Schedule() instead of immediately calling new Job().Schedule() but i can't find it anymore. this still true?
by doing what?
ah
yeah, it's in manual
ah ok, well it's entity specific and actually a known issue. so i guess it will be fixed at some point
What's the best way to check if a World is a server or client world now that the default groups are gone?
Nevermind, there's a native extension for it now
I'm pulling the release branch that is pending pull request, can't wait xD
hey guys, another thing. i'm not perfect in asm, so a question: vmovups are apparently vectorized movs of floats, but are there vectorized movs for integers?
pog, scene entity selection is a thing now
Yes. Depends specifically on your code but there are loads for packed 32-bit integers: https://www.intel.com/content/www/us/en/docs/intrinsics-guide/index.html#ig_expand=4352,4375,4374,4235&cats=Load vmovdqa32
hm, must be missing something then. i have a NativeArray<Color32> but burst uses vectorized float movs
how are we supposed to remove certain comps now in baking? i can get it to work somewhat with an additional baking system that removes comps with an ecb but when a baker uses CreateAdditionalEntity, it won't work. and now i have runtime entities (which should be small) with translation/rotation/scale/LTW/LinkedEntityGroup/Parent ... what the hell ...
there are baker systems
I assume they will be able to iterate over entities
instead of game objects
i already do that. (#archived-dots message) they don't catch the additional entities for some reason
probably other bakers run later. i dunno about the sequence
now i'd have to remove them in runtime which defeats the purpose of a new baking system
Is there something new in enties or what? Haven't seen anything myself, but apparently we're talking new things?
a lot changed
Where can I get the new stuff? Don't have a package update
Thx
and unity 2022.2
probably not
:c
interesting
i'm honestly mostly dissapointed by the update. 128 entities cap in chunks, physics systems doesn't respect some settings and runs CreateRigidBodies eveyr frame, baking system is a lot of rewriting with 0 gains, regressions with features like removing. overall a bad experience and at the end of the day it has worse performance than 0.51
๐ฅฒ
I consider the baking system a huge qol improvement even if the outset is it looks like you dont get anything "new"
it's the same as IConvert. i don't get it
Have to check for myself I guess
whats not to get? it is far less boilerplate to write
i hope i change my mind on the other stuff. this 128 entities cap is quite the problem though.
when you have small entities a chunk only has room for 128. which means not as much iterations on a chunk and wasted memory
nope, totally uncapped up to 1000+ in a chunk
Oh wait it was a byte cap before, wasn't it?
the reason is the enabled/disabled comps feature. but the cap is there even if you don't use it.
hmm?
how is it relevant?
enabled components is implemented as a bitmask
yes, it was explained in a forum post. that's also why you have v128 in your IJobChunk now
ah
pff
it can be done dynamically
just more variables to count
so if you have 500 entities
you'll use 8 bytes
instead of 4
for enabled/disabled
or whatever was used
that's the crazy thing. tertle already tested it. it's not even much faster. and we could all implement this with a bool comp and even a change filter
well, tbh
I don't really value this for speed
but for utility
of saving data on entity
but the 128cap already gave him half the performance compared to uncapped
instead of storing it somewhere
I'm personally very excited to have enabled components built-in to the api. But I do see the value of making it some optional thing per-archetype or per-chunk if that was somehow possible.
The thing we couldn't implement ourselves was a way to have a query not return an entity if a bool inside a component was false.
correct, but iteration time on a tightly packed bool array is so fast. who cares
Btw, is there supposed to be some kind of auto-upgrade for GetOrCreateSystem -> GetOrCreateSystemManaged?
no you manually swap code
I have over 100 errors from this change and its trivial to do so. I know they want us to use new singleton pattern, but this seems like something we could have gradually done (maybe log a warning instead)
i hope they improved the source generator codes
lots of stuff about it
new API
What's the correct pattern going into the future then for system data? Similar to the Singleton component that something like EndSimulationCommandBufferSystem implements, and calling SystemAPI.GetSingleton<T>()?
the new source generator interface (aka iincrementalgenerator) or what?
yeah
Yeah I think so. The component doesn't have to be called Singleton, and you can have more than one component on the system entity.
SystemAPI
niiiiice
Yeah I know, I just wanted to refer to an example from Unity so everyone is on the same page ๐
that's not what I meant
wow :c
I meant ECS API that uses codegen
system handles are mostly a fix for ISystem. for SystemBase it's a regression
no actual codegen from Unity, sorry xD
and well i meant the source generator code
Oh yeah, I just copied the code from one of the ECB systems. Had to make one change for my custom ECB systems since they use an internal field. I can share the code here (not tested yet as I'm still fixing errors)
So If I e.g. require a ECB from unity's systems, but I am calling the code from inside a SystemBase (not an ISystem), it would be better to use GetExistingSystemManaged instead of SystemAPI.Singleton?
i was just looking at your game on the DOTS showcase thread, looks really cool i love the style!
Or what exactly do you mean by regression?
I think they are pushing us to the pattern of no public fields on systems. Only share data through entities + components. Not sure how its a regression. With singleton pattern you get better auto dependency handling
Only as long as the system that has the singleton actually requests e.g. a write handle to it though right?
(Forcing other requesting jobs to wait)
If you intend to write outside the system, then yeah
Ok, just wanted to make sure the singleton API isn't doing any special magic
No I don't think its doing anything new other than creating these per-system entities for you
World.UpdateAllocator.ToAllocator
What the
is that allocator that gets disposed on end of frame?
Why does unity hurt me so by making everything internal 
i sometimes wish there was a compiler parameter to allow you to access internal and private things. that is usually not something you want to do, but sometimes this would just be insanely useful
for advanced use cases
Are you making a custom ECB system by chance? That's where I ran into an internal issue
are we supposed to store TypeHandles inside of the singleton system entities?
how do you actually access that system singleton anyway?
No, just upgrading broken code. I read the GhostComponentType guid (which is now internal for some reason) to check if a runtime entity matches the same prefab
I think you can pass a SystemHandle to SystemAPI.GetSingleton
that's a good thing
because you can publicize it easily
compared to private
Ideally I wouldn't even need to, and there would be a property to read the values in the struct...
well, if you want to tweak with complex stuff, publicize it kek
That kind of defeats the purpose of encapsulation
But I get where you are coming from, since otherwise it just isn't possible
I just find it annoying
use the asmref trick
Yeah I know about that, but I'd rather not
asmref is so much more elegant than copying the entire package to modify it though?
Sorry, I mean SystemAPI.SetComponent() can be passed a SystemHandle
I'll definitely do that before copying the package ๐ In my case I can probably work around it
ah, other people know about that. nice. is there a way to do something similar, but with e.g. UnityEditor.CoreModule ?
@whole gyro thanks!
not that i'm aware of.
damnit
but the asmref is nice, since you can just use 1 line of code to make it accessible for anything you want
why? it does exactly what you want ๐ setup is really easy
Probably (hopefully) because there is a reason it was made internal in the first place
/// Old way
var query2 = GetEntityQuery(
new EntityQueryDesc
{
All = new[]
{
ComponentType.ReadWrite<LocalToWorld>(),
ComponentType.ReadOnly<Translation>(),
ComponentType.ReadOnly<Rotation>(),
},
None = new[]
{
ComponentType.ReadOnly<Parent>(),
ComponentType.ReadOnly<Child>(),
}
});
/// New way
var query2 = new EntityQueryBuilder(Allocator.Temp)
.WithAllRW<LocalToWorld>()
.WithAll<Translation, Rotation>()
.WithNone<Parent, Child>()
.Build(this);
oh man, this looks cool
internal means public for the namespace assembly. they just don't want to expose it to us. (which makes sense for noobs)
finally some good compact API
'public' for the assembly, not the namespace
compared to those nested monstrosities
ah right
I mean yes, but it's similar to reflection. Yes you can do it, but I think you should take a second to think if you should
anyone looked into it?
I prefer noob API
Check the generated code I guess, but I assume so
I am still reading through manual, haven't really touched editor yet xD
You can kind of, you have to use the magic asmdef "Assembly-CSharp-Editor-testable.asmdef" that should give you access to atleast some of the internal editor methods and classes. (I used it to access AudioUtil in the past)
oh man, I feel like migration will be tough
Wasn't there some trick you had to do with asmrefs so that your normal asmdef works again? I haven't used them in some time
ah huge if that works. i really need to access the TextureImporterInspector
you create a asmref in a seperate folder, add a single file, and add [InternalsVisibleTo("my assembly")] for any assembly you want to that file
i need 1.0 sample from this: https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/ECSSamples/Assets/Advanced/Boids/Scripts/BoidConversion.cs - here they remove comps
Seems like they reworked it to not need it?
oh nice thanks, gonna look through it
asmref is the only thing i have no idea how to do with the .net sdk csproj. anyone has an idea?
For one thing it's faster. The dependency generation is much tighter too, giving consistent and correct results
The API changes are a matter of taste, but functionally it's an improvement in almost every way
once i figure out the regressions, fine. until then, i don't profit from any of this
anyone notice ICleanupComponentData ? certainly dont remember this in 51 https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/components-cleanup-introducing.html
Yeah, fair enough
Its the renamed ISystemStateComponentData
ahh that makes more sense now
Not sure how I feel about the name. It definitely makes it more clear that it won't be removed during normal destroy, but I feels weird when it is often used to initialize an entity
partial solution found: baker.CreateAdditionalEntity(TransformUsageFlags.None - this won't add any transform stuff then
Hmm, given that that exists makes me think there was no other solution for removing components
Wait so is there no way to remove transform components from the main entity?
leads to ArgumentException: A component with type:Unity.Transforms.Translation has not been added to the entity. Entities Journaling may be able to help determine more information. Please enable Entities Journaling for a more helpful error message. Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, Unity.Entities.ComponentType componentType) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityComponentStoreDebug.cs:301) Unity.Entities.EntityComponentStore.AssertEntityHasComponent (Unity.Entities.Entity entity, Unity.Entities.TypeIndex componentType) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityComponentStoreDebug.cs:323) Unity.Entities.EntityDataAccess.SetComponentData[T] (Unity.Entities.Entity entity, T componentData, Unity.Entities.SystemHandle& originSystem) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityDataAccess.cs:1280) Unity.Entities.EntityManager.SetComponentData[T] (Unity.Entities.Entity entity, T componentData) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities/EntityManager.cs:417) Unity.Physics.Authoring.PostProcessPhysicsTransformBakingSystem.PostProcessTransformComponents (Unity.Entities.Entity entity, Unity.Physics.Authoring.PhysicsPostProcessData physicsPostProcessData) (at Library/PackageCache/com.unity.physics@1.0.0-exp.8/Unity.Physics.Hybrid/EntitiesBaking/BakingSystems/PostProcessPhysicsTransformBakingSystem.cs:28) oh man ... ๐
physics expects transform on childs or smth
Yeah, might be from the code that traverses the hierarchy and bakes all colliders into one
I was hoping they would make the collider merging thing optional in this release but I didn't see anything about it in the changelog.
how is this untested? ๐
good thing i have my 0.51 still open. hard to figure out where the differences are otherwise. my best guess is that the additional entity wasnt a child
How do hide this thing?
figured it out. Had to drag it to the side and then it let me right click and hide it
so the reason we make so many things internal is that for anything we make public, we are going to get absolutely murdered by everybody who uses it if we ever change it. cf. https://xkcd.com/1172/
and because of all the pain we've caused historically by messing with public stuff, we now have draconian internal processes for preventing us from breaking anything that was ever public (edit: in a non-preview/experimental/prerelease version)
put another way, the group here in this channel is much more tolerant of breaking changes than the median user ๐
well, that's exactly what internal is supposed to be used for. so no issues there :)
would just be nice if there was an / multiple 'unsupported' wrapper out there for advanced users
we unfortunately haven't had much success to date signaling that unsupported is really unsupported. most people seem to just use it like it's production ready and then get just as mad when it breaks as they would have otherwise. this is also why we've gotten so much cagier with our messaging and promotion
I personally dont see API changes as an issue (even for large projects.) Yes it may be annoying, but as long as a upgrade guide is provided, or some sort of automation is in place, I prefer progress over having an outdated API/features
i can't tell you how much unity devs wish you were in the majority on that point
at least, anything that's a package you can 'hook into' with asmref. unfortunately that doesn't work for e.g. UnityEditor.CoreModule
when the .net sdk workflow get's integrated into unity, what would be equivalent for asmref?
i would say that for all of the above reasons, most people at unity who worry about this stuff consider asmrefs a mistake. so i wouldn't be surprised if there isn't one, but i also don't work on that stuff myself, so i don't really know.
absolutely agree. we have 2022 goddamnit. devs need to get away from the lazy mentality.
i feel that the switch to a yearly release version schedule(2021, 2022) sorta hampers the ability to go hog with huge changes
maybe a scheduled release for API changes? I think that would be best-practice since it's expected. For things that dont get finished in time (regarding ONLY API changes) they can be pushed next API update
regrettably, many people upgrade projects from unity versions from approx 500 B.C. and expect it to just work out of the box
dark times ahead.
XD
i hope i'm not bothering, but there is something peculiar about UnityEditor.CoreModule:
some things that seemingly exists (but are glue with c++) are available in UnityEditor.CoreModule, if you extract the same types to your own assembly though, 1 : 1, some (glue properties, methods,...) just don't exist at all in that type anymore. how?
not sure what you mean by extract the same types
essentially copy paste to own assembly XD
what's an example of such a thing?
You won't be able to do that since usually the bindings are internal (since these are private impl details that can change)
I think unity devs need to just stop caring so much about API changes. If it breaks your game, it's for a reason, and as a game/software developer you can either stick with the old editor, or update and make changes to the API yourself
If you want to roll the dice and bind to them anyway, you'll need to use reflection or sneak around and use the internalapibridge approach Unity employs
e.g. TextureImporter.MaxTextureSizeAllowedForReadable just vanishes completely
since essentially i'm trying to extend what image files are 'supported' in the unity editor, and would've liked to have the same importer inspector, or at least the same features as the built in one (aka e.g. ShaderUtil.hardwareSupportsFullNPOT) but it's pain since everything's internal
and vanishes when you try to replicate it
is there an advantage to using a ChunkEntityEnumerator over a for loop of entities from the chunk's nativearray?
no non-uniform scale for experimental 1.0 ๐ฅฒ
does the post-transform-matrix component affect dots physics' collider?
non-uniform still exists
any idea?
Does the 1.0 experimental package have proper 2d support now?
Don't know if you saw that, but there's a ENABLE_TRANSFORM_V1 define if you wanna keep the previous Transform system
Hahahaha. No
afaik there's no conversion from 2D with 1.0
Unity released 1.0 hella fast
Ok so back to hiatus for another year then.
Pain
just use quad
Seems kind of strange that AddSharedComponentData is being auto-upgraded to AddSharedComponentManaged
Since it could be either or
Nah I just use another solution. If I have to jank up solutions that may have unforseen side effects I rather use monogame and one of the myriad of ECS libraries out there.
bleagh
this was a hard call for me. the thing is that the managed path is actually able to deal with both unmanaged and managed paths, BUT the version that can deal with both is not burstable. so in order to make it obvious why your system is not getting bursted, i decided to rename the combined path to be called Managed
Enabled by default
no need to explicitly declare it
same thing?
I thought that was only if using physics or netcode
Thanks for correcting me ๐
Yeah I read it quick but I think GravitonPunch is right
By the way, like thelebaron said, very nice game indeed @whole gyro , wishlisted it !
No worries, I thought I'd just remark for the others upgrading here ๐ And I agree, at the very latest burst would let you know ๐
Really liking all the other API name changes so far
Thank you!
How do I query managed IComponentData types? It throws an exception stating it needs to be unmanaged.
No
since essentially i m trying to extend
Is there a difference between calling GetSingleton<PhysicsWorldSingleton> and RequireForUpdate<PhysicsWorldSingleton> when it comes to dependency management for systems that require reading the physics world?
Anyone have any ideas? trying to use the new foreach loop
The Query api?
yeah, specifically the Query<>() method
I don't think you can request managed components using it
Since it is specifically for ISystem based systems
if foreach doesn't work
I'm guessing so? I don't think Entities.ForEach was deprecated in SystemBase based systems
why not just iterate chunks
with managedtypehandle
allthough you most probably want to create a list somewhere
dictionary actually
I'm just making an entity follow system so I can track an entity with a camera
managed component access is extremely slow
yeah, but I have no choice
I suppose
Isn't managed component access doing the same thing?
in 0.51 at least
there was list of object type
in which managed components were stored
untyped
and it was all accessed by index
on entity
I still need to copy the LocalToWorld position to the GameObject so yeah, I still need to query the components
Why would that be slower than a dictionary
because list can be way bigger
And? You are using an index
since it stores all managed components
not exactly deprecated per se, but we do know it takes 4x longer to compile than idiomatic foreach or ijobentity
Is the Query API the recommended approach for SystemBase systems going forward?
Im still enumerating over the entire list/dictionary, so it's kinda pointless
(instead of Entities.ForEach)
yep
Thanks, good to know
it's not
What is the ideal method to enumerate over managed components?
You can't schedule queries though, can you? I thought I was reading that you can't
i believe the idea is to use ijobentity if you want to go parallel
in first case you must access index array by entity and then access managed component by index
Alright, just making sure. So IJobEntity for scheduling and Query for immediate access
in other case you access dictionary by entity
How's 1.0 update? any major bugs?
I wouldn't call a second indexing "extremely slow", especially if it makes the code more readable ๐คท
foreach over Query is supposed to work
if it doesn't it's a bug
each time I try it throws an error saying it needs to be unmanaged
using the RefRW type
That is correct :3
Are you still using source generators anywhere then?
thx, good to know
source gen is used to make IJobEntity, SystemAPI, Entities.ForEach and Aspects work
another thing, what is the intended use case for netcode for entities?
currently im directly using unity transport
@rotund token how did you fix the Loading Entity Scene failed because the entity header file couldn't be resolved. error?
btw, @proud jackal here is on the team that works on sourcegen/ijobentity/systemapi/Query/entities.foreach
Ah ok. Good to see that source generators are still used in some places
source generators are not going anywhere. They're effectively the new metta
Any timeline on when we can expect them to use IIncrementalGenerator instead of ISourceGenerator ?
No timeline yet, but we're investigating!
Awesome
it implements all kinds of things, including prediction, replication of specified components over the network, client/server connection stuff, and much more; see https://docs.unity3d.com/Packages/com.unity.netcode@1.0/manual/index.html (although don't mind some stuff being a little out of date, e.g. GAC still being used).
i personally had a great time doing a game jam with it last month; it seemed more doable to prototype a multiplayer game than i had previously imagined
compared to other networking solutions, (Mirror for example) how much more does it complicate things?
haven't used mirror. but mostly, i found that all the complexity i discovered was pretty inherent in the problem being solved and the model of networking it implements.
e.g. you have to decide whether a given object is synchronized between client and server, and whether it's just simulated on the server or also predicted ahead on the client, or just simulated on the client and the server never hears about it
as i understand it, this is not a thing with the lockstep / rts networking model, which com.unity.netcode doesn't implement
some love to the unity staff for showing so much presence today โค๏ธ
any learning material for implementing the whole thing?
oh, is the 'Roslyn Compiler for Unity' package still needed?
nice
You can even change our generators if you want to add stuff, like e.g. adding your own OnChunk to IJobEntity, it's pretty fun, but it does entail the same problems that happen if you change Entities package code AKA new release causes nightmares with anything but minimal changes :3
that's to be expected
but the only thing i'd really change right now is to IIncrementalGenerator XD
porting old code to 1.0,
at the getting it to working again stage,
how do i get SystemState outside of SystemBase?
how do i get SystemState outside of SystemBase?
To what do you refer? there's a mySystemBase.CheckedStateRef property you can call is that it? :3
Or do you mean, how do you get hold of a SystemState if you're not inside a SystemBase? To which the answer is World.GetExistingManagedSystem<MySystem>().CheckedStateRef o.O
Do you mean ISystemStateComponentData?
im using a monobehavior to access the commandbuffer in 0.51
oh, ok thx
Slightly cursed tho, if it's just to get hold of the UnmanagedWorld then please do World.Unmanaged
ah
still struggling on how to get a GameObject to follow an entity...
If you have a SystemHandle, WorldUnmanaged.ResolveSystemStateRef(sysHandle) works for both SystemBase and ISystem from anywhere
Is SystemBase.GetSingleton or SystemAPI.GetSingleton preferred? (in a SystemBase based system)
RenderMesh constructor now requires a Renderer, where can i find a default one?
what's the new substitution of NativeParellelMultiHashMap ?
I've also been wondering this
Same goes for all the other SystemBase APIs that are now available under SystemAPI
NativeMultiHashMap.ParallelWriter
Or if you don't need parallel, just NativeMultiHashMap
thx
Funny thing is, that's my item for tomorrow, putting Obsolete on SystemBase versions
SystemAPI will generate the ideal code, and it is simpler to migrate a SystemBase to ISystem if SystemAPI is used already. The only real reason to use SystemBase versions is if you are not a fan of more code gen than absolutely necessary.
So basically use SystemAPI for everything?
Yup!
if you are not a fan of more code gen than absolutely necessary.
But even there we have EntityManager and XXXXLookups for that exact reason, wouldn't have done it otherwise ๐
So should we expect more deprecated and removed parts of the API prior to 1.0 coming out of experimental? Like removing IConvertGameObjectToEntity?
I would vote for more things being removed to clear up confusion
I'm guessing SystemAPI.Time
Yup :3
The idea is for there to always be a non-codegen alternative, and SystemAPI to be the we will try to make it work in more places approach :3
why's it not called deltatime tho?
It's SystemAPI.Time.deltaTime so still there ๐ (just also has a elapsedTime)
Isn't it SystemAPI.Time.DeltaTime?
oh XD duh
why have a non-codegen alternative though? i've never seen any problems with codegen
damn, the editor is crashing almost every chance it gets
constantly having to clear entity cache just to hit play mode
iteration time on bigger projects mainly
but that's where IIncrementalGenerator comes into play XD
Indeed :3
so.....
There in the investigation ๐.. We don't know if it'll actually solve our concerns (yet)
damn. i'd love to work on dots as a unity employee
well, anything really that doesn't touch c++
Unity is made in CPP so not like we don't touch it either ๐
damn. thought there were some unity teams that don't
Depends on the team, DOTS Access rarely does, until we have something specific that needs changing :3
it's not that i don't know cpp. just...cpp feels old and chewy.
I noticed that RenderMeshUtility no longer support passing EntityCommandBuffer.
Is there a new utility that add the relevant component with ECB?
do the commandbuffersystems still need .AddJobHandleForProducer() ?
not if you talk to them through getsingleton
Is there a way to set the entity's name through a baker?
i know that's been asked before, but how do i get state.WorldUnmanaged in : SystemBase?
World.Unmanaged
No, I think they said they are going to wait for 1.0 to be out of experimental before pushing the update
ok. out of the package manager it flies XD
subscenes are still bugged... clearing the cache doesn't do anything as old components are still showing up even after removal
I don't remember where I read this and I don't use havok so I skimmed over the message. May want to confirm that before you remove it from your project.
lmao my editor crashes on an empty scene now
Any callstack?
nope
You running on an M1 mac or GNU/Lunix or something in particular? What editor version?
windows, 2022.2.0b8
eyyyyyy first crash
88 IConvertGameObjectToEntitys on the wall
88 IConvertGameObjectToEntitys
Take one down, convert it to Baker<>
87 IConvertGameObjectToEntitys on the wall
...
There should hopefully be a crash log in C:\Users\<username>\AppData\Local\Temp\<app_company_name>\<appname>\Crashes\Crash_<date> (can search for editor.log / player.log or a crash.dmp)
is ISystemBase the new standard now btw?
ISystem, and yes indeed, at least if you want Buuuuurst ๐
right. niiiice
i ALWAYS want burst
speaking of burst, can we call any external native method soon?
Updating from Unity 2021 to Unity 2022 ๐คฏ
Entities 1.0.0-exp.8 **Changelog ** ๐ฑ
Unity Physics 1.0.0-exp.8 **Changelog ** ๐ชฆ
may i create or remove components inside ISystem ?
uh, there doesn't seem to be much docs on ISystem yet.
so question is: is it supposed to be class or struct?
Wow ok the crashing was caused by an unused component that didn't have an empty constructor
partial struct, prefereably with [BurstCompile] on top :3
good
speaking of burst can we call any
what's the difference between state.world.unmanaged and state.worldunmanaged
none, well, except world meant a managed reference so ideally should be avoided if you want buuurst
World.Unmanaged would not be burst compilable
Cause of the managed reference (World is managed)
state.World = unburstable because World is managed
state.World.Unmanged is as a result unburstable.
state.WorldUnamanaged is not, cause it doesn't go through a managed reference first
ahhh. why have state.World.Unmanaged then?
Wow ok the crashing was caused by an
so runtime conversion is deprecated in 1.0 ?
how do you do dynamic entity building then?
Is there a version of Unity 2022.2 that is compatible with the Entities 0.51.1 ecosystem?
I tried with Unity 2022.2.0b7 (a beta before the switch to entities 1.0.0) but it doesn't pass.
you can still create entities via entitymanager
no. and there will not be
isn't Bake api works similarly to conversion?
is anything from SystemAPI burstable?
awesome
Making a 2021 LTS project upgrade to 2022.2 seems very compromised if I have to solve DOTS 0.51.1 => 1.0.0 first
upgrade -> enter safe mode -> fix compiler errors -> continue upgrade -> crash -> start project again -> work from there
Is inheriting from a custom base class for SystemBase not allowed anymore? The code generators aren't finding my base class
All of SystemAPI is burstable :3
backup first (zip or clone the whole project),
then switch it to 2022.2.0b8,
then in safe mode resolve all error
backups? what's that? muahahahaha
im brain dead
How would I iterate through a nativearray in a threaded job if some of this stuff is being depreciated?
what is being deprecated related to that?
de-pre-ca-ted people not de-pre-ci-a-ted
Ijobparralellfor, and entities.foreach
Oh, you should be using IJobFor for a while anyway
Anyone have an idea?
Temp\GeneratedCode\Schnozzle.Networking\ClientServerBootstrapSystem__System_2072064792.g.cs(21,76): error CS0234: The type or namespace name 'SchnozzleSystem' does not exist in the namespace 'Schnozzle.Utility.ECS.Systems' (are you missing an assembly reference?)
It's a class inheriting SystemBase
only time i've seen something related to this it was missing an dependency on the asmdef
yeah are you missing something like, entities
non 1.0 question:
is it possible to set a buffer or buffer element via ecb?
entities is also there
or is only add to buffer possible
yes
there's a SetBuffer isn't there
There is, but it doesn't accept anything
what's the reason for removing [generateauthoringdata] anyway?
at least on a parallel ecb it doesn't
it returns a fresh buffer - that you then populate as your set
one thing that im really happy with 1.0 is that the 2022 editor is much faster than 2020
very interesting. to me it seems like it would be a prime example for a source generator
uuhhh.....................
:/
that's a false 'truth' it's the same compilation time as writing it yourself
yes, but IIncrementalGenerator reduces that massively, and it runs while you code, not while you compile
Not all the source generators are incremental
yes but you're in the process of making them be
And you can't get faster than not running
true. but. i have thoroughly tested c# source generators. i have tested the extra compilation time of the extended email regex, which writes thousands of lines of extra code, and the added compilation time was less than 10ms
so don't tell me it's 'too slow'
?? 2022.2.0b8 editor problem and not DOTS?
i have written multiple source generators, some using syntax, some semantic and some both. when using ISourceGenerator you could feel it slowing down the ide in a large project. once i migrated all to IIncrementalGenerator, i could never feel any difference to vanilla even on large projects
of course if you keep writing Files to the temp folder and getting all kind's of (frankly) unnecessary string annotations from (idk where) you will be slow
So... did you have to make EntityCommandBufferSystem.PendingBuffers internal? ^_^'
i'm not really seeing how i create my own command buffer system
(without just hacking myself internal access as always which I am happy to do but seems like i'm overlooking something)
Also kind of confused that NetworkStreamDriver.Connected is internal, that'd be nice to know
yeah. just please stop writing the code as files to the temp folder. that will always be slow
well, if anything IO is in comparison always very slow. but also, it's just not needed. as a temporary debug measure i can understand it, but source generators are built so that if you want to inspect the generated code you can go into visual studio, look into the analyzers of the solution, find the source generator (yes it's under analyzers), open it, and you can view any and all generated code 'files' (not actual files) on demand there.
It indeed does in Rider :3
i'm not 100% confident, since i primarily use VS, but it should be supported or at least supported very soon
it also keeps you from editing the file. which is not a given with the file output to the temp folder
with a big banner 'this file is autogenerated'
Here's how to find it
I'd love to switch to Rider just to get away from VS occasionally deciding to be slow as hell
didn't have that problem with 2022 at all. any major extension you have loaded?
just in general, i'm still on 2020 with 0.51
not sure if it's called intellisense, when it loads up code completion suggestions
Ah right no i'm VS 2019 ๐
then damnit. switch to 2022 much better
it keeps telling me unsupported please upgrade, tired of installing versions of vs every ten minutes ๐
rider certainly popular these days those, 80% of our devs have switched over the past 2 years. VS22 might slow the transition though.
but yeah, i should
???
Am I missing something with the Query API not being found by my IDE?
for various purposes tbh.. i actually do have VS 2022 installed but it's setup for C++ as i was building some repos
latest vs community seems much nicer than I remember vs in the past at the very least, but gotta say rider is pretty damn smooth
sure. i'll stick to vs though
It's part of SystemAPI, so do SystemAPI.Query<NetworkIdComponent>()
i had this convo before.. people have said for example if you have all packages set to generate project files VS slows down by typically like 70%.. apparently rider doesn't have such problems
why are there () around q
Ah, I guess I missed this line: using static Unity.Entities.SystemAPI; ๐
Thanks!
๐ค
Can you exclude things from the query?
WithNone
these options, in Unity prefs.. you can enable generation of built in packages etc, say if you want to browse the ecs codebase for example in VS, rather than just getting stubs..
Do you guys give any thought for modding support during development?
game modding I mean
yeah i know. just doesn't seem to slow down vs 2022
never tested any other vs version
i'll def look at getting VS 2022 setup for C# in that case, good to hear it's much faster
Also, can you nest calls to Query?
You indeed can!
unfortunately not yet compiled with .net 6 / 7, but that's getting done eventually too
Interesting!
personally I can't see myself using Query at all outside of baking systems
AHHHHHHH omg. just started migrating to ISystem and writing foreach() is pain. you can feel the v1 source generators kicking in XD
ye
hmm I assume there's no way to specify a handle for ECBS anymore?
I might have to rework a few systems and split them into 2. I specifically avoided adding a few expensive jobs to this on rare occasions
possibly relevant question -
If you use a ecb.CreateEntity and assign the returned 'dummy' entity to a component entity field - that will be tracked and the entity field will be updated with the correct entity once the ecb has run..
However doing the same with a dynamic buffer - the entity field inside the buffer element is never updated..
Is this something that's likely to be 'fixed'? It would be quite useful.
wait what
Is there a significant performance difference?
what happened?
i converted all my system bases to ISystem
system base is obsolete?
pretty much
maybe not significant but good enough. it's all burst is what's great
apart from inherited systems for certain patterns, I can't see myself using SystemBase anymore
^^
Still SystemBase
hmhm
ok I got it
with new way to get ECB
there's little to no need in managed systems
SystemBase is not being depricated cause there are valid uses still do to how much of Unity is managed today. Mesh is an example of that. But ISystem is to be the go to for ALL new systems, unless they specifically have to do something managed that is to be stored in the field of a system
so if system level data is stored on entities now how does that work with for example a nativearray stored on the system, how would you retrieve it
i haven't bothered moving all my system level data yet to the entity, you can still store them in the system - this is going to be a task
and how do you get a reference to another system, using GetExistingSystem as before
i got the impression it was done internally
entities
system reference stored on them
hmm
so if system level data is stored on
Just imagine that anything you want can be stored on entities
And can be queried through entity manager in almost any part of code
on a side note: did anyone notice they removed Recompile After Finished Playing in 2022?
Recompile and Continue Playing is a nice dream, but it just breaks everything atm for me ^_^'
This is the first time interacting with ISystem for me, how do I work around calling something like SceneSystem.LoadSceneAsync now that SceneSystem inherits ISystem and not SystemBase?
so the only regression i have now in my project is a lot of CreateRigidBodies jobs. I've dug into the query and the job runs on Translation/Rotation/PhysicsVelocity - my entities don't have a PhysicsVelocity so i'm not sure why i have so many jobs - scratch that - it also runs on static colliders.
when i run my project it complains that there is no EndSimulationCommandBufferSystem singleton. how can that be?
have you implemented your own CommandBufferSystem ?
no
What happens if I do GetExistingSystem and then call World.Unmanaged.GetSystemStateRef but the system doesn't exist? I can't see a way to check
Itโs an oversight. Use m_PendingBuffers since thatโs protected
yep i noticed, thanks!
mySystemHandle == SystemHandle.Null will tell you if it doesn't exist
Thanks!
what's the state of the dots compatible input system?
normal unity input for the time being. Iโve never seen it be a bottleneck tbh
yeah it's not a bottleneck question. rather a convenience one for ISystem etc
is ISystem always bursted btw or can you disable it?
it needs a [BurstCompile] tag
both on struct + methods you want to compile
UnityEngine.Input.GetKeyDown and friends are all burst compatible now, with the exception of the ones taking a string argument
๐ InputSystem not .....whatever getkeyDown was
Yes totally fair - still possibly worth knowing in a Burst compiled ISystem pinch
sure. thx
even the OnCreate / OnDestroy / OnUpdate ?
yes
often oncreate won't be burstable still (not really a huge deal) [actually not 100% certain it can be bursted i haven't tested since update]
it can if you use the new query builder thingamajig
i noticed they had the tag in the short examples which i thought was unusual but i guess it gives the option of using it or not
oh that's what i needed to do
update my ISystem template to use query builder instead
in ISystem is there something like OnStartRunning() ?
ah
Is it still internal?
is there a reason in a game to have multiple audio listeners?
Cool
Unsupported parameter `Unity.Mathematics.quaternion` `q` in function `MoveSystem.ToEulerAngles(Unity.Mathematics.quaternion q)`: structs cannot be passed to or returned from external functions in burst. To fix this issue, use a reference or pointer.
since when????
Thatโs just for burst entry point functions
uh, sorry, what?
i am 100% sure i was able to define a static method, burst compile it and pass a value type to it
I'm guessing EndSimulationEntityCommandBufferSystem.AddJobHandleForProducer is handled by the dependency to the singleton now?
yes
My updated ISystem template for rider if anyone used it in the past
obviously update formatting for your own styling
(and if you don't have a template, highly recommend you making some. saves so much time)
i gotta be...idk..it's late. what's the problem here
i should do that. looks useful
is there a [BurstCompile] tag on ToEulerAngles?
yes
you can't pass structs to burst function pointers
need i ref / in it?
only primitives / pointers
ref might be fine, i havent written a function pointer in ages
does anyone else have CreateRigidBodies jobs on static colliders all the time? with entities 0.51 those were only calculated once and then the job was just a blip on the timeline. i've even checked the change job and comps. no changes going on.
it's not a function pointer. it's just a simple static method
Do you have more templates posted somewhere? Or are they in your Core library you shared recently?
Thanks for sharing btw
if i don't it will still get burst compiled?
if you call it from burst code yes
so.......i don't need to annotate everything with [Burstcompile]
only OnUpdate
why do i need to annotate OnUpdate then?
to make it into a function pointer
since [BurstCompile] is already on the system struct?
that doesn't compile anything
that's just a hint for burst to find things to compile
burst searches structs/classes for [BurstCompile] attribute
then searches within that struct/classes methods for [BurstCompile] attribute to actually compile
(unless the attribute on a job, then it just knows what to do)
i was better at dots once......have to get good again XD
ok, so with a job struct inheriting from IJobEntity....do i need to also annotate Execute() since it's not a fixed definition?
or is that redundant
you don't have to
i think burst handles every IJob as trigger to compile every method there. the same can't be said for ISystem where methods are sometimes not possible to burst compile.
that's why we need individual [BurstCompile] tags in ISystem but not for every job
right. i start to remember now
Not every method. Just execute. Everything else can be called in mono.
every method in a job gets burst compiled. 100%
๐ค
yeah i agree. it's kinda inconsistent and a bit confusing. need clarification here please
no way to do use EntityQueryBuilder with chunk components? ๐ฆ
I guess you live another day GetEntityQuery
maybe if a method in a job struct isn't called from execute is the only reason burst compilation is skipped
so uhm, about my physics problem. no one uses static colliders? ๐
what was the problem?
i haven't got to the point of having a gameplay library updated yet
haven't yet reached my physics part ๐
3/14
the colliders get recalculated every frame
i got caught up updating this libraries api
CreateRigidBodies job is running heavily. no idea because there are no rigid bodies on these colliders
To be fair, it's 12:50 AM here in CPH, so those of us based here just answer because it's fun :3
no stress
Just curious, do any of the DOTS devs work out of the Seattle/Bellevue office?
And thanks for staying up late for us ๐
no way to do use EntityQueryBuilder with
Not to my knowledge, but we have some that go there often-ish from what i remember ๐
ok here's the deal with burstcompile people
burst can only ever burst static methods, period, end of story.
what's the deal with isystem's onupdate, and ijob*'s execute, you ask? different magic for each.
in the case of jobs, each job interface is annotated with an attribute like [JobProducerType(typeof(SomeOtherSpecialSecretType))]
burst knows to look for this attribute, go find that other type, make sure it's generic, specialize it with the type of your specific job struct, and then compile the static Execute method on that other type. the static Execute method on that other type will call your personal Execute with some arguments and in some context, and your personal Execute will be bursted as part of that larger static function.
physics giving me more trouble. the spike is when the player character moves. no such spike in 0.51
in the case of isystem, we run an ILPP that specially generates static functions that take a void* for the this argument plus the ref systemstate, and we cast the void* back to the particular system type and then call the non-static onupdate on that. burst then bursts our static wrappers, and we make sure to call the static wrappers when we update systems.
so, corollaries of this:
- non-execute methods of job structs that have burstcompile on the job struct are not bursted [edit: unless they're static and you put burstcompile on them specifically]
- the isystem magic only happens for the special callbacks we've implemented this wrapper stuff for
- the job execute stuff can make it seem like burst entry points can take other arguments, because your personal execute is not actually the burst entry point
i feel like i should paste this somewhere less ephemeral, but i dunno where
some friendly mod should pin this ๐
i feel silly, but ah, where is the live conversion option now (i don't see anything in preferences)
you mean the dot?
that doesn't seem to change this preview
is it not edit->preferences->entities->baking->live baking?
err, sounds like a bug to me.
i imagine it was a slightly flubbed backport from master
i assume i can probably hack this on via LiveConversionSettings
yeah just set LiveConversionEditorSettings.LiveConversionEnabled = true
nice explanation.
but one question. if burst only does 'magic' on the defined interface methods, how does IJobEntity behave, since the Execute() method is not defined in the interface and takes the form of a custom signature?
i mean there's more codegen magic there, but basically, the execute is still ultimately called from a static secret extra method which is the actual burst entry point
ah
haha this has led me down a much more fun path
UnityEditor.EditorPrefs.SetBool("DeveloperMode", true); ๐
what's that do?
probably something i shouldn't do
but makes Unsupported.IsDeveloperMode() return true
enabling a bunch of internal things
I think it's the same as just typing internal inside the help>about window ๐
i haven't actually noticed too many things that are gated on that these days. i think it enables these funny circles that tell you when a window is repainting?
and i can actually see my authoring data at runtime now
i was very confused why that wasn't working
aww time for work, back to 0.51
how do i enable the new transform system?
it's enabled by default
but if you install physics/netcode it gets disabled
as they aren't updated yet to support it
what's the new way of writing tests with ECSTestsFixtures now? I used to use Entities.ForEach(() => { }) for quick tests. is there something as convenient or would it be using an EntityQuery and iterating that query to test components? ๐ค
Ugh, i wanna play with 1.0 so badly. Damn work, taking up all my time.
SystemAPI.Query ๐
Anyone know what's going on here? [Worker0] 'Schnozzle.Serialization.SerializeEntity' is missing the class attribute 'ExtensionOfNativeClass'!
When calling other non-static methods from the execute method, the other method will run non-bursted even though the execute is bursted? Is this correct?
So our other methods should be static bursted (if we want)?
no. unless you jump through massive hoops, everything you call from bursted code is bursted
right so what you're saying is "don't call the other methods from a non-burst context and expect them to be bursted?"
so I haven't figured out the physics change. if I just remove the colliders I'm back to how my timeline looks in 0.51 - at least that's something. 2022 and 1.0 is around 5-10% faster in my stress test
what i find worrisome though for physics. every static collider gets rebuilt when 1 dynamic collider changes position. i don't know how that should work with any kind of game world.
i was hearing whispers that this will be fixed but apparently not in 1.0exp
getting 12ms BuildPhysicsWorld when the player moves ๐
is anyone's unity stalling on reloading domain from code changes? a restart always cures it but getting annoying
no issues here
does deleting the library folder and then relaunching unity fix it?
havent tried that yet
giving it a go now
Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle.CheckReadAndThrow (Unity.Collections.LowLevel.Unsafe.AtomicSafetyHandle handle) (at <d8312cdadbc04553bb2b6d38bb19d383>:0)
Unity.Collections.NativeParallelHashMap`2[TKey,TValue].CheckRead () (at Library/PackageCache/com.unity.collections@2.1.0-exp.4/Unity.Collections/NativeParallelHashMap.cs:747)
Unity.Collections.NativeParallelHashMap`2[TKey,TValue].GetValueArray (Unity.Collections.AllocatorManager+AllocatorHandle allocator) (at Library/PackageCache/com.unity.collections@2.1.0-exp.4/Unity.Collections/NativeParallelHashMap.cs:330)
Unity.Entities.BlobAssetStore.ResetCache (System.Boolean disposeAllBlobAssetReference) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities.Hybrid/GameObjectConversion/BlobAssetStore.cs:69)
Unity.Entities.BlobAssetStore.Dispose () (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities.Hybrid/GameObjectConversion/BlobAssetStore.cs:455)``` that's an odd one
Dispose leads to GetValueArray?
oh leak detection is no more?
oh in jobs. i see ๐
lol it was enabled all the time. seems it doesn't have as much overhead anymore
ugh still stalling on domain reload
hook up a debugger and force a break point
see what's looping
the above error is thrown on an empty blobAssetStore btw. somehow i have one left in a system that i just create and dispose
how do I force a breakpoint for script recompile?
just when it's stalled
Still looking for an easy way to track a entity with a GameObject
so far I've tried to add a component that has a reference to a prefab, that didn't work as I kept getting null refs
add the Transform to the entity?
Needs to be a prefab, because any references outside a subscene is broken
if i remember correctly the fps demo used WeakAssetReference to get around the problem. might be overkill though. is this for a 3rd person camera or smth?
Literally just want a GameObject to follow an entity. Lights, camera, etc that dont currently work with entities
can you query the entity? i have a case where I query a comp in a coroutine until it's found. then setup some stuff
I can query an entity, but it doesn't have a valid prefab because for whatever reason the baker fails to assign the field
i mean query the entity from the GO. that way you don't need any reference at all. just spawn the prefab and have some kind of unique tag on it to query it easily
I could, but having multiple targets that could be potentially the correct target is unnecessary
For now I guess that's what I'll do
The API I think changed a bit, do you got a good idea on what needs to be done?
this is my implementation if you want extevious
can just attach any gameobject to an entity
and optionally bind monobehaviours/components to the entity
(not updated to 1.0)
{
[SerializeField]
private GameObject prefab;
[SerializeField]
private CopyModes copyMode = CopyModes.CopyTransformToGameObject;
public GameObject Prefab => this.prefab;
public CopyModes CopyMode => this.copyMode;
}```
can control what direction the transform is copied
the gameobject life cycle is managed for you
created/destroyed
the tldr: it stores the prefab reference on a class ComponentData
and instantiates it at runtime
then adds any componet you want, animator, light, etc to the entity for you to query
that's the proper solution ๐
note: the entity is marked UnityEngine.HideFlags.HideInHierarchy
so you won't even see it
it'll just appear to be a pure solution
but if you want to see it just change the bindings in HybridDecoratorSystemGroup
but you dont need to touch the gameobject ideally
it'll create/destroy on entity lifecycle and by default bind Transform, Animator, SkinnedMeshRenderer to the entity
All this just so I can get a camera to follow an entity...
but you can add anymore you want by implementing ComponentDecoratorSystemBase
i mean it's 1 component
then the whole thing is automated?
(though if you want a good camera, i have a near full cinemachine wrapper for entities)
doesn't matter, it shouldn't even be a requirement to set it up this way in the first place
until hybrid is more of a thing that's how it is
It's no longer called hybrid, but Entity Graphics
I'm really hoping they add support for at least the camera, but they said it is unlikely to change
hybrid as in GO <-> entities link mr smarty pants
for cameras and stuff where there's only one, i just set static variables with the position and rotation from the code that knows which entity is which, and then read said variables from a monobehaviour on the gameobject i want to move
hardly a rolls-royce solution, but it works
yeah if it's a singular object it works decently
we have heard very little on hybrid or GO companion objects. as long as animations are not out we have to rely on GO Animators and it's pretty frustrating that we all have to implement the same thing. tertle has put a nice package together but there's still so much more. Audio or Particle systems for example where there's no dots equivalent.
i mean for animators yeah we're dealing with it, but it's a big task. for audio, it's kinda like input where it's unlikely to be a bottleneck. for particles, probably same, but with vfxgraph? how many particle systems do you intend to have? and also, you can kind of make your own particle systems in dots, because dots scales almost as well as the c++ in shuriken
it's not really about bottlenecks. it basically boils down to having all the missing features on a GO that follow an entity and writing the interface from the entity to the GO. apart from the interface we have to deal with spawning the presentation GO and handle the updating of Transforms. everyone today has to implement this because there's no way around it and will stay so for much longer.
it's true. but i'd say most of the things we have dealt with so far have been hair-on-fire things where people really couldn't write their own stuff to get around it
and you have been doing a great job! ๐ i hope there's not so much fire anymore. you have ticked off most of the big things in this release i think. some focus on this problem would be great when things have settled down and especially for 1.0 which will bring in a lot more devs and newcomers.
it's also in the spirit of converting existing games to dots. with a good foundation of entities <-> GOs it's not as daunting.
yeah, agreed, especially since this flavor of QOL is probably not a huge amount of work? whereas the next steps for more speed are very involved, like research into changing the dependency scheme of systems so jobs can overlap more
i can't even imagine how complicated improving the dependency scheme is ๐ the job system is already doing such a good job. kind of surprised you want to do even more on that front.
if you look at the cpu utilization in a cpu-heavy dots game, you'll see that we go wide a lot better than normal monobehaviour unity, but there are still significant bubbles where we call .Complete() and then do some main thread work
whereas if you look at the same profile for e.g. Spiderman, you will not see such gaps
so we wanna fix that ๐
great times ahead. you are obviously not slowing down even with 1.0 on the horizon
when an ISystem can be used for conversion. A SystemBase will work too, right? Has anyone tested?
yes
think you gotta add the system flags to baking
^
[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)] just this one, right?
yeah
that's convenient. so GOCS is completely obsolete?
they still use it in some physics bake/conversion so not really sure
i basically have to use a systembase because it's a generic baking system. now it's a GOCS
i'm so confused. that happens in my game project. can an asmdef lead to that?
guessing missing asmref?
i use the same in my other project so it's double weird ๐
hm on first glance companions dont create gc like before
lol I'm so lost to what's going on ๐
i never had a namespace problem for Dictionary or List
i thought this
but i looked deeper and physics has full baker support
from my testing GOCS don't even run
so ah i think it's just like IConvertblah left in non-functionally
ah well sort of feel better because I was converting my GOCS(because they werent working & i didnt know about the flag) to bakers until I saw that physics still had them, and now I def should continue converting
i wonder if they fixed the joint conversion behaviour bug? no mention of it in the changelog ๐
Generic message code 233 has not been handled very helpful
alright libraries updated, lets see how opening the actual project goes
is RegisterPrefabForBaking the new DeclareReferencedPrefab?
you dont need to do anything
except GetEntity(prefab)
handles for you now i think
kinda what confuses me, what situation would you need RegisterPrefabForBaking then?
{
if (gameObject == null)
return Entity.Null;
var gameObjectId = gameObject.GetInstanceID();
// If it already exists, just give back the reference
if (!_GameObjectToEntity.TryGetValue(gameObjectId, out var entity))
{
if (gameObject.IsPrefab())
{
// Okay, it doesn't exist so we need to create it
entity = CreateEntityForPrefab(gameObject);
}
}
return entity;
}```
``` void RegisterPrefabForBaking(GameObject prefab)
{
if (!_BakedEntities._GameObjectToEntity.ContainsKey(prefab.GetInstanceID()))
_BakedEntities.CreateEntityForPrefab(prefab);
}```
both just call CreateEntityForPrefab
damn, i've found out what's going on. codegen is breaking my custom partial class SpellLoader
was working fine in 0.51
tricked it with putting all the using declarations into the partial file
how do we get the BlobAssetStore in a baking system?
var bakingSystem = World.GetExistingSystemManaged<BakingSystem>();
.BlobAssetStore
/// Provides methods to control the baking process, and provides access to the <see cref="BlobAssetStore"/> used
/// during baking.
/// </summary>
[DisableAutoCreation]
public partial class BakingSystem : SystemBase```
ah nice thanks a lot!
have you tried SystemAPI.Query with a MB? doesn't seem to work
how are we supposed to iterate over MBs now for baking?
EFE ๐
says error DC0053: Entities.ForEach cannot be used in system ScriptableObjectConversionSystem as Entities.ForEach in generic system types are not supported.
well yeah you cant use code gen with generics
you'll just have to manually chunk iterate or ToEntityArray from a generic
i hate these kind of regressions. that was working great in GOCS
isn't systembase just an enhanced version of componentsystem?
true
hm, the query can't find anything. does this look correct to you? var query = GetEntityQuery(ComponentType.ReadOnly<ScriptableObjectConverter>()); as it's just a MB I think I can't use it.
oh in your baking system?
it's too late by this point
the gameobjects no longer exist
(as far as i can tell from my half day of playing with this)
oh well that makes sense. okay at least i know what to do now. but now i need sleep. thanks for your help
there's 2 phases
Baking phase using Bakers, (slow managed phase) that converts authoring data into entity data (and you can create temporary entity data for baking)
Processing phase, (fast burst) systems that process this entity data
That's deprecated way of getting query btw
you can store temp data on components and have the component removed before runtime using
[TemporaryBakingType]
there are limitations that don't work with new api
(not this case but it's still required for now)
anyway on baking, i wrote a very quick sample of this on forums for someone: https://forum.unity.com/threads/1-0-0-exp-8-baker-remove-component-and-destroy-entity.1341818/#post-8472449
if you have data you want to store in a blob, basically write it to a temp component then process it into a blob in the system
it would be nice to avoid this for blobs and have access to them in baking but not possible atm at least from my quick testing
(again hasn't been long of experimentation)
Anyone have an example how you define system group?
I just have to make a class that derive from ComponentSystemGroup?
yep
public class PreMovementGroup : ComponentSystemGroup { }
[UpdateAfter(typeof(PreMovementGroup))]
public class SetDirectionGroup : ComponentSystemGroup { }
[UpdateAfter(typeof(SetDirectionGroup))]
public class MovementGroup : ComponentSystemGroup { }
This is fine?
should be fine
Ok thanks :)
public partial struct TeleportJob : IJobEntity
{
void Execute(ref LocalToWorldTransform transform, ref TeleportData teleportTarget)
{
//if (teleportTarget.enabled)
//{
transform.Value.Position = teleportTarget.Position;
transform.Value.Rotation = teleportTarget.Rotation;
//}
//teleportTarget.enabled = false;
}
}
How do I do this with the new IEnableable now?
(Dani got you ^_^) [I love trolling people while they type]
Well you make teleport target ienableable and as long as you're using IJobEntity it will do the rest cause by default it knows how to handle enableableComponents.. if you want to set enabledness there are Functions inside both ComponenentLookup as well as EntityManager ๐
So I no longer have to check enabled in the execute and it will exclude from query automagically?
And I assume I have to set enabled = false outside the job?
Correct
Specifically all the code to check enabledness is source generated by us when you do IJobEntity, so the biggest difference between doing IJobEntity and IJobChunk is that you would normally have to write that check yourself by checking the V128 bitflag ๐
Btw you can also set enabled = false/true inside a job by using ComponentLookups :3
Any plans on making uncapped chunks though?
How do I do this?
partial struct SomeJob : IJobEntity {
public ComponentLookup<TeleportTarget> someLoonup;
Execute (Entity e) => somelookup.SetEnabledness(e, false);
}
then
var myLookup = SystemAPI.GetComponentLookup<TeleportTarget>();
new SomeJob{someLookup= myLookup}.ScheduleParallel();
Nvm I figured out, thanks :)
job.TargetComponentData = this.GetComponentLookup<TeleportData>(false);
//In Job
public ComponentLookup<TeleportData> TargetComponentData;
Preferably use SystemAPI version as that will properly cache it for you since you don't need to create the lookup every frame simply need to .update() it ๐
I see, ok!
using ISystem
this happens: The system --- writes Unity.Transforms.LocalToWorldTransform via --- 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.
apparently ISystem requires manually adding it to some dependency?
it's same as SystemBase
If you use jobs
you must return correct JobHandle with all dependencies
i do it the same as here:
public struct SampleComponent : IComponentData { public float Value; }
public partial struct ASampleJob : IJobEntity
{
// Adds one to every SampleComponent value
void Execute(ref SampleComponent sample)
{
sample.Value += 1f;
}
}
public partial class ASample : SystemBase
{
protected override void OnUpdate()
{
// Schedules the job
new ASampleJob().ScheduleParallel();
}
}
from the docs
so not sure what the error is
i do it the same as here
what roslyn version does current unity 2022.2 use?
Hello guys,
I have another dots question:
I have a struct that describes the execution of a player ability,
it contains info like animation names, timings, damage, references to effect prefabs etc.
I would like to be able to dynamically store these abilities on my player entitiy, and be able to switch them out at runtime.
What do you think is the best way to do this in dots?
That's a bit of a broad question and I could probably write a thesis on it!
I've researched half a dozen ability systems and they all worked very different to achieve different things.
If you're question simplifies down to just, I have data about abilities, how do i store it there are a few different approaches all with different positive negatives, a few but definitely not limited to
- don't store it on the entity, keep the actual data in a system (or system singleton) that uses it and just index to it
- store it in blob memory on a component
- store it on a separate entity with a reference
- write a custom container suitable for your needs
all of these have a theme of not really needing to store the actual data on the actors entity, but just some type of indexer into your data
this could just be a buffer of keys, where each key is a skill you have unlocked
oh god, upgrading project's conversion is so painful
btw
native containers now are fixed sized structs, right?
for component data
i mean, they aren't fixedlist or something like that
most just end up being like a ptr + allocator label once safety is removed
Thats already a great help @rotund token , thanks a lot. I assumed that it would be a bad idea to store the ability data directly on the entity so that confirms my intuition. I will try around with your suggestions!
what about editor?
so
since they are unmanaged now
it's still fixed size
just a little bigger
yeah still a certain size just has a few safety elements as well
i mean, all structs are fixed size ^_^'
hmmm
[UpdateInGroup(typeof(GameObjectAfterConversionGroup), OrderLast = true)]
what would be an equiavlent for BakingSystem?
anyone know what roslyn version current unity 2022.2 uses?
i think these 4 are setup
var postBakingSystemGroup = gameObjectWorld.GetOrCreateSystemManaged<PostBakingSystemGroup>();
var preBakingSystemGroup = gameObjectWorld.GetOrCreateSystemManaged<PreBakingSystemGroup>();
var transformBakingSystemGroup = gameObjectWorld.GetOrCreateSystemManaged<TransformBakingSystemGroup>();```
pre -> transform -> bake -> post
A pinned message in the forum would be useful for a maximum of people to find it easily in the future ? ๐
hmm
any idea
whether DisableRendering affects nested entities?
so for example
there's parent
with DisableRendering
will children get drawn?
I believe they still will
I wrote a simple helper at one point to disable all in a hierarchy
(this info from 0.51 but I doubt it's changed as it'd inefficient to check hierarchy for component each frame)
[BurstCompile]
public partial struct TeleportSystem : ISystem
{
public void OnCreate(ref SystemState state) { }
public void OnDestroy(ref SystemState state) { }
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var teleportLookup = SystemAPI.GetComponentLookup<TeleportData>(false);
new TeleportJob
{
TeleportLookup = teleportLookup
}.Schedule();
}
[BurstCompile]
public partial struct TeleportJob : IJobEntity
{
public ComponentLookup<TeleportData> TeleportLookup;
void Execute(Entity e, ref LocalToWorldTransform transform)
{
var teleport = TeleportLookup[e];
transform.Value.Position = teleport.Position;
transform.Value.Rotation = teleport.Rotation;
TeleportLookup.SetComponentEnabled(e, false);
}
}
}
This kept executing even when TeleportData is off.
void Execute(Entity e, ref LocalToWorldTransform transform, in TeleportData teleport)
{
transform.Value.Position = teleport.Position;
transform.Value.Rotation = teleport.Rotation;
TeleportLookup.SetComponentEnabled(e, false);
}
This gives off InvalidOperationException: The writeable ComponentLookup<ProjectBrave.TeleportData> TeleportJob.JobData.TeleportLookup is the same ComponentTypeHandle<ProjectBrave.TeleportData> as TeleportJob.JobData.__ProjectBrave_TeleportDataTypeHandle, two containers may not be the same (aliasing). exception
Not sure how to make it behave like it does when I used flag before using IEnableable interface.
public partial struct TeleportJob : IJobEntity
{
void Execute(ref LocalToWorldTransform transform, ref TeleportData teleportTarget)
{
//if (teleportTarget.enabled)
//{
transform.Value.Position = teleportTarget.Position;
transform.Value.Rotation = teleportTarget.Rotation;
//}
//teleportTarget.enabled = false;
}
}
Previous code
Need help using IEnableable as a flag correctly :(
the classic aliasing problem
you can't pass in a typehandle and a lookup of the same component
without turning off safety assuming what you're doing is safe
what you're doing is actually safe so you could turn off safety on the ComponentLookup if you wanted
alternatively if you aren't comfortable doing that instead of passing in get TeleportData from your TeleportLookup
and just add a [WithAll(typeof(TeleportData))]
to your job
I see, I will do that. Glad to know its safe!
But currently IEnableable is pretty weird, there are too many workarounds you have to do compared to just using flags.
this isn't really related to IEnableable
(your error)
it's a pretty common case
for example you want to offset 1 entities translation to another entities translation
I posted this for enzi above
Here
And a bit more below
You can also use AddBlobAsset inside of the baker instead if its about deps and storage
There is a difference between a Baker and a BakingSystem. In a Baker, you should use AddBlobAsset because then the BlobAssets are tracked and correctly reverted and rerun whith Incremental Baking. For the BakingSystem, while technically you can get a BlobAssetStore as described, you should note that that does not mean that it is properly tracked and reverted like in a Baker.
any example of how to use AddBlobAsset then?
I'm curious about this actually because physics currently does all their blob asset work in the baking systems
What's the benefit either way
Is this for sharing memory? Eg. Does addblobasset only create unique blobs?
I'll split my answer in two, first for the Baker:
ref var blobRoot = ref blobBuilder.ConstructRoot<int>();
blobRoot = 2;
var blobAssetReference = blobBuilder.CreateBlobAssetReference<int>(Allocator.Persistent);
AddBlobAsset<int>(ref blobAssetReference, out _);```
This is a very simple example, after creating the BlobAssetReference, you call AddBlobAsset to 'register' the BlobAsset to the Baker. After that you can store the BlobAssetReference in a component like before and it will be available to you
hmm
And if add DependsOn()
then blob will be removed and replaced with new one?
(Sorry I skipped ahead and read the source code. It totally is TryAdd ref stored to the asset store. somehow missed this ok)
Then for the BakingSystems. Unfortunately, this is a lot more complicated. I haven't looked at the Physics code yet, but I do know that there is some code that we haven't been able to change yet, afaik Physics falls in that category.
I'm assuming the case for using BakingSystems would purely be very specific performance or use cases then?
But yeah this makes a lot more sense, for most use cases Baker seems much more preferable
Yes, I am currently working on some samples for BlobAssets to show the different use cases. A user pointed out on the forum that creating a lot of BlobAssets that are intensive to create could be more performant in BakingSystem. But for most use cases the Baker is sufficient and easier
I am not entirely sure what you want to achieve with DependsOn(). In the case of BlobAssets, it does not do anything, AddBlobAsset() is required for the Baker to track it
Use of [ExecuteAlways] on systems is now deprecated. Use [WorldSystemFilter(WorldSystemFilterFlags.Editor)] instead to ensure your system is added and runs in the Editor's default world. If you'd like to ensure your system always updates, use the [AlwaysUpdateSystemAttribute] instead
Does it mean that now systems can run in edit mode?
I guess 1 final question, it returns the hash of the blob asset in an out - what would be a use case I would need this? (I can think of uses in a BakingSystem but not so much a Baker)
You are correct, it is mostly a TryAdd, except that AddBlobAsset also tracks it in the Baker and handles reverts and changes that simple TryAdd does not.
Oh I guess 1 more, if I use Baker.TryGetBlobAssetReference I assume it will still track fine / reverts etc?
Usually this is not something you need. But you can use the hash in TryGetBlobAssetReference() to check if a BlobAsset already exists. AddBlobAsset() also checks that the BlobAsset doesn't exist, but it does require you to create the BlobAsset first.
Yes, all methods provided by the Baker will track correctly and revert as needed. That is why we removed the access to the BlobAssetStore directly, to make sure that you have no unexpected behaviour because something is not tracked
ok thanks for your help! that will provide a way to avoid some costly blob setup
need to sleep but mind is racing now
`Use of ExecuteAlways on systems is now