#archived-dots

1 messages Β· Page 215 of 1

minor sapphire
#

but you probably don't want to dig too deep into 2021 until further information at least

#

if you're already on it though... maybe just wait for more info

remote crater
#

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

ocean tundra
#

@remote crater Theres a guide for downgrading now

#

thats my plan 😦

night venture
#

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?

ocean tundra
#

yup thats a dynamic buffer

night venture
#

ok. thanks! πŸ™‚

ocean tundra
#

well the downgrade worked

#

yay

#

but i dont really have much in the way of assets

night venture
#

@ocean tundra still here? having some issues with the triggers, dynamicbuffers and official example

ocean tundra
#

i am

#

but havnt used triggers/physics/collisions in ages

night venture
#

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?

ocean tundra
#

use HasComponent instead

#

pretty sure that will work with Buffers (yes weird naming)

#

GetBuffer will throw if there isnt a buffer attached

night venture
#

EntityManager.HasComponent<DynamicBuffer<TriggerEventDetected>>(e) ?

ocean tundra
#

no DynamicBuffer

night venture
#

cant entities have several dynamic buffers?

#

(one for each type)

ocean tundra
#

EntityManager.HasComponent<TriggerEventDetected>(e)

night venture
#

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);
?

ocean tundra
#

no add buffer should work

#

im not sure sorry

#

g2g

night venture
#

bye. thx anyway

karmic basin
#

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

night venture
karmic basin
#

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

crude sierra
#

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)
            }
        }
crude sierra
#

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));
stable anchor
crude sierra
crude sierra
#

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

stable anchor
# crude sierra for some reason im having trouble copying over the physics data (such as motion ...

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... πŸ€”

crude sierra
pulsar jay
#

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 😬

north bay
#

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.

pulsar jay
#

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

north bay
#

Nothing wrong with having your struct share data/logic. If you look for inspiration check the physics package out. Especially the PhysicsWorld/CollisionWorld.

pulsar jay
#

ok thanks will have a look at that

night venture
#

---
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?

coarse turtle
coarse turtle
gusty comet
#

what is burst synchronous compilation doing? its in toolbar at top of unity. do i need it for ScheduleParallel?

ocean tundra
#

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

naive ice
gusty comet
#

ok thx

north bay
#

Synchronous compilation has nothing to do with builds. Burst uses ahead of time compilation outside the editor.

crude sierra
#

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
north bay
crude sierra
north bay
#

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

sturdy rune
#
Unity Technologies Blog

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

ocean tundra
#

Yup I signed up, nothing tech specific up yet

#

But I love Unity so happy to give time to surveys

karmic basin
#

gonna check if that's open to individuals, Unity is a hobby for me, not my main job

night venture
#

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? 🀣

safe lintel
#

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

robust scaffold
#

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?

karmic basin
#

Just waitNsee

ocean tundra
#

@robust scaffold Yea my unity contact confirmed that ECS is not dead/dieing

safe lintel
#

must be nice to have a unity contact for insider info πŸ˜„

north bay
#

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

ocean tundra
#

@safe lintel they didnt say anything else tho

#

:/

#

@north bay Does that stop onCreate/OnDestroy?

north bay
#

I'm going to call it from the first systems OnUpdate call

ocean tundra
#

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

north bay
#

Ehh

#

Let me check actually, now that you say it

ocean tundra
#

what about a RequireSingletonForUpdate<> that will never exist

north bay
#

I can also set this.Enabled to false but I want to strip it completely from the update list

ocean tundra
#

i guess thats still putting a small logic test somewhere

north bay
#

Okay, the OnCreate/OnDestroy calls are independent of the system group

ocean tundra
#

nice

north bay
#

So I should be good

ocean tundra
#

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

north bay
#

THat looks like a list or other collection just keeps growing in size

ocean tundra
#

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

safe lintel
#

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

ocean tundra
#

im not instantiating anything

#

i think...

north bay
#

Anyone else seeing those things?

ocean tundra
#

no all im doing is removing a component

north bay
#

I have them at each of my CommandBufferSystems

north bay
ocean tundra
#

Am i correct in assuming this is the 'sync point' Unity talks about (the CompleteAllJobs)

#

i think its waiting for a job

north bay
#

