#archived-dots
1 messages ยท Page 94 of 1
IJobParallelForTransform
How do you manage to modify transforms in jobs and that anyone else is already modifying them?
I never dug into what the class does, but it works. Signature is:
public void Execute(int i, TransformAccess transform)
Then you can just write
transform.position = new Vector3(
I saw this in an ancient sample, before Burst/ECS was much of a thing ๐
Maybe is some kind of CommandBuffer-like thing
This tutorial series I think
https://www.youtube.com/watch?v=wTl1kss6QQw
This tutorial series will introduce you to the Unity Job system by examining how to optimise a landscape of cubes created with Perlin Noise. Recommend more t...
Anyways, I think that way to access the transform will be deprecated very soon ๐
Yeah i even though it wasn't supported anymore
well i'm fine with doing it outside of a job.. i can just.. access the GO right from the OnUpdate?
ugh how do I paste a codeblock in Disco again?
{
Camera mainCamera = Camera.main;
if (mainCamera == null)
return;
Vector3 cameraVector = mainCamera.transform.position;
float3 cameraPos = new float3(cameraVector.x, cameraVector.y, cameraVector.z);
Entities.With(query).ForEach(
etc.. ```
that should work just fine @winter veldt
This is from a ComponentSystem
ok cool! thanks
works great
@flat talon https://discordhelp.net/code-blocks
Code blocks are a useful chat markup feature in Discord, they allow you to highlight code, and color messages. This article teaches you how to use them in full.
@winter veldt you can also just parent the camera to another entity(as well as using CopyTransformToGameObject) and access that parent entity through a job if you ever wanted to manipulate it through jobs without messing around with its transform directly
Is it possible to check if entity exist in job?
Like, I have a reference to an entity in a component, and might want to add a component to it, I'd assume it's not safe to add component to entity that has been destroyed?
I think @rare umbra might be having the same issue @mystic mountain
Or a similar one
Realized I can solve it by checking a component I never remove from it..
@mystic mountain pretty sure there is a entitymanager is entity handle valid type call somewhere
not sure from within jobs tho
@mystic mountain yes it is possible by using Exists on ComponentDataFromEntity giving the id, but I guess you just figured that out ๐
btw, just asking. Its not possible to add/remove components while iterating, no?
not even on non-jobbed systems
yea afaik
If I'm understanding correctly you can do this by continously getting the "getcomponentdatafromentity()"-type functions
Atleast that's what I did for my thingie
So like you get the componentdata, add the component or any other structural change, things get invalidated, get the component data again after
Im doing this on the main thread though, not sure how itd work in a job
oh, not talking about that exactly
i comment about adding/removing entities while iterating
you are iterating a for-each or system of some entities, and modifying the entities you iterate
without command buffer and without barriers
for example you iterate all entities with a Health component, and if health < 0, then you set a Dead component
can someone explain to me what is DOTS animation? it is mentioned multiple time but i never see any article or documentation about it ๐ค
A package for doing animation within DOTS (ECS and such). That's all I know. AFAIK it isn't out yet, or if it is, it's very recent (preview).
ah i see, kinda weird that they mention something that isn't available yet.
which make me even more confused
@vagrant surge latest (or one of latest idk it has been a while) update added being able to add/remove during iteration/ForEach in non-job systems
jobbed still needs ecb tho
There is a super early version of DOTS animation on staging
the issue is fairly simple-ish. Take that you are matching component A, and adding B. And there are 10 archetypes that have A
one of them has A+B
you start iterating an archetype that is maybe A only, and add B
[0.1.0-preview] - 2019-07-30
Allow structural changes to entities (add/remove components, add/destroy entities, etc.) while inside of ForEach lambda functions. This negates the need for using PostUpdateCommands inside of ForEach.
was the version it was added in
Latest update was late June though
now an entity is moved into chunk of AB, and you risk double-exxecuting the entity
yea i don't really understand it but i remember people talking about it being a big deal
@remote coyote theres a non staging release, i couldnt get it to work though https://bintray.com/unity/unity/com.unity.animation
what is the benefit? is it more efficient to do during iteration?
a lot more so
its also a lot more flexible
the reason its faster is because you dont need all of the command buffer execution. You do the copy while iterating, when stuff is still hot in the memory
ahh i see
welp, i guess i better wait then
Ah nice find!
if you manage to get it working ping me ๐
you'll get ping in few weeks once Unity releases the updated package ๐ค
things breaking would be my educated guess
I'll gladly wait for them to make everything work nicely together instead of trying to learn from something unfinished that requires weird workarounds
well.. it still sort of requires some weird workarounds right now
and probably still does after next version
would need to come back in few years if one wants more finalized setup ๐
even if they do get the base entities package out of preview next year, it's likely to evolve a lot during upcoming years still
We have a commit!
Not very exciting though, sadly

At least we now know how to contribute properly.
Thanks goodness, there could have been all kinds of wacky pull requests!
How can I add a component to entities that have a specific component. But to set this in a normal GameObject?
You can use EntityManager and EntityQuery in a MonoBehaviour.
How can I create a query in a MB?
np ๐
I was trying to get entity query
But I guess thats the old way from these Unity Docs
Or unless that's in a ComponentSystem
(not mine, from earlier discussion about that)
Oh, that sweet sour taste of anticipation
Hahaha
And another day goes by.. ๐ข
will probably be last Friday in November, or first Friday in December, or last Friday in December, or first Friday in January, or...
just sucks because the more I build the more I have to change to accommodate changes we dont know. but then again, we signed up for this with prerelease software
Currently I'm in a position I don't know if I've done something wrong order, logic seems fine, but DOTS NetCode crashes on me - spend possibly 3 day debugging and possibly finding nothing, or wait for next release and maybe save that time x)
yeah, I wouldn't sit on the fence waiting for Netcode
I'm just doing other things that don't rely on it
That's what I thought too and took a look into the new UI Builder. Builder looks awesome. bad thing, the corresponding Panel Renderer just renders nothing during gameplay. Another spot to wait for probably ๐ฆ
is there a way to inspect this static method ? Unity.Physics.JointData.CreateRagdoll
i want to create my onw joint but can't see the source code
its in here https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/UnityPhysicsSamples/Assets/Demos/4. Joints/Scripts/RagdollDemo.cs
its part of the samples, not the package
What's the correct way to iterate through entities with X and Y component but not Component Z?
Like if I have run component, turn component, death component
and have a system that move's the target, for entities that have run and turn components
But when death is added, to stop move system from running
atm im just removing run and turn components when I add death
but dunno if that's the right way?
I think is better to have a Alive component
But there is an attribute to ignore entities with X component
Don't remember the name tho
at this point, I wouldn't wonder if 2019.3 release and dots packages landed at the same time
I think that's the expected thing Olento. That we will get the 2019.3 release and the new 0.2 version of the DOTS packages (along with Netcode and DOTS Animation) at the same time.
I was thinking about .4 for some reason
atm im just removing run and turn components when I add death
@civic bay you can either add[ExcludeComponent(typeof(MyComponent))]to the job struct or set aNonevalue on the query description passed into the job schedule._myQuery = GetEntityQuery(new EntityQueryDesc { Any = new [] { ComponentType.ReadOnly<Whatever>(), ComponentType.ReadOnly<SomeStuff>(), }, None = new [] { ComponentType.ReadOnly<MyComponent>(), } });
I have a NativeArray of entities of a query type, how can I add a component to just any half of the entities in this array?
I tried Slice() but don't understand fully how that works
I have the add component stuff all set up, but it adds it to every entity matching the query, just want it to add to 50/100 of the entities
Does it have to be perfectly even? You might be able to do if(rand.NextInt(0, 101) < 50) {add component }or similar
No not perfectly even, just average
Is there no way to split a NativeArray to another NativeArray with a set size?
Create a new NativeArray with a smaller size, iterate over it and copy values?
@civic bay
// 100 of something
var a = new NativeArray<int>(100, Allocator.Persistent);
// first 50 of em
var b = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<int>(a.GetUnsafePtr(), 50, Allocator.Persistent);
// middle 50 of em
var b = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<int>(((int*)a.GetUnsafePtr()) + 25, 50, Allocator.Persistent);
if you know what it's doing, and how the memory is shared between the array instances, yes
if you have no idea how it works, or what happens when you pass a pointer from one arrays memory to another... no probably not
yes
Awesome, got it thanks @trail burrow
np
unsafe
{
NativeArray<Entity> tenPercentOfEntities = new NativeArray<Entity>();
tenPercentOfEntities = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<Entity>(landedEntities.GetUnsafePtr(), (landedEntities.Length * 10) / 100, Allocator.Persistent);
m_entityManager.AddComponent(tenPercentOfEntities, typeof(TestTag))
tenPercentOfEntities.Dispose();
}
@trail burrow Hey I get an error with this, wondering if you could see what I'm doing wrong?
well what was the error lol
Sorry was playing it again to get it
also you should not tenPercentOfEntities.Dispose()
InvalidOperationException: The NativeContainer GatherEntityInChunkForEntities.Entities has not been assigned or constructed. All containers must be valid when scheduling a job.
How come?
Because it's persistent?
because the copy array doesn't own the memory
Ohh
Still get the same error though
As well as A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.
i dont have time to debug this sorry ยฏ_(ใ)_/ยฏ
@civic bay new NativeArray<Entity>() should have Allocator.Persistent arg; convertexisting copies the safety/sentinel, and your collection has neither so job detects it and gives u that exception All containers must be valid.
But NewNativeArray<> takes in 2 args
Entity[]
NativeArray<Entity>
length
Followed by Allocator
I suppose I could put the size in based on the % I want
for both of them
I'll try that
EntityQuery landedGlitterQuery = m_entityManager.CreateEntityQuery(ComponentType.ReadOnly<LandedGlitterData>());
NativeArray<Entity> landedEntities = landedGlitterQuery.ToEntityArray(Allocator.Persistent);
unsafe
{
int percentToFall = (landedEntities.Length * 10) / 100;
NativeArray<Entity> tenPercentOfEntities = new NativeArray<Entity>(percentToFall, Allocator.Persistent);
tenPercentOfEntities = NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<Entity>(landedEntities.GetUnsafePtr(), percentToFall, Allocator.Persistent);
m_entityManager.AddComponent(tenPercentOfEntities, typeof(ReadyToShakeTag));
}
landedEntities.Dispose();
This is my code now and still same 2 errors as above
InvalidOperationException: The NativeContainer GatherEntityInChunkForEntities.Entities has not been assigned or constructed. All containers must be valid when scheduling a job.
A Native Collection has not been disposed, resulting in a memory leak. Enable Full StackTraces to get more details.
@trail burrow Have you compared that method with using NativeArray.Copy ? That in the end does a MemCpy after a bunch of bounds checks
I always thought ConvertExistingDataToNativeArray() was mostly useful when reading from managed arrays?
But you can't copy to a smaller NativeArray<> than the current, can you?
you can specify index start in both source and dest, and how much of the source to read
so you would allocate a target native array with the smaller size you want, then copy into it from the bigger array
How do you specify the index start?
there are lots of overloads, one has 5 params: sourceArray, sourceStartIndex, targetArray, targetIndex, length)
It looks like ConvertExistingDataToNativeArray doesnt do a copy but simply uses the memory already present, ie copies the pointer
Wait, lots of overloads in what method?
CopyTo? or on the constructor for the NativeArray
Copy yes
Alternatively you could also use a NativeSlice, which seems to do a similar thing as using ConvertExistingDataToNativeArray
I tried to use that, but didn't seem to work how I wanted it to
Sorry if Im confusing your case JHulse, I'm just interested in what is the best way and in what case each is useful
If you really want to copy the data into a new memory block, then I'd recommend using NativeArray<T>.Copy
If you just want a "view" into the existing memory, then slice or ConvertExistingDataToNativeArray() seems more useful.
Anyone please feel free to correct me here ๐
I wanted to get 10% of the entities with a certain tag, so I can add another tag to just that select 10%
So wouldn't copying the pointer be better?
Seems NativeArray.Copy works though
I'll roll with this and keep trying the ptr method, see if I can get that working
the Copy copies the memory, so if you modify that those changes wont be reflected in the bigger array
I use it when combining things and splitting data apart
thinking about seperating rendering from simulation, dots physics atm modifies Translation directly but would be nice to be able to run simulation at a certain framerate (e.g. 30 or 60) while rendering goes at whatever the refresh rate of your monitor is, interpolating between physics positions. i assume this is pretty common
can't decide wether to use either
- seperate Entity for rendering, holding its own Translation + mesh + a reference to the physics entity that has the 'real' position
- keep everything on the same Entity, but make a new component like InterpolatedTranslation and use that for rendering (would be writing own rendersystem anyway)
what would you guys do
afaik to run things at different rates they need to be in different worlds no? Or you mean not tick the component systems every frame?
I know Unity is working on adding more support for that (running different worlds at different rates)
my plan was to just leverage ComponentSystemGroups, default world is already split up into a SimulationSystemGroup and a PresentationSystemGroup
not sure if they support different rates atm, but should still be possible to turn off autoupdate and call update manually from somewhere else at different rates
not sure if that's better than seperate worlds, but presentation systems would be constantly getting data from simulation components to represent so i feel like same world makes sense
Yeah that was my worry as well, you'd constantly be copying data between the two. But this is one of the cases they have stated for having multiple worlds at different tick rates, game logic vs rendering.
I haven't done anything like this yet though, but people on the forums have been discussing it.. have you tried searching there?
@hollow sorrel the multiplayer NetCode already does simulation at fixed rate, and rendering at framerate
how do they do it? seperate worlds?
also while i'm definitely interested in that too and i'm glad you brought it up, the tl;dr of my question i guess is more:
is it better to split components into multiple entities (such as 'render entities'), or is it better to have monolith entities that hold everything
leaning towards the 2nd because i feel dependencies are kinda anti-ecs if they can be avoided, but i think that also means there'd be a lot of chunks by how dots handles archetypes
@hollow sorrel split is generally better if you are editing them commonly
the cost of add/remove components depends on how big your entity is
and if you add/remove lots of different things, there is kind of an explosion on archetypes
so in this case, it depends if your entity is going to change commonly or not
ahh i see
for my experiments on c++land with my own ecs that copies unity, i have a clear separation beetween the render entities and the game entities
so on the game i have game object with physics/logic/states, but it just points into a "dynamic mesh" entity that is basically transform + bounds + mesh
does unity already do that? ๐ค
on the ecs renderer
not sure but i don't think they use a different entity
only a sharedcomponent to hold the material/mesh iirc
thats fragmentation nation
i thought of doing that in my engine, but it was a terrible idea
loading any sort of game map would end with 999999 archetypes
and crazy fragmentation
ahhh
what happens memory wise tho when you reference them? i assume for each entity that is iterated you do another lookup to the referenced entity's component using the entitymanager
or is there like a smarter way to get all references
current DOTS multiplayer has everything in one world, they use two additional components for interpolated rendering.
in my case i was using change detection through version ids and the like
so i had a system that checked if transform changed, and updated render objects
for static objects you obviously dont need that
but for dynamic game objects...
i havent checked the code of the hybrid renderer, probably should
yea makes sense
i think for hybrid renderer they also filter changed objects
saw something like that at least
btw i feel it makes sense to put the reference on the rendering entity to the simulation entity since that's where the data comes from, but what if you delete the simulation entity and want to delete the rendering entity
would the rendering system just constantly check if the referenced entity is still alive
no,there are tricks for that
unity has system state components that are precisely designed for this
ah yea i forgot about those
but then they'd both have a reference right
simulation entity a state component to the rendering entity, rendering entity a normal component to the simulation entity
just making sure
no, no need
the system state component holds a reference to the "render proxy" entity
when the game object gets deleted, the system state component gets "orphaned"
you can iterate orphaned SSCs
so you iterate those orphaned sscs, and then delete the render proxies they are pointing to
i havent added system state components to my own ecs, but i absolutely want them for things like this
yea but the render proxy still holds a reference to the entity with the state component right
yeah. But when the entity gets deleted, the state component gets orphaned, so then you delete the proxy
makes sense
thank you, this helps a lot
and @mystic mountain ty for letting me know about the netcode, i'll check out how they do the different rates
hey all. i have a question about getting components and component data from entities. is there a way to get the components from a given entity? like for instance, if i save an entity in a component, can i then get the entities position data from it somehow?
Use EntityManager.GetComponentData to get the data from your first entity, then again get the position data from the entity referenced in your component.
new 0.2 version of the DOTS packages is out /o/
don't play with my heart
But no netcode yet (since it's in his own package)
Wait, for real?
Wat
Well netcode always was in the multiplayer git repo
But let me double check
Not seeing anything related to that
So will need to wait the specific netcode update
Still, there is a lot to process in that update so enjoy
and here i was beginning to gain acceptance of a long wait!
it really is out ๐
seems new entity gets automatically created in default world now that keeps track of time
might be related Time` is now available per-World, and is a property in a `ComponentSystem
oh 3 mins ago i got "changelog not available offline"
oh prob cuz i still had compile errors nvm
Oh my god
The build manager is sexy
Well.. time to do some major digging haha
I figured if I started doing some large refactoring with manual labour dependent on current DOTS stuff, which I know I have to redo when they release new package, then they would release the new packages in a day or two, but I didn't expect the same day ๐
Yikes, good luck!
It now requires the scriptable build pipeline, thats new
https://pastebin.com/6RZdyDMG changelog for anyone unable to download it
Thanks bro
looks like samples have been updated too
@digital scarab oh hey since you're here, was wondering if you knew of any long term plans for the physics system to use more of the transform system components?
alrighty thanks, will ask on the forums
Are there separate system groups for Update and FixedUpdate?
aww yiss, finally โค๏ธ
this looks interesting https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/ECSSamples/Assets/StressTests/HybridComponent/LifetimeAuthoring_HybridComponent.cs
oh wait maybe i misread the code there
yeah forget that
really? I was planning to do something else but guess not ๐คท๐ผโโ๏ธ
Why this new sudden restriction? InvalidOperationException: Cannot add more than 8 SharedComponent to a single Archetype
in what cases would you possibly want that many shared components? Ive used like a max of 1 or 2 ๐
not sure how i feel about that [ConverterVersion(string username, int version)]
if i understand correctly we're supposed to increment that every time we change a component or authoring so that subscenes rebuild?
Is there a way to not schedule a job if your data isn't ready?
@flat talon its more that its odd to suddenly have this limit. If I want to have lots of chunks.. why not
@prisma anchor don't call Schedule()? ๐
they had to put a limit, Mike went into it somewhere. Cant remember if it was for perf or API reasons
Interesting stuff, I wonder if
* Duplicate component adds are always ignored
* No exception is thrown when re-adding a tag component with `EntityQuery`.
will allow duplicate Tag/Component adds without exception throwing all over the place? That would be neat! : )
@worldly pulsar it complains that i didn't return a job and just returned input deps
HYPE
hardcodednumber: Combine your new job with the input deps and return that
an empty job?
ie just pass the deps into your schedule method and return the job handle for the new job
i imagine * Duplicate component adds are always ignored means it won't be added
I see. thanks.
ah sry, didnt see you didnt want to schedule a job.
correct.
you can just return the same jobhandle that's passed in as param i think
btw can you explain how your "data isnt ready" ? is it being prepared by another job? if so, add that job as a dependency?
it complains that i didn't return a job and just returned input deps
Wait what? What's the exact error? I'm 90% sure I did return inputDeps before and it didn't complain.
I'm trying to recreate it, gimme a second
oh wow
they did release them
better grab local copies to cache before they wipe them for whatever reason ๐ค
cant see the new animations or network packages though, Im sure they will follow shortly
yeah they are not on the bintray yet
only entities, jobs, hybrid and collections
missing physics update as well
good enough for me for now ๐ there goes the weekend ๐
On an unrelated note, I'm getting this error ArgumentException: A component with type:GameBoardData has not been added to the entity. However, in the entity manager the entity does have the type GameBoardData
hmm physics is weird, they did promise last time to keep that in sync
it's not given that physics does require a bump
you'd expect it tho due to bigger api changes
beta 12 out as well, crashes my project as soon as I try to open it ๐ฆ better stick with 11
I haven't had issues with b12
did you wipe library?
I mean I get random crashing very often when upgrading the engine version for old projects
@digital scarab any word on the anim and netcode packages?
ah
is there going to be physics update for this?
or is the current version fine?
with Entities 0.2?
ok, thanks for the info ๐
ah good point, I'll try wiping library
Thanks @flat talon @worldly pulsar I was doing it wrong lol. Its working now
oh hey ๐
## [Entities 0.2.0] - 2019-11-22
**This version requires Unity 2019.3 0b11+**
### New Features
* Automatically generate authoring components for IComponentData with IL post-processing. Any component data marked with a GenerateAuthoringComponent attribute will generate the corresponding authoring MonoBehaviour with a Convert method.
* BuildSettings assets are now used to define a single build recipe asset on disk. This gives full control over the build pipeline in a modular way from C# code.
* BuildSettings let you attach builtin or your own custom IBuildSettingsComponents for full configurability
* BuildPipelines let you define the exact IBuildStep that should be run and in which order
* IBuildStep is either builtin or your own custom build step
* BuildSettings files can be inherited so you can easily make base build settings with most configuration complete and then do minor adjustments per build setting
* Right now most player configuration is still in the existing PlayerSettings, our plan is to over time expose all Player Settings via BuildSettings as well to ease configuration of complex projects with many build recipes & artifacts
* SubScenes are now automatically converted to entity binary files & cached by the asset pipeline. The entity cache files previously present in the project folder should be removed. Conversion systems can use the ConverterVersion attribute to convert to trigger a reconversion if the conversion system has changed behaviour. The conversion happens asynchronously in another process. Thus on first open the subscenes might not show up immediately.```
* Live link builds can be built with the new BuildSettings pipeline.
Open sub scene
* Closed Entity scenes are built by the asset pipeline and loaded via livelink on demand
* Opened Entity scenes are send via live entity patcher with patches on a per component / entity basis based on what has changed
* Assets referenced by entity scenes are transferred via livelink when saving the asset
* Scenes loaded as game objects are currently not live linked (This is in progress)
by assigning the LiveLink build pipeline
* `Entities.ForEach` syntax for supplying jobified code in a `JobComponentSystem`'s `OnUpdate` method directly by using a lambda (instead of supplying an additional `IJobForEach`).
* `EntityQueryMask` has been added, which allows for quick confirmation of if an Entity would be returned by an `EntityQuery` without filters via `EntityQueryMask.Matches(Entity entity)`. An EntityQueryMask can be obtained by calling `EntityManager.GetEntityQueryMask(EntityQuery query).`
* Unity Entities now supports the _Fast Enter playmode_ which can be enabled in the project settings. It is recommended to be turned on for all dots projects.
* The UnityEngine component `StopConvertToEntity` can be used to interrupt `ConvertToEntity` recursion, and should be preferred over a `ConvertToEntity` set to "convert and inject" for that purpose.
* _EntityDebugger_ now shows IDs in a separate column, so you can still see them when entities have custom names
* Entity references in the Entity Inspector have a "Show" button which will select the referenced Entity in the Debugger.
* An `ArchetypeChunkIterator` can be created by calling `GetArchetypeChunkIterator` on an `EntityQuery`. You may run an `IJobChunk` while bypassing the Jobs API by passing an `ArchetypeChunkIterator` into `IJobChunk.RunWithoutJobs()`.
* The `[AlwaysSynchronizeSystem]` attribute has been added, which can be applied to a `JobComponentSystem` to force it to synchronize on all of its dependencies before every update.
* `BoneIndexOffset` has been added, which allows the Animation system to communicate a bone index offset to the Hybrid Renderer.
* Initial support for using Hybrid Components during conversion, see the HybridComponent sample in the StressTests folder.
* New `GameObjectConversionSystem.ForkSettings()` that provides a very specialized method for creating a fork of the current conversion settings with a different "EntityGuid namespace", which can be used for nested conversions. This is useful for example in net code where multiple root-level variants of the same authoring object need to be created in the destination world.```
* `EntityManager` `LockChunkOrder` and `UnlockChunkOrder` are deprecated.
* Entity Scenes can be loaded synchronously (during the next streaming system update) by using `SceneLoadFlags.BlockOnStreamIn` in `SceneSystem.LoadParameters`.
* `EntityCommandBuffer` can now be played back on an `ExclusiveEntityTransaction` as well as an `EntityManager`. This allows ECB playback to be invoked from a job (though exclusive access to the EntityManager data is still required for the duration of playback).
congrats on the release @digital scarab You guys must be so relieved to finally get this out the door ๐
I won't spam the rest of the changelog here, those were the new feats, rest has upgrade guide changes and fixes :p
Somewhat unrelated, but did anyone manage to get the "Generate all .csproj files" option to work reliably? It sometimes works for me, but even when it does, Unity then decides to regenerate the .sln again without all the package projects whenever I touch anything in the editor
Anyone else seeing a bunch of these on project load? its just warning, so should be fine :)
"Assembly for Assembly Definition File 'Packages/com.unity.entities/Unity.Scenes.Hybrid.Tests/Unity.Scenes.Hybrid.Tests.asmdef' will not be compiled, because it has no scripts associated with it.
UnityEditor.Scripting.ScriptCompilation.EditorCompilationInterface:TickCompilationPipeline(EditorScriptCompilationOptions, BuildTargetGroup, BuildTarget)"
does it change all the things again?
thanks @dull copper wiping the library got me into b12 ๐
@worldly pulsar i've had that issue too, and dropped it.
Dropping it is not really an option if I often need to read the Entities code :/
generate csproj? as in like for packages?
@worldly pulsar I've had mixed experience with it
I think wiping all generated stuff sometimes work
but not always
only way to reliably get the missing packages to solution is to place the packages as local packages on your packages folder
but obviously it's more pain to update them there
If somebody else runs into weird Burst issues, just restart Unity.
@hollow sorrel if the csproj are not on the game solution, you can't browse through those packages source code, or jump to it from your project
it's super handy
especially when figuring out how things work
where does one find this
it's in editor preferences I think
Alex - there's normally an error when you update the package, that the one you ran into?
some combination of restarting Unity, deleting all .csproj/.sln, opening a .cs file in Packages in editor and clicking Assets/Open C# Project works. You can see how this is annoying ๐
@hollow sorrel when it works you get this:
yup
ooooo
technically you could make two batch scripts that moved packages back and forth from your library/packagecache to packages folder and back
thanks, i've gotten used to F12 and clicking files manually in project window, but references don't show up because it doesn't know the entire csproj
yeah, you don't get further than metadata if you don't have the full packages there
@untold night I know, I just really don't like the IntelliJ IDE (mostly because their vim plugin is terrible)
so.. anyone know how to do that live conversion thing?
@safe lintel ```* Live link builds can be built with the new BuildSettings pipeline.
Open sub scene
- Closed Entity scenes are built by the asset pipeline and loaded via livelink on demand
- Opened Entity scenes are send via live entity patcher with patches on a per component / entity basis based on what has changed
- Assets referenced by entity scenes are transferred via livelink when saving the asset
- Scenes loaded as game objects are currently not live linked (This is in progress)
by assigning the LiveLink build pipeline```
these things need to be in subscenes for now
anyone here running beta 12 with HDRP 7.1.5? I have a weird thing where I create a Cube (GameObject->3d object -> cube) it emits light like crazy
i thought subscenes would show the live conversion in editor though(without needing to build?)
@safe lintel have you tried the Advanced/SubsceneWithBuildSettings sample on the DOTS sample repo?
it has some livelink confs by the looks of it
@flat talon since b5 ive had strange artifacts with the default material if its converted to an entity
thanks ill check that out
How do you make this BuildSettings asset ?
nvm.. found it, it was weirdly greyed out, but suddenly let me make one
where did you find it?
With the [GenerateAuthoringComponent], how can we run a GameObjectConversionSystem? Since the generated component doesn't seem to appear in the code editor, there is just no way to GetPrimaryEntity
why would you want to use both? Either you want the conversion to be automatic or manual?
You can still implement IConvertGameObjectToEntity as before
If you mean you want a converted prefab entity reference, I dont know of a way to let GenerateAuthoringComponent handle that since the component field is just Entity
Mmm, build out players with burst compilation disabled, throws an exception when the world is created
Could anyone help me verify this isn't just me?
The disabled checkbox unchecked in the Burst AOT settings? and you updated to 1.2 preview 9?
I'm on 2019.3.0b12, with the new entities package and whatever that relies on
Burst AOT has compilation disabled for all platforms
Things work fine in the editor, burst on and off
'Message': 'Burst failed to compile the function pointer `Void AddComponentEntitiesBatchExecute(Unity.Entities.EntityComponentStore*, Unity.Collections.LowLevel.Unsafe.UnsafeList*, Int32)`'
'Stacktrace': ' at Unity.Burst.BurstCompiler.Compile[T] (T delegateObj, System.Boolean isFunctionPointer) [0x000f3] in <3e635592c8244e9c835505c46070ed2f>:0
at Unity.Burst.BurstCompiler.CompileFunctionPointer[T] (T delegateMethod) [0x00000] in <3e635592c8244e9c835505c46070ed2f>:0
at Unity.Entities.StructuralChange.Initialize () [0x00000] in <71559f61f83b471ca031f77599b51d27>:0
at Unity.Entities.EntityManager..ctor (Unity.Entities.World world) [0x0000b] in <71559f61f83b471ca031f77599b51d27>:0
Its not really telling me why it failed
did you check what version of Burst is installed? when I upgraded an existing project it didnt update Burst, but did for a new fresh project
@dull copper hmm that example doesnt show you the preview conversion results unless im not enabling a certain setting?
- Added support for managed
IComponentDatatypes such asclass MyComponent : IComponentData {}which allows managed types such as GameObjects or List<>s to be stored in components. Users should use managed components sparingly in production code when possible as these components cannot be used by the Job System or archetype chunk storage and thus will be significantly slower to work with. Refer to the documentation for component data for more details on managed component use, implications and prevention.
this is absolutely huge
really, really, really huge
@flat talon The only version in the PackageCache is com.unity.burst@1.2.0-preview.9
yeah thats the latest
Just to check, have you done a standalone player build on this machine before updating to 0.2? Just wondering about the VS SDK prereqs
@vagrant surge im a little confused how that differs from just using AddComponentObject?
I've certainly build standalone before, but I made sure the checkout of my project was clean
@safe lintel letting you store normal C# classes lets you do anything
you can point to OOP classes for stuff
its more than just the component object stuff
but couldnt you do that before?
no
component datas had to be struct
so no managed data types
now they can be class, and be managed
they will be much slower
and no burst support
but you will be able to interface with external things to the ECS much, much easier
but how is it different from the example here https://forum.unity.com/threads/combining-hybrid-ecs-and-pure-ecs.775709/#post-5185586 ?
is it just me or did Convert and Inject stop working (seems to also destroy now)
i think you use ConvertToEntity(stop) now, seemed to not destroy the gameobjects for me
actually you know what forget what I said, not really sure what the hell is going on here
@flat talon thanks, I just did not know it handled the whole conversion (thought it just created the authoring component for attaching to the object and nothing else).
workaround for the inject stuff here https://forum.unity.com/threads/0-2-0-preview-13.781937/#post-5204351
Yay I just saw the update ๐ time to play with it ๐
I just updated and I'm getting a compile error in the package:
ICompiledAssembly' does not contain a definition for 'Defines' and no accessible extension method 'Defines' accepting a first argument of type 'ICompiledAssembly' could be found (are you missing a using directive or an assembly reference?)
i found that not all of my packages updated automatically, so like had to manually update some things
hrmm it says everything is up to date here
i had a lot of trouble updating though, did have some prior package combination that wasnt compatible so i had to make a new project, add entities and the main packages manually, and then copy paste it back over to my main project.
and my project still is broken with the new inject behaviour ๐
"Convert and Inject" destroying the gameobject has to be a bug
Whoops
What I do anyway and think is a good practice is to use a separate object for the convert to entity and always destroy. If you need transform access add it in the conversion.
too much stuff to change if this is just a bug/oversight on their part personally but i see what you're saying
It would be nice if conversion happened before any system "on create" method ๐ข I find it nice to use oncreate for initialization and just found out that my converted entities were not created at that point.
"Convert and Inject" destroying the gameobject... damn!! Breaks everything on my current project... ๐ฆ
youre not alone ๐
Where exactly are these Fast Enter playmode options? Do they mean disabling these guys?
Thanks, I wrongly assumed they added new options with the new .02 entities update but it just means they support it now. Man, this is fast.
oh what is this? version 0.2.0 is released
why yes, I do want to try the update at 2am
@night cargo i've found that annoying also, especially if you have a filter on the system because then OnStartRunning will be fired repeatedly. But i guess the conversion has to be considered async since it can happen at any time (e.g. addressables intantiating objects with conversions)
"Cannot find the field TypeInfos required for supporting TypeManager intrinsics in burst"
Canโt wait to get my hands dirty with 0.2, now conversion of any type is supported? Like Cameras, Skinned Mesh Renderer, etc?
has anyone gotten this error?
i deleted and rebuilt my library folder but it didnt seem to help
"InvalidOperationException: Burst failed to compile the given delegate: Void InstantiateEntitiesExecute(Unity.Entities.EntityComponentStore*, Unity.Entities.Entity*, Unity.Entities.Entity*, Int32)
attribute: Unity.Burst.BurstCompileAttribute"
i get this too
checked all your package versions and editor version are latest? to rule out caches you could try making a fresh new project and see if the issue still appears.
yup i checked, editor version is 2019.3.0b12, packages are all updated
@onyx mist make sure burst is on the latest preview package, not the latest verified
1.2.0 right?
it should be preview.9- 1.2.0, yeah
yup im good there
try rebuilding your Library, I was getting that error before but I'm not sure exactly what fixed it
I'll try doing that again
ok i think that did it!
whats your error
might have to manually add packages to the json, mainly properties 10
@hollow sorrel i just gave up and realized that i'll wait for ecs/dots to be some resemblance of stable before i poke it again
i just cba to fiddle with it to make it work anymore lol
๐
though imo entities 0.2 seems pretty stable so far apart from the gameobject inject issue (which has a workaround but i hope they fix it before 0.3)
didnt seem to have breaking changes for existing code either
@digital scarab eh... nice backhanded comment lol.
Getting some type of compilation error when i import it, and a friend had some issue with burst throwing an error on some internal job in the entities package i think.
And I can't be bothered to figure stuff like that out by hand, when I install a package for the engine I'd like it to just work without having to go through manually figuring out if there's missing references, etc. and patching .json config files by hand
yea i think thats fair
Well. I tried to install entities 0.2-preview, something doesn't compile inside of it. I don't know what it is, and I can't be bothered to figure it out.
@digital scarab will have to be later, gotta deal with the kids now (Saturday morning and all)
@digital scarab any chance the GameObject Inject/Destroy issue will be hotfixed within like a week or two?
@digital scarab I do feel that Unity should be more agressive on clearing the library cached things on package upgrades as that's like source of half of the issues people have with the updates (not just with dots but in general)
making people wait more when they upgrade things is lesser bad than stuff straight up throwing random looking errors at people
right now it feels like library conflicts are not dealt at all
I'm quite used to clearing the whole library folder as first step when things do something unexpected right after any update in Unity because that stuff simply does not work like you'd expect
I do stress that we, as users, shouldn't need to clear Unitys cached data manually
as long as package manager has been around, this has been like number one issue with new people or people in general who started disliking the package workflow in current Unity
@dull copper clearing the whole library folder is like a no-go when you have a project which takes 12+ hours to import lol
people new to this stuff will not know this either
that's not a solution
yeah, this is why Unity should do it for us selectively
clear things that got removed from manifest and only then get things in that are added
I think they kinda try to just replace some things but don't cache things they already found which would cause some random glitches after the upgrade
@trail burrow clearing only code and package related files wouldn't take long tho
and these are all separated there
I wonder if the new asset database system handles these things more gracefully
it's enabled by default for new projects on 2019.3 now I think
Re-import of project takes 3 days here ๐
but somehow I feel that the issue is mainly in the script assemblies
with SRPs there can be some issues with cached shaders too I guess
Be free rage and anger! An update has summoned thee and it is inevitable! Mean while... I am getting McDonald's whilst I await forum answers 
@solar ridge I'm not angry... lol
I'm just tired of installing updates, getting errors and having to dig through the forums to figure out how to make it work.
Whilst that I understand 100%
It's getting a bit long in the tooth, while yes it's in 'preview' for now
It is a mixture of a lot of things
/join #502893580512395264
It's supposed to be stable at 2020.1 right?
1: Beta of the editor, 2: preview of the package (of a preview almost) 3: they likely were still feeling rushed as it went Waaaaay past their intended drop date
Nobody wants to preview anything, if you can't even make it run a little bit, nobody wants to give feedback to unity if feedback is always ignored.
Having it drop on a friday evening (copenhagen time at least), it feels like someone pressed the release button by mistake lol
- as Topher said, the package manager itself might be a source of issues
You never release on friday evening lol ๐
I was surprised to see it today infact
Releasing on friday evening is either crazy, or you have a 7 day work week
(I went to sleep early so didnt see it until this morning) but yes. It is indeed odd
Also @dull copper I didnt see your ping before now. Feel free to DM. May not be able to help though ๐ as I need foooooood
@digital scarab what may we use instead of removed PlayerLoopManager.RegisterDomainUnload?
I meant, it is removed in 0.2
Sorry I mixed up these two, PlayerLoopManager has been removed so we cannot use it anymore.
Any alternatives to receive a callback in proper order of shutdown?
Thank you. It was very handy to subscribe on it and call something before or after shutdown (example: free resources or dispatch IO events)
Okay, thank you, yes I followed that it uses GO internally. I will try to replicate the behavior.
https://puu.sh/EHKO4/5f34a2d76e.png How come the last line gives me nothing? https://puu.sh/EHKOC/90f86f2ac7.png their rel[0].person is definitely set as shown here.
am i using something wrong?
ive done a few checks and mother is definitely null
You're not showing all your code...
So how do you know you get nothing?
commandBuffer.AddComponent(i, mother, new dfdf { });
i did tests such as this
checked the mother entity and they had no such component
DynamicBuffer <Relationship> motherRel = relBuffer[mother];
doing this (which is the main reason i need the mother) gives me a null reference exception
Well, for starters have you checked your Job is running?
And if you printout the entity from the job?
Your CB is properly created and handle added?
oh nevermind my silly brain forgot the commandbuffer doesnt immediately do things
so yeah the mother is definitely not null
DynamicBuffer <Relationship> motherRel = relBuffer[mother];
the issue is this line then
oh i didnt set the buffer from entity...
i was refactoring my code and forgot to put it back in
silly me
thanks for your time jaws i appreciate it
important post
https://forum.unity.com/threads/performance-overhead-of-dots-systems.751823/#post-5205242
tl;dr you can now run ForEach lambda on the main thread from a job system and it'll be bursted + using codegen so 0 garbage alloc and without the overhead from scheduling a job
useful for systems with few entities
What renderer is everyone using with ECS and Hybrid? I thought HDRP was the recommended one, but Im having massive issues with it now and everything is very slow (starting/stopping play takes ages)
Make sure to turn on the fast playmode
under Editor in the project settings
alllll the way at the bottom
yeah I did, didnt matter
new project in beta 11/12, upgrade packages to 0.2, add HDRP 7.1.5, new scene.. add cube = glow of doom. And even with an empty system the start play is like 5-6 seconds.
Playing around with the old default renderer now, muuuch faster there
Intersting
I have the HDRP loaded up and getting nothing like that, but I don't doubt it is happening ๐ฆ
new project or existing one you upgraded? Can you try for me "new scene" and add an empty cube? (via the menus)
Im using whatever the beta ships with
the last time I tried loading HDRP from packagemanager (a month or 2 ago) everything died
7.1.1
updating
as nothing in the new scene is causing anything awry
oh you using 7.1.1? interesting point! previous I had to update to 7.1.3 (which was broken) and then 7.1.5
maybe 7.1.1 works with 0.2 entities
Nope
Still loads fast
Now. FPS is interesting when moving the camera
No idea what is going on there
Scene
@solar ridge At least the bloom is gorgeous ๐
It looks MUCH better than it used to
yeah
their default processing was Baaaad before
bad doesn't even begin to describe it lol
start and stop is the burst compilation
where exposure was 10x more sensitive
oh this wasn't scrolled down
only like one hundred and second time
it's such a poor UX
it should warn you are not scrolled down if you start typing in the past view :p
I tried to get them to fix this few years ago but they didn't care as they think it's fine this way
... why is the editor loop ~60ms per frame???
haha you getting the same glowie cubes as I then
I'll stick with 7.1.1 since that seems to work with beta 12 now
hm
I add a cube and get this in b12 ๐ light probes or some debug stuff?
Yes. That is normal
only appears when I select the cube though. Never seen that before
That is where it is in the light probe group
Which probes to pull light samples from
new scene -> add cube = bloom of doom
no
Empty scene with no light.. default cube, new project
anyways, not really related to DOTS.. hdrp just seems broken for me somehow ๐
./facepalm.. Guess I have a lot to learn about the new SRPs ๐ I was worried this was the hybrid renderer breaking somehow
Nope
cheers!
So on the default scene
turn off the post Process volume for a trip ๐
It is specifically the exposure helping here
this gives you the light in / out of a cave effect
yeah Im used to auto exposure in UE4
That is a setting ๐
has anyone gotten the per-instance material params working? I know they're not in the release notes, but for example:
[MaterialProperty("_Color", MaterialPropertyFormat.Float4)]
public struct MaterialColor : IComponentData
{
public float4 Value;
}```
are those new?
yes
thats what I thought. Somewhere on the forums a long time ago it was mentioned the next release should support this
wonder why they wouldn't put that in the notes since it's a pretty big thing
Ive tried both normal and hdrp and cant get them to work so far.. I just get a gray color when setting any value
maybe its not finished
ah
I'll make a forums post, see if they respond ๐
ah wait, found yet another checkbox
ooh got it working โค๏ธ
that new entity inspector thing didn't land yet?
looking at the updated ecs samples, what is joe converter? ๐
[RequiresEntityConversion]
[AddComponentMenu("DOTS Samples/IJobChunk/Rotation Speed")]
[ConverterVersion("joe", 1)]
public class RotationSpeedAuthoring_IJobChunk : MonoBehaviour, IConvertGameObjectToEntity```
lol
enjoy :)
https://forum.unity.com/threads/per-instance-material-params-support-in-entities-0-2.782207/
@dull copper the ConvertVersion attribute is because of the V2 asset database subscene saving. I believe once it detects a new version it will refresh the saved subscenes. Im not sure what the name param is for
๐
that will allow some very serious shanenigans
aye! its marked as experimental, so not sure yet how efficient this is
I've only done a few meshes so far
in previous versions you had to manually convert a subscene and the entities/components made through the authoring monobehaviours then get serialized
but if you then change your authoring component like if you wanted to add an extra component in your converter, it wouldn't automatically rebuild your subscene, so it'd still have the old serialized components until you manually hit rebuild
i'm guessing the converterversion is a way to tell unity "oi m8 this subscene changed so it needs to be rebuilt" if the version changed, and the username is prob a way to prevent conflicts. if 2 ppl both make a commit where version is changed to 3, git will think it's fine but they'll both only have their own subscene changes
but still i feel like there has to be a better solution
instead of manually changing the version attribute (and with a name on top of that)
ah yeah, that makes sense from the conflict pov
that said the only other way i can think of is by checking if an authoring type has been modified after recompile, which would involve a lot of magic and more assembly checking
recompile time is already long enough
@solar ridge the editor Ms thing might be the xr (inputs?) package, either removing or updating it should fix the editor gc issue(I only tried removing it which did fix it for me)
I have found it is something related to the fast playmode
if I build or turn off the playmode settings then it fixes it
WHich is weeeeiiird
did you try keeping the fast mode on but enabling for example the domain reloading? in that case, it could be something like a static field
Not having much luck spawning an entity that changes its color @flat talon
Interestingly the material I created the values won't change from full white in the editor nor will they change via the component :\
Can't seemingly change input color at all
Well. Scratch part of that. It works now, but still odd I can't change the instancedMaterial at all as a default
Yeah I noticed that too, something broken with the thumbnail preview perhaps?
Also performance dies after a bit
14k material colored entities was roughly my cap before it was not ideal for a player
anyone having issues with physics in the new update?
Didnt think Physics had updated to use the latest yet
i mean just using the old package with the new entities release
yeah that wont work really... ๐
A LOT of systems changed
I think you will need to wait for the FPS sample to really get it. (I THINK)
bleh kind of forgot stuff might need to be changed there too
what kind of issues?
from what i can tell, everything works except for manually overriding velocity
i don't think 0.2 really introduces any stuff that 'need changing' other than if you were abusing World.Active and were using bootstrap interface
so physics should be fine
I'm currently upgrading DOTS samples repos physics samples to latest hybrid, burst and entities
i'm also manually overriding velocity
is it working for you?
well i'm also using only kinematic physicsbodies but yea that is working
dunno about dynamic
is it just not changing velocity for you?
I'm getting burst errors
maybe your system order changed compared to before update
is your system using [UpdateBefore(typeof(BuildPhysicsWorld))]?
i always mix up when it's supposed to update tbh there's so many different physics systems to keep track of
but before buildphysicsworld works for me
ah that does appear to fix it
even samples don't seem to be unanimous in this
i've seen a system that does before buildphysicsworld, before physicsstep, and the kinematic charactercontroller does [UpdateAfter(typeof(ExportPhysicsWorld)), UpdateBefore(typeof(EndFramePhysicsSystem))]
kinda confusing
thanks @hollow sorrel
ok, upgraded lwrp to latest (I totally forgot to do this) and regenerated library
the few use case demos I tried from physics samples work as is with the latest entities and hybrid
odd, i was using UpdateAfter* BuildPhysicsWorld for another system prior to the update and velocity was being changed
*typo
yea not sure what the cause is
ooo burst appears to be working with commandbuffers
i also really appreciate being able to select entities and traverse a hierarchy or go to other referenced entities in the debugger, that is huge
Yeeep the command buffer change is nice
Has anyone been able to run a build out player with burst AOT disabled?
lots of stuff that didnt make the changelog, i already have the urge to switch every use of inject to the new companion gameobject system even though its marked as experimental and not recommended apparently
I'm trying to figure out if its just me
just tested briefly, project built but got console errors, tbh dont recall disabling burst compilation in a build previously so not sure if thats new or what happened before for my own project
what's the new companion gameobject system?
ah maybe my nomenclature is wrong but https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/ECSSamples/Assets/StressTests/HybridComponent
vague understanding is it just keeps the gameobject around but hides it away from the scene. i think it also destroys/instantiates the gameobject along with the entity
it keeps the gameobject around and the component you specify, i quickly used it for my camera setup so I can use ConvertAndDestroy while also having the camera persist with its associated gameobject(i think?)
it does say: Hybrid Components are an experimental feature, their use isn't recommended yet. but that kinda feels applicable to the entire spectrum
seems to be kinda the same as adding a copytransform or whatever it was called + a seperate statecomponent for destroying it when the entity gets destroyed tho
should i worry about making native(x)s too big?
simplifies the workflow for me at least, dont have to create some mumbo jumbo system to attach the camera via another gameobject that has to hook together to a pure ecs entity, it just gets kept on conversion and lives and dies with that same pure ecs entity
Thats actually cool
hmm looks like a good idea with sprite renderer ๐ค
i mean for that wouldn't you just have to add a convert&inject mono + copytransform component + a link statecomponent with a system that's like 5 actual lines to destroy the gameobject when the entity gets destroyed
so workflow is like add 2 monobehaviours once you get it setup
and you're still able to see it in hierarchy/modify it in editor in that case unlike the hybridcomponent thing
12ms for 73k sounds a lot better than doing it the old way at least ๐
Right... but with old ECS I had 200k at ~120fps
Well for me, also another system to find the camera thats unparented, some components to add as a tag to ensure it doesnt get double attached, possibly a linked entity group to ensure its deleted along with the other entities if they ever get destroyed, also the prefab camera gameobject has to be split from the other player prefabs and then with the current ConvertAndInject bug of destroying root gameobjects...
just switching over to a system that does: AddHybridComponent(camera); is way simpler
you could add the monobehaviours to the entity already so you could still run your ForEach(Camera camera) query like normal
@hollow sorrel @solar ridge loosing performance as you add features is pretty expected
I expected it... but 200k to 17k seems fairly drastic
@solar ridge this in a build?
This is not in build no. Neither was the 200k
17k is the last 60fps marker
worth checking against a build to see if it's safety check related (speaking of which, you disabled safety checks right?)
72k is slowly leaving 30fps
materialpropertyblocks aren't free but there's prob still room for optimization there
it wasn't even part of release notes so i wouldn't worry about it so soon
oh i thought you were changing colors
I tried that
That was 8k 60fps or so with 4 color variants
No material component results in the above
so the same code as before but now it runs worse?
So, uh
I'm wondering wheather I should switch to dots
What are the pros and cons of using it?
Is it hard to switch from the "old" system to dots?
The code itself on our side is no different. the new C# Renderer (RenderMeshSystemV2) is taking far longer than it was
@gusty comet at this point it's less 'switch' and more like 'augment' - dots can help cpu stuff run faster if you need it to but isn't yet a replacement way for doing everything
if you meant something like 'dstManager.AddComponentObject(entity, GetComponent<Camera>());' it wont survive the Convert&Destroy option
ahh yea that's worth making a bugreport for if it's a regression like that
@amber flicker
So I could use it for some things but do other things in the old system?
You can mix and match pretty well
but you have to be aware of what you are trying to mix
Not everything has to be an entity and vice versa
Is the hybrid renderer not compatible with latest dots packages?
Well, let's say I would like to spawn multiple object at the same time from time to time
Are dots better in that?
I get a bunch of errors after importing on 2019.3b
The hybrid renderer is actually made with the latest dots
Gotta reimport/restart the editor
@safe lintel no i meant convert&inject + the addcomponentobject
i'm just ignoring the convert&inject issue since that's clearly a bug but if we include that then i'd agree the workflow is pretty ass
usually fixes the issue
Ok let me try that
What are the various dots platform packages
Thats new to me
is DOTS Platforms just, all of them?
You needn't worry about those for now
That I believe will be the way they support builds of other systems later
ok
well i like not having to create extra code to handle the gameobject's life as well as linking to the entity its supposed to be attached to, and it simplifies the prefab usage in my case
i guess its minor in the end, but those extra steps it takes out was just really refreshing to have simplified given how much of it is usually adding extra stuff to replicate simple things from before
I know 2019.3 is beta, but how stable has it been for you guys
@gusty comet yes, it can be good at spawning - entities + IComponentData's have much lower overhead than gameobjects + monobehaviours... however, almost no traditional monobehaviour components are fully supported yet
that's fair
i do think it should be included
i'm just wondering what the difference is if you already did write a lifetime system for when it wasn't built in
btw any way to like force the csproj generation? i turned it on but it never did anything
this was asked a while ago too i think but i forget if it was answered
What I find the most interesting thus far: If the cubes are off the screen, they don't get rendered so the render loop skips them, but the presentation group still takes ~20 ms
If I purely just create an entity (no components tagged) then I can go WELL past 4million
@safe lintel just be careful to not use too much of the hybrid component workflow, apparently it's very slow.
Is it possible to add constraints to position/rotation?
after updating to the latest preview packages, is anyone else getting this error? it persists even after rebuilding my Library
@flat talon thanks, theres always a catch ๐
Object reference not set to an instance of an object
at Unity.Entities.CodeGen.TypeDefinitionExtensions.IsComponentSystem (Mono.Cecil.TypeDefinition arg) [0x00000] in D:\Projects\GAME\Library\PackageCache\com.unity.entities@0.2.0-preview.18\Unity.Entities.CodeGen\CecilExtensionMethods.cs:142
Have you made sure to restart the editor? And what packages do you have?
yup, restarted the editor (both before and after removing Library) - there's a number of packages installed... primarily supporting DOTS (Burst, Hybrid Render, Entities, etc)
I've seen that the various rendering packages (primarily SRP, I believe) can cause weirdness, but... That error seems very ECS specific. This was a project upgrade right? Could be some existing code that's incompatible with the new package, does a fresh project with those same packages work for you?
correct, this is a project upgrade - lemme give it a go in a fresh project
If a fresh project works, I'd go around each of your ECS-related files and fix any and all compiler errors (and possibly warnings), but also one by one comment them out, until it worked or I nothing left. Then work back from there towards everything working
i had to make a new project, import the main packages and then copy paste the manifest back to my main project to get it to work, though I didnt specifically encounter your error
Thanks for the insight guys, I had commented out my ECS code to get a starting point and still encountered the issue... so I'll keep poking around
may just downgrade and wait a week
well i think my dreams of hassle free companion objects just came crashing down, trying to use it in a prefab situation falls apart due to hdrp's [RequireComponent] on the camera.
Anybody got EntityCommandBuffer working with new entities update? Specifically in IJobChunk, ECB does not play back my commands.
I think I solved my problem, it is related to custom world bootstrap and default BufferSystem that was not initialized.
Is it possible to set the Collision Filter at runtime?
One concept I can't figure out is how systems are added to runtime. What constructs a new system?
There is an automatic default world bootstrap, it iterates on all systems in the project and adds them to the world, however you can disable it and initialize your world manually
Ok so by default it finds all systems in the project and adds all of them, interesting
How would I specify my own custom bootstrap
you can prevent automatic system adding
on project level by defining UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP constant in player setting
on per system level by adding [DisableAutoCreation] attribute
check what is inside DefaultWorldInitialization.cs
here is very old code to bootstrap a custom world, not sure if it is still works https://bitbucket.org/element_wsc/unity-ecs-world-bootstrapper/src/master/
ty
Is this currently the best resource for learning Unity ECS?
I'm coming from heavy Entitas usage.
- see pinned posts here
So, in this sample there are several systems which handle rotating cubes
How can that work if all systems are doing the same thing in a different way at the same time
Because the default bootstrapper loads all systems in the project in
I guess in each example, the components on the cube are different?
It's just weird to me that all systems in the project are loaded in
Even if they aren't being used for the current example scene being used.
What is calling DefaultWorldInitialization
[RuntimeInitializeOnLoadMethod( RuntimeInitializeLoadType.BeforeSceneLoad )]attribute on static method
if system has nothing to iterate on world not going to run it
Surely it's still existing in memory though right?
I can see a bunch of unused systems just sitting
Looks like AutomaticWorldBootstrap.cs called the DefaultWorldInitialization
it is ok to have a ton of not-running systems
This concept of scripts being loaded in that aren't in the scene is weird
nothing prevents you from initializing your world manually, automatic bootstrapper can't understand what in you project is related to which scene
What would be the correct way to initialize two separate words Client, Server with individual transform systems and renders? Entities 2.0 broke the workflow I had before.
Is every single system in Unity ECS called every frame?
Every system that is properly added to a system group in a world, that is run, yes
Which means that by default, yes, every system that is not disabled automatically (not entities to work on) or by you will run every frame
Assuming it isn't culled due to not finding anything that fits its query to run on?
You can override the behavior, though, either at system level or build the entire world-system group-system graph yourself
Ok interesting
Trying to understand this syntax in the lambda expression
Entities.WithName("RotationSpeedSystem_ForEach")
Why in WithName is it the name of the system as a string?
Uhh, where is this from?
The Unity system example
Probably the new example foreach
Yes'
Because that's a magic string, which seems... brittle
I don't understand why a string is used here
Probably magic
And why is the string the name of the system
But it says Entities.WithName
Why would an entity have a name of the system
I assume that's either a more advanced example (where they need magic to do magic), or not something we're supposed to take as an example
Check the source for the documentation for the string argument
Again, check the documentation for that argument/method overload, either in source or some documentation, if it is updated
But that seems to me like maybe it registers an index or something for potential future use?
It seems like might still be too early to start using Dots
Some parts, specifically simple jobs and burst, you should be able to use no problem
That isn't just an Entity, I think it's a lambda that does some magic to turn what's inside of that into jobified code.
Where can I find more examples of ECS systems? I found some online but they are outdated now.
It's weird but it's essentially a new speedy shorthand to skip a lot of boilerplate that's involved in making regular jobs.
ECS, however, is still very much in preview. You can do simple stuff, but for more complex stuff you got boilerplate and/or a lot of work ahead of you. The built-in stuff isn't quite there yet for (most) mechanically complex games.
Yeah thats cool. Just doing some learning for now.
But don't want to learn how this works then the whole syntax changes next year.
If so, it might be a generator, and the WithName might be the name of the generated job
That would make sense
Unity did have a bunch of examples of small simple games converted into DOTS https://github.com/Unity-Technologies/DOTS-training-samples/tree/larus-labrat-netcode
The key part to focus on now isn't the syntax, it's the pattern
I'm coming from Entitas, are you familiar with that?
Some of the examples I linked may be a bit older but the overall structure will probably remain the same
How do you make good components? What should be one? What about entities? How do you handle that in systems?
That example there is basically the same as what you'd previously do , but move the .ForEach() contents to the Execute of a job
And you can still do that
Which might actually be better for clarity, in some (many?) cases
I'm sad that example doesn't use nameof() though - it's literally in that same class, and nameof() is compile-time constant. Unless this is some mumbo-jumbo happening before that? They should be able to recognize nameof(x) either way...
I guess you could go argue your point with Joachim in the .02 thread
These sample projects are a bit of a mess
Giant folder with a bunch of scripts
Some of them are really long and probably need to be broken up into more classes. Did they do this because of some current limitation with the API?
This one has several classes and structs in a single .cs file..
Yeah thats cool. Just doing some learning for now.
But don't want to learn how this works then the whole syntax changes next year.
i've started learning from the first day, yes syntax changed few times for some things, but you can learn core concepts
Ok, that is good to know.
Yeah, let me reiterate: **The important part to learn isn't the syntax, it's the patterns and the way of thinking. **
That's the hard part, and if you got that down, and some basic google-fu, the syntax doesn't really matter.
I'm coming from Entitas
Entitas is not that low-level, it is not about cutting edge performance only about structuring data
Assuming that they promised to release first stable version in January right now is a very good moment to start learning DOTS, to be prepared right at launch day ๐
Ok nice. So the final product is pretty close to what we have now then.
I'm prepping for that new netcode 3rd person demo
Has there been any news on it
yes API should not change very much anymore
forum is the best place to monitor any announcements
0.2 hit yesterday and this is a BIG thing, i hope we'll get everything that was promised "with next release" very soon
Nice I will check out the changelog
Iโve asked this question in networking but didnโt get much traction so asking it again here.
Iโm building a game where inventory items are awarded and managed on the server and then syncโd with the client. Inventory shouldnโt be updating too frequently. At heaviest times every 5 seconds and on average once every 3-5 mins.
Iโm looking to represent inventory items as entities with Item Components (bunch of types) and serialized them on the server. Itโs important to keep the inventory in sync but itโs only ever one way (read only from client). I donโt need a dedicated server, Iโm thinking about using a web server. What stack would you recommend and is there anything that will make syncing with the server and local data via DOTS simpler?
0.2 brought changes but the syntax is mostly the same for the core bits of it
@rare umbra What we are doing is using a web api server built on NodeJS that acts as the middleman between the client and database
For the database we are using documents
And on the Unity side we are using an Asset called BestHTTP to build a web request and send/receive data in JSON format
Looks like this:
BestHTTP Web Request => NodeJS api server => MongoDB storage
On the Unity side We have web request entities/systems that take care of those web requests.
Not sure if its the best, but its working well for our use-case.
Is it possible to set 100 of the same entity but set the material colour of 0-49 to red and 50-99 to blue?
I can get the shared render mesh data of the entity and set the shared component data to the new colour, but this affects all entities of this type
And I can't set component data with Render Mesh, has to be shared component data? or am I doing it wrong lol
to do that you need Entities 0.2 and HDRP
@rare skiff Sounds like what Iโve been thinking. What do you do when you pull down new json data? Do you do clear all entities / components and create from scratch? Or do you do a version check and only rebuild everything if the data version on the server is newer? OR do you somehow do a diff and only create the data locally for the new data on the server? (Last one is what I think I should be doing but have no idea how to achieve this)
Right now we are just destroying and rebuilding the entity using the new data but in the future we will be able to just update existing because every object has a unique UUID.
Also we have an entity serialization/deserialization system that takes care of everything automatically
We have a component for each field in the JSON document
i need help in #โ๏ธโeditor-extensions pls help me\
So we deserialize the JSON directly into an entity with each field in the JSON as a component
i think its simple but idek
@rare skiff yep this is really similar to what I thought I needed to do. Glad Iโm not crazy. Sounds like a fair bit of work for me given that Iโll be starting from scratch. Might start with a basic dev and node server and API call and then just iterate from there. GUIDs would definitely help me know if I need to create the entity or not but it doesnโt really help me know if the entity is up to date
Your API server would have to inform the client which entities (by UUID) need to be updated and provide the new data as well
The API server would always know what is changing
@rare umbra
Yeah I need to look into RPC I think. I only have experience with request based server architecture
If you are doing a web based API server RPC won't work
This would be a REST API that you would access through a url endpoint with a json payload
RPC would be like a socket based game server
Right so I guess on the server you need to store some flag as to whether the data has been sent to the client or not?
As itโs only sent when requested
Or time stamp
Ok I think I see what you are getting at
Of course, time stamp is the way to go
If data changes we don't distribute that to clients
Not in real time
It sounds like you need more of a streaming solution
If you want to keep clients updated
Nah doesnโt have to be - it doesnโt have to happen often. Iโm planning to use this for an inventory system. Inventory can be a thousand items, wouldnโt want to destroy / recreate entities every time a http request is returned
Think Iโll just track what time items are added or updated and send down only stuff that changed since the last request
makes sense to me
And do requests every 20 seconds or something
When logging in just pull down everything, ignoring the time stamp
Actually I might send everything down every time and put the burden on the client to filter out unchanged stuff for optimization. This will make my server much simpler
Apparently the new [GenerateAuthoringComponent] has a "one component per file" restriction ๐ฆ
also kind of weird how the built in stuff doesnt have them ๐คทโโ๏ธ
I guess most built in components are supposed to be converted from the old-style built in components (Transform -> Translation+Rotation, Rigidbody+Collider -> all the physics stuff)
i suppose so, only noticed when I checked out the CopyTransformToGameObject etc stuff
I think the idea is with the new [ConverterVersion] attribute you never need to regenerate the cache by hand?
I don't suppose there's a way to set a ChunkComponentData on conversion is there?
Are they discarded if you set them in GameObjectConversionSystem? Never tried tbh
Hmm well the entities I'm converting wouldn't be discarded, but I guess I can try to do it in a conversion system - it would probably make sense to do so lol
Hi everyone. Does anyone can guide me about what's the best way to update a game object using ECS ?
I'm trying to let some cinemachine cameras to track a gameobject (or entity, that would be awesome). And i really don't know how to achieve that. So any guide or keywords will be useful
The examples that i found used ComponentArray or Inject, so they are obsolete already
Well. I did the opposite. The monobehaviour reads from an entity query and updates itself
// Serializable attribute is for editor support.
/// ReSharper disable once InconsistentNaming
[Serializable]
public struct RotationSpeed_ForEach : IComponentData
{
public float RadiansPerSecond;
}
What is the ReSharper ?
It's a Visual Studio plugin
i guess i shouldn't worry about it since I'm using VSCode
would that effect OmniSharp tho ?
no, these comments are specifically for resharper
ok got it, cheers
it's like #pragma warning disable 123, but only for resharper
oh i see, i guess it will auto scan the comments
// ReSharper ...
@worldly pulsar would you happened to know about ecs-physics-joints ?
nope, I've never used anything other than raycasts in dots physics
ok, thanks
pretty interesting post about the new generated jobs https://forum.unity.com/threads/performance-overhead-of-dots-systems.751823/#post-5205242
For low entity counts + many systems. This is now the most efficient way of writing that code. It uses burst for the execution, but does not schedule a job. Instead it uses the Burst delegate compiler to run the job directly on the main thread without going through the job system which at the moment has too much overhead when the code being executed is as simple as above and just process 1-2 entities.
indeed
this is going to confuse a lot of people tho
but yeah, it's temporary
but if you think about current state of DOTS, most things are temporary
what's temporary about it (with regard to what i posted) ?
Lets call this a workaround for now. The end goal is to make it unnecessary to type out [AlwaysSynchronizeSystem].
ahhh ok
you'd need some way to imply you want it to run on main thread tho
so I dunno how that's a real issue
I wonder if it would be feasible to run some tasks synchronized on same worker thread instead of letting the job system manage that, like to still have things out of main thread
also, if the job system doesn't really give gains on low entity counts.. I dunno... most games will have low entity counts and many systems
ahh i get it, they have to have this manual sync attribute becauise they're not using the job dependency system to complete dependencies.
so the most efficient way to use DOTS would then be to just run everything on the main thread still?
if talking about your gameplay code now that is
brute force systems like physics etc can definitely make use of the jobs
gameplay code is usually not the bottleneck tho
good point
the big wins are for rendering/physics/AI to be jobified
the fastest way is probably going to call the compiled burst function directly, which thread its on probably doesnt matter, just depends if you want it to block or go concurrently.
gameplay code is prob gonna be most of your game's codebase tho, right now the 'default' is using jobs but maybe it should be the other way around
my main interest on dots is being able to run custom physics code along with dots physics/havok, but I don't really have that many entities I'd need that custom math for, but I do have crazy amount of iterations between physics steps for my own stuff
this isn't really traditional gameplay code, rather extension of physics engine
which thread its on does matter tho because scheduling has overhead
I'm writing most code in ComponentSystems, because jobs were like 10x more code for 0 performance gain. But then I have like 200 entities total
but if you don't run your code through burst, you can't get determinism
@worldly pulsar they changed that in 0.2, now you can use same foreach syntax without adding a new job struct
I know