#archived-dots
1 messages ยท Page 23 of 1
hmm maybe i miss-read it
if there's a new attribute to add old behaviour then it wouldn't be that bad
somehow nothing in uitoolkit works out of the box ๐ i have display none/flex css and set it with ```private const string visibleTag = "visible";
private const string hiddenTag = "hidden";
public static void ToggleVisualElement(this VisualElement visualElement)
{
if (visualElement == null)
return;
Debug.Log($"VE: {visualElement.name} has display {visualElement.style.display.value}");
if (visualElement.style.display.value == DisplayStyle.Flex)
{
visualElement.RemoveFromClassList(visibleTag);
visualElement.AddToClassList(hiddenTag);
}
else
{
visualElement.RemoveFromClassList(hiddenTag);
visualElement.AddToClassList(visibleTag);
}
}``` the class add/remove works fine, that i already tested but the toggle doesn't. even when the VE has a hidden class the display will still show flex. in the debugger it shows display none.
do i have to dirty the VE or something?
oh! i'm not supposed to use .value
that's not it either. it just switched my condition to the always visible branch. "VE: shopOverlay has display Null"
they really differentiate between class style and inline style... i don't even ... WHAT
visualElement.resolvedStyle.display is the solution ๐ the pitfalls are real.
they are very different things ๐
of course they are ๐ but you need to read code to figure it out /// <summary> /// <para> /// Reference to the style object of this element. /// </para> /// </summary> public IStyle style { get { if (this.inlineStyleAccess == null) this.inlineStyleAccess = new InlineStyleAccess(this); return (IStyle) this.inlineStyleAccess; } }
i assumed style is the computed style. that's what every browser uses
whatever, one of those, once you know, you know kind of mistakes
now i figured that out my extension also works: ```public static List<T> GetActiveElements<T>(this VisualElement ve)
where T : VisualElement
{
List<T> tmp = new List<T>();
ve.Query<T>().ForEach((T element) =>
{
if (element.resolvedStyle.display == DisplayStyle.Flex)
tmp.Add(element);
});
return tmp;
}``` kind of useful to have. so i don't need to micro manage every element and can just query in appropriate situations
what does active mean?
displaystyle == flex is the same thing as saying it displays normally (as opposed to hidden); seems a bit odd to me until i read the docs:
there is now a RequireAnyForUpdate call that can OR between queries for this purpose
my IDE tells me quaternion.Euler cannot be applied with * operator
quaternion.Euler(0f, j * (360f / slices), 0f) * new float3(0, 0, 1)
is there a work around for this?
try math.mul(quaternion, float3)
thanks I will try
will there be an internal way to set up it all manually?
yep
nice
Are queried entities in order?
for example, if I make a job that gets all entities with component A, will the entities index be in order 1, 2, 3, 5, 11, 13, etc?
The reason I ask is because I want to adapt my small networking API to ECS and I need a way of mapping entities to connected clients
no
internally it gets chunks
and goes through them
entities can be in any order
damn, well... I guess I need to find another way to map entities to connections then
GameConversionSystems and the interface IConvertGameObjectToEntity are being removed in 1.0. This is a breaking change. I think we all knew this was going to be a breaking change but just thinking about all the work to refactor everything is ๐ ๐ญ
Convert to entity finally gone as well
URL
Thanks!
might be easiest
gameconversionsystems and iconvert are being removed 
huh? it's in the post. baker and bakersystems
it's just new api. mostly very similar
ah you mean specifically runtime conversion? yeah no idea either. seems we have to build entities ourselves. question is how it will work with HR and physics
I assume you don't
As in
Bake literally all possible prefab scenarios beforehand
And then just modify them
Hello everyone, I've been experimenting with DOTS (with ECS 0.51) since a couple of days and I'm trying to get an android build on Google Play. To do so I need to I need to add the "Android Export Settings"component to my build configuration but it's not available in the component list.
Anyone have any idea why it's not available? (I'm targeting android & have com.unity.platforms package)
hmm i think most of those build configuration settings were removed in 0.51
with the removal of the specific platform packages for android/ios/windows etc
Humm ok It may have been a part of com.unity.platforms package.android witch is now depreciated with 0.51. Any other known way to build an App bundle with the DOTS build pipeline?
does just setting this up via the regular project settings window not work?
NopI also need to build using L2CPP arm7 & 64 And it dont seems to work using the regular way.
you still have to build with build configs
but i thought most of the project settings stuff should still apply
(i haven't developed on mobile recently though and I know optimize on the forums had some issues with this in 0.51 for a little while)
It's seems to work Thanks! I tough it was a completely different pipeline and project settings didn't apply.
Looks like I got (part of) my wish

what was your wish
removal of ConvertToEntity component
yes but you lose the ability to link GOs for tracking without having to jump through a few hoops first
not sure i follow
if you want a camera to follow an entity, you can only do so (easily) from a ConvertToEntity GameObject, not in a subscene because the subscene is already processed
personally I hope they add a camera component so I dont have to rely on GOs for just that purpose
it's not that hard to set this workflow up in a subscene
but what i don't understand is, if you liked ConvertToEntity for this use
why are you happy they removed it?
it suggest they're making improvements towards not using GOs
Im all for a pure entity workflow
me too
i love patch notes like this Fixed a bug in Burst player builds where sufficiently complicated Bursted code could cause a deadlock deep within LLVM. it sounds so mysterious
historically it's actually a bit annoying because some of them have been my reports and it's hard to know if it's the fix
(pretty sure this one has no relation to anything i reported though)
I think 1.8 fixes an issue I reported a long time ago... maybe that was 1.7
what were the issues?
oh it was only released 12 hours ago
didn't really miss anything
For me at least, it had to do with really large static arrays causing burst to throw really weird and non-accurate errors.
oh i know the error you're talking about
yeah that should be fixed
not sure what version it was fixed in though
I was the first to report on it I think
not sure
It caused me so many headaches when I was working with proc gen
eventually, after testing the bug, I concluded it wasnt my code
lol we can never go by the patch notes date
It has been a while since I worked with Unity DOTS. What should I be aware of prior to choosing between these two Unity versions? Like any problems in Unity 2021 that Unity 2020 doesnt have?
I'm using 2021.3.10f1 and it works fine
(try build with il2cpp if you have compound colliders)
I don't, specifically for issues ill2cpp gives me regardless
Oh shit we can finally have compound colliders in Unity physics?
haven't compounds been supported for ages
Idk I remember something like that not being possible since the last time I played with DOTS
Nvm maybe I should first reorient myself in all this before talking nonsense
and when was that?
half a year ago i think
yeah, compounds have existed since the start
hmm i can see support in the original released package
Commits on Apr 3, 2019
com.unity.physics@0.0.1-preview.1
seems to support it
otherwise, their test projects would not work at all
Weird. Then it must have been something else, I just cant remember what it was. Something I really needed lol but couldnt be done (yet)
Ooooh
I remember
Moving the child colliders of a compound collider!
Like, you can totally do that with GameObjects and Rigidbodies
But with DOTS...hmmm...
oh yeah all colliders are baked in unity physics
you'd need to regenerate the collider
for now at least
What would performance be for regenerating each physics step you reckon?
(well no, you could edit the blob probably but it'd require unsafe code)
Maybe not too bad?
fine
I dont think I tried that yet
converts to a DOTS mesh collider
And I read there is... DOTS audio in beta? That correct?
it was planned, but for now it is on hold
yeah development on audio stopped a while ago
@sinful cipher https://unity.com/roadmap/unity-platform/dots
"Under consideration"... Hmm alright
an audio system isnt too hard to design, so I wont be surprised if they add it shortly after 1.0
once 1.0 is released, a LOT of doors will be opened
I presume this is referring to navmeshes and AI and such?
yeah see they even have working prototypes
Nice... I really want this to work out. This is exactly what was missing for me
I wont be surprised if OOP/mono is phased out in the coming years (5-10 maybe)
even if it doesn't, we still got the foundation to make whatever we want with it, mod it, etc because it's a package... effectively open source project
Hmm
right now it is an "addon engine"
Yeah I heard something similar is being developed for Unreal
yes, but as it stands it's not nearly as polished as DOTS
IIRC unreal also struggles with multi-threading
Seems DOTS is already quite widespread among AAA in-house engines, but not so much for public/licensed engines
DOTS is what unity is calling their ECS implementation
ECS has existed for a long time, its just now being valued since multi-core CPUs are widespread
8+ core CPUs will absolutely destroy with ECS
hell, my 4 core does incredibly well
I read that games as early as Deus Ex and Killzone 1 used ECS
ECS is just a design pattern
Yeah but like to me it was never immediately obvious why you'd go through the trouble of implementing it for a game
(until I opened up the Unity Profiler to see what was taking so long lol)
It was quite a shock to me honestly when I learned about how the way you code affects how well CPU cache is utilized and such and how much of a difference it makes
I had already been programming for quite a few years and no one told me lol
Here is an old test of my vehicles. 2k total vehicles, 100hz physics rate, with level 4 contact solving. You cant do that with mono lol
going to make a new test with all the optimizations I did
Oh so the cars are also like proper cars with simulated tires and such?
yep, significantly better than mono WheelColliders
proper lat/long friction, anti-roll, tire inertia, and eventually engine simulation
Nice. Mono WheelColliders are useless. Wont even work upside down (so no driving around on a spherical world)
they dont work regardless lol
lol
why they still exist, is honestly annoying
I dont have a nice recording but here's what I've been trying. Some kind of spherical world surface geometry streaming thing (although its not baked terrain, but generated from noise).
Reasonably performant, but not nearly good enough yet. Really made me respect what is being done by the proper studios that ship games with huge streaming worlds
DOTS isnโt just ECS.
Also a reasonably accurate aero sim. (No particle/vector grid yet though...that would be cool to do)
Been wanting to dabble in air vehicles for a while now
wanted to start off with a simple heli as they are significantly easier to design compared to a plane lol
I actually did a heli once lol
Just stuck a bunch of narrow plane wings on a rotating body and that did pretty well. Although I did have to "exaggerate" the amount of blades otherwise the thing would be very jittery
But what part of designing planes would you consider hard? The 'balancing'?
well, the proper air simulation aspect seems pretty daunting
I imagine it could be easily faked getting the normal direction by the plane of the air foils
max resistance for when their perpendicular with eachother
Oh here it is lol. This was way back before ECS though.
actually yeah, seeing the normals on the blades suggests it's what I should actually do
Yeah thats more or less what I did. Just a LOT of parameters
Yeah I really did simply use the same equations for the segments of a plane's wing for the rotor blade segments
And then angle the individual blades like one would on a real heli to steer it and go up and down
you could use a logrithmic spline that transitions the blade from one angle to another
Worked super well. As long as you did a decent job with the wing segment physics
But if I have to be honest: I kind of regret taking this approach, at least for simulating modern fighter jets.
this looks really nice - i'm curious what is level 4 contact solving?
Solver Iteration Count
Modern fighter jets really make use of surfaces at the front changing the airflow before it reaches surfaces at the rear. You can't really do that with this 'surface normal' approach. Or at least its not very intuitive, and definitely hard to do in ECS.
A particle/vector grid makes much more sense in that regard.
ah!
But that shit hard lol
you could always fake air flow
what sort of optimizations did you have to do, is it unity.physics?
air is going to flow in a pre-defined direction, so with a few params you could deterministically simulate airflow
Unity Physics, but in the video I used havok by accident
no optimizations yet
Yeah but endlessly tweaking like 20 wing parameters to get the behaviour it should have really starts to suck after a while. Like look at this Curve. It was done by hand. And I need one for the tip of the wing, the middle, the sharp leading edge, the vertical tail, the horizontal tail...
And thats just for 1 plane
I really want to just simulate it all and be done with it
And after all that trouble I dont even get airflow interaction between 2 wing surfaces
do you know of any external software that does simulations? I think you could export the curve data into a file and port that over to unity mono/ecs
There is something that will give you angle-of-attack vs lift and drag curves. Hold on,,,
you could then "animate" between the different air current directions
http://airfoiltools.com/airfoil/details?airfoil=naca23112-jf
http://www.airfoiltools.com/plotter/index
This is not the complete solution. Theres other software that takes a custom shape and outputs the curves
Details of airfoil (aerofoil)(naca23112-jf) NACA 23112 NACA 23112 5 digit reflex airfoil
Airfoil (aerofoil) plot of NACA 63-412 AIRFOIL with ajustable chord width, camber and thickness and full size print out
If you intend to make simple planes (classic '+' shape I guess ill call it) then your idea should be sufficient for good simulation
Yeah I dont need to recreate MS flight simulator lol
does everything you're talking about
But for some plane the airflow interaction becomes more complex. Here a vortex is created from the airflow before it washes over the main wing
(which is what Im interested in)
Then no need to bother with proper aero sim I guess
Surface normal trick like you suggested should indeed do
yeah but I will make it a little better than just a normal direction
Nope
I would suggest something like an AnimationCurve resembling something like these to start with. But thats up to you. Maybe you have something more suitable in mind
and then discord.gg at the front?
Ah yes got it
I'll just dm you the link kek
no its alright i got it lol
ah ok lol
what is that? something dots physics related?
no for anything physics basically
oh cool, so not even just for unity?
any engine yeah (mostly unity)
do you have an invite to it, i can't see it in the discord search thing..
What's the difference between the 2?
Which one do I have to move to move my object?
Generally it's best to set the Translation
In what case do you want to move the LocalToWorld float4 value?
it's part of transform system
in which
translation + rotation + any type of scale
create local to world
automatically
I see, thanks!
LTW is generally more useful to read and get final pos/rot from
Whereas if you want to actually set pos / rot it's best to use Translation and Rotation, as the transform system then reads those and factors in scale to create the entities final matrix etc
Is it safe to read data from that Transform component's Transform.Value.transform.position? And does it actually read the gameObject's current transform?
And one of my script which does not implement IConvertToEntity ends up being in the entity's component
Called Tester, how do I prevent that?
yeah it does, but why?
it's the slowest way to read position
Just wondering what purpose that gets converted as well
Accessing Transform is technically random access as your getting the game object out of other memory so it's best to avoid
you probably have hybrid component attached
Yes, ConvertGOToEntity > Inject
It'll exist so that the transform game object system can take the final entity translation data and apply it to the gameobject
Sorry slow, pc crashed while I was typing lol
So I create my own script that converts everything that implements IConvertToEntity?
Hmm I'll give it a go
Dots seems to consume my gpu and doing anything else you intensive on the pc whilst using unity tends to cause problems
no
there's conversion pipeline
use it
in other words
put your gameobject to convert into subscene
it will be converted as soon as you close it
Dont forget to cross your fingers and click your heels together three times
I've found that helps to get it working as expected
Ok thanks, that's a lot to read and understand, will take my time on it
Yeah read the official manuals at least twice, will prevently answer a lot of questions ๐
Reading that, its not really clear when and what calls Convert() method on MonoBehaviours that implement IConvertGameObjectToEntity. Does it gets called automatically by ConversionSystem, and when GO with authoring is placed in a subscene?
And I still need my GO for hybrid workflow. Does the destroys the game object?
If I write a ConversionSystem, does it destroy my GO?
// Authoring component
class FooAuthoring : MonoBehaviour
{
public float Value;
}
// Runtime component
struct Foo : IComponentData
{
public float SquaredValue;
}
// Conversion system, running in the conversion world
class FooConversion : GameObjectConversionSystem
{
protected override void OnUpdate()
{
// Iterate over all authoring components of type FooAuthoring
Entities.ForEach((FooAuthoring input) =>
{
// Get the destination world entity associated with the authoring GameObject
var entity = GetPrimaryEntity(input);
// Do the conversion and add the ECS component
DstEntityManager.AddComponentData(entity, new Foo
{
SquaredValue = input.Value * input.Value
});
});
}
}
How do I create a one shot system that only runs once? Like a door open system? Removing Entity's component data after the system finished is a structural change and shouldn't be done right? So how do I do it correctly?
Couldn't you just add a component like DoorToBeOpenedTag and remove it once the door was opened?
That is a structural change as well according to the docs
what's the problem with that?
Okay, I'll do tags thanks
I think the way to think about structural changes, adding/removing tags is:
If you're doing it on 10k entities regularly, maybe don't do that, find another way
For just occasional stuff like UI etc, it's probably fine
I'm currently syncing rotation and positions of different entities like this:
var translation = cloneLocalToWorld.Position + (mirroredLocalToWorld.Position - cloneLocalToWorld.Position);
EntityManager.SetComponentData(clone, new Translation {Value = translation});
var rotation = cloneLocalToWorld.Rotation.value + (mirroredLocalToWorld.Rotation.value - cloneLocalToWorld.Rotation.value);
EntityManager.SetComponentData(clone, new Rotation {Value = rotation});
EntityManager.SetComponentData(clone, new LocalToWorld { Value = mirroredLocalToWorld }) didn't work for some reason.
Surely there must be a a more straightforward way to do this?
there's a system that does
just queries over all game objects and calls this method basically
but only during conversion (subscene or convert component)
maybe if you explain a bit what you're doing
I'm copying the position and rotation of one entity to another
Setting the LocalToWorld directly doesn't work for some reason, so I'm setting the Translation and Rotation instead
possibly you're setting the LTW and it's being then overwritten by the Transform system
it is generally more advisable to write to Translation/Rotation unless you know exactly when and where you're setting LTW
Basically, the transform system takes the Translation and Rotation components ( and scale also ) and writes them to the LocalToWorld
LTW is probably in general more useful to read from than actually write to
Ah yes, you're right, it updates before the TransformSystemGroup.
I don't think I can change the order in this case, so I guess the way I'm setting the position and rotation is correct
you can just remove rotation and translation
off entities you sync with
if they are simply meant to follow you main entiites
That's a good idea actually
yea but I think I'll add my own interpolation later so keeping Translation and Rotation is more convenient
Would the absence of Rot/Trans not cause any problems for the Transform system when it attempts to update LTW ?
I take it just queries for all three ( and scale ) and so will skip updating LTW on any that don't meet that criteria
it simply won't
transform runs only if entity has one of those components
with change filter
Right
And the renderer will read the LTW right, so objects will still render ok with just that component i'd guess
yeah
ie they'll render in updated positions still
( obviously if you do do that - be wary of scale values not equal to 1/1/1 as you'd have to factor that in when setting the LTW otherwise it will result in skewing and all kinds of hell i believe )
is it possible to get chunk by value in SharedComponent? For example i want get chunk with entities which has Components with value = 1
yeah
you apply shared filter to query
and then you can get all chunks from it
but i need exactly by value.
you apply filter by value
ty
i can finally talk about this
https://github.com/needle-mirror/com.unity.entities/blob/85dc36a489eb40741392d89c574c7a6013355379/Unity.Entities/EntityCommandBuffer.cs#L5441
/// Entities in the <see cref="LinkedEntityGroup"/> that don't match the mask will be skipped safely.</summary>
/// <remarks>Behavior at Playback: Will throw an error if the entity is destroyed before playback,
/// if the entity is still deferred, if the entity has the <see cref="Prefab"/> tag, or if any of the matching linked entities do not already have the component.</remarks>
/// <param name="sortKey">A unique index for each set of commands added to this EntityCommandBuffer
/// across all parallel jobs writing commands to this buffer. The `entityInQueryIndex` argument provided by
/// <see cref="SystemBase.Entities"/> is an appropriate value to use for this parameter. In an <see cref="IJobChunk"/>
/// pass the 'unfilteredChunkIndex' value from <see cref="IJobChunk.Execute"/>.</param>
/// <param name="e">The entity whose LinkedEntityGroup will be referenced.</param>
/// <param name="mask">The EntityQueryMask that is used to determine which linked entities to set the component for.
/// Note that EntityQueryMask ignores all query filtering (including chunk filtering and enableable components),
/// and may thus match more entities than expected.</param>
public void SetComponentForLinkedEntityGroup<T>(int sortKey, Entity e, EntityQueryMask mask, T component) where T : unmanaged, IComponentData```
i think this is a really cool/useful feature for initialization
Convert IJobEntityBatch and IJobEntityBatchWithIndex to IJobChunk
we've done full circle
and what about Render system? Does its still no have gles3 support?
haha there's as many errors as i expected and this upgrade is going to take a while
be a while before i get to looking at rendering ๐
im only installing Unity 2022b right now ๐
just reading the transform and physics changes, yeah converting conversion to bakers is the least of my worries
Not gonna lie, did not expect an update so soon
Might be time to jump back into dots ๐
Woohoo!
We are still working on making the physics and netcode systems compatible with the improved transform system.
what does this even mean? is it working?
Interesting, I thought the transform system improvements were coming later. But it seems like its already here?
i mean, it's there, but because it doesn't work with physics or netcode, it's not super useful yet
GLES 3.1 supported as of Entities Graphics 1.0 (and the experimental releases as well)
Entities Graphics is the new name for the Hybrid Renderer package
Each system has an entity associated with it, used to store per-system data. This approach should be preferred over adding public fields to ECS systems.
that's nice
oh that's really useful for serialization
if i can figure out how to write back to it easily on load
How so? Just curious what you intend to use it for
well my saving saves entities
i could save state from a system if i required
previously i just made my own entities and stored the data on it anyway
@wraith hinge so physics is planned to be integrated with the new transform system?
just to confirm, does that mean fi we're using phsyics/netcode we need to enable ENABLE_TRANSFORM_V1?
yep and yep, for the time being
the general hope and intent is that v2 should replace v1 over time, but some work to do before that can happen
i am so confused what is happening with native hash maps
has NativeParallelMultiHashMap been removed again and changed back to NativeMultiHashMap
but there is still a NativeParallelHashMap
If you are using netcode or physics you will be automatically forced to use Transforms V1, no need to do anything yourself
trying to figure out what to do with my libraries
because i have a few extension methods complaining about v2 changes
how's that 1.0 rolling out?
"New features like motors and breakable joints "
Happy to read that ๐
has NativeParallelMultiHashMap been
Is the TransformAspect only a thing for transforms v2?
oh they even addressed acquisition of the Rivial asset
if (healthData.Left > 0)
SystemAPI.SetComponent(friendlyOgreEntity, healthData);
else
state.EntityManager.SetComponentEnabled<AliveTag>(friendlyOgreEntity, false);
I noticed this in the ISystem example. Seems like there should be a SystemAPI.SetComponentEnabled<>. Can we assume this will be added in a future version?
this is interesting yeah, so this would basically mean you could do init stuff or propagate ecb commands down a hierarchy, without necessarily having access to the linked group
motors.. oh damn i better get reading
๐ I was asking a few days ago to see if I start my New project with dots... Welp I got my answer now ๐
you can just generically assign data
Does this use the LinkedEntityGroup at record or playback time? If the latter, I'm surprised since I thought they were removing things that operated on the state of the world at playback rather than record time
like
SetComponent (New CreationTime {Time = time})
and not care if anything needs the data or not
maybe a designer thinks at some point, having creation time on this entity would be useful, they can just add it in the editor
and it'll be set next time
tertle, is your SharedStatic working? it get compile errors in my libs
SharedStatic is a burst feature
oh you mean can i compile with it?
i haven't fixed compile errors yet in just my core library
even for BurstCompile tag
lol i dunno maybe i have too many errors ๐
seems fine
ok runtime no compile errors
onto authoring/editor
gah Inspector is gone lies just made internal
i thought enableable components wasn't coming till later, that's nice
there's a ton of nice stuff in this, top marks to everybody involved
No
What's the api for grabbing this entity?
i don't know yet
This is neat
Added OptionalAttribute, used for declaring optional components inside an aspect declaration.
Yeah this is a really big step forward for DOTS. Exciting times. It's laying the groundwork for the next generation of Unity games which are going to be, something else entirely.
CDFE renamed to ComponentLookup - much better name
@rotund token will you update your EventSystem package? our team heavily using it
i will definitely update 2.0 branch (today probably)
I will see how broken 1.x is
ideally yes i will do it for others sake
we are already on 2.0 now. tyvm
ok 2 hours later, core library compiling
This seems useful for serialization
Added TypeManager.HasDescendants(), TypeManager.IsDescendantOf(), and TypeManager.GetDescendantCount() for checking the inheritance relationship between types.
nice surprise at a 4am wakeup today
Cool thanks! It looks like there is a SystemHandle property you can call on systems (or SystemState if in ISystem)
look like i don't need my lib anymore ๐
hm, not quite. can't get the ptr. it's private
best news is ComponentSystemGroup is now a SystemBase
still a step up to having no ref values at all
@wraith hinge please add the ability to get the pointer to RefRO/RW struct ๐
i feel like you can if you're determined
with UnsafeUtility.AddressOf?
that's exactly what i don't want to do ๐
errr... you want a pointer but you don't want to say addressof?
i have no idea what burst does with it but a chain of UnsafeUtility.AsRef<T>(_Data) and UnsafeUtility.AddressOf() is not that great when byte* is directly in the struct and I could just call GetPtr and it returns byte* _Data
burst is very happy about it; it's a no-op, i believe. (for burst, a ref is just a pointer anyway.)
in mono it might add an extra function call, because mono is bad at inlining. but burst is great at inlining, so nevermind
put another way, if you find out that asref and/or addressof is slower in bursted code than just talking about a raw pointer, i hypothesize the burst team would treat that as a bug and fix it; not least because we use it everywhere ourselves and rely on it being fast
ah that's cool then if it translates to no op. currently rewriting my lib that exposed pointers in CDFE. looks like everything is covered - even public bool TryGetComponentPtrRW(Entity entity, out T* ptr) can be made with the RefRO/RW
i'm also curious what the use case is for the ptr over the refrw
Physics got a big update, I like
Finally setup how I feel it should be, no longer needing system access or setting up dependencies
(also supports scale)
Limitations
Code in the foreach body always runs on the main thread (until foreach is supported inside IJobEntity).
You must use the RefRO and RefRW generic types to iterate through components. RefRO indicates read-only access and RefRW indicates read-write.
You can iterate up to 8 aspects or components in the same foreach statement.
You can't query dynamic buffers in a foreach statement.
You can't save a query in a variable, field, or property and then reuse it multiple times.
You can only perform a foreach iteration over a Query<T>() inside a method that has a ref SystemState parameter.
Reading through the upgrade guide on the new idiomatic foreach. Surprised to see that dynamic buffers aren't supported. Is that planned?
Also, there is mention of foreach maybe being supported in IJobEntity at some point. I'm curious if that is true and what that would even mean since the IJobEntity interface is already per-entity.
does physics got improvement in performance ? i got problem when in run time creating a lot of colliders BuildPhys system took a long time to execute
wait what 1.0 is here?
i'll let you know if I can find any. now that we have the Ref* structs in CDFE I can't think of any tbh but I'm also knee deep in the rewrite and have 100s of errors ๐
That was so 3 hours ago
yes, but as with everything it depends on your use case. but a ton of changes in physics are perf-focused
I'v been reading into this convo and wondering why suddenly Unity devs around ๐
Bit early for me to profile anything but at a first glance there might be a few things (all isystem to start with) - edit-beaten by actual dev
i asked in the 1.0 thread but might as well ask here, is a 1.0 preview package for havok planned?
i would have thought so, but i can never predict licensing/legal stuff accurately myself
anybody care to do a tldr on physics update?
The changelog has an upgrade guide
Front facing its really just about system ordering and world access
Reading the changelog now. But main things I've seen so far:
- They totally reworked how all the systems are organized.
- You no longer need to fetch the PhysicsWorld or Simulation from systems. Instead you go through new singleton components.
- Dependencies are now automatic (no more RegisterPhysicsSystemsReadOnly, etc.).
- Uniform scale now works.
ah yeah reading this now, thanks
so getting PhysicsWorld using GetSingleton i guess is in line with all system variables now being stored on entity
Netcode didn't get the memo ๐
any idea why my package throws this error? LocalPackages\com.unity.entities.exposed@0.1\DynamicHashMap\DynamicHashMapData.cs(314,10): error CS0246: The type or namespace name 'NotBurstCompatibleAttribute' could not be found (are you missing a using directive or an assembly reference?)
RegisterPredictedPhysicsRuntimeSystemReadWrite and RegisterPredictedPhysicsRuntimeSystemReadOnly extension methods, for tracking dependencies when using predicted networked physics systems.
Not burst compatible is removed for something else
Yeah, the ECB systems do the same thing
renamed to [ExcludeFromBurstCompatibilityTesting] because that's what it actually means
similarly burstcompatible renamed to [GenerateTestsForBurstCompatibility]
the exclude is not scriptupdatable because you have to provide a reason now
thanks!
Are you using a copy of my dynamic hash map enzi?
(unless you are very determined, i very much doubt you were actually getting anything out of those attributes; they only do anything if you proceed to run the codegeneration that knows about them AND then make a player build afterwards)
It's already fixed in my 0.9 branch
Perhaps a dumb question but I didn't see it in the upgrade guide. Are we supposed to upgrade to unity and the ECS packages at the same time? And should I use the latest unity 2022.2 beta?
yep and yep
yeah, i get it there also ๐
Thanks! Just realized that it was mentioned on the new forum post.
I wonder how long it will take to convert my project to 1.0
seems to go a bit deeper as I'm getting Burst and mathematics errors. burst namespace can be found though. mathematics doesn't
Really nice to see physics has had some love
Cleaned up and a couple of nice features added
I can sortof understand why Animation has been deferred, given the level of changes all round
I'd guess work on that might continue after the move out of experimental
Besides removing/replacing [GenerateAuthoringComponent], is there anything else that should be done before updating?
@wraith hinge are there any sample projects we can test 1.0 with?
Yes, it is generated for the Aspect to map the the ComponentTypeHandles of the components in the aspect.
PhysicsWorldSingleton worldSingleton = SystemAPI.GetSingletonRW<PhysicsWorldSingleton>();
Very interesting, I'v been using same approach in 0.50 ๐
not quite sure about the idea behind SystemAPI
Is that codegen?
we dont need to register rw or ro for physics systems now?
i am totally failing where to find the physics upgrade docs ๐
ah wait it was just the changelog for now I guess
Yes, SystemAPI is backed by Roslyn analyzers / source generators.
where is changelog? xD
in the physics docs https://docs.unity3d.com/Packages/com.unity.physics@1.0/changelog/CHANGELOG.html
I am so glad everything is getting actual ECS structure
which is also fully unmanaged
Including unmanaged shared components
ok, baking sounds interesting
it mentions in the physics changelog one of the sample scenes:
are updated samples available?
sounds like open subscene won't be as buggy
check whether they are in package folder
i haven't downloaded the latest editor tbh, was considering doing that if there were samples available
ah really?
This is only for transforms v2 btw. If you use physics or netcode, you have to stay on v1 for the time being.
The samples are being updated atm. We'll update the forums once they are out
I think they removed it for physics reasons. If you want to scale it in a non-uniform manner, it suggested to pass in a matrix before rendering
yeah, the whole idea was a huge mess
RegisterPhysicsRuntimeSystemReadOnly can just be removed now?
Yeah I think so, assuming you access the PhysicsWorld or Simulation using the new singletons
how do I get the physics world so I can cast rays and such?
Okay thanks!
Retrieval of PhysicsWorld is achieved differently. Previously, it was necessary to get it directly from BuildPhysicsWorld system. Now, PhysicsWorld is retrieved by calling (SystemAPI|SystemBase|EntityQuery).GetSingleton().PhysicsWorld in case read-only access is required, and by calling (SystemAPI|SystemBase|EntityQuery).GetSingletonRW().PhysicsWorld in case of a read-write access. It is still possible to get the world from BuildPhysicsWorld, but is not recommended, as it can cause race conditions. This is only affecting the PhysicsWorld managed by the engine. Users still can create and manage their own PhysicsWorld. Check out documentation for more information.
haha yeah, but it took me a while to figure out that the physics upgrade guide was inside the changelog
upgrading is pretty wild, just drifting around in a sea of red
sad that Entities.ForEach is going in the bin
my dear friend
idiomatic foreach looks good though
ok i think i get what Aspects is doing
that's pretty nice, i like it
should remove a ton of boilerplate crap
How are you trying
I don't, I simply look at manual
And it still says to use system reference
To create ecb
Hmmm
Pretty sure it says to use system api
Is there anything else besides registration in type manager required to register generic component
var ecbSingleton = SystemAPI.GetSingleton<BeginSimulationEntityCommandBufferSystem.Singleton>();
var ecb = ecbSingleton.CreateCommandBuffer(state.WorldUnmanaged);```
Yeah that ^
Where type of generics doesn't affect struct?
This upgrade is going surprisingly smoothly for me
I wonder if Unity can add hook to register generics with reflection
same
Hmm
My heavy use of decoupled libraries and standalone projects probably helps as I can just upgrade 1 at a time
Did they implement codegen?
But just off the api stuff isn't too breaking
To generate struct for each ECB?
Yes systemapi is codegen
I meant ECB specifically
Not sure about that?
Is there anything else besides
damn selecting an entity causes everything to fall through the ground :C
GenerateAuthoringComponent has been deleted or am I just having a reference problem?
haha, man I'm glad I only have a couple of them
I dont have a single one

Is there any documentation of what system api generates under the hood if I need the functionality but somewhere code gen won't run
Or do I just need to inspect the generated code
That's what I usually do
Although pretty sure you can look through codegenetators
But they are probably way more confusing
What I intend to do but just for speed of updating I'd rather leave source code reading to when it can actually compile
I also like it, more streamlined than the original mouthful api
yeah
Do bakers support update after?
still unsure how you use DeclareReferencedPrefab etc with it though
Constraints
You don't
You simply get entity now
GetEntity()
Seems like registration is inside of it now
GameObjectConversionSystems still seem to work now? (though they use SystemBase instead so need api udpates)
i will deal with those later
tertle, did you already upgrade Inspector? seems gone
I keep getting errors about how my GameObjectConversionSystem need to use .run or structural changes and then it disappears when i fix another error so want to get rid of them now
thanks
well yeah the old one system the old ComponentSystem
which had only entiites foreach main thread
no schedule option etc
you just have to add WithStructuralChanges().Run()
to them all
still get errors after adding those things but maybe just due to how many other errors I still have yet to fix
Is dots replacing OOP? Or is it just optional?
I'm making a game in Unreal but I'm trying to make the switch to Unity once it's done
'Implicit cast from
NativeList<T>toNativeArray<T>has been deprecated; Use '.AsArray()' method to do explicit cast instead.'
I love that change
that caused so many bugs
It is very, very optional
wow converting to the baking system was pretty painless
all I had to do was add properties
and add authoring. at the start
along with rename and remove some methods/params
Damn working with cameras is still annoying af
is there no way to nuke subscene data to regenerate it?
you mean like something similar to reimport?
in 0.51 and below
there was a window you could clear subscene data to fix errors
like
Loading Entity Scene failed because the entity header file couldn't be resolved.
i have a completely empty subscene but i'm getting errors like
[Worker0] Exception thrown during SubScene import: System.TypeInitializationException: The type initializer for 'Unity.Entities.Conversion.CompanionComponentSupportedTypes' threw an exception. ---> System.ArgumentException: Unknown Type:`UnityEngine.Rendering.Volume` All ComponentType must be known at compile time. For generic components, each concrete type must be registered with [RegisterGenericComponentType].
oh maybe i need a render pipeline installed
let me throw in urp
have you restarted the editor? I noticed some errors went away after that
yeah
ok yeah I think a render pipeline is needed
i was testing my library compiled with hybrid renderer
so i just installed it
so makes sense it's not working without a pipeline
im not rendering anything atm, just testing scripts compile
clear entities cache is gone too
only thing left is the upgrade physics
so sneaky, got down to 5 errors in my packages fixed one and then like 100 new ones popped up after another updater ran๐
Has anyone successfully gotten a custom ECB system to work?
The upgrade guide says to implement your own Singleton type. I copied the one from one of the built-in ECB systems but the implementation uses an internal PendingBuffer field.
i need to remember what empty, mixed, orange buttons mean ๐
but its cool switching between these views
just getting a few random uielements errors on isnpecting though
UnityEditor.GameObjectInspector.OnDisable () (at <dbec13b8891f4cb392de8ec34da2cbaf>:0)
UnityEditor.InspectorWindow:OnEnable()```
not very descriptive on why...
yeah even when that video came out thought a circle changing colors was like a really cryptic way of showing state change
i am seeing one huge annoying issue though
you know those new entities tied to systems? well they're all in the inspector
lol
Are those entities empty by default?
@rotund token That is a bug on our end
should be a slider
or like a little drop down similar to the shader modes
LinkedEntityGroup still exists in chunks ๐ข
Systems now have an entity mapped to them which allows systems to carry state inside components rather than the system instance itself. However you should not need to know about that entity unless you've explicitly set data on it
please can we make it 0 size ๐
i literally gain 50% performance in some of my libraries by removing this
would grouping entities inside a hierarchy ever be a possibility? just to clean up that entities inspector so it isn't just one huge list..
was thinking even if things are grouped by linked entity group or something
just meaning visually in the inspector fwiw
i am slightly confused, i can't seem to select the gameobject representation at runtime
i thought this was part of the workflow
I think they've said that this is planned, but not just for entities. They want to allow for custom grouping in the normal unity hierarchy for game objects as well. So they want to solve that problem for everything, not just entities. Not sure when that will happen though
ah right yeah
i guess kindof like a layers system in any dcc app
the ability to group and show/hide based on type or some arbitrary collection criteria
Journaling window โค๏ธ
having 10k bullet entities all show up etc isn't really ideal, would make sense to just group them in the inspector and show collapsed group headers
similar to ordinary hierarchy view
clear entities cache is now in edit->preferences->entities
aha! thanks
along with a bunch of other formerly dots menu things
ah and it has my next question already answered, journaling memory
nice thanks
hmm, yeah I don't understand how to make a custom ECB system with the public API
But it looks like ECBSystem.CreateCommandBuffer is still there so I can just use GetOrCreateSystemManaged and do things the old way
so, compiler errors gone. now i'm left with InvalidOperationException: The previously scheduled job ParallelList`1:ParallelListToArraySingleThreaded writes to the Unity.Collections.NativeList`1[NZSpellCasting.ThreatEvent] ParallelListToArraySingleThreaded.array. You must call JobHandle.Complete() on the job ParallelList`1:ParallelListToArraySingleThreaded, before you can write to the Unity.Collections.NativeList`1[NZSpellCasting.ThreatEvent] safely. which is a weird one because the scheduling is handled and worked before. ๐ค
eh? what if you use the underlying m_PendingBuffers, which is protected?
the point of the singleton is just so that you can create ecb's to be played back by that system from a bursted isystem. if you don't plan to do that, don't worry about the singleton thing
Ah okay yeah I think that will work.
Yeah, I think I misunderstood and thought this was the intended way to work with ECBs now.
it's intended in that we have clearly found that bursted isystems are by far the fastest thing in town, and so given that speed is, uh, pretty core to dots, we feel guilty about recommending defaults that aren't the fastest
Will cameras ever be ECS supported?
Does the singleton approach remove the need for AddJobHandleForProducer?
...i would think so? because you obviously can't call that from a bursted isystem, and we have made command buffers from jobs in bursted isystems in e.g. netcode... so it better not need that... i'll ask around.
the new splash screen is great. the chosen image though ... ๐คจ
i imagine we might do some work to make them less annoying to talk about, but "supported" is kind of a relative concept. do you have a specific feature in mind?
I know this isn't the intent of the change, but personally I would love it if all I need to work with ECBs is this one-liner:
EntityCommandBuffer commandBuffer = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>()
.CreateCommandBuffer(World.Unmanaged);
Instead of the old way:
private EntityCommandBufferSystem _commandBufferSystem;
_commandBufferSystem = World.GetOrCreateSystemManaged<EndSimulationEntityCommandBufferSystem>();
EntityCommandBuffer ecb = _commandBufferSystem.CreateCommandBuffer();
_commandBufferSystem.AddJobHandleForProducer(Dependency);
The ability to add a Camera component to an entity.
also, only the directional light works (still)
it's a plausible idea i suppose? i'm not aware of any concrete plans though
I just find it odd how sound is potentially getting ECS support but the #1 most used component, isnt (camera)
same with lighting
I really appreciate the unity devs that have been hanging out here and helping us with the upgrade
finding first time i select an entity after a domain reload i always get an argument exception
Parameter name: _unity_self
UnityEditor.UIElements.InspectorElement.GetOrCreateEditor (UnityEditor.SerializedObject serializedObject) (at <dbec13b8891f4cb392de8ec34da2cbaf>:0)
UnityEditor.UIElements.InspectorElement.Reset (UnityEditor.SerializedObject bindObject) (at <dbec13b8891f4cb392de8ec34da2cbaf>:0)
UnityEditor.UIElements.InspectorElement.ExecuteDefaultActionAtTarget (UnityEngine.UIElements.EventBase evt) (at <dbec13b8891f4cb392de8ec34da2cbaf>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEvent (UnityEngine.UIElements.EventBase evt) (at <a69592e6e5cf4003ac6707a67bdf3fd1>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtCurrentTargetAndPhase (UnityEngine.UIElements.EventBase evt) (at <a69592e6e5cf4003ac6707a67bdf3fd1>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at <a69592e6e5cf4003ac6707a67bdf3fd1>:0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetAndDefaultPhase (UnityEngine.UIElements.EventBase evt) (at <a69592e6e5cf4003ac6707a67bdf3fd1>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.SendBindingEvent[TEventType] (TEventType evt, UnityEngine.UIElements.VisualElement target) (at <f05d71c29e974cdca581869c2af9adb3>:0)
UnityEditor.UIElements.Bindings.SerializedObjectBindingContext.BindTree (UnityEngine.UIElements.VisualElement element, UnityEditor.SerializedProperty parentProperty) (at <f05d71c29e974cdca581869c2af9adb3>:0)```
then it works fine until next domain reload
my entities still fall through the ground, I would prefer an exception 
Hmm can you report a bug?
yeah im just going to debug it a little to see if i'm causing it somehow
i thought it might be my custom inspectors but i deleted them all and still happens
mine work fine
fell and stopped as expected
no no, only happens when I select an entity in the scene viewport
by clicking on it
that is very funny
It looks like a huge spoon with pepples on it
Its a shitty ball pit to drive my vehicles through lol
Does the new entities graphics package still support the MaterialProperty attribute?
huh, so IConvertGameObjectToEntity doesn't convert anything anymore. the mention would have been nice ๐
this may sound idiotic and might completely not be the issue but try reducing the size of the floor plane
OK so Inspector doesn't work anymore
replace it with PropertyInspector
i had an issue recently after increasing the size of the ground, things started to wonk out completely until i finally figured it out and reduced the size of it again
thanks! yeah, the Inspector should belong to Entities
there's also a
PropertyInspector<TValue, TAttribute>
where you can draw for a specific attribute
hm, does that help in our buffer problem?
nah i dont think so
i havent tested it yet
but i assume it just allows you to custom draw a specific int etc somehow different
yeah feel like it should have just been removed, that confused me
was expecting that too. i'll rename it and then write the bakers to not miss any
hmm is DeclareAssetDependency still needed?
from what i understand DeclareReferencedPrefabs is no longer
but that's quite different
hmm seems like i might, but i can't seem to do it from baker
np, have you found a way to get rid of LinkedEntityGroup and the likes? i see no way to remove. other thing i'm trying currently is to call a baker from another baker. that was working very easily before with static methods
can't still use GameObjectConversionSystem?
it still seems supported to me by the fact physics still seems to use it
(haven't tested)
oh right, i think i read code from you where you were adding a comp to trigger a removal in a GOCS. that could still work with a bakersystem
i'll probably have to rethink my approach to support individual authoring comps and full authoring comps that handle a group of them
wait, can we bake aspects?
i know we probably aren't meant to pass IBaker through a chain of objects
but doing this instead of all the old conversion stuff has made my code so much cleaner
can you post what you are doing?
{
public override void Bake(SettingsAuthoring authoring)
{
if (authoring.Settings == null)
{
return;
}
foreach (var setting in authoring.Settings)
{
if (setting == null)
{
Debug.LogWarning("Setting is null");
continue;
}
this.DependsOn(setting);
setting.Bake(this);
}
}
}```
oh that's all
this is how i setup all my settings entities
i'm fumbling around with this. how does authoring.Settings look that you can call Bake on it?
{
[SerializeField]
private Settings[] settings;
public Settings[] Settings => this.settings;
}```
Settings is just
{
public abstract void Bake(IBaker baker);
}```
System.InvalidOperationException: The BlobAssetReference is null. well thats not good, physics isnt converting on a default cube. not an empty project but i dont think my packages should be breaking the baking system
ok thanks, i need to utilize the IBaker too
wondering are there any major breaking changes going from 0.51 to the experimental 1.0.0 thing?
lots ๐
ooh yay
what's a way to grab an unmanaged system? Seems like getting the systemHandle.Struct is no longer valid with 1.0. (Although I guess in actuality, I guess I should move some inter dependent stuff into a different location)
i was just about to start work on getting nvidia flex (fluid simulation thing) working with dots, is 1.0 stable enough, and/or better than 0.51 currently?
we'll have to wait a bit for performance tests as we are in the middle of rewriting
understandable, thanks for the info yall!
https://gitlab.com/tertle/com.bovinelabs.core/-/tree/0.9
library is mostly up to date to 1.0 if anyone needs it - i will do events next
extensions not all tested so good chance some of them are broken but will be tested as I work through my libraries that depend on them
unfortunately have to do some actual work
this is my boilerplate now so i can call bake from other bakers ```public class AvatarAnimationState_Authoring : MonoBehaviour
{
public static void BakeMethod(IBaker baker)
{
baker.AddComponent(new AvatarAnimationState());
}
public class Baker : Baker<AvatarAnimationState_Authoring>
{
public override void Bake(AvatarAnimationState_Authoring authoring)
{
BakeMethod(this);
}
}
}```
https://forum.unity.com/threads/dots-development-status-and-next-milestones-september-2022.1341077/ btw, here's a recap of the changes with 1.0
there's probably a better solution but i have way too much comps to go through to think about it much ๐
awesome, thanks!
Any sense in getting the 1.0 upgrade out of the way now or do you think things will change significantly until it becomes stable?
so before i make any dumb mistakes. calling GetEntity inside a baker will return me what was once the Entity entity parameter in IConvert, right?
the bakers are the biggest pain to rewrite. so get that out of the way as soon as possible
I use almost no authoring code, so I should be fine on that front
Looking over the migration stuff there are quite a few things though
lucky you ๐ then you can chill a bit and wait what others say about the version. hard to tell right now. but also nice to leave unity 2021 behind ๐
Ah, it supports 2022 now?
What's this?
the same thing but faster ๐
there's a pretty good chance i'll write bakers in my dreams today
wondering does dots 1.0 work on the 2022.1 version, or only on the beta .2 version?
I think only the latest 2022.2 beta
ah ok thanks!
I'm just basing that on this post btw: https://forum.unity.com/threads/experimental-entities-1-0-is-available.1341065/
got it, thanks a ton!
oh this sucks. i thought we moved beyond this InvalidOperationException: Baking error: Attempt to add duplicate component NZSpellCasting.TargetableTag for Baker Avatar_Authoring_Baker with authoring component Avatar_Authoring. Previous component added by Baker NpcComponent_Authoring_Baker
EntityManager didn't care about this. Now I wonder how I can even catch this
i cant say for certain but i think it could be related to incremental conversion desire
ideally you only need to re-bake what changes
not certain this is a thing atm (it might be) but from what i've seen of code it's desired and imo would be great for performance
I would assume the whole
Authoring <===> Runtime
Concept basically relies on mapping 1:1
oh well, time to fix my authoring ๐
(well 1 to many would be fine as well)
(again just speculation why the restriction might exist)
eh, makes sense anyway. way too much weird bugs could happen with unclean setup. got it working, i have only screwed up one comp in this chain of authoring comps
now everything seems to work except for my spawner lol
7 hour rewrite. the downside of being just one dev
bakers were the most time consuming. wish they had a simple codegen for upgrading ๐
im 1/14 libraries down
most libraries only have 1 (many 0) authoring script though
so i don't expect that part to be to hard
14? ... sheeet
doc writers have gone above and beyond for this sample ๐ [WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)] partial class BakingOnlyEntityAuthoringBakingSystem : SystemBase { protected override void OnUpdate() { // โฆ Your code here โฆ } }
you guys moved your GetComponentTypeHandle's to OnCreate? do we just store them as system fields now?
got so many warnings about that in only my packages, dont want to think about the main project
yes, since 0.51
how can we get entity with a SystemAPI.Query? - found it foreach (var (translation, entity) in SystemAPI.Query<Translation>().WithEntityAccess())
ahh that was a thing in 51? I never got warnings about it there ๐ฆ
there were no warnings but we were able to create once and then call update
simple baker system for removing unwanted default comps
i have some unwanted systems running now, like LocalToParentSystem ๐คฎ but other than that, every job runs a bit slower. reason might be the overall timing but the first tests are disappointing. @rotund token pretty interested how fast your stat system will be
Oh yeah I'm going to benchmark and compare to my 0.51 benchmarks I did earlier this week, I have them saved
3rd or 4th on list of libraries to update just because of this curiosity.
When I clock off see how many I can get done tonight
@viral sonnet it also gave message to update the handle, did you do that in 51 too?
Can you not do this with the entity query overload method?
haven't found a way sadly
WithEntityAccess needs the Query and Query() alone doesn't work
looks quite ugly ๐
State entity manager create query?
Cached in on create
Just a regular ISystem isn't it
Anyone figured out how to work with SystemHandle, where we used SystemBase before?
"[...] error CS0029: Cannot implicitly convert type 'Unity.Entities.SystemHandle' to 'Unity.Entities.ComponentSystemBase'"
couldn't find any documentation on it
GetExistingSystemManaged<T>() will return the ComponentSystemBase instead of SystemHandle.
thanks mate ๐
@torn hornet "GenerateAuthoringComponent could not be found" - do you happen to know how this works in 1.0 now? the release post didn't mention it either ๐
I'm not sure if they have a like for like replacement, but this is the new method https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/baking.html
alight, thanks guys
quite excited to try 1.0
ahh upgrade guide, perfect
tiny bit tedious to update everything but the Baker API is pretty clean so far
that's fine if 1.0 is worth it
I guess authoring components now meant to be simple monos?
this does look a lot more simple indeed
What happened to build configuration?
After upgrading to Entities 1.0.Experimental8 it all failed to import
No longer needed?
Its still in the context menu
Build configurations should not be needed any longer. You should be able to build using the regular build window. This post has some info https://forum.unity.com/threads/exciting-developments-in-upcoming-entities-1-0-releases.1341071/
Ok thanks!
I didn't quite understand,
**Entities 1.0.0-exp.8 **is only available for Unity 2022.2.0b8 and later.
Does this mean that there will be no v1.0.0 for Unity 2021 LTS?
no
This plan was announced quite a while ago
1.0 full release will likely come with or after the release of 2022.3 LTS
is it safe to convert project to 1.0.0 are there some problems?
I think I did read it, but it was a long time ago. I just forgot. Thanks
it's experimental
so I'm 100% sure it's not safe ๐
well so is everything earlier ๐
i had a large post of issues when we updated from 0.17 to 0.50
i don't have a same list to make so far this time
only gotcha i've found is implicit interface implementations
void ISystem.OnUpdate(ref SystemState state)
breaks code gen
which I don't think many other people will run into
obviously more painful than previous updates, but i'm finding it more stable at least (so far)
one thing i wish they really had done
would have been great if we could do codegen with similiar to reflection fashion
was delete IConvertGameObjectToEntity
it doesn't work
it just hides issues because it doesn't work
smth like
Foreach (type which inherits from T)
create new class with this and that
What does it mean if a function that returns a NativeArray doesn't allow me to specify the Allocator? I see in the source that it's using Allocator.None, in this case it's GetDynamicComponentDataArrayReinterpret
This would be a direct view to the memory, and not an actual copy right?
Preferences
I think
they mentioned moving everything dots related there
oh
theres a jobs tab as well
thats what im missing
i was literalyl looking at that page
but just the entities tab
what's another tab pinned to my editor
is that correct version?
any ideas how can i fix this ?
Library\PackageCache\com.unity.entities.graphics@1.0.0-exp.8\Unity.Entities.Graphics\MeshRendererBaking.cs(120,46): error DC0005: Entities.ForEach Lambda expression parameter 'renderMesh' with type RenderMesh is not supported
Also i have a lot of similar erros
Um, my DOTS (0.51) windows appear very broken and I can't seem to fix it with an editor restart. Any ideas?
I would have thought that in the long run we would have been able to do without Shared Components and reduce the gap between MonoBehaviour Components & Entities, but nope.
Even worse, new components are appearing (the documentation has become abysmal).
I'll have to wait for the update of the samples because it's clearly not accessible enough as it is.
when did it start happening?
When I opened the project on my laptop as opposed to desktop
what version of unity
2021.3.8f1 - it appears to affect all DOTS windows, all other windows are working fine
Yeah no dice, I'm really confused here
It seems to be releated to some kind of import issue, I think it's the cache server being wonky or something
I noticed that a certain uxml pane for the UI wasn't correctly imported, reimporting fixed that particular one but issue remains
I'm getting a lot of these after updating, what goes wrong?
InvalidOperationException: No suitable code replacement generated, this is either due to generators failing, or lack of support in your current context
ProjectBrave.Runtime.Combat.InputMovementSystem.OnUpdate () (at Assets/_ProjectFolder/Scripts/Runtime/Combat/ECS/InputMovementSystem.cs:18)
using System;
using System.Collections;
using System.Collections.Generic;
using Unity.Burst;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
namespace ProjectBrave.Runtime.Combat
{
[UpdateBefore(typeof(LocalMoveSystem))]
[UpdateBefore(typeof(WorldMoveSystem))]
public partial class InputMovementSystem : SystemBase
{
protected override void OnUpdate()
{
new InputMovementJob /*Error leads here*/
{
DeltaTime = SystemAPI.Time.DeltaTime
}.ScheduleParallel();
}
[BurstCompile]
public partial struct InputMovementJob : IJobEntity
{
public float DeltaTime;
void Execute(ref LocalToWorldTransform transform, in InputData input, in MovementData movement)
{
transform.Value.Position += input.Value * movement.Speed * DeltaTime;
transform.Value.Rotation = quaternion.LookRotationSafe(moveDirection, new float3(0, 1, 0));
}
}
}
}
i think there was a note about this
try do this
var deltaTime = SystemAPI.Time.DeltaTime;
DeltaTime = deltaTime;
i swear i read something like that breaking atm due to double code gen, but can't find it
i could just be making it up, long day
I'll try lol
ah yes
Known issues
If you schedule an IJobEntity constructed with an initialization expression that invokes a SystemAPI method, such as:
SomeJob{targetLookup = SystemAPI.GetComponentLookup<Target>()}.Schedule()
This causes the following runtime error:
No suitable code replacement generated, this is either due to generators failing, or lack of support in your current context.
To fix this, put in a local variable first. For example, the following works:
var targetLookup = SystemAPI.GetComponentLookup<Target>(); new SomeJob{targetLookup = targetLookup}.Schedule()
I hope that's temporary? Lol
Are you sure this works for LinkedEntityGroup? I think it's not added till after this runs
Cool it worked :)
var ecb = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>().CreateCommandBuffer(combatWorld.Unmanaged);
This on MonoBehaviour Awake() also produces the same error.
can't use SystemAPI outside of systems
I see
it's completely codegen
was just reading there's a new AI Navigation package in 2022.2
hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm
Crashing soon as build starts
something about blobarray
yet i don't even have any of my own
well I can build mono
I built with faster (Smaller) builds as instructed for il2cpp so not sure what's up
@viral sonnet benchmarked it
0.51 - 2.05ms
0.51 128 Limit - 4.75ms
1.0 - 4.34ms
Slower as expected
I think the gains are mostly the rewritten job scheduler which is pretty sweet
Hi! I'm trying to capture a bullet collision with enemies and create a new Damage enity to collect them in a different system and inflict Damage. I don't understand what to use in EntityInQueryIndex when creating an enity via command buffer. I will need to process the created enities in the same order that I create them in this system.
commandBufferParallel.CreateEntity(???? , damageArchetype);
protected override void OnUpdate()
{
var commandBufferParallel = _commandBufferSystem.CreateCommandBuffer().AsParallelWriter();
var nonTriggerMask = _nonTriggerMask;
var bulletMask = _triggerBulletMask;
Entities
.WithName("ProjectileHitDetectionJob")
.WithBurst()
.ForEach((Entity e, int entityInQueryIndex, ref DynamicBuffer<StatefulTriggerEvent> triggerEventBuffer) =>
{
for (int i = 0; i < triggerEventBuffer.Length; i++)
{
var triggerEvent = triggerEventBuffer[i];
var otherEntity = triggerEvent.GetOtherEntity(e);
if (triggerEvent.State == StatefulEventState.Stay || !nonTriggerMask.Matches(otherEntity))
continue;
if (triggerEvent.State == StatefulEventState.Enter)
{
if ((bulletMask.Matches(triggerEvent.EntityB) && bulletMask.Matches(triggerEvent.EntityA)) ||
(bulletMask.Matches(triggerEvent.EntityA) && bulletMask.Matches(triggerEvent.EntityB)))
{
//HERE
commandBufferParallel.CreateEntity(???? , damageArchetype);
}
}
}
}).ScheduleParallel();
_commandBufferSystem.AddJobHandleForProducer(Dependency);
}
just put entityInQueryIndex where the ???'s are..
entityInQueryIndex is always equals 1 in this case
it basically provides the entity index for parallel jobs where the total number of entities being iterated is split up across different threads
you only have one stateful trigger entity?
ahh i think i see
i don't think it's necessary to do a parallel job in that case, although it should still work
the entityInQuery index refers to the entity holding the buffer, not the buffer index itself that you're using
Yes it works, but I'm generally not sure I have the right approach to implementation
The enitites are created with different indices, it seems as if everything is fine. maybe I should process them in another system and check the order.
The value passed to an ecb.ParallelWriter is a key into the command buffer. The value won't match the entity.Index but instead be 0..n. The docs for that method should also mention you should pass entityInQueryIndex when in an Entities.ForEach
edit: doc link: https://docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Entities.EntityCommandBuffer.ParallelWriter.CreateEntity.html#Unity_Entities_EntityCommandBuffer_ParallelWriter_CreateEntity_System_Int32_Unity_Entities_EntityArchetype_)
This line:
var otherEntity = triggerEvent.GetOtherEntity(e);
got it! what would you advise to use just Schedule? or will my code work correctly?
get other entity is just a helper, the event object holds EntityA and EntityB.. if you pass in A it'll return B and viceversa.. you don't want to pass in e
i don't think you even need that line, just use triggerEvent.EntityA and triggerEvent.EntityB
But yeah, ScheduleParallel isn't needed here as there's only one stateful event buffer entity, just use Schedule
thanks!
Time to upgrade to the new version, wish me luck
Does baking with a baker deletes the authoring gameobject?
Haven't tried, my original code before upgrading manually creates entities
And can't try rn bc not in office, but just wondering since the docs doesn't specify
Wanted to go hybrid
Is there a reason why the names for the hashset collections keep changing? It went from NativeMultiHashMap to NativeParallelMultiHashMap and now it's back to NativeMultiHashMap...
there are multiple of them now
I see
So something like NativeHashSet.ParallelWriter doesn't exist anymore I'm assuming
It would need to be NativeParallelHashSet.ParallelWriter
hmm
any tip how to install graphics package?
I can't find them in search
and I can't find correct package name
Is NativeMultiParallelHashMap missing from collections?
It's in the docs but it doesn't seem to be in the package
com.unity.entities.graphics
yeah
I'm guessing the docs are just incorrect, and there is no NativeMultiParallelHashMap, since NativeMultiHashMap is also missing from the docs
I guess they just messed up the name
Why the hell did they change the name again if you can still write to it in parallel
Yeah I know
But there is no non-parallel MultiHashMap
and they changed the name from "Parallel" to no parallel
Even though you can request a parallel writer
I don't remember naming
???
I can't find it in collections 2.1.0-exp.4
There is only one multi hashmap, NativeMultiHashMap
Which is weird because it is parallel capable, and in the previous version it had parallel in the name, but they changed it again for some reason...
Yes. A lot has changed and hopefully you will get some better perf in situations where Hybrid Renderer V2 would be slow (lots of unique meshes and materials). We can now reference many combinations of mesh/material from the same batch, as long as the "GPU Archetype" is the same
I think one of the devs spoke about hashmap renaming here:
https://discord.com/channels/489222168727519232/1024402954251415612
I assume graphics uses old transforms?
I don't think we required any change. We rely only on final matrices and don't interact with the transform system in any other way
Which mean: I think graphics can use the new transforms
I thought transforms got rid of LtW component
Thanks, still kind of strange for the case of NMHM
Ah, perhaps that is the case. I remember discussing this and getting to the conclusion that getting graphics on to the new types would be a trivial change for the transform people. I did not hear anything after that.
Sorry for the confusion
yeh it is a little confusing tbh!
Also kind of strange that it wasn't auto renamed
i think i sortof get it based on his last comment:
There's now:
Yeah I get the other collections, but there's still only one multi hashmap
I'm fine with it not auto renaming the other ones since they have distinct use-cases
NativeHashMap
NativeParallelHashMap
NativeMultiHashMap ( with or without ParallelWriter )
new transform is hella confusing, I guess I'll wait until all crucial packages pick it up
well that's not good. the loss is really drastic.