LocalToWorldSystem is taking 14ms?

#

That's pretty crazy lol

ocean tundra
#

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

north bay
#

Does the time the LocalToWorldSystem take keep growing or which one does?

#

That sounds really cool, you gotta share a gif or something πŸ˜„

ocean tundra
#

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

north bay
#

Do you not use a circular buffer to erase the old ones?

ocean tundra
#

i probably will when i have the file writing part done

karmic basin
#

yeah a ring buffer, you don't need more than RTT length ?

ocean tundra
#

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

karmic basin
#

oh yeah then you need every step

ocean tundra
#

i would like to keep that as a feature, makes debugging weird sync things so much easier

karmic basin
#

but replays don't need to be fast sync'ed ? you can load again fro file ?

ocean tundra
#

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

karmic basin
#

like youtube will stream again if you move the head too much

ocean tundra
#

also it might be a matter of just keeping the data in memory but not on a entity

karmic basin
#

could even be a blob asset ? it's just read only

ocean tundra
#

ill try clearing my arcs and see how it goes

#

yea but only after the game is 'done' could it become read only

karmic basin
#

yeah right

#

replayable RTS right ? could be interesting to see once you get something close to finish πŸ™‚

ocean tundra
#

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

karmic basin
#

so is it to finance your project or just for fun ?

ocean tundra
#

both

#

i may sell it

#

but also considering open sourcing it

#

currently its in the for fun stage

karmic basin
#

that's the best part, before it becomes a job

ocean tundra
#

yea

karmic basin
#

I mean because all the support and such

ocean tundra
#

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

thin moth
#

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?

ocean tundra
#

@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

thin moth
ocean tundra
#

theres probably something offical on the job system now days

thin moth
#

thanks

ocean tundra
north bay
#

Roycons link is better, the one I posted already expects you to know how jobs work

thin moth
#

oh ok

sturdy rune
#

DOTS really should have it's own category on the left

#

NetCode, Physics, Animation, etc... doesn't fit in other channels

karmic basin
night venture
solid estuary
#

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?

gusty comet
#

its very hard because dots/ecs still isnt finished and lacks proper documentation

karmic basin
#

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 πŸ‘

night venture
#

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();
}
north bay
#

Also generally try do not use the EntityManager inside ForEach loops. SystemBase should have methods for everything you need.

night venture
night venture
north bay
north bay
night venture
night venture
north bay
night venture
night venture
# north bay What exactly are you trying to do? To use burst you can change the code you post...

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?

stiff skiff
#

You need to use a GetComponentFromEntity first

#

and use that to read out your Translation components

night venture
stiff skiff
#

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

stiff skiff
#

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

night venture
#

that's correct

stiff skiff
#

Note that the true in GetComponentDataFromEntity specifies that your lookup's will only be reading

night venture
#

but if i need to get OTHER entities translation...seems i cant GetComponent<Translation>(e.a).Value;

stiff skiff
#

Nop, that will use the var translations from above as translations[e.a].Value

night venture
#

....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

