#archived-dots
1 messages Β· Page 111 of 1
Technically it is but to be honest right now it doesnt seem like it's in a state where it can practically be used by anyone other than the person who wrote it
I'm kind of not liking the Ghost / Generation model that DOTS Netcode use right now. Having to generate code from an Inpsector interface to generate them is a bit meh.
I really like how RPCs are set up with code-only and no code generation
is it possible to destroy entities from within a threaded job?
or to generate an EntityCommandBuffer from within a threaded job?
Entities 0.6 just released
in the package, not online yet
just got to wait another two months for the next Netcode update then
[0.6.0] - 2020-02-17
Added
- The
[GenerateAuthoringComponent]attribute is now allowed on structs implementingIBufferElementData. An authoring component is automatically generated to support adding aDynamicBufferof the type implementingIBufferElementDatato an entity. - Added new
SystemBasebase class for component systems. This new way of defining component systems manages dependencies for the user (manual dependency management is still possible by accessing theSystemBase.Dependencyfield directly). - New
ScheduleParallelmethods inIJobChunkandEntities.ForEach(inSystemBase) to make parallel scheduling of jobs explicit.ScheduleSingleinIJobChunkindicates scheduling work to be done in a non-parallel manner. - New editor workflow to quickly and easily build LiveLink player using the
BuildConfigurationAPI. - Adds Live Link support for
GameObjectscenes. - The
SceneSystemAPI now also loadsGameObjectscenes viaLoadSceneAsyncAPI. - Added new build component for LiveLink settings in
Unity.Scenes.Editorto control how initial scenes are handled (LiveLink all, embed all, embed first). - Users can now inspect post-procssed IL code inside Unity Editor:
DOTS->DOTS Compiler->Open Inspector
Changed
- The package
com.unity.buildhas been merged into the packagecom.unity.platforms. As such, removed the dependency oncom.unity.build@0.1.0-previewand replaced it withcom.unity.platforms@0.2.1-preview.1. Please read the changelog ofcom.unity.platformsfor more details. - Managed components are now stored in a way that will generate less GC allocations when entities change archetype.
- Moved
Unity.Entities.ICustomBootstrapfrom Unity.Entities.Hybrid to Unity.Entities. World.Dispose()now completes all reader/writer jobs on theWorld'sEntityManagerbefore releasing any resources, to avoid use-after-free errors.- Fix
AssemblyResolveExceptionwhen loading a project with dependent packages that are using Burst in static initializers orInitializeOnLoad. .sceneWithBuildSettingsfiles that are stored in Assets/SceneDependencyCache are no longer rebuilt constantly. Because they are required for SubScene behaviour to work in the editor, if these are deleted they are recreated by OnValidate of the SubScene in the edited Scene. They should also be recreated on domain reload (restarting unity, entering/exiting playmode, etc).EntityQuery.cs: Overloads ofCreateArchetypeChunkArray,ToComponentDataArray,ToEntityArray, andCopyFromComponentDataArraythat return a JobHandle (allowing the work to be done asynchronously) have been renamed to addAsyncto the title (i.e.ToComponentDataArrayAsync). The old overloads have been deprecated and an API Updater clause has been added.Entities.WithNamenow only accepts names that use letters, digits, and underscores (not starting with a digit, no two consecutive underscores)- Updated package
com.unity.propertiesto version0.10.4-preview.
@flat talon where did you find this change log?
- Updated package
com.unity.serializationto version0.6.4-preview. - The entity debugger now remembers whether chunk info panel is visible
- The entity debugger now displays the full name for nested types in the system list
- The entity debugger now sorts previously used filter components to the top of the filter GUI
- Bumped burst version to include the new features and fixes including:
- Fix an issue with function pointers being corrupted after a domain reload that could lead to hard crashes.
- Fix potential deadlock between Burst and the AssetDatabase if burst is being used when building the database.
-- SNIP-- Find the rest when you download the package under Library\PackageCache\com.unity.entities@0.6.0-preview.24
please stop spamming...
@odd ridge Library\PackageCache\com.unity.entities@0.6.0-preview.24
thanks @flat talon
ty Siggi
one thing I need to ask, when you edit a script in unity 2019.3, does it take a while for the editor to refresh or it's almost instant?
cause mine has been taking a while, like 5-10 seconds freeze on any script change and it's so annoying
for this reason I've been staying with 2019.2, but I'm missing on all the juicy DOTS updates...
World.Dispose() now completes all reader/writer jobs on the World's EntityManager before releasing any resources, to avoid use-after-free errors.
yey
sweet 500ms iteration timesπ
trust me, they are not juicy, if i wouldnt need it, i would wait a year longer to implement it
tons of fixes in this release, including perf fix for subscene loading
@warped trail but 2019.2 does give me sweet 500ms iteration time! π’ , but .3 is iteration time hell.. I can't stand it
@crystal helm I mean juicy compared to using Entities version 0.1
I can't even use the [GenerationAuthoringComponent]
in 0.1
you have to die one death π€£
lol
@odd ridge did you try the new faster play options in 2019.3 (domain/scene reload toggle)? Im getting very fast startup time on my DOTS project with that. Or you mean just your script compilation?
@flat talon I'm not sure what it is, but it's when I edit a script and click back into the Unity Editor. the editor freezes for 5-10 seconds
he means the recompiling
I meant this feature, which DOTS supports. And no sadly it wont make recompile faster π¦ but it makes hitting play a lot faster
https://blogs.unity3d.com/2019/11/05/enter-play-mode-faster-in-unity-2019-3/
Try moving your code files to an SSD, if not already?
sadly it's already on SSD. I mean I'm confused because 2019.2 recompile is almost instant, why is .3 so slow
"Why is .3 so slow" is something a LOT of people are asking π even the editor viewport is slower
it is! I've been avoiding it because of that
there is huge posts about this "Why is .3 so slow" on forums π
I guess I'm stuck on Entities 0.1 until they fix that
I've found at least one cause is the new UI. Moving an object in the scene view is slower when the inspector is open and updating the coords. Tabbing into another window (hiding inspector) makes moving objects faster
yeah I like the look of the new UI but if it what slows everything down, I wish we could choose
anyone knows how i get the jobindex inside a ICollisionEventsJob? π¦
found it, inside the job: [Unity.Collections.LowLevel.Unsafe.NativeSetThreadIndex] public int jobIndex;
Just reading through Netcode a bit to enhance my understanding of its inner tickings. In CommandReceiveSystem we have this little snippet:
int age = (int) (serverTick - tick);
age *= 256;
snapshotAck.ServerCommandAge = (snapshotAck.ServerCommandAge * 7 + age) / 8;
Any idea what these magic numbers are doing?
I'm following the first line
but why these magic numbers?
soooo... we inherit from SystemBase instead of JobComponentSystem now ?
i assume it lets you avoid the performance penalty of all the safety checks and events they're using in the normal ...ComponentSystem classes
so no safety checks in SystemBase ? that doesnt sound useful
@remote coyote Looks like some bit shifting
hmm.. in new SystemBase, you can just Schedule().
Looks like the online docs have been updated. Not seeing any manual references to SystemBase aside from the API and changelog
Added new SystemBase base class for component systems. This new way of defining component systems manages dependencies for the user (manual dependency management is still possible by accessing the SystemBase.Dependency field directly).
Not really sure what they mean by this
Haven't they always managed dependencies for the user? Or am I missing something?
seems like a typo to me; it says it managed dependencies, then explains how you can still manage dependencies manually, why would you need that if its already managed.
also dependencies seem jacked, getting 7 exceptions after upgrading.
it required collections 0.5.2 but collections doesnt seem to be on the dependencies list for entities at all. strange.
Oh I see, no more jobhandles...hmm
Has anyone done Animations with DOTS and can point me to a good tutorial?
yeah i think so as well Sark, so i guess we also dont need to worry about Run() π€
We do, Run will still force it to run on the main thread. As far as I can see it's just saving us from having to constantly pass "inputDeps" around when scheduling jobs
So an EntityCommandBuffer seems to not have any way to change component data
So if you call Schedule it would automatically assign it back to inputDeps and pass inputDeps in as a dependency under the hood
But it would still be scheduling a threaded job
Yeah but idk, feels like Run lambdas should be also automatically dependency handled
i am however not really using Run much so i cannot confirm
Had a look through SystemBase, looks like the new "ComponentSystem" is that being depreciated maybe?
OnUpdate() doesn't pass/return job handles.
Supports Entities.ForEach & Job.WithCode
Doesn't use [AlwaysSyncronizeSystem]
Doesn't lookup handles from dependencyManager by default
Still completes previous frame's job handle if "Dependency" field is set.
Yes
pretty much
Doesn't lookup handles from dependencyManager by default wat
yeah thats what ComponentSystem did π
but ComponentSystem is succeded by JobComponentSystem, no ?
@zenith wyvern just some extra work its not doing.
I mean ComponentSystem and JobComponentSystem arent different things
so i feel like SystemBase is created to succeed JobComponentSystem
idk π
Since 0.5 JCS should be able to do anything ComponentSystem could do but faster
And with no allocations
Okay I see, so SystemBase does some extra checks to see if it can avoid doing dependency lookups if you're only using .Run() in it
So it should be a replacement for both ComponentSystem and JobComponentSystem
oooh how do you know that π
ah thats cooll, i generally dont go in there, its a minefield for me
but yeah i guess no need for AlwaysSync now
if you generate all csproj files, it is very helpful to jump into packages sourcecode ... gives better up-to-date information than docs
You should. There's usually helpful comments in there that you don't get from "GoToSource":
// If outputJob says no relevant jobs were scheduled,
// then no need to batch them up or register them.
// This is a big optimization if we only Run methods on main thread...
Even if you don't deep dive on the code itself the comments are usually super helpful
π
good to know, maybe i will check that later
i should convert my code to SystemBase now
Well you might want to wait considering it's not even properly documented yet
Who knows how they might change it
comments like these are always helpful π because it might be hard to spot differences in docs text... but in code, it is obvious
Hmm idk, doesnt seem like its something that can be change drastically
but yeah i should wait i suppose
actually i will not
i am wild like that
@digital scarab and write better documentation for people like CurlyOne π€
So i have a question, about design, so i am making space ships, and these ships will have shield, armor and hull, when they are hit by a bullet(or laser rather) depending on what ship has it will deduct from that, so lets say ship only has shield and hull, shield will get hit first and then hull, if ship has armor and hull, armor will get hit first and hull, so do you guys think that i should make them seperate components or one big component ?
Seperate component means i have to check if ship has shield, armor or hull component and get hit properly, big component means i have to have bools inside that component and write their values, but that means there will be ships that will have wasted memory if they dont have all shield/armor/hull.
will they ever "lose" their shield/armor after creation? or is it just at 0 if depleted?
do you have shield regeneration? armor regeneration? hull regeneration?
don't think about objects if you are using ecs π only think about pure data, how/when it changes and what is actually needed for one part of your logic to read/write to that data. it depends entirely on your specific usecase in most scenarios
@opaque ledge it depends strongly on how you want to implement all that, for example, is the shield just a number that "protects" the HP? or is it a collider that catches the impact before the hull does?
iam personally for flexibility, so i did seperate components for Reactor/Shields/Engines etc.etc. and Systems run multiple Jobs to process all the possibilitys.
yeah for the time being it protects HP basically, and Armor is reducing the damage taken by hull.
One solution could be that the dmg are entities and the Health, Shield and Hull Systems are executed in order, modifying those Entities for that dmg to be applied?
I think i will go with big component first, then we will see how things go.
So how do we register a jobhandle for command buffer ?
i mean in SystemBase
@opaque ledge Just in case there's any "why didn't anyone say" element - I'm generally pro smaller components. There aren't many downsides - whilst initially you may have a monolithic system that requires all the components, eventually I tend to find I mostly end up with more systems acting on single components. Especially as behaviour gets more complex. The upside I believe is that it's slightly faster to iterate only on the components you need. But like you say, quite easy to change later. I also tend to have a lot of bools rather than add/remove tags. You probably don't need every smaller component to have a bool though.
@opaque ledge
https://pastebin.com/EznYicFq
its ripped out of my class, but should explain how to use it
oh sry, i ripped out the part where you register the command buffer for producer;
endSimBuffer.AddJobHandleForProducer(projHandle);
Looks like the samples have been updated to use SystemBase as well
Huh, I didn't realize there was a sample for subscenes
Hey, how would you follow an Entity with your camera? How can I get the Translation position in my system? One approach I found in the AngryDOTS demo is a singleton "Settings" class that holds the position of the player. But this isn't a pure DOTS approach.
So, how do I do GetComponentData with a CommandBuffer?
The answer to both your questions is that the only way to get component data is via EntityManager.GetComponentData or through a query
Or via GetComponentDataFromEntity
oh, neato, was wondering when the next entities drop would be
after updating the hybrid renderer my android build does not work like the editor X.x
I wonder if we'll get that entity preview ever for nonDOTS subscenes
unity platforms?
I kinda gave up on the DOTS subscenes already as it's just too much additional pain if you don't use hybrid rendering
@crystal helm ```md
- The package
com.unity.buildhas been merged into the packagecom.unity.platforms. As such, removed the dependency oncom.unity.build@0.1.0-previewand replaced it withcom.unity.platforms@0.2.1-preview.1. Please read the changelog ofcom.unity.platformsfor more details.```
Unity Platforms in package manager
ahhhh, ty π didnt catch that, ill try
No need to return jobhandles from job onupdate anymore it seems
How to I delay the creation of a system?
btw, wondered about that that dots subscene thing because of this: ```md
- Adds Live Link support for
GameObjectscenes.```
[DisableAutoCreation]?
if they can do live link in GO scenes, they have some serialization support for it
ok cool
No need to return jobhandles from job onupdate anymore it seems
@magic frigate what do you mean by this?
surely you have to return something since the OnUpdate still requires a return type
SystemBase handles the jobhandle internally so you can ignore it unless you need it, like for command buffers or explicitly scheduling parallel jobs
OnUpdate returns void with SystemBase
Sorry I was fumbling around trying to link the exact commit. Here's one place they changed: https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/5fbe871da2ae7f3a173265221017861d2ae6d13c/ECSSamples/Assets/HelloCube/1. ForEach/RotationSpeedSystem_ForEach.cs
I do like the ScheduleParallel and ScheduleSingle
makes way more sense than Schedule and Run
Is ScheduleSingle a replacement fo- ah
I was about to ask if it was different than Run(), lol
hmm
they still have Run
the ScheduleSingle is apparently only for IJobChunk?
I was hoping it would have been for all
hm, getting the android platform package didnt fix the problem
so, nevermind me
@crystal helm you only need android platform package if you build against dots runtime afaik
i though the difference was that ScheduleSingle() gets scheduled and potentially on a different thread, but Run() just gets main thread inlined if possible.
but if you need DOTS subscenes to work in build, you still need Unity Platforms package
oh right, good point @mint iron
so what's the diff with ScheduleParallel and Schedule now?
"ScheduleParallel` methods in `IJobChunk` and `Entities.ForEach` (in `SystemBase`) to make parallel scheduling of jobs explicit.
i got both... but i updated from LRP to URP today, some materials seem to be a bit off too....
ill fix the materials and render pipeline stuff first, maybe the hybrid renderer just chokes and dies from something left over
I admit I read the changelogs too quickly, I really thought they changed the wording to make the diff between schedule and run more clear but I guess not π
Do any of the old ones give deprecation warnings or something?
Schedule at least doesn't for me (with SystemBase)
but in general I like this, it's awesome that we get closer to not having to write a ton of extra code with DOTS (unless we need finer control over things)
Any tips or best practice on state machines and DOTS? Broad question I know, but curious what approaches have worked well. My naive inclination is to make entities representing states (since they're just data) but not sure what that looks like when it comes to the animation state machine and whether any logic should live on the animation nodes, etc
Looks like condition tables might be the way
state machines are this animation pseudo visual scripting, right?
Well, technically a FSM (Finite State Machine) is just a concept that exists in all kinds of programming and systems. The animation node graph is one, yes.
But really they're all over the place, just maybe not formally considered as such
Any finite set of states with defined ways to transition between them is a FSM
If jumpButton -> isJumping=true; is a state transition, for example
What I'm asking about is a more formal, structured approach for organizing an FSM in an ECS/DOTS architecture, to use to drive logic like combat/locomotion/animation
because you can use that to switch what systems run on an entity
The current default unity non-DOTS approach seems to be "define a state machine in the anim graph and tie logic to the nodes there"
Which is messy and hard to maintain
just be careful with it, as its a memory switch, and can be expensive if you do it on the "tens of thousands per frame"
as always, look at your specific usecase... you probably don't want to implement a generic "one rules them all" FSM with ecs, as this would run counter the dod principle
how often do you switch states, are there far more transitions than states? can you add new states/transitions via config files, etc etc
Of course. Just that it looks like a blind spot as far as docs/examples to go from "setup combat/locomotion in the anim graph" to "process your entities in DOTS with systems", without a clear bridge to achieve the same FSM-style behavior graph
yup. Ive seen people trying to do a generic FSM on ecs and it allways fail
its just better to have it special-case
That's why I was curious if there was a Bestβ’οΈ way to think about it
@indigo delta as a rule of thumb, component = state is the easiset to think about
the easiest of cases is the "Dead" component
if entity has the Dead component, then its dead
and on your general gameplay systems, they dont run on entities with Dead component
or you could use shared component values with an enum for all your statesπ€·ββοΈ
aye it is, but it is possible π
you are doing the whole "archetype switch" anyway
might as well have it as component
better filtering and you can put data on it
So view components as behaviors, systems operate on entities with matching components, change components on events that should change behaviors, to transition "states". I get where you're going
yup
thats great, but it has downsides of causing memory switch when you need to transition state
and causes fragmentation
so generally only use it in the cases where you wont constantly switch
What alternative architecture would you be using if you want a graph of contingent behaviors?
maybe "child" entity
To be more ECS friendly
an state is done by a separate entity which points at parent
downside is reduced performance when calculating things, as accessing component data from an entity ID is slow-ish on unity ECS
I see
this is kind of why trying to create a general state machine is not a good idea
there are multiple ways with pros-cons, and they are all really trivial code, so the general state machine is unnecesary
Well that's kind of what I was getting at moreso than just how to FSM, but rather how to approach gameplay systems that are often graphs with contingent nodes while respecting/gaining ECS benefits
Then how in Unity one ties that intelligently to an animation graph, for instance
The naive approach (and every video/doc on it) has you just drag in anim nodes and attach scripts to transition on variable conditions
Which feels antithetical to DOD thinking
@dull copper Schedule is equivalent to ScheduleSingle with an IJobForEach, it forces it into one thread but it still schedules a job on another thread. Run forces it to run on the main thread
π
So we should go for ScheduleParallel then
i thought Schedule would default to ScheduleParallel
Yeah it's a bit unintuitive, with job structs the default is parallel and you have to explicitly call ScheduleSingle for a single threaded job, in SystemBase they reversed it for some reason
it's weird, yeah
but I just tried this and profiler does show this as well
for simple systems .Run will still be way faster, and .Schedule will be tad faster than .ScheduleParallel
it all boils down to job system overhead there
oke, ive tried everything now, checked all used materials and meshes.. got the new platform packages (btw you cant install unity platform android without unity platform) and checked the debug console on the build;
nothing helped. it seems like the hybrid renderer cant calculate the position of the objects, all of them sit at 0,0,0 but the entity logic is running without problems and no debug error fires :/ all since the update today
Are we still supposed to use [AlwaysSynchronizeSystem] if we're only calling .Run?
you fixed the projectiles xD
π yeah
ah not officially. but: https://docs.unity3d.com/Packages/com.unity.tiny@0.16/manual/module-particles.html
havnt looked into that, but i know i need a lot of particle systems... i was planning to use simply shapes with shaders that looks like a effect... which should be much lighter than the base particle system
ah is tiny particle only on the 'tiny' platform effectively?
dont know, didnt try. but found the docu and was curious.
Rip
ah and @zenith wyvern dang haha
oke, for everyone who runs in this problem too:
the hybrid renderer cant hande the SRP Batching. Thats why all renderobjects get placed in 0,0,0 and the logic works just fine.
the update turned it on and i didnt catch it.
works again πΎ
the problem occured just in build, not in the editor
That happens from trying to use a member variable in ForEach, in the previous entities version it would give a nice error about need to assign to a local variable first
Is that with URP @crystal helm ?
jep
I wonder if it wouldn't do that in HDRP
@zenith wyvern i got that as well on previous version i reported it then said they fixed it on 0.6, but i guess not π
I'm sorry for asking again but I can't get it to work. I have a Player Entity with just a Translation Component. I want to access the Translation Value inside a System to chase the Player Entity with another Entity. How can I achieve this? I tried storing the player entity in a GameManager singleton but all I can access is its Index.
do you only have 1 player entity ?
yes
then you can do:
var playerEntity = GetSingleton<PlayerTag>();
var translations = GetComponentDataFromEntity<Translation>(true);
Anyone got a duplicated Unity.Build package error with Entities 0.6 ?
then inside your job you can do
var playerPosition = translations[playerEntity];
you should put a PlayerTag on your player entity so you can retrieve it using like that.
so complete example would be:
OnUpdate(){
var playerEntity = GetSingleton<PlayerTag>();
var translations = GetComponentDataFromEntity<Translation>(true);
var deltaTime = Time.DeltaTime;
Entities.WithAll<Enemy>().ForEach((ref Translation enemyPosition)=>{
var playerPosition = translations[playerEntity];
enemyPosition += normalize(playerPosition - enemyPosition) * deltaTime;
})
.WithReadOnly(translations)
.Schedule()
}
Ahh great now I understand how GetComponentDataFromEntity works. Thank you π
or you give a component to the playerentity that just tags it as such and going for Entitys.ForEach -> this keeps the option open to add more playerEntitys
π
Actually wait, that example wont work since you are getting Translation in OnUpdate, and also getting Translation of the entity. But thats the general idea
So for future reference i am fixing it:
OnUpdate(){
var playerEntity = GetSingleton<PlayerTag>();
var translations = GetComponentDataFromEntity<Translation>();
var deltaTime = Time.DeltaTime;
Entities.WithAll<Enemy>().ForEach((Entity enemyEntity)=>{
var playerPosition = translations[playerEntity];
var enemyPosition = translations[enemyEntity];
enemyPosition += normalize(playerPosition - enemyPosition) * deltaTime;
translations[enemyEntity] = enemyPosition;
})
.Schedule()
}
Something you have to watch out that, you cant use a component data in ForEach if you get it from GetComponentDataFromEntity, otherwise it will give you alias error
copy positions of all targets in different job to native array and than pass to your job π
then you can iterate over targets and choose which one you wantπ§
I think I can do it like this to manage some sort of "Aggro" in a battle . I will play around with this thanks alot π
is Unity.Build like an internal namespace now? cant seem to access it
i think it got merged to platforms
i mean its still there in the new platforms package, my ide just doesnt see it now tho and neither will it compile in unity if I try to use it
i found this inspector for components package on github last week, and its been so awesome to be able to fix all the missing inspectors, like NativeString/Fixedstring showing a massive byte dump, or flags enums. Worth checking out https://github.com/OndrejPetrzilka/EntityComponentInspector
I can't get over his facial expression xD
Did anyone experience Entities falling through the floor when converting a GameObject with a RigidBody and Gravity turned on to an Entity? If I don't convert my GameObject it doesn't fall. π€ Nevermind I didn't turn my ground into an Entity π
theres no other way ^^ the physics system of gameobjects and entitys dont interact with each other
how can it be that EntityCommandBuffer.DestroyEntity(index,entity) does not destroy its children? O.O
you need to add any child entities or entities you want to destroy together to a LinkedEntityGroup
hm :{
then i load the object to a prefab and instantiate it, less work and it needs to be done anyways
instantiated prefabs from referenced prefabs are linked automatically, right?
i dont think LinkedEntityGroup is added automatically to many things at all but whatever youre doing just check in the entity debugger if it has it or not, should be easy to tell
I have a problem, I have this Ball object prefab which I put a ConvertAndDestroy script on it
when I put it in the hirarchy, the ball converts to an entity and works properly
but I'm trying to spawn it from code, so I reference the prefab through the inspector, convert it to an entity prefab, and create an instance of it with the entity manager
problem is, when I instantiate the entity from code, the physics doesn't work
are you using the physics authoring components(shape and body)?
should "just work" but I would double check the entity debugger that everything on the instntiated as a prefab is the same as non prefab test
i realize i've been doing this for a while without thinking about this but, how does using ecs get/setcomponentdata from non-ecs code work? jobsystem manages dependencies inside ecs, but what about outside? is it possible to setdata from monobehaviour while it's at the same time being set in a job in ecs?
i mean the latter seems to be possible, but is it safe?
Referenced Prefabs automatically add a LinkedEntityGroup with the complete child hierarchy.
uff, tomorrow ill write the spawn system, iam not doing that today >.< sitting since 12 hours on this, its gaming time now :}
@hollow sorrel As far as I know ECS uses entity queries in combination with the JCS job handles to manage dependencies.
You can technically access the entity manager from a MonoBehaviour via World.GetDefaultGameObjectInjectionWorld.EntityManager. With the entity manager you could set component data on any entities your MonoBheaviour has a reference to, but I think you would have to force a sync point first with EntityManager.CompleteAllJobs(). And I don't think there's a way to create an entity query outside a system so getting access to an entity in the first place is going to be a little hacky.
okay, I found the problem..
tell us :>
@mint iron Haven't analyzed all the code, but wow thanks!
Although I kind of have a hard time understanding everything in detail, since I am not very experienced with C# events(I have only used events with Action). It's a good opportunity for me to learn more about that though.
Also I didn't put it in an editor yet, so that might make it easier for me to read.
@crystal helm well... it's something to do with the transform. even though the prefab was identical (same transform value), it wasn't handled the same way, and the values were only valid for the manually instantiated balls. so I adjusted the values for my ECS spawned balls and they work
now breaking the manually instantiated ones, but I don't need the manually instantiated ones anymore
how do you count the number of entities in a ForEach job?
if you know the query you can use query.CalculateEntityCount
QQ everyone. What is the DOTS? is this kind of ECS? or what is it all about?
@odd ridge cs var count = myEntityquery.CalculateEntityCount(); Entities .WithStoreEntityQueryInField(ref myEntityQuery)//field in your system .ForEach(()=> { });
Hmm π€ So.. i put a 6 targets on scene to shoot at (you can see that in my previous video) but what i have noticed that is.. Target's child objects are attached as "Child" Component not LinkedEntity Component, therefore when i destroy Target, the actual mesh(which is Target's only child) is still around and it actually 'spawns' at 0,0,0 since Translation value, compare to parent, is 0,0,0.
When i instantiate an entity from EntityManager.Instantiate, children are linked entities, but when i put them to editor and add convert to entity, children are "Child"
anyone got Unity Physics raycasts working with the new Entities.ForEach setup?
I'm currently basically stumbling to same thing as @silver dragon here: https://forum.unity.com/threads/invalidoperationexception-the-previously-scheduled-job.682744/#post-5399547
try to disable JobsDebugger
no idea π
well, it's clearly bypassing the safety checks now
thats what happened to me as well so
which should tell if things are doing things they shouldn't
which isn't all that great solution
i am not sure, it says debugger not safety checker
nvm you are right π
but idk, everything works fine for me so
also maybe use new SystemBase, it handles every dependency i believe
I'm actually using it already
trying to slim everything down
I'd still love to set the collision world to read only for this as it's what's causing this to happen in the first place
Yeah, tried stuff but couldnt make it work.
I will just disable job debugger when i am sure my other systems are working properly
kinda annoying really
I also keep getting tons of these:
it's not related to the system mentioned here
this happens even without it, it seems to be some stock physics authoring component triggering it
well, it's convexhull thing
I'm feeding the shape component a mesh to use as basis for convex hull generation, and it does generate it nicely from it but I suspect this is what makes this happen
I got other meshes in the hierarchy which I don't want to be used in convex hull generation at all, hence manually feeding the mesh there
@dull copper I have a solution for this raycast issue! It was posted here in discord, i forgot to update the forum thread. Give me a few minutes...
ah, nice, I tried to seach this channel but I guess I failed π
Ha, found it:
public struct CollisionWorldRo
{
[ReadOnly] public CollisionWorld collisionWorld;
}
and pass it to Entities.ForEach:
var collisionWorldRo = new CollisionWorldRo{collisionWorld = _buildPhysicsWorld.PhysicsWorld.CollisionWorld};
Thats it!
yep
This and all the other things π
anyway, thanks for the info, much appreciated π
Thanks for the hint, i just updated the post!
I'm still getting this
InvalidOperationException: The previously scheduled job BoundingVolumeHierarchy:BuildFirstNLevelsJob writes to the NativeArray<Range> BuildFirstNLevelsJob.Ranges. You are trying to schedule a new job TestSystem:<>c__DisplayClass_OnUpdate_LambdaJob0, which reads from the same NativeArray<Range> (via <>c__DisplayClass_OnUpdate_LambdaJob0.Data.collisionWorldReadOnly.collisionWorld.Broadphase.m_StaticTree.Ranges). To guarantee safety, you must include BoundingVolumeHierarchy:BuildFirstNLevelsJob as a dependency of the newly schedu
the message clips there π
but it's basically the same error that the original poster had on that thread
I believe Unity doesnt properly handle dependincies if you include physic world, because for me, its working fine if i only have 1 system that does raycast, but starts to fail if i have 2 systems doing it
Try UpdateAfter(typeof(EndFramePhysicSystem)), that actually helped me when i was working on it just now.
but it said i was 'modifiying' bodies, in first system, so 2nd system should depend on it, but i am not modifying it, so i think Unity cant see that.
If i try to make Physic World read only then it will give an error and wont compile.
So in the end, its like what you said Olento, there is no way to do read only
but then again even if i am modifying it Unity Job Scheduler should see that and schedule correctly.
but maybe i am wrong idk, i am not smart
that just breaks it totally for me π
Ah, i have: [UpdateAfter(typeof(BuildPhysicsWorld))]
- I really need to do this before physics stepping or I get one physics step delay for no good reason
yes, that's what I had too
hm, i have two systems doing raycasts and no error anymore
But let me double check π
does both system access bodies ?
weird, I even tried reverting to the JobComponentSystem (from new SystemBase setup) but it still spams the same thing
only one of my systems doing raycasts access bodies
I'm on newest entities 0.6 too
try to access to bodies on your 2nd job, thats when you will get the error
same Olento
uh, i'm still on 0.5.1
doesnt matter probably
I am on 2020.1.0a23 as well so that could also change things
its still same package tho
Ok, i added access to bodies in my 2nd job and i got no errors.
but maybe you are right
2019.3.0f6
this thing crashes the editor for me like on every 3rd run π
well i get error if i do that
strange enough...
theres 3.1f1 now as well
Both are Entities.Foreach with CollisionWorldRo and [UpdateAfter(typeof(BuildPhysicsWorld))]
Oh, there is more: .Schedule(JobHandle.CombineDependencies(inputDeps, _buildPhysicsWorld.FinalJobHandle));
seems like it came out really quick after 0f6
yay an update π
Everything should be in there π
3.1f2 is getting out this week
Yep, new week, new update!
f2 is going to fix DX12 breaking with HDRP, people testing DXR are anxious in getting that
ah nvm, i am already at 2019.3.1f
@silver dragon ah, I didn't have that input dep as BaseSystem setup doesn't allow it
I'll try it on the JobComponentSystem
Hm, the SystemBase is for ComponentSystem only? I thought this goes away somewhen?
You can use SystemBase.Dependency
no SystemBase is the 'new' System now
anyway, inserting that dep did fix the error for me
I'll try again with BaseSystem now
π
thanks again π
for.. stuff π it succeeds both JobComponentSystem and ComponentSystem
old setup:
public class TestSystem : JobComponentSystem
{
protected override JobHandle OnUpdate(JobHandle inputDependencies)
{
var jobHandle = Entities.ForEach((ref TestComponent testComponent) =>
{
// whatever here
}).Schedule(inputDependencies);
return jobHandle;
}
}```
new setup: cs public class TestSystem : SystemBase { protected override void OnUpdate() { Entities.ForEach((ref TestComponent testComponent) => { // whatever here }).ScheduleParallel(); } }
i believe whole ECS Sample updated for that
basically it's just reducing the boilerplate if you don't need the dependencies
it came with 0.6 btw
also it improved your jobs if your system only has Run jobs
or so i heard
its a secret π
But yeah, in their manual it still shows JobComponentSystem and ComponentSystem
but like i said ECS Samples are updated to SystemBase
ok, this works with SystemBase: cs Dependency = JobHandle.CombineDependencies(Dependency, buildPhysicsWorld.FinalJobHandle);
Maybe i should update the samples, i have a really old version... haven't used them for some time.
no more errors, yay
π
Hmm i tried that but didnt work π
i will check it out later, gotta update some stuff
did you combine them?
yeah
and you did that before Entities.Foreach?
you still need the struct hack
ahh nvm, you guys doing it with struct hack ?
i will just wait until its properly handled π
Yep, see https://forum.unity.com/threads/invalidoperationexception-the-previously-scheduled-job.682744/
You need all those funny things π
yeah π
btw a question, so one of my system is checking interaction distance between my interaction target and my player, if its in distance it interacts, this is the code:
protected override void OnUpdate()
{
RequireSingletonForUpdate<PlayerInteractionTargetTag>();
var playerEntity = GetSingletonEntity<PlayerTag>();
var targetEntity = GetSingletonEntity<PlayerInteractionTargetTag>();
var translations = GetComponentDataFromEntity<Translation>(true);
var playerPos = translations[playerEntity].Value;
var targetPos = translations[targetEntity].Value;
if (distance(playerPos, targetPos) <= 0.3f) MasterInteractionMono.instance.TestInteraction(targetEntity);
}
yeah, I just tried it without the ReadOnly hack and it still fails without
so you need all that
so there is no job in it at all, should i make a IJob or this is okay?
its working so far but not sure
Add ProfilerMarker and check times with(out) job
so should i add physics dependency before ForEach or after ?
before
btw, got rid of the convex hull errors simply by adding physics material to the thing π
I thought it would always just use some default 0.5 values if there's none assigned
that's how things work like... in every other physics implementation out there
Oh boy another syntax change
hooopefully won't be too long until they update Netcode to these latest Entities changes
anybody tried to run Netcode with latest updates? I wasn't able to get it running on 0.5.1
Let me check the fix for it...
Yeah June, been tempted to just run with Transport myself.
It's much more sane
It all works in jobs, you can just construct whatever packets you need to whatever meaning
Yes, Transport seems to be where the archwizards applied code... or perhaps its just that Netcode is more opinionated
yeah, I'm used to Raknet, so would be cosy
and I really don't like to have to generate code via editor inspector
If you know how to build up from a simple udp packet lib I highly suggest it
as a side note, having Debug.DrawLine working now on jobs (with 2020.1) helps a lot on these raycasts, no need to do workarounds to get these drawn
yeah, lets you shape it to exactly what you need, rather than hope to mold Netcode into what you need
A seriously fun pro tip is that you can use a unsafe pointer and memcpy to the nativesteamwrter
From your entity components
Which are fixed sizes
do you still write to dynamic buffer like Netcode does?
@remote coyote If i remember correctly you have to move netcode to packages folder (make a dev package) and make this change in ClientServerWorld:
protected internal static void GenerateSystemLists(List<Type> systems)
to
protected internal static void GenerateSystemLists(IReadOnlyList<Type> systems)
Should be enough to get it working with 0.5.x
yeah, I did that fixx daschatten, but was some other error that I was not able to resolve. Must have been something else (I don't recall off the top of my head)
Hm, it was the only fix for my project. Maybe some feature i don't use...
You never know what bugs are hidden π
yes, I have set up just enough unit tests / integration tests for my code that it catches a few of those
I avoided tests for netcode, so there are no bugs for me 
I'll have to play around with that a bit June. Thanks for the tip. Was looking seriously at Steam Network Socket yesterday, but might as well stick with Transport and stay in DOTS-land with it.
how can i send a persistent native array to ForEach ? if i capture it locally in OnUpdate, it wont be the same array.
isn't native array just a pointer to some memory?π€
or what do you mean by not the same?
i have to capture it like, var newArray = persistanceArray;
to be able to use it inside ForEach
but it is the same NativeArray
copy of a pointer points to the same memory of the original, or am i wrongπ€
Yep seems so, my bad, there was a mistake in my logic
@silver dragon btw, instead of After BuildPhysicSystem i did it after EndFramePhysicsSystem, that way i didnt need to combine dependincies
not sure if i get lucky or smth tho π can you try it on your side as well when you have the time
I suppose you're lucky. It depends on when a system is scheduled and when the jobs are running. Once i added one more system and suddenly got some dependency errors from other systems. Since then i like explicit dependencies.
(and keep read/write attribs clean)
Hi, everyone. So I've invested some time on learning Entitas. Is it going to be hard to switch to DOTS?
to learn/work with it? not particually, migrating a project to it? hell yes.
if you want to outsource just one seperate system to it (it needs to be mostly independent to the rest) its manageable
Oh, thank you for this answer. I want to learn it. I'm in love with the concept. And I'm ready to start a new project to understand all the caveats of DOTS.
Where should I start from?
in this channel, on the top right it a pin, if you click on it it shows you a collection of useful links, also i can recommend the "codemonkey" youtube videos on ecs, some have outdated syntax but the principles are the same and easy to fix.
oh and stay away from ComponentSystems, get directly used to Jobsystems π
F***, a FixedListByte4096 has only space for 4094 bytes... i need 4096 for my 16x16x16 cluster...
π€£ lies everywhere

in this channel, on the top right it a pin, if you click on it it shows you a collection of useful links, also i can recommend the "codemonkey" youtube videos on ecs, some have outdated syntax but the principles are the same and easy to fix.
oh and stay away from ComponentSystems, get directly used to Jobsystems π
@crystal helm, thank you!
thats why we are here π besides complaining about outdated documentation ofc π
So use JobComponentSystem even if the work you're doing cannot be multithreaded? Run instead of Schedule? ComponentSystem going to be deprecated then?
icant find the link right now but i saw a unity technologies post in the forums that said componentsystems will get more changes than the jobsystem in the near future.
Makes sense as the job system is more mature, though I literally never used it before ECS
and yea, you can just .Run() a job to mainthread it
there is that statement that some things cant get jobified, but i personally never encountered a limit :\ someone else maybe
We need more DOTS!
Doesn't a lot of Unity's API have to run on the main thread? Sure, you can make a copy of any piece of data, do multithreaded transforms on it, and sync it back up to the main thread. But sometimes it just makes sense (and is faster) to keep it on the main thread, right?
Yes, for simple tasks it's faster to run on the main thread. You can still get the benefits of burst on the main thread as well using .Run instead of .Schedule
how do I use burst when using a Entities.ForEach statement?
if I understand, job structs require the attribute [BurstCompile], but ForEach is bursted by default?
Correct
is there any reason to use a job struct over a ForEach lambda or vice versa?
Chunk iteration - I typically tend to use IJobChunk
until there's a way to do ForEach lambda with chunk iteration soon - I'd probably be jumping to that π
i thought ForEach lambda does a chunk iteration under the hood; IJobForEach<T> did as well.
i see what you mean, i can't see a lamda match anywhere for the chunk
ah I guess I misread this: When you define the lambda function to use with Entities.ForEach, you can declare parameters that the JobComponentSystem uses to pass information about the current entity (or chunk) when it executes the function. (A Job.WithCode lambda function does not take any parameters.)
sometimes people use 'return default;' in a system's OnUpdate function. what is the meaning of the default here? I never saw the default keyword used outside of a switch block. is this new to ECS? is this specific to Unity or is this a c# feature?
its c# feature
var translations = GetArchetypeChunkComponentType<Translation>();
Entities.ForEach((ArchetypeChunk chunk) =>
{
var stuff = chunk.GetNativeArray(translations);
}).Run();
this doesn't compile π¦
default is generally used with AlwaysSync attribute, AlwaysSync attribute makes jobs finish before system starts, since all jobs are finished you dont need to return inputDeps, you simply return default
I don't think we need to use AlwaysSynchronizeSystem with the new SystemBase now as well, so the pattern of using alwayssynchronizesystem and returning default is obsolete with SystemBase
From the docs Note: Currently, you cannot pass chunk components to the Entities.ForEach lambda function.
right now there's two ways to create a system, either with the .ForEach lamda or a IJobForEach struct. is there any reason to use one over the other?
no, they are basically the same
but for ForEach, you gotta capture variables locally, you cannot use class variables just like that, so it has kinda 'weird' workflow
what's the recommended way to react to input? I tried using Input.GetKey() in a IJobForEach but that wouldn't work
why does Input.GetKey() work for a ForEach lambda but doesn't work for IJobForEach
I'm not sure actually
You read input on the main thread and pass it into your jobs
The old is default, so if you didn't specifically opt-in to the new one you're on Manager
protected override void OnUpdate()
{
var moveInput = _moveAction.triggered ? (float2)_moveAction.ReadValue<Vector2>() : float2.zero;
if (moveInput.x == _previousMove.x && moveInput.y == _previousMove.y)
return;
_previousMove = moveInput;
Entities
.WithAll<Player>()
.ForEach((ref Movement move) =>
{
move = (int2)moveInput;
}).Run();
i am using new one, so i simply register class fields on performed, started, canceled etc. then capture them locally
is there a DOTS audio solution already?
There's audio in the project tiny racing demo, you'll have to see what they're using
if not for project tiny, I have to communicate sound events between ecs and regular audio?
Project Tiny uses ECS by design, so whatever they're doing for audio, that is how we'll have to do it
Or come up with your own solution using hybrid
wwise will be supporting ECS within this year as well.
what's the frequence of a JobComponentSystem OnUpdate function? like, does it run as fast as it can or is it a fixed 60hz?
just like the regular Update of monobehaviour
so I need to write my own fixed time step solution to have my jobs run at 60hz?
I suppose there's a way to disable the OnUpdate per frame call so that I can call it manually from my own Job manager?
@odd ridge Or you can use deltaTime to scale your rates to compensate for changing frame rates?
@indigo delta it's really performance that I'm concerned about, leaving game logic to run as fast as it can seems ... non sensical
Modern CPUs with multiple cores (reason for DOTS and Jobs in the first place) and the Burst compiler make per-frame updates pretty darn fast.
If you don't need to update something very fast, just... don't update it every frame. But the basic OnUpdate logic is pretty universal as a main place to handle things
you shouldnt really concern about performance when you are using ECS π
Performance seems to be unity's first concern, it's the whole reason they made ECS. And some people are making games for mobile devices, where better control over the update rate can mean the difference between a dead phone or not
I don't have a link but I seem to remember someone from Unity saying they are working on giving us better control over the update rate
Sure, hence the don't update a thing every frame if you don't need to, but that doesn't necessarily mean writing your own JobComponentSystem function
You can do lots of things. Limit frame rate to 60, for one. Use timers. Run jobs in response to some trigger.
Keep a counter and only run your logic every nth frame
what I had in mind is to have a per job system update rate. like I could tell my audio sound system to run at 10hz, and some manager super class handles calling it only once every 100 milliseconds
just wondering what's the proper way to do this in unity
you could manually update systems yourself
instead of the default injected world you would create your own with your own authored systems to handle different tick rates
You add [DisableAutoCreation] and add your systems to ComponentSystemGroups with World.GetOrCreateSystem<SystemGroup>().AddSystemToUpdateList
Then when you call update on the group it updates all that group's systems
that's also another way π
so if I want each system to have its own tick rate, I will have 1 system group per system?
or could I skip the group system if I'm to call systems 1 by 1
There's probably about 1000 different ways you could do it
pretty sure you can just ignore the system groups
We gave you at least 2
and update the system manually if you have a reference to them
Hmm I wouldn't worry too much about formalities/proper if you're exploring π
well, exploring for the long run yeah hehe
I like using AddSystemToUpdate list since it lets you avoid touching the default initialization and also obeys the UpdateBefore/UpdateAfter attributes
Although if you go down this route you're losing the ability to see your system in the entity debugger
interesting - that's good to know
and I suppose I don't want to lose the entity debugger right?
anybody has experience with the profiler and ECS? my framerate breaks after i Destroy a Entity for the second time, profiler tells me:
edit: seems like a editor bug, not ecs related
102k calls seems like a error xD
@dull copper I sent them a message and asked π
lul
did you just time travelled 63 ms in the past
i try to figue it out :\ iam not convinced about a time anomaly within my cpu...
it isnt a Threadripper 3990x π€£
could it be that i manipulate a static variable (yea i know i should not) but it didnt throw a error of any sort so i thought it is fine π¦
within a IJobForEachWithEntity
if I use EntityManager.AddComponentData to add a component that already exists, is it gonna be duplicated or replaced?
It's going to throw an exception because an entity can only have one of any component type
if I get such exception I should use SetComponentData instead?
also, what does [Inject] does? is this specific to dots?
If you get an exception it means you're doing something you shouldn't be doing
inject has been removed a long time ago from dots afaik
you'll see that a lot if you find some older tutorials/dots code
Meaning if you're trying to add a component when it already exists there's a flaw in your logic. You should either already know the component exists or you should be checking for it's existence.
my question about AddComponentData was because of the latest unity ECS tutorial by Mike Geig
he has a Ball prefab which has PhysicsShape and PhysicsBody components, but to change the velocity value, he adds a PhysicsVelocity component
which should already be added by the Physics scripts
because PhysicVelocity exists if I don't add it in the first place
from here, he adds PhysicsVelocity to the ball even though it should already have that component, no? https://youtu.be/a9AUXNFBWt4?t=3212
In this workshop style video we walk through an example project created by Unity Evangelist Mike Geig on how to script a Pong style game using Unity's Data Oriented Tech Stack (DOTS) including the Entity Component System (ECS). This video covers the latest syntax in Unity 2019...
Yeah I have no idea, I don't really use the physics package right now and I haven't seen that video for a while, but it's easy enough to test. If you call AddComponent twice in a row on the same entity with the same type you will get an exception. Meaning you must be misunderstanding something in the video
I suppose the distinction is between AddComponent and AddComponentData, I guess the data only overwrites the data of the existing component
Okay I was wrong. AddComponent doesn't throw an exception, I was sure it used ot
It does return a bool, I'm assuming that's to let you know if it was a duplicate
AddComponentData is just if you want to set the value while adding it at the same time
But yeah, I would still say if you're adding when it already exists that's not right
ooh
false if the entity already had the component. (The component's data is set either way.)```
that doesn't sound like like there's anything wrong with adding it again
oh, I got my answer from the doc
Okay I was wrong. AddComponent doesn't throw an exception, I was sure it used ot
isn't that in the doc? π
"Returns true if the component was added, false if the entity already had the component. (The component's data is set either way.)"
well it won't add it again if it's already there
hm
lmao the server is having a heart attack
yes, I just quoted that π
Discord is haunted
"Returns true if the component was added, false if the entity already had the component. (The component's data is set either way.)"
yup
that doesn't sound like like there's anything wrong with adding it again
@dull copper
Just because it doesn't stop you from doing it doesn't mean it's not wrong. Not a big deal or anything but I think it does represent a flaw in logic imo
I mean, I feel it's better this way (that you can just override the data if it exists already)
yup
yeah
wtf discord π
there can be cases where you just want to add and set the data, if you don't do it a lot, being able to override the existing component data saves you from writing the checks yourself
also... I'll just wait until discord doesn't freak out like this π
discord should be fixed now (https://discord.statuspage.io/incidents/87fx3r91zt46)
I tried building and running the Boids example from the latest sample but I just get a blue void. Any ideas as to why nothing is spawning?
if it uses dots subscene, you have to build it with the new build tools
Ahh, I forgot about those
dots subscenes will not build using the old setup
also pretty sure that was the exact sample where I first found out about this π
New build tools?
this thing:
it's part of the platform package now, used to be Build package before recent DOTS packages
I've never seen this thing in my dang life. Seems nicer than the "Build Settings" window
you haven't used dots subscenes in build?
they would totally get ommitted by the old build setup
I think this happened only during 2019.3 stage of DOTS
yeah, understandable
you need dots subscenes for dots livelink + dots editor's entity preview tool to work
they did add gameobject scene livelink on recent version tho, so I dunno if that's changing the livelink situation on DOTS without subscenes too
entity conversion preview thing is still dots subscene only
it was the main reason I even tried to use dots subscenes myself as I really dig it
@dull copper dont suppose youve tried to access the Unity.Build namespace at all?
latest update made it internal or something? its there, but I just cant access it since the latest package update that consolidated it
@safe lintel if you mean past the attempt to build using these tools when we last spoke about it, then no
ah
they moved the build things to platform package
so it's probably just under different namespace now?
or did they move them to internal there too?
same namespace in the new package, i dont actually know what to look for if its actually internal, just that I cant use it π¦
I don't use the conversion system hardly at all since I do most of my work via procedural generation, subscenes should be useful on that front though so I should really start using them
I wonder where I even put that old build script now
I should really organize random experiments better
anyway just saying as I had a nice little editor tool that consolidated annoying clicks in the editor, one of which was to build button off of one of those build assets so I didnt need to constantly hunt it down
ah found it
its also getting confusing in the forums finding out which package has a subforum etc, took me a day to find the one for the python package which is just a thread
ah, should do stuff like that myself too, it's just, only done small protos on DOTS so far to understand where it's at better, but if moving it into production side, then stuff like that would be really handy
atm, I don't even need the new build setup as I already ditched the dots subscenes
my main painpoint on those is that you really have to use hybrid rendering if you go there or do some hacky workarounds
main benefit of the dots subscene for me would have been that dots editors entity conversion preview, as it also shows live data easier than entity debugger does
but since there's no support on cross scene references, authoring rendering on other scene and syncing it to dots subscene was pain
you can do it but it's quickly more pain than what it's worth
i think i can use subscenes for enviro stuff, hybrid is adequate for my needs for now
it'll get better soon for sure
hoping they announce and release v3 of hybrid at gdc though
but I don't think the more experimental things will work in DOTS any time soon, like raytracing on hdrp
I downgraded to universal as I can just about stumble blindly through the shader code for it
id probably switch back if raytracing worked with dots though π
always chasing the new shiny thing
and that DXR barely works right now π
Shamelessly copying the build pipeline asset from the FPSsample seems to have done the trick
ecs samples already have it
oh you meant the whole editor tooling they did there
Oh, they are there
Strange that these didn't show up when I searched for a pipeline
Those and the build pipeline they need to target
proper Unity Physics joint support is still pretty far off
Steve from Havok wrote this few weeks ago: Conversion from Legacy Joint components will be in the next release due in the next few weeks.
so that will likely release soon (or at GDC)
but when it comes to joint motors (which these DOTS packages don't support atm), the response was: This upcoming release of the conversion code will not include motor support, however Joint motors are a priority for the subsequent release.
considering there's been ~3mo delay between physics packages, it's looking like we could expect that motor support around this summer (unless they speed things up)
yeah i was really hoping the cadence for updates for physics would be higher
trying to setup those joints atm here
could try to do some naive motor to these I suppose
but man even the setup for limited hinge joint... π nobody would setup these like this
should be at least some editor gizmo to tell where the positions and ranges are in reality
it's been ages since I've setup joints in unity in general, maybe I'm just spoiled by ue4's physics asset editor
oh wait there is a gizmo (I initially took only the joint scripts from dots repo, should have taken the editor tooling for them as well)
nevermind me π
i dont think ive ever used the motor part for joints, personally im looking forward to being able to ignore self raycasts
I still wonder why there has to be perpendicular axis on this joint
from dots samples:
one would think the position and axis + angles would be enough, why you need the perpendicular axis too?
I wouldnt know π
just tested prismatic joints and they seem to have huge tolerance for the angle, things just twitch back and forth π
prismatic joint is supposed to be piston like joint, only moving on one axis
but due to the low stability, it lets the attached objects rotate back and forth
oh wow, it freaks out because I had scaled the other object
it's still not fully stable but at least it's more in the ballpark what I expected from it
and switching to Havok totally explodes my test setup.. somehow Havok still plays nicely on the sample repos joint parade level
maybe fixed time steps would help?π
π
nope, still explody without
this is super simple setup, but I'm guessing I'm still doing it wrong here
i've only tried limit DOF joints and they worked fine
yeah, all joints do work fine on the samples repo too, with havok or unity physics
i used it in my test project
oh and used soft joints too, but i created them from script. like they do in testsπ€
I'm just reusing the same scripts from that samples thing
here's the test setup using Unity Physics
of course this will not work properly without the motors
it wobbles less if I halve the physics step interval
same with havok:
I wonder if it's the huge mass ratio difference between the wheels RB's and vehicle RB that makes that happen
it's not self collision as collisions between joints and body have been removed
and they want money for thisπ
or well, I guess it could be if the authoring scripts failed there
it's clearly nowhere near finished (but I agree it's still quite raw to charge money for)
but I don't expect stable joints on Unity Physics at all
I'm pretty sure I could hide most of the wobbling even with Unity Physics if the rest of the things were implemented, mainly missing those motors from physics engine side
I normally do just basic raycast suspension, it's easy to get stable but requires all kinds of workaround and hacks for corner cases. Would love to do joint based suspension and handle wheel contacts on own code (as Unity Physics would let me do this), this would let me get best of both worlds but those joints would need to work better for it
Trying to get the Child buffer from an entity when creating it, however it gives back an error saying that the child component has not been added to it. Is there a different way to get the children of an Entity or am I missing a step? I know the object has multiple child objects on it
if you are creating from command buffer, those doesnt add components to an entity immeidately, for simplicity you can think they are added next frame, the reason that is for performance reason.
Ah thanks you're right. If I just wait a small bit they are added!
looking at unity physics internals for the linear limit jacobian and saw this comment: However, if the limits are nonzero, then the region is not a point, line or plane. It is a spherical shell, cylindrical shell, or the space between two parallel planes. In that case, it is not projecting A to a point on the constraint region. This will not prevent solving the constraint, but the solution may not look correct. For now I am leaving it because it is not important to get the most common constraint situations working. If you use a ball and socket, or a prismatic constraint with a static master body, or a stiff spring, then there's no problem. However, I think it should eventually be fixed.
Does anyone know how to read Chunk Utilization in Entity Debugger
This is my ship chunk, what should i understand from that orange rectangle for example
or number of "44"
@opaque ledge
i think the ui for it is completely bonkers as for readability
have to look up what everything means every single time
https://forum.unity.com/threads/chunk-info-ui-explained.586729/ for source, don't wanna take credit for image
Thank you so much
@vale nymph very good video about command buffershttps://www.youtube.com/watch?v=SecJibpoTYw&t=180s
Ah useful Scorr! Somehow that forum thread had skipped my eye
Thanks @warped trail! I'll check it out!
I'm also struggling to convert child physics bodies when the parent has it's own dynamic physics body
in past it was enough to just have another convert to entity script on child RB's
but somehow it doesn't convert anything anymore
if I separate the childs to not have converted parent, it works
even the script says it will be unparented when it will not actually convert anything
hmmm, I might have used convert and destroy earlier when it worked
I honestly can't wait to have proper ECS editor in year 2025 :p
@dull copper Not sure what your wanted result is?
hm, anybody has experience running conversion via unit tests?
in particular I need the GhostPrefabCollectionComponent to exist as singleton, which is handled through GhostCollectionAuthoringComponent's conversion pipeline. I have this component added to a gameobject in a scene that I load with UnityEditor.SceneManagement.EditorSceneManager.OpenScene
Since a unit test is not in "playmode", perhaps it prevents this from working
Ah, might just be that ConvertGameObjectToEntitySystem is not added... (its a private class in Unity.Entities.Conversion)
GameObjectConversionSystem is abstract, so can't add that system manually
hm
@mystic mountain just want to have different physics bodies in parent and child without having to flatten the hierarchy
this works with convert and destroy on physics samples
but I'd prefer convert and inject gameobject as I can't use hybrid renderer and would still want to sync the mesh renderer logically
I could set the remaining GO's in different hierarchy tree and it would solve this (would still need to write custom conversion scripts for everything) but seems like every thing you do with conversion workflow nowadays is jumping through different hoops
or well, this probably would work even with this hierarchy if I did my own conversion again
it's just annoying that can't use almost any "stock" setups as they don't work in expected ways
if you use hybrid renderer, you are getting so much nicer experience with these conversion hacks
I think most of my recent painpoints with DOTS have boiled down to the built-in conversion stuff. Earlier, as soon as I dropped the editor tooling for most part and wrote my own, things started to work in more predictable ways
but at the same time Unity strongly recommends using the built-in authoring components which I feel they only work on some really simple use cases
I've started using [GenerateAuthoringComponent] instead of writing proxies for my components. So instead of using the old "Game Object Entity" monobehaviour I use "Convert to entity". Previously, the changes made to entities showed in inspector (selected gameobject). How do I show current entity component values, in the inspector, with this workflow?
what you mean by changes in case?
that generate tag should expose the component data properties which are compatible to the editor
you of course have to add those to the gameobject for it to happen
Yes, I can see the properties in the inspector, but they dont change in runtime
they've never changed runtime on DOTS on that view
but if you can use DOTS subscenes and hybrid rendering, you can get live conversion preview per DOTS subscene gameobject that does work even at runtime
I guess I don't fully understand what you mean by changes to the entities
any change you make to componentdata struct shouldl get updated on inspector too
and live data has never showed there in past
Quick overview of the features in our DOTS Sample projects. More info: https://on.unity.com/2P61VDz
Getting started with DOTS: https://on.unity.com/2V3RJ2e
hmmmm, I thought that was a new video, but it has a comment from 2 weeks ago π
I guess they just updated the entry
too bad my potato pc can't handle HDRP at all, and DOTS Sample on lowest is kinda broken on my machineπ
does anyone made a script to check if an object can be seen in a camera ?
I made this:
var difference = normalize(localToWorld.Position - cameraLocalToWorld.Value.Position);
var forward = cameraLocalToWorld.Value.Forward;
var dotResult = dot(difference, forward);
var result = dotResult > cos(PI / 3);
it 'kinda' works and it actually is enough for my use, but was wondering if anyone has a 'proper' check
I know Camera class has WorldToViewPoint, but i need to use it on my job so i can optimize some stuff so i dont want to use reference type
I don't know much about culling but it seems like you can see how Unity does it in the hybrid renderer in Packages/Hybrid Renderer/Unity.Rendering.Hybrid/InstancedRenderMeshBatchGroup.cs. It seems like they pass in the camera planes to a job and do the checks against the entity's WorldRenderBounds components
They do some more broad checks like checking against the entire chunk bounds to avoid having to check any entities in that chunk too. Works well for megacity since large static chunks are separated spatially
found something here not sure if this is what you want https://unitylist.com/p/m0e/Out-Of-Frustum
Yeah something like this, thank you
Is it even possible to get more than 15 fps with DOTS in the editor x(
So i shouldnt use Physics Velocity yet right, since Physics isnt working properly ?
Is there a way to modularly add IComponentData to Entities through the inspector? I got so close but I get some incompatibility errors
I made a attribute drawer that searches all of an interface and adds it to the serialized reference value
[SerializeReference] public IComponentData data;```
I get this error ArgumentException: Unknown Type:`Unity.Entities.IComponentData` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType]. Unity.Entities.TypeManager.GetTypeIndex[T] ()
Is the [GenerateAuthoringComponent] messing things up?
I have to make a concrete type...but when I do that I can no longer use [SerializeReference]
I have to make somehting like [assembly: RegisterGenericComponentType(typeof(GenericComponent<int>))] in my scripts but then I cant use serializereference. so close... :/
Are you supposed to be able get a reference to a struct?
I thought they're value types
...oh shit yeah I guess I overlooked that
just saw that you can serializereference interfaces and thought this would work...didnt think about that though
Would be nice if we could add components this way so we could do "event" type actions
What are you trying to do? Some editor tool that adds components?
yeah so for example I can have a list of components I want to add before destroying an object the next frame.
or for a trigger event...a list of components are added
like I could add an "OpenTag" component, a "SpawnObject" component
You could use authoring components to generate an entity with a list of components. But iterating over the components in a generic way is a lot more tricky
yeah the only way I cna think of doing this is having a massive event system that each object carries all the time
Anyone got any more ideas than turning off JobDebuger and Leak Detection, and enabling burst compilation to speed up editor? :S :/
@mystic mountain Subscenes
hmm wondering if I should convert t dots now or wait still it's near final because I want to switch to dots soon as it's fully ready
What difference does subscenes make more than for load? However I'm already using it as much as I can...
You can unload subscenes when they're not in use, and any entities in the subscenewill not be processed by systems
Is anyone using .ScheduleParallel() inside a SystemBase? I need to chain job dependencies but I can't figure out how to get the first one
disabling editor attaching in preferences should make editor running faster too
altho then you can't debug and it's a pain to switch back cuz then you gotta restart editor
@toxic mural If you need to manually manage the job handles you just use Dependency like JCS used inputDeps
@zenith wyvern Hey I recognize you from the forum thread. I'd like to use automatic dependency management but I don't know how to trigger that. My issue is I'm using Entities.ForEach().ScheeduleParallel(), so to get a JobHandle back from the first job, I had to pass in a jobhandle, but I get errors thrown if I use this.Dependency or a new JobHandle()
If you're only scheduling lambda jobs you don't need to worry about the jobhandle. It will automatically chain them off eachother internally
Otherwise if you need the job handle you can do something like
var deps = Dependency;
deps = Entities.ForEach().Schedule(deps);
deps = new SomeParallelForJob().Schedule(deps);
Dependency = deps;
Assigning the job handle back to Dependency is basically like returning inputDeps from JobComponentSystem
fml it really was that easy. For two .ScheduleParallel() lambda jobs, second depending on first... well thanks!
Again, if you're doing Entities.ScheduleParallel only, you don't need Dependency. Just call them without passing in a job handle and it should work
Doing
Entities.ForEach().ScheduleParallel();
Entities.ForEach().ScheduleParallel();
Will do what I did above internally
I've only been into Jobs for a day or so, everyone kept talking about jobhandle dependencies so I figured I had to shove one somewhere, hah
Thanks very much for your help
Yeah the new way of doing it only came about a couple days ago
ah that's cool that they're chained via the compiler extensions
Yeah it makes it a lot cleaner
time to migate some jobs of mine to use this lol
Maybe more confusing if you're not familiar with how it works and you suddenly need to worry about managing job handles
Starting to look like LINQ chains :D
@velvet oxide i think i have something similar to what you're after (ignore the terrible naming)
Very nice in a reorderable list too
@mint iron how did you get around the registering components?
or is it converting a string value to a type?
umm, i used rotorz ClassTypeReference (https://bitbucket.org/rotorz/classtypereference-for-unity/src/master/) for the finding of Components and an ArrayDrawer Package (https://github.com/garettbass/UnityExtensions.ArrayDrawer);
Then stashing all the data on conversion with a TypeManager lookup >> ComponentType
Then just something to create the Component, https://gist.github.com/jeffvella/af139e2584c7f8512dee524a3aeab0e0
@mint iron Beauty thanks! I am loving this factory. Will poke around to get more ideas. I still need to be able to carry values with the components as well so I need to find out how to show that as well.
Does EntityManager.GetEntityQueryMask() need to be regenerated each update?
Has anyone else had an issue with RigidBodies within a convert-to-entity workflow? Notice how in PLAY mode the rigid body objects will fall while in the SCENE view, but not within the game view ... https://youtu.be/_o1Bfk9Hu_Y is that a bug? known issue? Is there a fix ?
is there a reason you are using rigidbodies over the physics authoring components? i did see this thread and wanted to give it a go on a small test scene but didnt get around to it
Ok quick stupid question. I have everything setup to test but I'm not seeing anything in game. But when I look at the debugger i see them moving... why?
Do you have the hybrid renderer package installed?
No. Thank you.
Has anyone experimented with the new NetCode for a RTS?
Netcode is specifically being designed for a real-time shooter right now. Overwatch seem to be an inspiration. So real-time arena shooter. It wouldn't be an optimal solution for an RTS with a ton of units moving about.
They will tackle the RTS genre among others later though. Maybe we will hear some updates on those things come GDC
I want to iterate over entities A with inner loop that are on the same spatial plane as entities B. The entities spatial planes rarely or never change, so my first idea was to subscribe both with a state component to a dynamic list which I can iterate over. Somewhat messy. Could sharedComponent solve this? I need to iterate A inner loop B, with matching sharedComponents then, anyone know if possible on first glance?
yes, with sharedcomponent you should get every entity with matching sharedcomponent state into a separate archetype. Does that work with ComponentsFromEntities? I'm not sure. Idk how else you'd do the inner loop?
I have not worked enough with the archetype/chunk specific stuff yet to know if it has an equivalent that would get you said list
well, array
Hmm, I thought I could do IChunk with NativeArray of the other loop, but seems I can't access SharedComponent of the chunk...
So one tag per spatial plane might be the solution then, unless they're arbitrary
They are sort of.
So, i am making a system that makes space ships to raycast forward and store the results to a DynamicBuffer, so my question is this, my Dynamic Buffer has 10 buffers, so lets say my raycast system stores 3 of them to this Dynamic Buffer, i will be processing this results later on, on a different system but how that system will know that there is only 3 'usable' results in that Dynamic Buffer, will bad things happen if i process more than 3 results ? I know that i could just clear dynamic buffer and store raycast result, but i was wondering if i can do it without it
i mean i could check if element is null if it was a class but its not, its a struct.
Why don't you want to clear it?
well i am clearing it right now π assuming clearing takes a little bit time i was wondering if i could do it without clearing
public void Clear()
{
CheckWriteAccessAndInvalidateArrayAliases();
m_Buffer->Length = 0;
}
yeah, that's about as cheap as a clear can be π
π
@remote coyote This is most likely how I will solve it this time if this works in practice, I basically have a duplicate of the shared component as normal one to check for index 0 of all chunks
https://pastebin.com/4Ri9j0VY
ofc with the typo of character chunks x)
thanks for sharing Jaws
right, so it just becomes a double for loop over the same chunk array?
well, in practice
ah
I see the comments where you set up the entity queries now Jaws
they're not actually meant to be identical, just wip
Yeah, just some fast mockup, also 39 should be "var characterSpatialChunk = characterChunks[k].GetNativeArray(spatialDataChunkType);"
Hey I'm currently working on rotating my character when moving the mouse. So far in my System I change the rotation like so:
// Get the player position and direction, and change his rotation
Entities.ForEach((ref Translation translation, ref Rotation rotation, ref LocalToWorld localToWorld, ref PlayerTag playerTag) => {
rotationY += mouseInputX * mouseSensitivity;
var targetRotation = quaternion.RotateY(rotationY);
rotation.Value = targetRotation;
});
And this rotates my character. I also have a CameraSystem that rotates the camera to the LocalToWorld.Forward of the player and sets the camera behind my target.
protected override void OnUpdate() {
Entities.ForEach((ref Translation translation, ref Rotation rotation, ref LocalToWorld localToWorld, ref PlayerTag playerTag) => {
var targetPosition = translation.Value + new float3(0f, 1.75f, 0f) + localToWorld.Forward * -5.5f;
cameraTransform.position = math.lerp(targetPosition, cameraTransform.position, Time.DeltaTime);
cameraTransform.rotation = rotation.Value;
});
}
I let my CameraSystem update after the RotationSystem. But I see alot of stuttering when I rotate around. Any idea on how to prevent that?
Update it before TransformSystemGroup, thats where CopyTransformToGameObject works
hope that helps.
also for tag components you can use Entites.WithAll<PlayerTag>().ForEach, its pretty useful when you wont be reading/writing to that component but want to have it on entity.
Oh it is faster then I guess? Thanks I will change my Systems then. But updating my systems before the TransformSystemGroup doesn't change the stuttering.
It's wierd because I explicitly run the rotation of the character first and then change the camera. Also both Systems run on the main thread so the rotation should be set first before I position the camera and rotate it. Or mabye the camera is stuttering because I rotate and position it π€
Well i have basically the same systems, let me check. Also another thing, if you are only reading from a component and wont be writing to it you can use "in" instead of "ref", that way Unity Job Scheduler can schedule your job better since parallely reading doesnt cause trouble while parelly writing to something needs to be in sequence
but that might be the case, its better to position first then rotate
Ah also, if you are going to use "in", there is a rule in sequence, without ref or in is written first, then ref, then in
So i just checked my systems, my camera system is updating after player movement, both on main thread, and before transform system group, i set position first then rotation. I only had your problem because of the issue i mentioned, but it was gone after i solved that. Not sure what else can.
I am currently changing my systems to JobComponentSystems and make sure I use in and ref accordingly. Maybe it is something with the ComponentSystem. Ah one thing I'm interested in is, do you have a hybrid camera or a normal GameObject camera?
its a hybrid camera i guess, i do Convert and Inject, and yeah changing to JobComponentSystem is good, tho newest one is SystemBase.
Also, generally speaking usage of ComponentSystem is not advised, in their manual it says it should be only used for deugging and such.
Also, if you are running main thread on JobComponentSystem, please use AlwaysSync attribute, otherwise it wont handle dependency properly, and return default.
you dont need to do that on SystemBase
So if I use a private float rotationY outside OnUpdate() I cannot use .Schedule() or must use a local variable that is initialized. I gues it's .Run() then
Can you upload your whole system in perhaps a hastebin or so ?
looks good to me π€
Anyone got any tips to solve unity editor crashing when enabling burst?
The output closest to crash in log;
Streamed scene with 1167ms latency from VirtualArtifacts/Extra/3f/3f1b1f1066f812fbeaf6b316faabde75.0.entities
Streamed scene with 1428ms latency from VirtualArtifacts/Extra/2c/2c7bf465ff5de0f0a21e3849bab2353a.0.entities
Refreshing native plugins compatible for Editor in 3.81 ms, found 3 plugins.
Streamed scene with 301ms latency from VirtualArtifacts/Extra/15/15894e1cc5f38121db59e5bae2b3b34b.0.entities
Streamed scene with 585ms latency from VirtualArtifacts/Extra/d1/d13fd0061ae04b252dcc1c416d44d1f8.0.entities
A crash has been intercepted by the crash handler. For call stack and other details, see the latest crash report generated in:
* C:/Users/chris/AppData/Local/Temp/Unity/Editor/Crashes
Crash!!!```
did you just update your burst package ?
Same but maybe it's because of my camera being a pure GameObject. Thanks for your help π π it's good to see that my Idea seems to be right just gotta play around a bit more then
Not sure, haven't had it enabled for a while...
Well burst manual says that if you upgrade your burst you should close your editor, delete library folder and open your project
And C:/Users/chris/AppData/Local/Temp/Unity/Editor/Crashes is empty..
Might be that then
"f you update to a newer version of Burst via the Package Manager in your project which has loaded already Burst, you need to close the editor, remove your library folder and restart the editor"
Thats so strange π€ removing this fixed my problem.
UpdateAfter(typeof(CameraFollowTargetSystem))
can you check entity debugger and what order they update ?
I know I have to fix the names of my systems π
MovementSystem > CameraRotateSystem(Rotates and positions Camera behind player) > PlayerRotateSystem (Rotates Player along Y-Axis)
Hmm, I thought I could do IChunk with NativeArray of the other loop, but seems I can't access SharedComponent of the chunk...
@mystic mountain You can grab the index of the ISCD and use it for later look ups
@opaque ledge So I removed and recloned project, and this time I actually got crash report, still can't decrypt what is casuing it...
Stack Trace of Crashed Thread 28740:
0x00007FF981421EB0 (cf9b3d8952302bff45629d8fc2c95cc) FB3CA9C5D08E944A
0x00007FF981421703 (cf9b3d8952302bff45629d8fc2c95cc) FB3CA9C5D08E944A
0x00007FF98142136D (cf9b3d8952302bff45629d8fc2c95cc) FB3CA9C5D08E944A
0x00007FF98142117A (cf9b3d8952302bff45629d8fc2c95cc) FB3CA9C5D08E944A
0x00007FF981421030 (cf9b3d8952302bff45629d8fc2c95cc) FB3CA9C5D08E944A
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF644C7065E)
0x00007FF644C7065E (Unity) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF644C708BC)
0x00007FF644C708BC (Unity) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF644C71742)
0x00007FF644C71742 (Unity) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF644C5F7ED)
0x00007FF644C5F7ED (Unity) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF644C5FF4D)
0x00007FF644C5FF4D (Unity) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF644C61AA3)
0x00007FF644C61AA3 (Unity) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF644C66E36)
0x00007FF644C66E36 (Unity) (function-name not available)
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FF6451B1123)
0x00007FF6451B1123 (Unity) (function-name not available)
0x00007FF99A7E7BD4 (KERNEL32) BaseThreadInitThunk
0x00007FF99AA4CED1 (ntdll) RtlUserThreadStart
hmm, it says function-name not available, perhaps something with function pointer ?
mmm... if you can find the .dmp, then open that in visual studio sometimes you can get a more useful trace of the callstack. But if its coming from deep in unitys native land you might just have to comment things until it works again.
weird thing is it doesn't crash when built.
@mystic mountain you tried to de-reference an invalid pointer
Is it possible to lock the Rotation of the DOTS Physics Body? Angular Damping helps a bit but it doesn't remove it. I apply force to move my character and moving back and forth along the Z-Axis. This causes my Physics Body or Physics Shape to rotate along the X-Axis. Which makes sense but I don't want rotation on either Z or X Axis. With a normal RigidBody you could freeze Rotations along Axes can I do the same with the DOTS script?
look at physics samples there is limit DOF joint
Thanks I found it π
This may seem like a stupid question but is there a way to remove a dynamic buffer?
from an entity
doesnt RemoveComponent work ?
dont write DynamicBuffer when you are removing tho, so if you have MyBuffer : IBufferElementData, then do RemoveComponent<MyBuffer>()
I've loved using DOTS so far, but man is it ever unstable on macos. π¦
@stiff urchin How exactly have you experienced it being unstable?
Typically on play any entities I have get rendered as transparent in the editor or weirdly like a plane if you're too close..
Editor crashes on play about 30% of the time.
What version of Unity and Burst are you using?
2019.3.1f1 and 1.2.3
Do you also have the experimental "Enter play mode options" enabled? That's supposed to cause a lot of crashes
As for the other things, sounds like it's a problem with the renderer
yeah it's weird I can set it to ogl and its better in some ways and worse in others.
I'm looking at my play settings now
yeah the play mode options are all turned off
I think the number of packages I have installed also makes it hard for vscode and vs to compile.
resulting in me not having intellisense in either code editor
Yeah I think IntelliSense is still an ongoing thing with DOTS generally
I'm at least having some major lag issues with Rider
yeah vscode/omnisharp just flat out fails to load and visual studio lags and shows incorrect information. π¦
Yeah, but that's kind of to be expected with preview packages
Not really the main concern there
Have you also tested your project on Windows to make sure they are actually Mac problems?
yeah I generally have way fewer issues on windows
only I'm never at my windows machine.
lol
I have been using unity with parsec(game streaming) and it works pretty good for the most part.
just an inconvenience.
Hm alright. My teammember hasn't complained about any Mac crashes tho, so π€·ββοΈ
are you only allowed one Entities.foreach in a jobcomponentsystem or something?
no
I don't understand why it isn't running then, debug.logs work in jobs don't they as long as you have .withoutburst()
are your jobs depend on each other or independent from each other ?
Either way, you should probably use the debugger of your IDE instead. It's going to be a lot easier to debug with that
they are independent the first job is just running on the main thread so I can't pass handle's from one to the other
I hate using the ide debugger its to slow
Which IDE are you using?
Rider
I haven't had any problems with it
well I mean you have to set a break point and if you want to see all variables through a length of time you have to click through constantly
So your first job do Run() and your 2nd job do Schedule() ? Well it should work then, can you check entity debugger to see if both ForEach has a valid query ?
no second is run as well withoutburst
WithoutBurst or WithBurst doesnt really affect whatever ForEach runs or not, if burst fails it falls back to withoutburst i think, but it sounds like your 2nd job doesnt have any entity to run on, maybe thats why you are not getting log output π€