#archived-dots
1 messages Β· Page 215 of 1
I have a literal working game in 2021
That won't let me make a standalone.
Its a crazy awesome game too, a MMO who honestly plans on dethroning Eve online
I'm just gonna keep waiting versions and such, or looking around for someone who knows what is going on
Hi.
I would like entities to have multiple components of the same type to keep track the entities they are colliding to. Did i understood properly and this intended to be solved with DynamicBuffer?
yup thats a dynamic buffer
ok. thanks! π
@ocean tundra still here? having some issues with the triggers, dynamicbuffers and official example
to sum up: trigger system detects events, add them to a list (entityA,entityB) and then I want to add each entity colliding with another that info.
The same the example is doing https://github.com/Unity-Technologies/EntityComponentSystemSamples/blob/master/UnityPhysicsSamples/Assets/Demos/2. Setup/2d. Events/2d1. Triggers/Scripts/DynamicBufferTriggerEventAuthoring.cs
However, I'm not adding buffers in authoring, but in code, and its not working.
if (!EntityManager.GetBuffer<TriggerEventDetected>(e).IsCreated) {
EntityManager.AddBuffer<TriggerEventDetected>(e);
}
ArgumentException: A component with type:TriggerEventDetected [B] has not been added to the entity.. Stack last line points the condition
hmm...after saying out loudly...perhaps null.iscreated?
use HasComponent instead
pretty sure that will work with Buffers (yes weird naming)
GetBuffer will throw if there isnt a buffer attached
EntityManager.HasComponent<DynamicBuffer<TriggerEventDetected>>(e) ?
no DynamicBuffer
EntityManager.HasComponent<TriggerEventDetected>(e)
ouch....that wasn't what i was expecting...
and components aren't added as:
EntityManager.GetBuffer<TriggerEventDetected>(e).Add(evt);
but
EntityManager.AddComponentData<TriggerEventDetected>(e, evt);
?
bye. thx anyway
No, NOT the "Universal Windows Platform" from the build menu. That's not the same as the com.unity.platforms package
I'll try a third time π Go back to there and read the few messages where I tagged you #archived-dots message
working! thanks!
This project is discontinued. You can still learn concepts but code will get old FAST
New official multiplayer github place for DOTS is here https://github.com/Unity-Technologies/multiplayer
Also check pinned messages for learning material. No real abundance of tutorials because tech is still evolving, so yeah no real Unity tutorial. They began a best practices here https://learn.unity.com/course/dots-best-practices Otherwise follow this one, it's kept up-to-date https://github.com/Unity-Technologies/EntityComponentSystemSamples
If you're really only interested in the DOTS_Sample, they released some kind of walk-through video at Unite LA 2018 if I remember well, I can find you the link if you need
hey guys, do you know how can I get all the IComponentData components from an entity? let's say I have a prefab and I'm trying to create it manually reading all components from the prefab
something like
foreach (var item in EntityManager.GetComponentTypes(spawner.prefabEnemy))
{
if (item.GetType() == typeof(IComponentData))
{
IComponentData typeData = (IComponentData)item.GetType();
var comp = EntityManager.GetComponentData(spawner.prefabEnemy);
ecb.AddComponent(manualEntity, comp)
}
}
yes, using that, it gives me more than I need. things like "LinkedEntityGroup [B]"
basically trying to make these lines look prettier and more dynamic to changes
EntityManager.AddComponentData(prototype, EntityManager.GetComponentData<PhysicsCollider>(spawner.prefabEnemy));
EntityManager.AddComponentData(prototype, EntityManager.GetComponentData<PhysicsMass>(spawner.prefabEnemy));
EntityManager.AddComponentData(prototype, EntityManager.GetComponentData<PhysicsVelocity>(spawner.prefabEnemy));
EntityManager.AddComponentData(prototype, EntityManager.GetComponentData<PhysicsDamping>(spawner.prefabEnemy));
There are some ComponentType properties... I think it's IsManagedComponent for IComponentData... So I guess you can do without these type castings...
interesting, will check it out thanks
for some reason im having trouble copying over the physics data (such as motion type) from a prefab to an entity instantiated from code..
var prototype = EntityManager.CreateEntity();
EntityManager.AddComponentData(prototype, EntityManager.GetComponentData<PhysicsCollider>(spawner.prefabEnemy));
EntityManager.AddComponentData(prototype, EntityManager.GetComponentData<PhysicsMass>(spawner.prefabEnemy));
EntityManager.AddComponentData(prototype, EntityManager.GetComponentData<PhysicsVelocity>(spawner.prefabEnemy));
EntityManager.AddComponentData(prototype, EntityManager.GetComponentData<PhysicsDamping>(spawner.prefabEnemy));
spawner.prefabEnemy contains dynamic motion type (in the inspector's Physics Body)
but copying it over doesn't pass this data it seems
All physics bodies require components from Unity.Transforms in order to represent their position and orientation in world space.
Dynamic bodies (i.e., those with PhysicsVelocity) require Translation and Rotation components. Their values are presumed to be in world space. As such, dynamic bodies are unparented during entity conversion.
I guess your new entity should at least 'have' LocalToWorld, Translation, Rotation components.
var prototype = EntityManager.CreateEntity(); // Is empty
Does AddComponentData<T> adds required components for T?
If so Idk... π€
yes, I was missing the Rotation component, thanks for pointing that out
Although I am getting more used to it I still struggle to leave my OOP mindset behind sometimes. Could anybody help me how to think about Grids DoD style?
In my case a grid has some properties (CellSize, Height, Swizzle) and some methods to convert between Spaces (e.g. WorldToCell(float3 worldPosition))
Its basically a bunch of transformation functions that may be used in many different places in code and always needs to know about the grid properties. So it makes sense to bundle these properties and methods in an object. But thats the OOP way π¬
I think you are mistaking OOP with data structures. There's absolutely nothing wrong with creating data structures like bounding volume hierarchies next to your other code.
It is more about should an Object/Struct contain data and functionality
E.g. I could create a GridComponent which has CellToWorld, WorldToCell, etc. methods but that would go against the separation of data and logic
Nothing wrong with having your struct share data/logic. If you look for inspiration check the physics package out. Especially the PhysicsWorld/CollisionWorld.
ok thanks will have a look at that
NativeArray<ComponentType> types = EntityManager.GetComponentTypes(myEntity, Allocator.Temp);
---
After setting the header [UpdateAfter(typeof(EndFramePhysicsSystem))] to my collision system, Unity complains with:
Ignoring invalid [UpdateAfter] attribute on CollisionSystem targeting Unity.Physics.Systems.EndFramePhysicsSystem.
This attribute can only order systems that are members of the same ComponentSystemGroup instance.
Make sure that both systems are in the same system group with [UpdateInGroup(typeof(Unity.Entities.SimulationSystemGroup)],
Setting [UpdateInGroup(typeof(SimulationSystemGroup))] doesn't seem to affect in any way.
Any ideas?
Does EndFramePhysicsSystem update in SimulationSystemGroup? It might be in FixedStepSimulationGroup.
FixedStepSimulationGroup updates in SimulationSystemGroup - but runs on a fixed time step
[ExecuteAlways]
[UpdateInGroup(typeof(SimulationSystemGroup), OrderFirst = true)]
[UpdateAfter(typeof(BeginSimulationEntityCommandBufferSystem))]
public class FixedStepSimulationSystemGroup : ComponentSystemGroup { ... }
what is burst synchronous compilation doing? its in toolbar at top of unity. do i need it for ScheduleParallel?
no you dont
burst can compile in 2 ways in the unity editor
synchronous will pause and compile, on play i think
where asynchronous will compile in background
It disables asynchronous compilation - downside is that it may cause hitches when Burst code is executed for the first time when your game is run, but the upside is that you're guaranteed to always be running Burst code. Leave it off for release builds, turn it on as-needed for debugging weird edge cases π
ok thx
Synchronous compilation has nothing to do with builds. Burst uses ahead of time compilation outside the editor.
does anyone have a sample reference for using Box/SphereCastAll? none on the physics sample project and I can't figure out what i'm doing wrong with this code
CollisionWorld pworld = m_physicsWorld.PhysicsWorld.CollisionWorld;
NativeList<ColliderCastHit> thisFrameHits = new NativeList<ColliderCastHit>();
Entities
.WithoutBurst()
.WithAll<TurretComponent>()
.ForEach((Entity e, ref Translation translation, ref TurretComponent turret) =>
{
pworld.SphereCastAll(translation.Value, turret.DetectionRadius, new float3 { x = 0, y = 0.1f, z = 0 },
0.1f, ref thisFrameHits, CollisionFilter.Default);
UnityEngine.Debug.Log(thisFrameHits.Length.ToString());
}).Run();
results in exception
ObjectDisposedException: The UNKNOWN_OBJECT_TYPE has been deallocated, it is not allowed to access it
You have to pass an allocator label into the constructor of you NativeList
okay, and dispose it each frame?
Depends if you aren't using jobs you can use Temp which doesn't have to be deallocated. If you don't care about memory you can bind the lifetime of the collection to your system by allocating it in OnCreate and disposing it in OnDestroy.
Otherwise use TempJob and deallocate it after your Entities.ForEach
gotcha, thanks!
Of you are serious about wanting DOTS and having an impact on it, I would suggest signing up for Pulse
https://blogs.unity3d.com/2021/04/15/join-unity-pulse-the-community-at-the-heart-of-building-a-better-unity/?utm_source=linkedin&utm_medium=social&utm_campaign=company_global_generalpromo_2021-04-15_unity-pulse
Are you interested in providing feedback directly to Unity teams? Sign up to become a member of Unity Pulse, our new product feedback and research community that we created because we believe your experiences and insight into product features are vital to Unityβs evolution. Unity PulseΒ is a new online feedback community created by the market [β¦]
These initiatives can seem market-ey but it is really good for the product and the user to have open two way dialogue
Yup I signed up, nothing tech specific up yet
But I love Unity so happy to give time to surveys
+1
gonna check if that's open to individuals, Unity is a hobby for me, not my main job
My car GO has 2 physics colliders: one for the whole vehicle and another one in front to detect objects ahead. I built it using an empty game object+physics shape component.
How can I get the "frontCollider" only to handle the collisions?
PS: that's a masterpiece, isn't it? π€£
the whole gift card thing on the unity pulse makes it seem kinda yucky to me, like one of those dodgy sites that offers rewards if you just click here and there
Radio silence from Unity on the forums really makes me concerned. However, I know Eizenhorn (forum poster) is in direct contact with Unity and DOTS netcode employees are still actually communicating with users on their subforum. DOTS is not disappearing off the face of the earth at least. Question is, will they bow to pressure and continue to 2021?
Just waitNsee
@robust scaffold Yea my unity contact confirmed that ECS is not dead/dieing
must be nice to have a unity contact for insider info π
Is anyone aware of a way to remove a system from it's ComponentSystemGroup so that the Update method of it is never called?
Imagine you want to have a system that only does some logic inside OnCreate/OnDestroy
I'm trying to optimize my update loop right now
Nevermind, RemoveSystemFromUpdateList should do
@safe lintel they didnt say anything else tho
:/
@north bay Does that stop onCreate/OnDestroy?
I'm going to call it from the first systems OnUpdate call
my worry is if the system is not part of the system group how does OnDestory get called? i would have thought it comes from the systemgroup
sounds tricky
what about a RequireSingletonForUpdate<> that will never exist
I can also set this.Enabled to false but I want to strip it completely from the update list
i guess thats still putting a small logic test somewhere
Okay, the OnCreate/OnDestroy calls are independent of the system group
nice
So I should be good
So how do people optimise/profile their DOTS stuff
My EndSim buffer system is taking TONS of time
time just keeps growing π¦
longer i leave it slower it gets
THat looks like a list or other collection just keeps growing in size
well i do have a TON of those
dynamic buffers that keep getting bigger
BUT i never loop over the entire thing
ive figured i can loop over just the last few items to find the one i want
But also digging into the profiler hierarchy, the EndSimEntityCommandBufferSystem is the one making a issue
im also a little concerned about my endsim system taking up time. not really sure what the real solution is other than trying to figure out ways to instantiate with native arrays of entities
Anyone else seeing those things?
no all im doing is removing a component
I have them at each of my CommandBufferSystems
Check the timeline if it is actually the EndSim buffer or the EndSim buffer waiting for a job to complete
Am i correct in assuming this is the 'sync point' Unity talks about (the CompleteAllJobs)
i think its waiting for a job
yea this is a stress test for my networking
ive taken Unitys BoidDemo, networked it, and im spawning 4k boids
without doing things like optmizing the network data (im syncing the whole localToWorld matrix, which isnt great)
it was very easy to network tho π which im happy about
Does the time the LocalToWorldSystem take keep growing or which one does?
That sounds really cool, you gotta share a gif or something π
yea, so this networking is based on Curves, so im syncing keyframes of data and then 'playing' that back on the client
so that list of curves (or arcs as im preferring to call them) just keeps growing π¦
i'm planning to write them out to files or something for replay playback
Do you not use a circular buffer to erase the old ones?
i probably will when i have the file writing part done
yeah a ring buffer, you don't need more than RTT length ?
for now ill try just removing all the old ones
and yea i dont really need that many
BUT one of the cool things you can do is change the game time, so i can scroll back in time like a movie and everything correctly updates and renders
oh yeah then you need every step
i would like to keep that as a feature, makes debugging weird sync things so much easier
but replays don't need to be fast sync'ed ? you can load again fro file ?
i would expect people would want to scroll though the replay
but if theres a time dealy thats ok
i dont expect it would be terriable
like youtube will stream again if you move the head too much
also it might be a matter of just keeping the data in memory but not on a entity
could even be a blob asset ? it's just read only
ill try clearing my arcs and see how it goes
yea but only after the game is 'done' could it become read only
yeah right
replayable RTS right ? could be interesting to see once you get something close to finish π
yea
well its for other people to make a rts
π
tho i do have many ideas/plans
and will use it to make something one day
so is it to finance your project or just for fun ?
both
i may sell it
but also considering open sourcing it
currently its in the for fun stage
that's the best part, before it becomes a job
yea
I mean because all the support and such
thats one of my issues with selling/releasing it
i would love to do that, but time is already tight
having to support people would be a bit of a strain
woo
that profiler sucks
π
my issue was i had a bug where i was looping over my entire arc
whoops
if I have a game where you loop through a huge amount of variables every frame but there isn't that much gameobjects in the scene would dots still help the performance?
@thin moth Probably Jobs/Burst would be better then ECS
if your variables are structs, you can put them all in a native collection and feed into a job
oh thanks. is there any documentation on that or something to learn it?
theres probably something offical on the job system now days
thanks
Roycons link is better, the one I posted already expects you to know how jobs work
oh ok
DOTS really should have it's own category on the left
NetCode, Physics, Animation, etc... doesn't fit in other channels
But it is already #archived-dots channel
you can mess with RequireForUpdate. if you need details, let me know.
how hard is dots/ecs for someone without much programming experience to understand? should you do some years of work with the standard monobehaviour stuff first?
its very hard because dots/ecs still isnt finished and lacks proper documentation
Unity DOTS is still young, but you can already learn ECS as an architectural pattern. It's Data-Oriented (vs. OOP). It's not that hard at first, it's like favouring composition above inheritance in OOP. Then yeah it can become more complicated as it's more about your data layout, closer to the hardware, so you can squeeze as much performance as you can by design.
And actually you can have data object composition workflow in MonoBehaviour Unity for years, it's just that beginners tend to mix everything in MonoBehaviours without thinking about it much, just trying to make something work. Then later hit performance issues because that does not scale well
It's good to have some OOP fluency though, this way you can immediately understand DOD benefits
Hope that answers your question @solid estuary , I used some keywords here. If you don't know yet, be sure that MonoBehaviours are not going anywhere soon, and atm an hybrid approach between MBs and DOTS is recommended. So it's safe to begin with the MBs route π
Trying to improve board/2D tile system, I'm exploring vertices and edges approach.
To sum up: my world has a few vertex entities with a translation component, and edge entities which have an edge component linking entities a, b.
OnUpdate I'm drawing lines on edges/between vertices, but as xyz it's a component of each vertex, I need to get translation component first in order to draw it.
Unity complains it can't be done with Burst...
Do you know if it's possible to change architecture design of the system, in order to use Burst?
For example, it would worth copying the xyz values to Edge OnCreate to just have a local (inside egde component) copy? do you thinks that's a good workaround?
public struct Edge :IComponentData{
public Entity a; //from
public Entity b; //to
public Edge(Entity a, Entity b) {
this.a = a;
this.b = b;
}
}
NativeList<Entity> edges; //with Edge component
NativeList<Entity> vertices; //with Translation component
//...
protected override void OnUpdate() {
Entities.ForEach((in Edge e) => {
float3 a = EntityManager.GetComponentData<Translation>(e.a).Value;
float3 b = EntityManager.GetComponentData<Translation>(e.b).Value;
Debug.DrawLine(a, b);
//FIXME WithoutBurst sucks
}).WithoutBurst().Run();
}
Inside SystemBase you can use GetComponent<T> directly. The only reason I see why your Entities.ForEach is complaining about not using burst is that you aren't capturing EntityManager as a local variable. https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/ecs_entities_foreach.html
Also generally try do not use the EntityManager inside ForEach loops. SystemBase should have methods for everything you need.
how would you make a systemBase to only move entities with Car component if not within a entities.ForEach/spawning a new job+ecb?
Either I don't understand what you mean or we aren't understanding each other. According to https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/ecs_entities_foreach.html#supported-features what I was refering is not possible, so that's why I asked for possible workarounds.
Ehhh I didn't mean to say that you shouldn't use Entities.ForEach loops. I rather meant to say that you shouldn't use the EntityManager inside those loops, but the GetCompoennt/SetComponent/GetBuffer methods on your system instead
What exactly are you trying to do? To use burst you can change the code you posted above to this:
Entities.ForEach((in Edge e) => {
float3 a = GetComponent<Translation>(e.a).Value;
float3 b = GetComponent<Translation>(e.b).Value;
Debug.DrawLine(a, b);
}).Run();
Or are you trying to do something else?
I didn't know that. Thanks a lot.
similar Unity complain when trying to use edges variable within Foreach:
protected override void OnUpdate() {
Entities.ForEach((in Edge e) => {
Debug.Log(edges.Length);
//FIXME WithoutBurst
}).WithoutBurst().Run();
}
You need to capture your field above the Entities.ForEach and use that one instead
NativeList<Entity> m_edges;
protected override void OnUpdate() {
var edges = m_edges;
Entities.ForEach((in Edge e) => {
Debug.Log(edges.Length);
}).Run();
}```
and what's the reason behind that?
I mean, m_edges is available...why it needs a local edges at OnUpdate scope?
(besides the mentioned https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/ecs_entities_foreach.html#supported-features)
Seems I cant:
Entities.ForEach((in Edge e, ref Translation t) => {
float3 a = GetComponent<Translation>(e.a).Value;
float3 b = GetComponent<Translation>(e.b).Value;
t.Value.x += 1f;
}).Run();
Unity complains I cant use GetComponent<Translation> if used as a lambda parameter.
If I try to:
Entities.ForEach((in Edge e) => {
float3 a = GetComponent<Translation>(e.a).Value;
float3 b = GetComponent<Translation>(e.b).Value;
Translation t = GetComponent<Translation>(e).Value;
t.Value.x += 1f;
}).Run();
Seems its not updating position (cause it's a local copy?). only option to update WithBurst is using ECB?
You need to use a GetComponentFromEntity first
and use that to read out your Translation components
so GetComponent to get other (not selected by Foreach) entities comps, and GetComponentDataFromEntity for the selected entities?
Although I vaguely remember SystemBase allowing you to still use GetComponent and have it do this automagically
Avoiding the magic code generation for a bit
you'd use var translations = GetComponentDataFromEntity<Translation>(true) to have something for looking up translation components in other entities
so opposite as i said...
In Entities.ForEach((in Edge e, ref Translation t) => { your ref Translation t implies you want read AND write access on that component for the iterative entity
so you can use t.Value.x += 1.0f there
that's correct
Note that the true in GetComponentDataFromEntity specifies that your lookup's will only be reading
but if i need to get OTHER entities translation...seems i cant GetComponent<Translation>(e.a).Value;
Nop, that will use the var translations from above as translations[e.a].Value
....i think im not explaining myself properly
entities.foreach selects CARS, within the loop i want to update car posisions, so ref Translation t as param would work
var translations = GetComponentDataFromEntity<Translation>(true);
Entities.ForEach((in Edge e, ref Translation t) => {
float3 a = translations[e.a].Value;
float3 b = translations[e.b].Value;
t.Value.x += 1f;
}).Run();```
BUT i set the positions depending on....lets say other entities (pedrestians), not selected by lambda
That will throw an alias error since the ForEach accesses the Translation which is also used by GetComponentDataFromEntity<Translation>
Huh really? I didn't know it would :/
that's exactly what I was asking for...:
Entities.ForEach((in Edge e, ref Translation t) => {
float3 a = GetComponent<Translation>(e.a).Value;
float3 b = GetComponent<Translation>(e.b).Value;
t.Value.x += 1f;
}).Run();
Unity complains I cant use GetComponent<Translation> if used as a lambda parameter.
If I try to:
Entities.ForEach((in Edge e) => {
float3 a = GetComponent<Translation>(e.a).Value;
float3 b = GetComponent<Translation>(e.b).Value;
Translation t = GetComponent<Translation>(e).Value;
t.Value.x += 1f;
}).Run();
Seems its not updating position (cause it's a local copy?). only option to update WithBurst is using ECB?
There's also SetComponent which you need to use when you want to copy the variable back. GetComponent doesn't return a reference
So...
Entities.ForEach((Entity e) => {
float3 a = GetComponent<Translation>(e.a).Value;
float3 b = GetComponent<Translation>(e.b).Value;
Translation t = GetComponent<Translation>(e).Value;
t.Value.x += 1f;
SetComponent<Translation>(e, t);
}).Run();
?
If you wanna write to the translation of e, yes.
while querying other entities Translations not selected by the filter
Ehh basically
this doesn't sounds pretty well...
@north bay Would the alias error still happen if it was in Translation ?
And writing of changes were done through an ECB
I don't think so, as long as all access is readonly
ecb would work
Cool, that makes sense at least
Well as you see there are a lot of nuances to all this stuff. That can almost seem random
Yeah learning the ECS and all its corners is tricky
Especially with it's current API. It's just not beginner friendly at all
but im really happy with ECS!...each day im learning something new that looks simpler than the day before...
i have to admit im in ecstasy!
Lets hope it doesn't largely change again throughout the year >_>
I actually hope it does π
Though, to be fair, it has been reasonably stable last year
Basically, what I mean, is gimme the damn enable/disable bitmask π
Though on the other side, I've stopped working with the ECS since last year. So I just kinda want that change because I needed it back then π
There's a lot of stuff tho.
Enable/Disable is pretty fance but unity also needs to solve hierarchies and relationships properly. IL weaving has to be replaced by code gen to fix iteration times.
A proper prefab based workflow
Yeah, I want those roslyn code generators. Those are usefull outside of ECS as well
I read they are in 2021.2 but unity said they will stick to 2020.3 lts for now soooooo
π€·ββοΈ
The usual
On your opinion, how much should I "divide" systems?
I mean, I have a test system which moves car to target, rotate towards target and, as it cycles, sets the targetIndex=0 when finished.
Should this be 3 systems/jobs? Does it really makes sense?
why cant I Entities.ForEach((Entity e, in Car c, ref Rotation r) => { ... ?
and, what about #archived-dots message ? π
The parameter order is wrong.. First the variables without modifier, then ref, then in
doc link?...
That's not something that can be easily answered and is mostly preference.
The more you divide and simplify your data and operations the easier you make it for burst to vectorize it.
But that might also introduce complexity and/or mental overhead, and in the current state of ECS systems have a pretty big cost.
@north bay and, what about #archived-dots message ? π π π π
I think that's just a limitation of the way unity does the code generation behind Entities.ForEach but I'm not sure about that and mostly guessing.
Yeah it's because of the lambda. csharp (not related to dots) will create a class with a field to have a valid reference to the captured var at the moment the code is gen. (your lambdas are compiled as jobs and queries are built from them, so they actually are used before system OnUpdate)
i'm not sure if i understood, but it's probably over my league so :whatever: π Thanks anyway
Basically it avoids some edge-cases where the var could have a different value but it will be tricky to see when. Capturing a var in the same scope as the lambda (the method above is the same scope, lambdas don't have their own) is a fail-safe
errr sorry that's very badly explained :/
just do it :p, it's a c# edge-case about references/values
occluded |= my_cool_bool_function();
Does this... short cirquit if occluded is already true?
Does it do so in [BurstCompile] code?
Aaand... I want to build my own collision world or BVH, has anyone done that? (not physics... just collisions, I need to select and scale objects that go into it by some specific rules)
I can see Broadphase.cs but Unity Technologies really, REALLY need to stop using the internal keyword. 
i have been playing on that last week
achieved to identify 3 use cases, implemented 2.
the third is the example using pointer, and altough seems the "ideal" for handling per-collider collisions, didn't get into it. probably next week
This helped me A LOT: https://www.youtube.com/watch?v=jga3nj_Ott4
Thanks @night venture
I saw these tutorials a while back, but they seem to work directly with the normal physics, or so I thought.
not that video...iirc it uses triggers, but don't hesitate to ask, as i have it fresh π
Basically I have objects whose position isn't really their translation, (floating / meta coordinate system). They are rather small but when you get close, they can occlude others. So I need to care only about a few in the immediate vicinity of the player, and because of precision, I can't use the normal collisionworld for it.
(I also want to write my own collision tests / collision warnings)
An alternative approach would be to "fake" the translations from the meta coordinates; but I decided to go for a camera centric rendering approach that already builds custom LTW matrices for these objects.
The other system wouldn't interfere with that much, but it would seem awkward. (the more I think about it, perhaps not)
ok...i think your question could probably be answered with my previous unanswered masterpiece, although i got an idea yet to test...let me introduce you...:
so far, I have been able to detect entities colliding (of course, entities have physics shapes=>colliders)
Yeah that works that's not the problem.
π
And I can schedule batch raycasts fine, too.
but, i was interested in being able to detect "an specific collider" collision (ie: part of an object)
But I realize if I just abuse the physics world builder then these special entities will be pretty easy to move around.
Wow. Like, 10 lines of code easy. Of course it's against anything that is pure and holy in software engineering...
Oh yeah I'll need that at some point too.
i think the only way to detect an specific collider is to use unsafe Ptr* to collider, as described in examples
but was wondering if someone has been able to handle "child" colliders as entities with a parent or something like that
I YET have to get into conversion, but doing things manually helps a lot to learn
so: how to detect an specific collider (not a physics body, but shape) which is part of an entity, but only "that collider" and not the entity itself?
perhaps attaching entities together?
Well you can also just raycast manually against any entity that has a PhysicsCollider component, but you need to inverse transform your raycastinput.
I'll try the translation thing. The weird thing is, that didn't work for a reason but I fail to recall why. Because it could get rid of my write group madness...
no raycasting! that's not a collision xD
ill ask you for raycasting help in a few days
XD
Any update on the ECS compatibility post ?
no that im aware
The bounding volume hierarchy dots physics uses is public
I can but I will have to downgrade a ton of stuff
Like shaders π¦
So I want to know exactly what the deal is before I spend more time
sorry for you. that's why im using LTS....my bet is you wont be able to use future entities releases until 2022 π
Yea it sucks atm
yeah im just using 2021 until it actually stops working π
Lol
or maybe just version lock here for a year, everything seems to work quite well for me
So frustrated atm
how many alpha's have u been involved with so far? xD
I find myself drinking 12 cups of coffee a day now
The thread really makes me wonder why unity doesn't say anything. Like literally anything. Their communication "strategy" is really confusing
I know!!!
I donβt need any details
Just say it ok
Itβs nuts
Unless itβs not all ok
Better to make a coffee
you can always find more productive ways to spent the time, rather than crying out loud...
...
...
like helping people get into this DOTS mess with you! π
I saw Mike Acton drive infront of me last year , I should try find him and ask him lol
you can cry out loud as well as help those crying about their own project problems π
actually out of curiosity did 2021 introduce shader features and changes?
urp deferred in hybrid v2(still github) but it works almost perfectly
oh right
actually having more than a directional light for an indoor fps, is really refreshing π
I will leave the thread open for questions, but please understand that this is the information we can share at this point in time.
Anyone else really annoyed by this line? The choice to lock entities to 2020 must have a good reason, why not state the reason?
Maybe they need to think of one first π

its a masterfully vague statement. feel free to ask questions but hey we wont be answering them
I mean they did for like 2 hours
Yeah... especially since people started speculating that this means they may be deprecating the entities package. I feel like it would be important to lay any fears to rest, or let people know...
I feel like the answers they gave only raise further questions
I do love that the one guy came in talking like thank god unity decided to stop dev, kind of a masterful troll with no one official to disprove it
I think this I why so many ppl assume the worse because not saying anything is in line w the worst case
Yeah it's laughable all around
I feel like unity "canceling" DOTS and keeping "only" Jobs & Burst this far in would hurt their image a lot, especially now that they are publicly traded
I know dots is all 3 pillars, job burst and ECS but ECS always felt like the thickest pilar to me
To me dots wouldnβt b the same without it
I mean entities in its current state "works", I feel like the real hurdle is usability
Well we still need a way to write actual gameplay logic on top of jobs and burst so yea
I also don't understand the whole thing with Entities 0.18 is coming. Coming where? You just said we need to stay on 2020.3 LTS and Entities 0.17 until the end of the year, and that 2021+ does not support Entities? So where exactly is Entities 0.18 coming?
You must stay on Unity 2020 LTS and on Entities 0.17 for now I think the for now was regarding the entities version
But if so it's poorly worded π€·ββοΈ
I mean what other version would I use, 0.17 is the latest...
Stay on ... for now implies there exists a different version
Ah nvm, I see what you mean
Stay on .. for now implying "don't upgrade to 2021+"
hey guys, i'm trying to cast rays in different degrees from my source, lets say in a frontal 180 arc.. so what should the End value be if my RaycastInput looks like this:
var raycastInput = new RaycastInput
{
Start = position.Value,
End = position.Value + (math.forward(rotation.Value) * maxDistance),
Filter = CollisionFilter.Default
};
will rotation.value + 10 be 10 degrees off forward?
rotation.value is a quaternion so you won't be able to add 10. Is this in 2D or 3D?
3D
Then first figure out the axis you want to raycast along
I want to raycast over the XZ plane, basically a turret that can rotate 45 degrees from it's original forward direction
Some questions about NativeMultiHashMap. Are my assumptions correct here?
https://docs.unity3d.com/Packages/com.unity.collections@0.0/api/Unity.Collections.NativeMultiHashMap-2.html#Unity_Collections_NativeMultiHashMap_2_Remove__0_
^ This removes ALL mappings for a particular key
https://docs.unity3d.com/Packages/com.unity.collections@0.0/api/Unity.Collections.NativeMultiHashMap-2.html#Unity_Collections_NativeMultiHashMap_2_Remove_Unity_Collections_NativeMultiHashMapIterator__0__
^ This is the only way to remove a particular single mapping for a key and you have to do it by first calling:
https://docs.unity3d.com/Packages/com.unity.collections@0.0/api/Unity.Collections.NativeMultiHashMap-2.html#Unity_Collections_NativeMultiHashMap_2_TryGetFirstValue__0__1__Unity_Collections_NativeMultiHashMapIterator__0___
OR
https://docs.unity3d.com/Packages/com.unity.collections@0.0/api/Unity.Collections.NativeMultiHashMap-2.html#Unity_Collections_NativeMultiHashMap_2_TryGetNextValue__1__Unity_Collections_NativeMultiHashMapIterator__0___
And then calling Remove with the out NativeMultiHashMapIterator value?
Sorry if these are obvious questions but the docs are extremely light in this area
Getting the direction should look somewhat like this
var direction = math.mul( math.forward( rotation.Value ), quaternion.AxisAngle( new float3( 0, 1, 0 ), math.radians( angleInDegrees ) ) );
nice one, thanks!
Ehh you actually have to swap the parameters inside the math.mul, my bad
I will test it out, great
I just did something similar to this a couple days ago:
float arcLength = totalArcLength*2*Mathf.PI / numArcs;
for(int rad = radiis; rad >=0; rad--)
{
for(int arc = numArcs; arc>0; arc--)
{
Vector3 dir = VectorFromAngle(arc*arcLength);
dir.y = Mathf.Lerp(lerpLow, lerpHigh, (float)rad / (float)radiis);
dir *= magnitude;
Ray ray = new Ray(transform.position, dir);
Debug.Log(ray);
Debug.DrawRay(ray.origin, ray.direction, Color.cyan);
}
}
produces this as you play around with the numArcs/radiis/totalArcLength
nice, how do you keep track of the rays being drawn? assuming it draws them all every frame?
as in, for debug purposes
yea, right now it is just redrawn each frame in Update
I was testing out how to handle vision for an AI, oh and the VectorFromAngle method in there is taking an angle in radians, you can find the code for that very easily online.
Also, what attributes should my system have if it's relying on raycasting in OnStartRunning()
do I need any UpdateInGroup?
@solid rock I'm not answering your question, I'll just say, click the blue button on the top, or use @latest in the URL
I need to stop trusting Google so much
thanks
At least they added a 1 line description xD
yeah yeah evolving too fast for google links
I'm not 100% sure I understand what Removes all elements with the specified iterator the container. means
but I'll see what happens
That sentence seems grammatically incorrect as well π¦
some engineer begrudgingly filled in those 1 line descriptions π
should be "from the container" I guess
Is there any way to have a "fixed length array" in a struct in a NativeContainer?
For example:
struct MyStruct {
int a, b, c, d;
}
NativeArray<MyStruct> arr;
I'd like to be able to access a, b, c, d inside of a loop as if it were an array by incrementing an index. If this was C I could do some pointer math like:
struct MyStruct ms;
int *field = &ms;
for (int i = 0; i < 4; i++) {
field = field + (i * sizeof(int));
int value = *field;
}```
obviously MyStruct cannot contain a regular managed C# array
just int in my case
Ideally any struct (that itself abides by the rules of the Job system of course)
So you mean another separate NativeContainer basically?
so like:
NativeArray<MyStruct> mainStructs;
NativeArray<int> ints;
where ints is 4x longer than mainStructs?
oh you want in jobs AND in your struct
so I could do like ints[index * 4] through ints[index * 4 + 3]
Yeah I basically want
struct MyStruct {
int[4] values;
}
NativeArray<MyStruct> data;```
I see I could do it with a separate NativeArray
instead of the struct itself containing the ints
Maybe I'll just do it with a separate NativeArray
that may be better anyway
a dynamicBuffer ?
I'm exhausted to try to make this fcking vector3.lerp work and I'm unable...
could someone help me make a f* *cking box follow a fcking line?
not sure I'm following with the "blob array" concept
I think you might be in the wrong channel?
i made it work with static gameobjects, but i havent with ecs...and i have spent all the f*kin afternooon. sorry for rant
gotcha
and, beside that...if i paste some code in #π»βcode-beginner or #archived-code-general that "smells" DOTS, they just forward here π
it's serialized immutable data, but i guess you need your values to change at runtime
I'd say a FixedList32 or DynamicBuffer, even if they are resizable
I'm not using Unity.Entities
Ok FixedList32 might be exactly what I need maybe
ok FixedList32 then, it's in COllections
maybe FixedList128?
is it a list of 32 bit elements
or a 32 bit list
oh it's bytes
so a FixedList32 would have room for 8 4-byte elements?
But there's no FixedList16 π€
boy there's some oddball collections in here haha
you can math.lerp() ? and apply result to the translate ?
car is not moving smoothly but jumping
Nativelist<Entity> path;
...
Entities.ForEach((ref Car c, in Entity e) => {
Translation t = GetComponent<Translation>(e);
if (interpolation >= 0.9f) {
// Destination reached
c.targetIndex++; // next in list
interpolation = 0;
if (c.targetIndex == _path.Length) {
// Start over
c.targetIndex = 0;
}
}
float speed = 0.005f;
Entity _current, _first, _second, _target;
next4Vertex(ref _path, c.targetIndex, out _current, out _first, out _second, out _target);
float3 current = GetComponent<Translation>(_current).Value;
float3 first = GetComponent<Translation>(_first).Value;
float3 second = GetComponent<Translation>(_second).Value;
float3 target = GetComponent<Translation>(_target).Value;
interpolation = (interpolation + speed) % 1;
float3 ab = math.lerp(current, first, interpolation);
float3 bc = math.lerp(first, second, interpolation);
float3 cd = math.lerp(second, target, interpolation);
float3 abbc= math.lerp(ab, bc, interpolation);
float3 bccd = math.lerp(bc, cd, interpolation);
//QuadLerp
//t.Value = math.lerp(ab, bc, interpolation);
//QubicLerp
t.Value = math.lerp(abbc, bccd, interpolation);
SetComponent<Translation>(e, t);
//FIXME burst
}).WithoutBurst().Run();
Hoenstly if I could somehow use this it would be amazing:
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/unsafe-code#fixed-size-buffers
but it only works in unsafe
You can use unsafe stuff in components
You can use it in jobs too
orly. Maybe my main limitation is having never used unsafe before
unsafe is perfectly safe, as long as you dont do anything unsafe
Yep - wrote some unsafe code - promptly did something that would've simply been an ArrayIndexOutOfBoundsException in managed code but instead caused me 2 hours of debugging sadness
but it works now!
and the fixed-size buffers work like a charm!
Except that Visual Studio for Mac's debugger has no idea how to read them and completely bugs out
@solid rock Try Rider if you can, maybe its debugger will be better
But also the VS teams are much better these days, maybe log a bug somewhere?
Rider's debugger is tons better than VS Mac's. But I can't say whether it deals with unsafe stuff in particular
I'm sure Rider will be much better. I vacillate frequently about whether to pay for it
try the 30 day trial
You can keep trying the EAP version if you're cool with using a beta version π
As for debugging unsafe stuff in rider, it works well
EAP ended about a week ago
That's when I had to decide if I liked it enough to pay for (Spoiler: Yes)
Rider's very good, but VS Mac is also really bad
https://www.youtube.com/watch?v=JxI3Eu5DPwE Interesting video, I'll allow myself to tag especially :
- @zenith wyvern because you're doing an ecs roguelike too. But maybe you already know his work, you used the same energy turns as him π
- @stone osprey you were stuck with Items bringing along effects, it might give you ideas
Talk from the Roguelike Celebration 2018 - http://roguelike.club
+seeing composition over inheritance is always satisfying π
Nice talk, thanks for sharing it! It seems the main point was to use composition, ECS forces composition, and only use ECS if you have performance issues.
i still recomend Entitas before unity ECS itself
entitas has far less restrictions and better editor support, so its much smoother to use
unity ecs doesnt even have that good of a peformance. Its actually slower than entitas due to the overheads if you have low entity counts
totally agree with @vagrant surge entitas is great, entitas has extremely low overhead and most of what people need for general gameplay is faster on entitas. Burst is super fast in some situations, but it only overcomes the UECS overheads if you're doing some really hardcore specialized stuff / games based around having a massive amount of things.
Yeah agreed, I've worked part-time with ECS the past one and a half year, and that's my experience as well.
Although I haven't tried Entitas before
i find it funny unity is going so slow that other libraries have leapfrogged it
on the cpp side both entt and flecs are better than unity ecs in their own ways
Is EntityDebugger window deprecated?
Ok, I found it in Analisys menu. It's strange that there are separate windows such like System and Entities that basically do the same
would it make sense to have items be entities instead, with different components for the buffs/stats/bonuses an item might have?
like item entity with a sword component, a bleed component, and a magic component
vs having each item be a component in an inventory entity
or would it make more sense to have those components/buffs be added to aplayer character (doing an MMO-style, but with ships) as items are equipped, and keeping inventory out of it
Thanks for sharing! I have seen it yeah. Watching it again, it seems like his main point against using ECS for a roguelike is that the development overhead generally isn't worth the performance benefits for a roguelike. Which is very fair.
I think it would make more sense for a open-world style game like dwarf fortress where the scale is a lot larger, which is what I'd like to make eventually.
Also yeah Nystrom is awesome, I've learned a lot from his blogs and game design patterns book.
@sturdy rune yeah makes sense too. Depends a lot on your game: how you describe things, query them, and such.
I am struggling to get started on my game because I don't know how to design it. Analysis paralysis. Also want multiplayer but I am having such a hard time figuring out netcode. Worried that if I start without netcode I will never be able to integrate it
Yeah you need to start something and don't allow yourself to get stucked, even if you reach a dead end, that's progress: you eliminated a solution.
And sure I would anticipate netcode from the start, could have to rewrite some parts later otherwise (migrating later is doable for small projects, but I'd still go netcode first).
Try to challenge yourself for your own little game jam
Decide a time frame for a prototype and try to put as much as possible in it. Don't put netcode in this one if that's too scary. Try at least to validate the fun mechanics as a proof of concept. You'll have a better view to conclude if the way you approached your system was right or need some changes, and maybe see the bigger picture for netcode.
Easier said than done I know, but it's also easier to fix a broken thing than starting from a blank page if you have paralysis.
Yes I will keep trying netcode.
It's my biggest challenge. I have done mini systems for all the other stuff and have a working prototype for at least a character, some physics, and collisions, but I want to start with multiplayer foundation so that it makes sense. I have the dotsnet asset also but it's not totally ready
whats your game about?
space game - flying in space collecting items/resources.
let me figure out it better...2d? 3d?
3d
flying through systems or planets or like a plane or how?
I want it to feel like these squad shooters, like Squad, scum, battlefield, tarkov, but in space
so for now just one system with some flair, asteroids, planets, moons
shooter?
space ships but yes shooter
first personm, third person, both?
instead of a body running around, it's a space ship flying. has a loadout, etc
first person primarily
will be some 3rd person elements
have you seen elite dangerous?
someone has been robbed! xD
I want more rpg-like elements, loadouts/kits/etc
so...a space rpg
low TTK, tactical gameplay is my hope.
what is ttk?
hmm I don't want the "levelling up" but there will be collectibles/customization/etc
time to kil
think call of duty vs counterstrike
one you have many bullets to kill, one you have 1 or 2 good shots
ok...im figuring out...more questions:
so you are in a "slow paced" space rpg?
you would pick items to improve/level
(I had a non-dots working prototype, it's ok, but I am using lots of assets and etc. I want to build something myself on dots as exercise)
whats the objective/end?
pick up items that are of value
so
you get resources, can buy better/different weapons and components
it's PVP focused
so elite dangerous/star citizen
so, leaderboards, kills, and resources
ok....is this your dream game?
I have made some smaller projects, never sold anything
am a software engg, have released commercial softwar e:)
ok...i can give you a couple of advices, if u want
always open
1-think smaller....trying to do your masterpiece as the beggining is a shot on your head
so, instead try to learn how to make "things that work".
so...if you want a space sim...would it have gravity?
not likely
would u go down on planets?
would you scavenge debris to get resources?
yes
ok...do you have that already done?
in my non-dots prototype yes I do
how it works?/whats the mechanic?
I have a ship, GO with collider. I have a "mining" asteroid, GO with collider. when I enter the collider I start a coroutine to "add resources" to my player GO, then I go back to spawn (carrier GO with collider), and on entering collider deposit resources to my stash
if I exit the collider, it ends coroutine
I tried with distance calls but did it with events instead
ok...in DOTS, things can be really different, but this could be an example
I did it with mirror and some pre-made assets/a course I took on mp.
now trying to replicate something similar in DOTS, using Netcode
your ship is an entity with no components. the asteroid is an entity with mineral_kind_a component (value=320)
add a button on your screen to gather minerals (notice i havent said "detect collision", neither move the ship, but a test button)
when the button is pressed, add a component mineral_kind_a to the ship and set value 320. set the asteroid value=0 or even remove the component
although it may sound simple, doing this in ECS in a whole adventure, as started typing "entities.foreach" would have a lot of implications you'll learn in the way
well, I have done a course on DOTS
so I am ... ok on how to use dots/some of the basics. my struggle right now is NetCode specifically π
Dots Netcode is in limbo , don't count on it.
xD
that's why I grabbed DOTSNET
also
but it's not ready yet either π what do you mean it is in limbo?
dots itself is quite in the limbo tbh xD
they have hit major blocks afailk and its not heading anywhere
netcode i mean
the other parts seem to progressing in healthy manner.
I have noticed, but every release seems to add soem value/make it better. so I am not so concerned. Not making a prod game yet, just learning so I am up to speed as it goes through. this is for fun
ok...so netcode for multiplayer?
yes
or for stats?
thats the reason also why they went out of their way and 'acquired' a foss netcode lib , MLAPI. cuz ecs netcode was no where close to being done
well both I suppose but for now I just want to ghost some transforms, then see if I can get projectiles working
whats the amount of people playting together? 2? 20?20000?
How do I render sprites (e.g. billboards) in 3D with DOTS / Hybrid Renderer V2 with URP? I've seen some older custom implementations from 2018, but googling brings up Project Tiny so prominently, I am worried π
exactly. I am in no rush, so I am building from basics. Have a ship (box) with both VR and pancake controls, now adding netcode to see two ships flying, then adding projectiles, then adding collisions
will just see where I go
in a multiplayer game , netcode does a lot more than just transmitting data.. i think thats well understood. in a game like he described , you wont need it just for bullets but all the networked aspects all the way from ships , to bullets to inventory etc
im trying to focus on single simpler things...
no I understand.. I have some experience w/mirror and etc
did an RTS in a course as well as a prorotype in non-DOTS for this concept using it
so I just want to start w/basic box/movement and add netcode
how is DOTSNET working out for you so far? on high level it seems to be have right intents , haven explored that in deep..
so it works, and he's developing a ton right now. Just about to add the major component (network identity) that will make it functional for something like this
ECS samples have a FPS demo. dont now really if it has netcode though. anyway, for this kind of game, apart from enjoying youtube i would suggest using an overwhelming quantity of components instead of a big one
but tbh NetCode vs DOTSNET, so far, are VERY different
ghost = networkidentity, sort of
so the mindset/design is very different
NetCode's core principle are very much in line with some of the AAA grade networking solution you would expect but clearly they are having trouble bringing it all together.
yes I suspect this is why they have frozen ther DOTS support for unity 2021
yes I have
depending on whats the ultimate goal of your project is , commercial or learning for eg you could be better of with MB/GO development for parts you are comfortable with and look towards DOTS , more specifically ECS only for pieces that are performance critical.
if you have been around long you would know the entire hybrid approach to DOTS workflow kind of sucks for all the right reasons but that's particulary due to unfinished state of ECS. Burst+Jobs are quite stable and functional and you can squeeze lots of performance out of them with DOD approaches even without an explicit ECS like Entities package..
There is great value to be had from ECS approach to developing things but if you strict timeline or roadmap , riding along with Entities can be rough..
and then there is whole challenge of trying to network a game built on top of a volatile system. and given lackluster state of unity's networking landscape , it can be 2x the pain.
yea that is my biggest fear - I have all of th emini suystems figured out independently, but trying to put them into one project and I am struggling to even get netcode functioning for me
i really won't count on putting anything sensible with current state of NetCode. better look at MLAPI which is neither MMO or FPS/TPS grade either but it has been receiving good updates now and there are some solid milestones on their roadmap that will actually help build a functional networked game. surely that means going back to MB./Go setup since MLAPI is aimed that.
I Was told MLAPI was specifically non-dots
hence DOTSNET π¦
but DOTSNET is under a lot of development and is looking quite good atm
yes , as i said. it going to be real tough to put out anything functional stable give current state of DOTS and Networking within DOTS.
there's no sprite support in DOTS as far as I know, you have to write it yourself if you want it
How to make RequireSingletonBeAbsentForUpdate()?
What about a query WithNone and early-exit if .CalculateEntityCount equals zero ?
well scratch the count I'm drunk, just the query with none is suitable for your use case ?
Yeah I wrote a billboard for now but it's kinda sucky because it needs to coexist with a linerenderer in Mono Gameobject space, but this billboard lives in a Subscene. π
Correct me if I'm wrong: if I use None then it will choose any entity without the component and OnUpdate will be executed. In this case I'd need to add another component to archetype to identify the entities I want to query
Currently I use if (HasSingleton<Bla>()) return; . That's the same as CalculateEntityCount. It works too but when you use RequireForUpdate entity debugger beautifully shows that the system is not run at all.
Your solution is better yes
You tried to inspect and retroengineer RequireForUpdate and it's internal I assume ?
Honestly your solution is okay I wouldnt worry so much and go to my next problem
So basically I could override ShouldRunSystem() of SystemBase. RequireForUpdate just puts the query into list and does checks in this method too. So yeah, not a big deal
Hey guys, i'm trying to change a component passed to a job in the Execute() of the job, but it seems the values in the component reset after the job is completed?
Entities
.WithoutBurst()
.WithAll<TurretComponent>()
.ForEach((ref TurretComponent turret, in Translation translation, in Rotation rotation) =>
{
Dependency = new RayCastJob
{
World = pworld,
SourceTranslation = translation,
SourceRotation = rotation,
TurrentComp = turret
}.Schedule();
}).Run();
struct RayCastJob : IJob
{
[ReadOnly] public CollisionWorld World;
public Translation SourceTranslation;
public Rotation SourceRotation;
public TurretComponent TurrentComp;
public void Execute()
{
World.CastRay(rayInput, out closestHit);
TurretComp.closestTarget = closestHit.Entity
}
}
so TurretComp.closestTarget always stays Entity.Null for some reason, even tho the ray hits
there's something like trail renderer (to draw where an entity has been moving) for ECS?
nope
ok...time to diy π
if your using hybrid you can just use the built in somehow
but if you have the time you could build meshes properly
nah...don't worth it. already done with a system+list+debug. crappy as hell, but works for the task
turns out to be an issue where passing references to jobs makes them a value and therefore changing them means nothing outside of the job, anyone knows how to handle that?
well thats how structs work
I can use [NativeDisableUnsafePtrRestriction] ?
why not?
cause none of those fed values will be accessable
and your poorly scheduling jobs
every loop will get 1 job
where if you used a better job type, you can get 1 job per chunk instead
IJobParallelFor?
also why cant you just world.cast ray inside the foreach?
like that execute code will work in the foreach fine
and you could then just schedule/scheduleparaell and everything will be easy and happt
yea the way your using foreach isnt right, maybe your looking at some older tutorials all about making jobs
we dont need todo that anymore π
Entities.Foreach actually creates a job for you, all magicly under the hood
interesting
yeah i'm still new to all the different ways of doing parallel things, especially with all the api changes
so ideally i will not be using jobs at all?
You only need a custom job if your not using entitys for something
Eg you have a native collection you need to process
Or for something like networking (sending and reading the network packets then directing them somewhere)
Physics still require them tho don't they? ICollisionEventsJob for example
Yea physics has a custom job
For triggers and collisions
And maybe somewhere else too if you want to customize the physics system
But there's a good example somewhere about just using those jobs to add events/components to your entities
so anything entities realted, in a foreach loop
Then you just foreach normally over your Entitys to process the collisions
yeah I do that in another system of mine
a collision jobs add collided entities to a native array, which is consumed in a foreach loop in a different system
so ScheduleParallel() throws this error
EntityBodyIndexMap is not declared [ReadOnly] in a IJobParallelFor job. The container does not support parallel writing. Please use a more suitable container type.
most containers have a parallel writing mode
should I use in?
i'm using CollisionWorld
its in the doc somewhere
that's why I used a job btw, following an example from the unity project:
struct Pick : IJob
{
[ReadOnly] public CollisionWorld CollisionWorld;
to use the ReadOnly attribute
nice, it works
thanks for your help π
it's all these different APIs to do the same thing that confuses me
I have a simple system that it takes more and more time to complete each time. Anyone here could help me on my first contact with profiler?
I dont know why, as its doing the same thing all the time, but FPS are steadily droppin. first time to complete:17s, 2nd:47s, third 1.5 min....lets see if i can figure it out
no...just im stupid xD
π
btw, @ocean tundra: Entities.ForEach doesn't allow to access class members/properties with Burst, so I can make a dummy copy _myvar=myvar in order to use it WithBurst.
but, what about if I need to update/write that variable?
my issue was my buffers just keep growing and i would loop over the entire thing
(i can provide an exmaple, but i think its clear)
when i only need the last x items
yea so the _myvar = var pattern is very common
for reading
now writing is harder
look how fancy: if (_p.Length >= 1000) { _p.RemoveAt(0); } xD
needs to be a native collection
its a float....native float?
πΏ
i mean...i dont want to sound rude, but...wth were they thinking? xD
A job can only write to captured variables that are native containers. (To βreturnβ a single value, create a native array with one element.)
yup thats it
there are user implemented single type containers somewhere
eg native float
nah...> //TO-DO!
You can use NativeReference<T> for one element
yea same
The lonely array π€£
you even named it!
btw @coarse turtle with your use of drawmeshinstancedindirect, are you using it for a multitude of different things/meshes or mostly a single thing many times? just wondering about my usage of it
mainly using it for a single type of mesh
it can work with submeshes, you just need to update the parameters in the compute buffer
have you tried with beginwrite/endwrite? also the whole notion of compute buffers being class things, that you need to dispose/recreate feels awkward
hmm - i haven't yet lol
I'll probably give it a try soon lol
Yea i didnt know that existed since 2020.1 lol
its really amazing for something that doesnt change often, but as with everything in unity, seems like a few more steps into a never ending rabbit hole for more optimization
ive only seen a few mentions of it, mainly from other dots guys eizenhorn, snacktime so seems like cutting edge with very little info about. also hybrid uses it but trying to understand the code there is difficult π
the DOTS rabbit hole of optimisation is craziness, I've barley started looking at it and theres SOOO many ways
Yeah I'll give it a try to see how it works
It's also interesting seeing how Burst optimizes certain things too π
im only bothering to do this because it says on productboard that dots native vfxgraph is still "Under consideration" which is fairly vexing
VFX graph compatability with DOTS will be sooo far away π¦
we dont even have normal particles yet
btw do either of you know where hybrid renderer actually renders stuff? like where the actual Graphics.DrawMeshWhatever is?
Hmm no, I still havent touched Hybrid Renderer
i didnt think it used graphics.draw***
i was under the impression it was using those fancy new RenderingBatch things
no clue if thats the right name π
i distinctly recall something like that being mentioned on the forums, so thanks, its a good lead
out if interest when you find it could you let me know π
i might take a peek at hybrid renderer one day
sure - if i ever find it
https://docs.unity3d.com/2019.1/Documentation/ScriptReference/Rendering.BatchRendererGroup.AddBatch.html probably something liek this?
yea BatchRendererGroup sounds right to me
btw dont suppose either of you know how to "schedule" drawmesh to run after a job completes or from a jobhandle? thats probably the last hurdle for my little adventure
usually I do something like this:
handle.Complete();
Draw(...)
handle = new Job().Schedule(someDeps);
sorry for disturbing you uninteligible talk...
is LocalToWorld.forward (from component) the same as transform.forward ?
@coarse turtle not great to handle.Complete
yes @night venture
you could schedule the new job depending on the old handle
Well I typically schedule it at the end of the frame
so the job is generally done by the start of the nxt frame
i was sort of getting around it by drawing stuff at the start of update, and scheduling jobs after, so it would be using the previous frame's info(which is fine for my uses) but was hoping drawmesh had some hidden jobhandle variant tucked away somewhere
Yea I was hoping for that too
interesting
wonder what hybrid renderer does
lol
inputDeps.Complete(); // #todo
lool
yea its not using jobhandles at all
return new JobHandle();
wow that code is crazy
cant make any sense of it
the systems are dense
yup
and zero comments, i have to comment my own stuff otherwise I forget even in small systems
@safe lintel Okay BeginWrite and EndWrite looks pretty straightforward, I can probably restructure it to get rid of the copy...
// Initialization
transformBuffer = new ComputeBuffer(count, size, ComputeBufferType.Structured, ComputeBufferMode.SubUpdates);
// Before you draw
var data = transformBuffer.BeginWrite<float4x4>(offset, length);
// Fill in data (this was where I did a copy)
transformBuffer.EndWrite<float4x4>(length);
// Draw
DrawMeshInstancedIndirect(...);
yea i need to comment my stuff more
mainly aiming for a system comment describing what the system is for
and maybe 1 on components too
yeah i think the copy part (in my case)NativeArray<DynamicParticle>.Copy(reinterpretedArray, 0, SharedPropertiesArray, 0, instances); is the only bit that goes inside a job right? just planning out the code for my test but havent tested it
Yeah
I think so - I'm wondering if you can just pass data to the job tho and fill it in
or does that throw errors?
what do you mean pass data to the job?
so when you do transformBuffer.BeginWrite(...) you get a native array. So with that native array, I'm wondering if I can pass it to a job and fill the native array with values without having to do a copy
thats my understanding
so in my case it'd look something like
handle.Complete();
Draw(...);
transformBuffer.EndWrite<T>(...);
data = transformBuffer.BeginWrite<T>(...);
handle = new Job {
Destination = data
}.Schedule();
guess i'll give it a try π
hey it works pretty well lol
nice, got it working as well but only single threaded, now trying to figure out how to do it in parallel for my setup
does float3 has something to normalize like Vector3.normalize ?
math.normalize(float3 here) or normalizesafe
should have thought that...already using lerp π€
damn i thought I had the compute buffer job thing figured out singlethreaded, committed it to version control.. and turns out I didnt? glitchin out like my graphics card is failing
what happens?
looks like graphical corruption, polygons going crazy
hmm yea wonder what's happening there - got some code to show?
does the properties array allocate enough elements?
it should, prev code that didnt write to the buffer inside the job was using the same code to calculate the amount. its odd because almost all of my tests previously just errored out if there was a mismatch
hmm yea the job looks right
how does that job get called?
wait ParticleBuffer is the same size as DynamicParticle too right?
ah thats probably it
wait should be the same, Debug.Log(UnsafeUtility.SizeOf<DynamicParticle>() + " - " + UnsafeUtility.SizeOf<ParticleBuffer>()); spits out 140 - 140
UnityEngine.Debug:Log (object)
hmm i guess they're pretty much identical if their structure is also the same
so particlebuffer is just a struct ParticleBuffer : IBufferElementData { public DynamicParticle Value; } am I making an incorrect assumption with reinterpreting?
no i think it should be fine, if they're the same size π€
I sort of do the same thing for my working test, get the dynamicbuffer as a nativearray and pass that directly into the compute buffer and the shader works without glitching out
yea the problem is probably somewhere else
ok now its working, though I know 100% nothing has changed because ive been doing mostly checks with Debug.Log and then discarding changes in source control
argh i really hope its some burst cache thing and not my video card actually dying
anyway for the record left is working, right is the problematic one, not feeling too good about it even though its supposedly working
ok narrowing it down, its due to the instance count so my math is def wrong, but for it doesnt give an error. also the instance count does line up for lower entity counts so thats why it was sometimes working #feelingstupid
folks,i was wondering how to optimize a big open world scene, i want to be able to see the far objects ,plan to use imposter to render the far objects, but isn't
the approach of dividing one big scene into multiple sub scenes is not be able to achieve this ?
Not sure what the act of just dividing the scenes would do beyond the ability to load and unload those scenes separately.
sry, my expression looks kinda confusing . what i meant was load and unload separate scenes as u mentioned
will Imposter even work with entity's π€
i dont think so
How can i fix that issue when instantiating entity with render mesh set translation any pos first frame when Entity instantiating its position became zero and then Transfrom system group start to work and setting it properly and that looks like blinking. How te setup that render start rendering in destination translation?
You just need to make sure your entity gets instantiated and it's position set before the transform system group, so it gets processed by that before the rendering systems.
What is dots?
Also if I remember right you may need to set both LocalToWorld and Translation for it to get processed on the same frame
Check the pinned messages
how does one use a nativereference? ie I have NativeReference<int> Instances; but I cant just use it as Instances+=5;
Instances.Value += 5
Value is returned as a reference
ahhh
Remember that Instances.Value += 5 is the same as Instances.value = Instances.value + 5; so it's not really anything all that magical. You're just reading the value out and setting it back.
what mechanism/pattern does unity use to keep track of what entity indexes are unused in order to reuse them? Wouldn't this pattern require some kind of sorting? or does it do it some other way? how does it get the index when I make a new entity?
@karmic basin Thanks ! Im gonna take a look at that ! π
- Because of the talk... im a bit late ^^
i get that they are reused, I'm wondering how unity keeps track of them and how it decides exactly which index to reuse on a create entity call
you can store empty indexes in an array I guess and just pop the last element, but doesn't unity reuse the lowest index? that must mean it's doing a sort somewhere right?
Ehhh no idea
I don't think they are aggressively reused
They could just store the version numbers in an array and access that by the entity idx to figure out the version
sure that makes sense but they have to pick an index first
I just checked the code and if I understood it correctly they basically have an array of all entities. And one index that points to the next free entity. The index to which the entity points then points to the next free index and so on...
Basically a weakly linked list
is there anyway to scrub the cached archtypes? I keep hitting the 16MB limit
ok so when I free an entity it iterates through the linked list to the right place and inserts the new free entity in the linked list? or is there some optimization there too? (this is all super interesting! thank you!)
I guess my question is, how are newly empty entities inserted into the list?
It's not actually a linked list. It's more of I have an array of all entities and I have an index that points to the next entity that is free. The data at that idx then contains the data for the next free entity and so on.
does it just add the next one at the end then?
when you get a new entity does it just take the oldest unused ID? I thought I grabbed the lowest id doesn't it?
From what I've seen it should take the last one that got deleted, when there is no deleted it should take the highest allocated one
oh ok. i misunderstood. so there's no sorting or organization to that "list" it just reuses the higher numbers even if there's lower ones. I guess if your game goes to that high of an entity count in one frame, odds are it will again so leave the memory reserved and index doesn't really matter
ok thank you! I appreciate all this info script
ur the best
No problem, don't quote me tho. I might be wrong with something. The code is a bit though to understand lol
nah thats fine. I feel like that makes sense hehe
Hey All,
I know this is a transport (networking) question but since Transport is kinda part of DOTS i was thinking there might be someone here who knows more
Anyone using Unity.Transport?
I'm wondering if there a max number of packets I can send per frame
As it seems be dropping a packet but only when im doing my stress tests (8kish entities being synced)
In my smaller tests those packets are definitely working fine
The packets are commands (rpcs basicly) but they all send/receive in the same way as any other synced data
There are VERY few of these commands (only ~2 each frame) which easilly fit within one packet
I haven't configured any Transport Pipelines, looking at getting the debug one in to confirm if packets are dropped
I havnt yet started my network optimisation path, things like bit packing/data compression ect are still missing, however i have good access to all this low level stream writing so should be easy enough to plug in
Did you check if EndSend returns an error code?
I know that @trail burrow did some testing on it and it felt apart with 100 clients sending 1kb packets from/to the server at 30hz.
Ohh nice, i was just starting to look into the return from EndSend
it doesnt say what is a error
im guess negitive number?
nothing in the main comments of that method
maybe its mapped to the StatusCode Enum?
{
NetworkArgumentMismatch = -9, // 0xFFFFFFF7
NetworkSendHandleInvalid = -8, // 0xFFFFFFF8
NetworkDriverParallelForErr = -7, // 0xFFFFFFF9
NetworkHeaderInvalid = -6, // 0xFFFFFFFA
NetworkSendQueueFull = -5, // 0xFFFFFFFB
NetworkPacketOverflow = -4, // 0xFFFFFFFC
NetworkStateMismatch = -3, // 0xFFFFFFFD
NetworkVersionMismatch = -2, // 0xFFFFFFFE
NetworkIdMismatch = -1, // 0xFFFFFFFF
Success = 0,
}```
So the real question is why do they not return the enum?
That send method is called from EndSend
oh nice
ty
ill give it a try later today
im also trying to get the debug pipeline in, see what stats that gives
Ohh they return the written length when not returning an error code
ooo thats another good check
make sure that written length == expected length
since i caculate packet sizes myself
hey...one last question before going to sleep.
Are dynamicBuffers honoring order (when added)?
Trying to add a path/route/set of waypoints attached to an entity...and it would screw all if unordered.
If you mean do they preserve the order that entries are added in then yes (i think, haven't used dots in a while)
I have a question regarding the current state of dots and the Linux Editor, Last time i used dots i couldn't do much without my project folder breaking itself completely. Since then i've switched to linux and am keen to dive back into dots but i'm not sure if that's a good idea given that both dots and the linux editor are experimental. Any advice?
@night venture Yea I use a ton of buffers, and so far i've never seen it break ordering via ADD
BUT there is RemoveAndSwapback or something, that will remove the item at Index, and then take the LAST item and put it in the same place, so that breaks orders
@shy pilot Experimental + Experimental isnt great :/
Is there a non experimental 2020.3 unity editor?
Unity have confirmed they are version locking Entities for about a year so if 2020.3 LTS isnt on linux then i would guess your out of luck
it is. just installed it. The question now is will everything turn to sh*t when i try to use dots on an experimental editor :D
when it already breaks the editor on windows π
@north bay So turns out im filling up my SendQueue,
I get -5 (NetworkSendQueueFull) from that EndSend result
I 'think' i can just increase the send Queue size for now π
Ty for your help
Are there any good workflows for loading/unloading a connected bunch of enemies? I am creating "Levels" of entites from code and I am looking for a good solution to unload all entities from a specific level at once. I could have a Shared Level Component on each entity within a scene or I could use a parent entity with a Level component on it which makes it also easier to distinguish levels in the Entities Window. Both have their pros/cons. Which would/did you guys use?
I generally like the shared component approach, but that might scale badly when you have a lot of levels because of all extra chunks that get created.
Yeah thats what I was afraif about. But on the other side I dont plan to load many levels at the same time
The other option has the advantage of grouping levels in entities window though
I really miss an option to group entities in entities view without having any other effect like transformations
Subscenes ?
Or for runtime, you could maybe add them to the same world
But you trade this problem for another one where you have to manage systems added to which world π€
I'd try with subscenes first
Could be interesting. I would have to take a look at how they can be created from code and if they work without their Subscenes MonoBehaviour. Its kind of a special use case because I need to load levels in both in Edit mode and at Runtime
u guys all use subscenes to construct big open world?
So we still don't know exactly why (avoiding guesses and speculation here) but the keypoint is confirmed again to be stay on 2020 LTS
(and wait until further notice)
oh, well at least there's hope
everyone loves hope
I'm gunna just go ahead and ship hope in my next release instead of a game
that's a lie, I don't have game releases yet π¦
Isn't that called early access? π
vertical slice
That entire series of posts said absolutely nothing in terms of actual information. But it at least stopped the doomsayers.
I'm honestly with Entities for Burst. If they start back porting Burst 1.5 and beyond to 2020 LTS, I'll manually downgrade my current projects.
Ya know what, fuck it. Time to go back to 2020LTS. All my code thus far is basically just number crunching and should be easy to downgrade. Shoooooould.
With my luck, tomorrow they'll announce that Entities will be continuing the 2021 tech streem.
Why stack is called AppendBuffer? π€π€π€
I don't think it's a choice. If you are using Entities, you *must* stay on Unity 2020 LTS and Entities 0.17 for now
^^
wait, entities 0.18 is coming to 2020 LTS too? that'd be great, I thought we wouldn't get any more updates
yes @odd ridge that's what we're talking about. Entities and related packages will be maintained for 2020LTS until late 2021. they will not be maintained and not guaranteed to work with 2021 until very late in the year
I feel like this link should be pinned in this channel or something
I am using the joystick pack from the asset store for a mobile joystick and I wanna reference it in a data script to be used for movement, however it gives me an error, so is there any way to reference custom scripts/objects in DOTS?
Does API Compatibility level be set to 2.0 for Entities package? I am using Unity 2019.4, imported the Entities, Burst and Jobs packages. However, I am getting a warning:-
Unity.Entities\ApiCompatibilityLevelTest.cs(2,10): warning CS1030: #warning: 'Project is expected to have API Compatibility Level set to .NET Standard 2.0'.
So I am not sure whether this is a hard requirement, searches related to DOTS never brought up this stuff.
yes
Did someone manage to get a mixamo model working with the animation package?
The Terraformer from the sample is working fine but I can't seem to get any other humanoid model to animate.
The AnimatedLocalToWorld buffer is not changing any values so I guess something with the clip/rig is going wrong.
The console isn't giving me anything. Is someone aware of some debug windows/settings that I can toggle?
with the dots animation package? I was able to get one working, but as soon as I put a second actor to animate in it jumbled both
I didn't dig too much. my understanding was that the animation stuff is far from ready and I should just use gameobject animation for that
this was like late last year or w/e, maybe it's better now
@north bay
I dunno I didn't do anything special so maybe I"m not helpful sorry
That's my first time trying the package out. In my actual project I'm using gameObjects for rendering.
They have a 'stress test' where they spawn some characters which are animated which seemed to work with more than 50+ characters.
ah ok then I prolly effed something up
I was surprised that they actually have an animation editor window dunno how useful that is yet tho
I guess I'm stuck with their character for now until I figure out how to add other ones π€·ββοΈ
so the mixamo ones dont have like a root node
the root is like the hip
might be something related to that? I dunno
there's a blender plugin or w/e you can use to rebuild the mixamo fbx with more compabible settings. it's meant for UE4 or w/e but u can dick with the settings to make it fine for unity
Hmm maybe
I'm not that well versed with rigging and shit
I normally tick humanoid and I'm happy it works
lol
But I would've expected the animation package to give me like anything in terms of feedback that something is wrong
i think it's very much in it's infantcy
but I dunno I can't be sure that's the issue i dunno
i needed the root bone to get it to work with kinematica
so I never tried without it
anyone else used dots animation package?
imo you should set the rig to generic, not sure what happens to mixamo characters with this but its how I solved my issues. I was using humanoid exclusively for the same model previously so at least in my case it works, but yeah had issues trying to get humanoid to work with dots animation.
I also am not sure if the package can be used in any real meaningful way without the use of statemachines, it quickly either becomes node graph code spaghetti trying to force them to function like statemachines or you rely on unbursted(I think) mainthread changes to force animation state changes which eats into performance with a lot of entities.
and I dont know if those mainthread issues really showed in that dots fps sample because it was such a small amount of animated chars it doesnt matter at that point.
lastly the default anim graph loader systems allocate something like 2.6kb garbage every frame which is super aggravating
ey! you still here! although half the people suggest DOTS is dead!
Anyway, anyone know why this is NPE?
Entities.Foreach...
DynamicBuffer<MyIBufferElementData> foo = new DynamicBuffer<MyIBufferElementData>();
Debug.Log("Length: " + foo.Length); //NullReferenceException: Object reference not set to an instance of an object
...
youre just making an element of a buffer, its not attached to anything
phrasing i guess not an "element" but it would need to be attached to an entity
that could be right, but that doesn't explain why NPE...
to give you some context:
entityA already has a buffer with 10 elements and i want to replace some of them, so as the first draft, i was trying to create a new buffer, clear entityA and iterate through it later
what do you mean npe?
null pointer exception
i mean...the dynamic buffer IS created and Debug.log(foo) correctly prints...but foo.Length is NullPointer???
dunno, is there a reason you arent just using var buffer = EntityManager.AddBuffer<mybuffertype>(entity);
that entity already has a buffer for that (which i want to alter)...though it was better to create a second and replace, rather than messing with "insert".
but the same question still applies: foo is not null but foo.length gives a npe :S
the DynamicBuffer's pointer might not be allocated
structs in C# dont have overridable default constructors
is doesnt revceive an allocator in constructor.
so whatever pointer or pointer chains will just have a null
pretty sure youre supposed to use a nativearray and that wholly replacing the buffer with a another allocation isnt really the way to go
cause the constructor is internal, but what thelebaron said is right
so...either create it outside foreach...or use buffer.insert, right?
Idk what you're trying to do tbh.
not sure if you want a dynamic buffer associated with the entity or if you want some temporary storage lol
to give you some context:
entityA already has a buffer with 10 elements and i want to replace some of them, so as the first draft, i was trying to create a new buffer, clear entityA and iterate through it later
i need a dynamicbuffer associated to the entity, thats for sure (unless theresa better way to add a collection of items to an entity :P)
well you can attach dynamicbuffers via EntityCommandBuffer or EntityManager.
var buffer = cmdBuffer.AddBuffer<T>(entity);
for (i in x) {
buffer.Add(y);
}
yes...but then it would have 2 buffers of the same type attached, and things could become crazy
so you need 2 buffers on the entity?
no, just one, but change the elements inside
but you need some additional temporary storage to iterate later
that's what i was trying as first draft...until it failed with that null pointer. i know i could use a nativearray...but ill use insert instead ans see how it goes
yea - if you can stick with 1 data structure that can work. Otherwise you'll need to do some sort of association between a data structure and an entity for later iteration
10 buffer elements is really a trivial amount of elements, just iterating through a loop should suffice, unless you need to do something really computationally heavy inside each replacement, but that still doesnt relate to the need to "replace a buffer with another buffer". i think you are just making things harder for yourself
aaaaaaand. i cant xD
so you consider it would be better to add a second buffer for the entity and then remove the first?
lol no
ok...entity is created with a buffer of 10 elements. system must iterate through them and add a few in between, so lets say 15 at the end
tried to create a buffer and then add to buffer. didnt work.
tried to insert element into buffer (inside a loop), its not a good idea and neither work
creating a 2nd buffer and then removing the first could probably work...
using a native array+clear+add all, could probably work
...your advice?
Thanks for the tip, that sadly also didn't work. I must be just missing something obvious.
That sounds crazy, in a (release) build?
you have a buffer, use that buffer. trying to remove buffer from entity, add new buffer to entity to replace the contents is just making sync points and unnecessary pain
inserting seems to neither work, as it breaks the references [i+1] and so...
2 options so far: create a 2nd buffer or use a native array...
i think ill use the native array
if you are running into issues with modifying the loop itself you might need to do a reverse loop?
a reverse wont work neither, cause im needing the newly added items, and they arent yet created (ECB) as im inside a foreach
@north bay yeah i get the gc allocations in a build, even in a scene that has zero animated entites
hmmm...its working "too well" XD
consider the following example:
EntityCommandBuffer ecb = commandBufferSystem.CreateCommandBuffer();
Entities.WithAll<MyTag>().ForEach((in Entity _e) => {
ecb.RemoveComponent<MyTag>(_e);
}).Run();
my entities foreach loop is running twice for same entity. seems 'cause the component hasn't been removed (ecb delayed).
is there a better way to ensure something is only run once per entity?
Uhhh are you mixing the FixedStepSimulationSystemGroup with one of the other groups?
Otherwise it should execute only once per entity as long as you don't add MyTag somewhere again
not yet...systems involved dont have any "custom" systemgroup added, but default
do i need ecb.playback or something similar to force the sync?
Entities.WithAll<MyTag>().ForEach((in Entity _e) => {
ecb.RemoveComponent<MyTag>(_e);
}).Run();```
Is that your entire OnUpdate?
And what are you using as the commandBufferSystem?
if i say yes, i would lie to you, cause i have a debug, but yes...no more code.
I thin kyou can easily replicate
No I can't replicate that, never seen something like that happen.
What about this?