stiff skiff
#
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();```
night venture
#

BUT i set the positions depending on....lets say other entities (pedrestians), not selected by lambda

north bay
stiff skiff
#

Huh really? I didn't know it would :/

night venture
#

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?

north bay
#

There's also SetComponent which you need to use when you want to copy the variable back. GetComponent doesn't return a reference

night venture
north bay
#

If you wanna write to the translation of e, yes.

night venture
north bay
#

Ehh basically

night venture
stiff skiff
#

@north bay Would the alias error still happen if it was in Translation ?

#

And writing of changes were done through an ECB

north bay
#

I don't think so, as long as all access is readonly

night venture
stiff skiff
#

Cool, that makes sense at least

north bay
stiff skiff
#

Yeah learning the ECS and all its corners is tricky

north bay
#

Especially with it's current API. It's just not beginner friendly at all

night venture
stiff skiff
#

Lets hope it doesn't largely change again throughout the year >_>

north bay
#

I actually hope it does πŸ™ƒ

stiff skiff
#

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 πŸ˜‚

north bay
#

A proper prefab based workflow

stiff skiff
#

Yeah, I want those roslyn code generators. Those are usefull outside of ECS as well

north bay
#

I read they are in 2021.2 but unity said they will stick to 2020.3 lts for now soooooo

#

πŸ€·β€β™‚οΈ

stiff skiff
#

The usual

night venture
#

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) => { ... ?

north bay
north bay
night venture
north bay
#

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.

karmic basin
#

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)

night venture
karmic basin
#

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

warm panther
#
occluded |= my_cool_bool_function();

Does this... short cirquit if occluded is already true?
Does it do so in [BurstCompile] code?

warm panther
#

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. blackholeangry

night venture
#

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

warm panther
#

Thanks @night venture

#

I saw these tutorials a while back, but they seem to work directly with the normal physics, or so I thought.

night venture
warm panther
#

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)

night venture
#

so far, I have been able to detect entities colliding (of course, entities have physics shapes=>colliders)

warm panther
#

Yeah that works that's not the problem.

#

πŸ™‚

#

And I can schedule batch raycasts fine, too.

night venture
#

but, i was interested in being able to detect "an specific collider" collision (ie: part of an object)

warm panther
#

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...

warm panther
night venture
#

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?

warm panther
#

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...

night venture
#

no raycasting! that's not a collision xD

warm panther
#

It's the first step πŸ˜„

#

Collider cast / Overlap test, etc.

night venture
#

ill ask you for raycasting help in a few days

warm panther
#

XD

light mason
#

Any update on the ECS compatibility post ?

night venture
north bay
light mason
#

Sweet mother

#

Do any unity dev comment here

#

Kinda feel stuck w my ECS project

night venture
#

why?

#

cant u just use LTS?

light mason
#

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

night venture
#

sorry for you. that's why im using LTS....my bet is you wont be able to use future entities releases until 2022 πŸ˜›

light mason
#

Yea it sucks atm

safe lintel
#

yeah im just using 2021 until it actually stops working πŸ˜’

light mason
#

Lol

safe lintel
#

or maybe just version lock here for a year, everything seems to work quite well for me

light mason
#

So frustrated atm

night venture
#

how many alpha's have u been involved with so far? xD

light mason
#

I find myself drinking 12 cups of coffee a day now

north bay
#

The thread really makes me wonder why unity doesn't say anything. Like literally anything. Their communication "strategy" is really confusing

light mason
#

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

night venture
#

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! πŸ˜†

light mason
#

I saw Mike Acton drive infront of me last year , I should try find him and ask him lol

safe lintel
#

you can cry out loud as well as help those crying about their own project problems πŸ˜„

coarse turtle
#

actually out of curiosity did 2021 introduce shader features and changes?

safe lintel
#

urp deferred in hybrid v2(still github) but it works almost perfectly

coarse turtle
#

oh right

safe lintel
#

actually having more than a directional light for an indoor fps, is really refreshing πŸ˜€

jaunty herald
#

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?

north bay
#

Maybe they need to think of one first πŸ™ƒ

jaunty herald
safe lintel
#

its a masterfully vague statement. feel free to ask questions but hey we wont be answering them

north bay
#

I mean they did for like 2 hours

jaunty herald
#

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...

safe lintel
#

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

light mason
#

I think this I why so many ppl assume the worse because not saying anything is in line w the worst case

jaunty herald
#

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

light mason
#

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

jaunty herald
#

I mean entities in its current state "works", I feel like the real hurdle is usability

north bay
jaunty herald
#

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?

north bay
#

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 πŸ€·β€β™‚οΈ

jaunty herald
#

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+"

crude sierra
#

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?

jaunty herald
#

rotation.value is a quaternion so you won't be able to add 10. Is this in 2D or 3D?

jaunty herald
#

Then first figure out the axis you want to raycast along

crude sierra
north bay
north bay
#

Ehh you actually have to swap the parameters inside the math.mul, my bad

crude sierra
maiden hemlock
# crude sierra hey guys, i'm trying to cast rays in different degrees from my source, lets say ...

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

crude sierra
maiden hemlock
#

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.

crude sierra
#

Also, what attributes should my system have if it's relying on raycasting in OnStartRunning()

#

do I need any UpdateInGroup?

karmic basin
#

@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

solid rock
#

thanks

karmic basin
#

At least they added a 1 line description xD

#

yeah yeah evolving too fast for google links

solid rock
#

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 πŸ˜„

karmic basin
#

should be "from the container" I guess

solid rock
#

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

karmic basin
#

array of what type ?

#

bits or generic type ?

solid rock
#

just int in my case

#

Ideally any struct (that itself abides by the rules of the Job system of course)

karmic basin
#

NativeList<int> would be good enough ?

#

It's resizable though

solid rock
#

So you mean another separate NativeContainer basically?

#

so like:

NativeArray<MyStruct> mainStructs;
NativeArray<int> ints;
#

where ints is 4x longer than mainStructs?

karmic basin
#

oh you want in jobs AND in your struct

solid rock
#

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

karmic basin
#

a dynamicBuffer ?

solid rock
#

It doesn't need to be dynamic

#

there are always exactly 4 ints

#

per struct

karmic basin
#

a blob array ?

#

you need to mutate though i guess

night venture
#

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 f
cking line?

solid rock
#

not sure I'm following with the "blob array" concept

solid rock
night venture
#

i made it work with static gameobjects, but i havent with ecs...and i have spent all the f*kin afternooon. sorry for rant

solid rock
#

gotcha

night venture
karmic basin
#

I'd say a FixedList32 or DynamicBuffer, even if they are resizable

solid rock
#

Ok FixedList32 might be exactly what I need maybe

karmic basin
#

ok FixedList32 then, it's in COllections

solid rock
#

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

karmic basin
#

:p

#

I didn't even knew that one

karmic basin
night venture
#

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();
solid rock
zenith wyvern
#

You can use unsafe stuff in components

solid rock
#

I'm not using ECS

#

just the Job System

zenith wyvern
#

You can use it in jobs too

solid rock
#

orly. Maybe my main limitation is having never used unsafe before

mint iron
#

unsafe is perfectly safe, as long as you dont do anything unsafe

solid rock
#

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

ocean tundra
#

@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?

wheat blade
#

Rider's debugger is tons better than VS Mac's. But I can't say whether it deals with unsafe stuff in particular

solid rock
#

I'm sure Rider will be much better. I vacillate frequently about whether to pay for it

ocean tundra
#

try the 30 day trial

coarse turtle
wheat blade
#

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

karmic basin
#

https://www.youtube.com/watch?v=JxI3Eu5DPwE Interesting video, I'll allow myself to tag especially :

  1. @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 πŸ™‚
  2. @stone osprey you were stuck with Items bringing along effects, it might give you ideas
#

+seeing composition over inheritance is always satisfying πŸ˜›

bright sentinel
#

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.

deft stump
#

or use ecs if you're a madlad

#

or crazy

vagrant surge
#

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

mint iron
#

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.

bright sentinel
#

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

vagrant surge
#

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

acoustic spire
#

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

sturdy rune
#

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

zenith wyvern
# karmic basin https://www.youtube.com/watch?v=JxI3Eu5DPwE Interesting video, I'll allow myself...

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.

karmic basin
#

@sturdy rune yeah makes sense too. Depends a lot on your game: how you describe things, query them, and such.

sturdy rune
#

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

karmic basin
#

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.

sturdy rune
#

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

sturdy rune
#

space game - flying in space collecting items/resources.

night venture
#

let me figure out it better...2d? 3d?

sturdy rune
#

3d

night venture
#

flying through systems or planets or like a plane or how?

sturdy rune
#

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

night venture
#

shooter?

sturdy rune
#

space ships but yes shooter

night venture
#

first personm, third person, both?

sturdy rune
#

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

night venture
#

have you seen elite dangerous?

sturdy rune
#

I play star citizen

#

πŸ™‚

night venture
sturdy rune
#

I want more rpg-like elements, loadouts/kits/etc

night venture
#

so...a space rpg

sturdy rune
#

low TTK, tactical gameplay is my hope.

night venture
#

what is ttk?

sturdy rune
#

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

night venture
#

ok...im figuring out...more questions:

#

so you are in a "slow paced" space rpg?

#

you would pick items to improve/level

sturdy rune
#

(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)

night venture
#

whats the objective/end?

sturdy rune
#

pick up items that are of value

#

so

#

you get resources, can buy better/different weapons and components

#

it's PVP focused

night venture
#

so elite dangerous/star citizen

sturdy rune
#

so, leaderboards, kills, and resources

night venture
#

ok....is this your dream game?

sturdy rune
#

yes but those are much more complex

#

yes

night venture
#

have you ever made other games (released)

#

?

sturdy rune
#

I have made some smaller projects, never sold anything

#

am a software engg, have released commercial softwar e:)

night venture
#

ok...i can give you a couple of advices, if u want

sturdy rune
#

always open

night venture
#

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".

sturdy rune
#

I have some things that work

#

this is my first time trying to make something on dots

night venture
#

so...if you want a space sim...would it have gravity?

sturdy rune
#

not likely

night venture
#

would u go down on planets?

sturdy rune
#

not in the version I am working on now

#

maybe in the future

night venture
#

would you scavenge debris to get resources?

sturdy rune
#

yes

night venture
#

ok...do you have that already done?

sturdy rune
#

in my non-dots prototype yes I do

night venture
#

how it works?/whats the mechanic?

sturdy rune
#

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

night venture
#

ok...in DOTS, things can be really different, but this could be an example

sturdy rune
#

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

night venture
#

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

sturdy rune
#

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 πŸ™‚

naive parrot
#

Dots Netcode is in limbo , don't count on it.

night venture
#

xD

sturdy rune
#

that's why I grabbed DOTSNET

#

also

#

but it's not ready yet either πŸ˜› what do you mean it is in limbo?

night venture
#

dots itself is quite in the limbo tbh xD

naive parrot
#

they have hit major blocks afailk and its not heading anywhere

#

netcode i mean

#

the other parts seem to progressing in healthy manner.

sturdy rune
#

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

night venture
#

ok...so netcode for multiplayer?

sturdy rune
#

yes

night venture
#

or for stats?

naive parrot
#

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

sturdy rune
#

well both I suppose but for now I just want to ghost some transforms, then see if I can get projectiles working

night venture
#

whats the amount of people playting together? 2? 20?20000?

warm panther
#

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 πŸ˜„

night venture
#

so you want netcode for bullets, right?

#

have you seen the ECS FPS sample ?

sturdy rune
#

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

naive parrot
#

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

night venture
sturdy rune
#

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

naive parrot
#

how is DOTSNET working out for you so far? on high level it seems to be have right intents , haven explored that in deep..

sturdy rune
#

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

night venture
#

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

sturdy rune
#

but tbh NetCode vs DOTSNET, so far, are VERY different

#

ghost = networkidentity, sort of

#

so the mindset/design is very different

naive parrot
#

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.

sturdy rune
#

yes I suspect this is why they have frozen ther DOTS support for unity 2021

sturdy rune
naive parrot
#

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.

sturdy rune
#

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

naive parrot
#

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.

sturdy rune
#

I Was told MLAPI was specifically non-dots

#

hence DOTSNET 😦

#

but DOTSNET is under a lot of development and is looking quite good atm

naive parrot
#

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.

odd ridge
acoustic spire
#

How to make RequireSingletonBeAbsentForUpdate()?

karmic basin
#

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 ?

warm panther
acoustic spire
# karmic basin What about a query `WithNone` and early-exit if `.CalculateEntityCount` equals z...

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.

karmic basin
#

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

acoustic spire
#

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

crude sierra
#

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

night venture
#

there's something like trail renderer (to draw where an entity has been moving) for ECS?

ocean tundra
#

nope

night venture
#

ok...time to diy πŸ˜‰

ocean tundra
#

if your using hybrid you can just use the built in somehow

#

but if you have the time you could build meshes properly

night venture
#

nah...don't worth it. already done with a system+list+debug. crappy as hell, but works for the task

crude sierra
ocean tundra
#

well thats how structs work

crude sierra
#

I can use [NativeDisableUnsafePtrRestriction] ?

ocean tundra
#

no

#

dont schedule a job from ForEach

crude sierra
#

why not?

ocean tundra
#

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

crude sierra
#

IJobParallelFor?

ocean tundra
#

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

crude sierra
#

hmmm

#

I can try

ocean tundra
#

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

crude sierra
#

interesting

#

yeah i'm still new to all the different ways of doing parallel things, especially with all the api changes

ocean tundra
#

Entitys foreach has 3 'run' methods

#

Run

#

Schedule

#

Schedule parallel

crude sierra
#

yeah but when to use jobs for example

#

still ambiguous to me

ocean tundra
#

It is a job

#

Dam link

#

Go to systems, using entities foreach

crude sierra
#

so ideally i will not be using jobs at all?

ocean tundra
#

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)

crude sierra
#

Physics still require them tho don't they? ICollisionEventsJob for example

ocean tundra
#

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

crude sierra
#

so anything entities realted, in a foreach loop

ocean tundra
#

Then you just foreach normally over your Entitys to process the collisions

crude sierra
#

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

ocean tundra
#

Not a native array, a dynamic buffer

#

Which is attached to a entity

crude sierra
#

yeah theres some usages in the physics sample project

#

ill check them out

crude sierra
ocean tundra
#

most containers have a parallel writing mode

crude sierra
#

should I use in?

ocean tundra
#

if your writing to them

#

if your reading then you just add WithReadOnly

crude sierra
#

i'm using CollisionWorld

ocean tundra
#

its in the doc somewhere

crude sierra
#

to use the ReadOnly attribute

ocean tundra
#

yea add WithReadOnly

#

check out the docs

crude sierra
#

thanks for your help πŸ™‚

#

it's all these different APIs to do the same thing that confuses me

night venture
#

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

ocean tundra
#

any dynamic buffers

#

or lists?

#

i had that issue too

night venture
#

no...just im stupid xD

ocean tundra
#

πŸ˜›

night venture
#

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?

ocean tundra
#

my issue was my buffers just keep growing and i would loop over the entire thing

night venture
#

(i can provide an exmaple, but i think its clear)

ocean tundra
#

when i only need the last x items

#

yea so the _myvar = var pattern is very common

#

for reading

#

now writing is harder

night venture
#

look how fancy: if (_p.Length >= 1000) { _p.RemoveAt(0); } xD

ocean tundra
#

needs to be a native collection

night venture
#

its a float....native float?

ocean tundra
#

no a native array

#

of float

#

1 item

#

same rules on the job page

night venture
#

😿

#

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.)

ocean tundra
#

yup thats it

#

there are user implemented single type containers somewhere

#

eg native float

night venture
#

nah...> //TO-DO!

coarse turtle
#

You can use NativeReference<T> for one element

safe lintel
#

wow never knew these were builtin

#

been doing the lonely array for so long

ocean tundra
#

yea same

night venture
#

you even named it!

safe lintel
#

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

coarse turtle
#

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

safe lintel
#

have you tried with beginwrite/endwrite? also the whole notion of compute buffers being class things, that you need to dispose/recreate feels awkward

coarse turtle
#

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

safe lintel
#

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 πŸ˜ƒ

ocean tundra
#

the DOTS rabbit hole of optimisation is craziness, I've barley started looking at it and theres SOOO many ways

coarse turtle
coarse turtle
safe lintel
#

im only bothering to do this because it says on productboard that dots native vfxgraph is still "Under consideration" which is fairly vexing

ocean tundra
#

VFX graph compatability with DOTS will be sooo far away 😦

#

we dont even have normal particles yet

safe lintel
#

btw do either of you know where hybrid renderer actually renders stuff? like where the actual Graphics.DrawMeshWhatever is?

coarse turtle
#

Hmm no, I still havent touched Hybrid Renderer

ocean tundra
#

i didnt think it used graphics.draw***

#

i was under the impression it was using those fancy new RenderingBatch things

safe lintel
#

well it doesnt but just whatever the equivalent drawing part is

#

ahh thats it

ocean tundra
#

no clue if thats the right name πŸ˜›

safe lintel
#

i distinctly recall something like that being mentioned on the forums, so thanks, its a good lead

ocean tundra
#

out if interest when you find it could you let me know πŸ˜›

#

i might take a peek at hybrid renderer one day

safe lintel
#

sure - if i ever find it

ocean tundra
#

yea BatchRendererGroup sounds right to me

safe lintel
#

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

coarse turtle
#

usually I do something like this:

handle.Complete();
Draw(...)
handle = new Job().Schedule(someDeps);
night venture
#

sorry for disturbing you uninteligible talk...
is LocalToWorld.forward (from component) the same as transform.forward ?

ocean tundra
#

@coarse turtle not great to handle.Complete

safe lintel
#

yes @night venture

ocean tundra
#

you could schedule the new job depending on the old handle

coarse turtle
#

Well I typically schedule it at the end of the frame

#

so the job is generally done by the start of the nxt frame

safe lintel
#

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

coarse turtle
#

Yea I was hoping for that too

ocean tundra
#

interesting

#

wonder what hybrid renderer does

#

lol

#

inputDeps.Complete(); // #todo

coarse turtle
#

lool

ocean tundra
#

yea its not using jobhandles at all

#

return new JobHandle();

#

wow that code is crazy

#

cant make any sense of it

safe lintel
#

the systems are dense

ocean tundra
#

yup

safe lintel
#

and zero comments, i have to comment my own stuff otherwise I forget even in small systems

coarse turtle
#

@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(...);
ocean tundra
#

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

safe lintel
#

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

coarse turtle
#

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?

safe lintel
#

what do you mean pass data to the job?

coarse turtle
#

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

safe lintel
#

thats my understanding

coarse turtle
#

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 πŸ˜…

coarse turtle
safe lintel
#

nice, got it working as well but only single threaded, now trying to figure out how to do it in parallel for my setup

night venture
#

does float3 has something to normalize like Vector3.normalize ?

safe lintel
#

math.normalize(float3 here) or normalizesafe

night venture
safe lintel
#

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

safe lintel
#

looks like graphical corruption, polygons going crazy

coarse turtle
#

hmm yea wonder what's happening there - got some code to show?

safe lintel
coarse turtle
#

does the properties array allocate enough elements?

safe lintel
#

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

coarse turtle
#

hmm yea the job looks right

#

how does that job get called?

#

wait ParticleBuffer is the same size as DynamicParticle too right?

safe lintel
#

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)

coarse turtle
#

hmm i guess they're pretty much identical if their structure is also the same

safe lintel
#

so particlebuffer is just a struct ParticleBuffer : IBufferElementData { public DynamicParticle Value; } am I making an incorrect assumption with reinterpreting?

coarse turtle
#

no i think it should be fine, if they're the same size πŸ€”

safe lintel
#

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

coarse turtle
#

yea the problem is probably somewhere else

safe lintel
#

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

vague cargo
#

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 ?

agile dome
#

Not sure what the act of just dividing the scenes would do beyond the ability to load and unload those scenes separately.

vague cargo
pliant pike
#

will Imposter even work with entity's πŸ€”

vague cargo
#

i dont think so

half jay
#

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?

zenith wyvern
#

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.

fallen shuttle
#

What is dots?

zenith wyvern
#

Also if I remember right you may need to set both LocalToWorld and Translation for it to get processed on the same frame

zenith wyvern
safe lintel
#

how does one use a nativereference? ie I have NativeReference<int> Instances; but I cant just use it as Instances+=5;

north bay
#

Value is returned as a reference

safe lintel
#

ahhh

solid rock
#

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.

slim nebula
#

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?

stone osprey
#

@karmic basin Thanks ! Im gonna take a look at that ! πŸ™‚

#
  • Because of the talk... im a bit late ^^
north bay
slim nebula
#

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?

north bay
#

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

slim nebula
#

sure that makes sense but they have to pick an index first

north bay
#

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

olive kite
#

is there anyway to scrub the cached archtypes? I keep hitting the 16MB limit

slim nebula
#

I guess my question is, how are newly empty entities inserted into the list?

north bay
#

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.

slim nebula
#

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?

north bay
#

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

slim nebula
#

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

north bay
#

No problem, don't quote me tho. I might be wrong with something. The code is a bit though to understand lol

slim nebula
#

nah thats fine. I feel like that makes sense hehe

ocean tundra
#

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

north bay
#

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.

ocean tundra
#

Ohh nice, i was just starting to look into the return from EndSend

#

it doesnt say what is a error

#

im guess negitive number?

north bay
#

Yea

#

There should be alookup somewhere but no idea where that is located

ocean tundra
#

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,
  }```
north bay
#

Looks like it

ocean tundra
#

hmm

#

thats the send method tho

north bay
#

So the real question is why do they not return the enum?

ocean tundra
#

well lets assume that EndSend is the same

#

ha no idea

north bay
#

That send method is called from EndSend

ocean tundra
#

oh nice

#

ty

#

ill give it a try later today

#

im also trying to get the debug pipeline in, see what stats that gives

north bay
ocean tundra
#

ooo thats another good check

#

make sure that written length == expected length

#

since i caculate packet sizes myself

night venture
#

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.

shy pilot
#

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?

ocean tundra
#

@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

shy pilot
#

when it already breaks the editor on windows πŸ˜…

ocean tundra
#

@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

pulsar jay
#

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?

north bay
#

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.

pulsar jay
#

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

karmic basin
#

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

pulsar jay
# karmic basin Subscenes ?

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

vague cargo
#

u guys all use subscenes to construct big open world?

vague cargo
#

wow,impressive

#

lol

karmic basin
#

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)

slim nebula
#

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 😦

north bay
slim nebula
#

hahaha

#

now adays yeah

deft stump
#

vertical slice

robust scaffold
#

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.

robust scaffold
#

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.

slim nebula
#

yeah based on what they saying I think 2020LTS is the right choice

#

for now

acoustic spire
#

Why stack is called AppendBuffer? πŸ€”πŸ€”πŸ€”

odd ridge
#

^^

#

wait, entities 0.18 is coming to 2020 LTS too? that'd be great, I thought we wouldn't get any more updates

slim nebula
#

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

unreal rampart
#

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?

golden delta
#

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.

deft stump
#

yes

north bay
#

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?

slim nebula
#

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

north bay
#

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.

slim nebula
#

ah ok then I prolly effed something up

north bay
#

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 πŸ€·β€β™‚οΈ

slim nebula
#

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

north bay
#

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

slim nebula
#

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?

safe lintel
#

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

night venture
#

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
...
safe lintel
#

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

night venture
#

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

safe lintel
#

what do you mean npe?

night venture
#

null pointer exception

#

i mean...the dynamic buffer IS created and Debug.log(foo) correctly prints...but foo.Length is NullPointer???

safe lintel
#

dunno, is there a reason you arent just using var buffer = EntityManager.AddBuffer<mybuffertype>(entity);

night venture
#

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

coarse turtle
#

the DynamicBuffer's pointer might not be allocated

#

structs in C# dont have overridable default constructors

night venture
coarse turtle
#

so whatever pointer or pointer chains will just have a null

safe lintel
#

pretty sure youre supposed to use a nativearray and that wholly replacing the buffer with a another allocation isnt really the way to go

coarse turtle
night venture
coarse turtle
#

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

night venture
#

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)

coarse turtle
#

well you can attach dynamicbuffers via EntityCommandBuffer or EntityManager.

var buffer = cmdBuffer.AddBuffer<T>(entity);

for (i in x) {
  buffer.Add(y);
}
night venture
#

yes...but then it would have 2 buffers of the same type attached, and things could become crazy

coarse turtle
#

so you need 2 buffers on the entity?

night venture
#

no, just one, but change the elements inside

coarse turtle
#

but you need some additional temporary storage to iterate later

night venture
#

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

coarse turtle
#

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

safe lintel
#

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

night venture
#

aaaaaaand. i cant xD

#

so you consider it would be better to add a second buffer for the entity and then remove the first?

safe lintel
#

lol no

night venture
#

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?

north bay
north bay
safe lintel
#

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

night venture
#

2 options so far: create a 2nd buffer or use a native array...

#

i think ill use the native array

safe lintel
#

if you are running into issues with modifying the loop itself you might need to do a reverse loop?

night venture
safe lintel
#

@north bay yeah i get the gc allocations in a build, even in a scene that has zero animated entites

night venture
#

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?

north bay
#

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

night venture
#

not yet...systems involved dont have any "custom" systemgroup added, but default

#

do i need ecb.playback or something similar to force the sync?

north bay
#

No

#

The CommandBufferSystem plays them back in it's OnUpdate

night venture
#

i dont want to use EntityManager cause im trying to stick with burst...but...

north bay
#
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?

night venture
#

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

north bay
#

No I can't replicate that, never seen something like that happen.

night venture
#

i can share my screen if you bet some $ πŸ˜‰

#

but no more code...restart unity?

north bay
night venture
#

...please, elaborate...

#

commandBufferSystem = World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>(); ?