#archived-dots

1 messages Β· Page 137 of 1

pseudo pollen
#

yeah dotnet core net5 is fully and lots of mono and full framework

tardy locust
mint iron
#

huh, so they're merging all the web stuff into .Net 5+? cause its not included right now thats why core exists?

pseudo pollen
#

full framework last is what it is

tardy locust
#

Core was done to make a subset that took up less space and did things differently using new stuff etc.

dull copper
#

since we are all off topic here now, can I rant a bit about Unity Hub again? πŸ˜…

tardy locust
#

But it became clear very fast that as demands rose up, they were heading for a new situation similar to the one they were trying to get away from

dull copper
#

why would I want to learn more about that?

pseudo pollen
#

well they was merging all to .net Core so name change then make sense

dull copper
#

and why do I have to dismiss that message

#

I mean, everything is fine

tardy locust
#

I assume those are patch notes?

dull copper
#

why even notify that hub actually works?

tardy locust
#

The new .NET going forward will be a ton of Dependecy Injection

#

So you can set up your system exactly as you want it

mint iron
#

@dull copper yeah.. its distracting enough i feel compelled to click dismiss, and then get angry because they made me do it. classic abuse of alerting systems, after a while people will just stop reading it.

dull copper
#

lol, I actually clicked "learn more" the first time

#

guess what it does?

tardy locust
#

Well at least you don't have to deal with all of the shit that happens in #πŸ’»β”ƒunity-talk . I've never seen so many people have trouble using the Unity Hub

dull copper
#

it opens changelog

tardy locust
#

It's kind of astonishing

#

So I was right

#

It opens that

dull copper
tardy locust
#

Now how is animation supposed to work with DOTS and ECS? Do you have to do some weird conversion tomfoolery?

#

I wanna make a small bee that can flap its little wings

opaque ledge
#

there is a dots animation package, but its at 0.2 i think

tardy locust
#

sweats in unfamiliar

dull copper
#

basically, there isn't any good out of the box solution for dots anims right now

tardy locust
#

So what would be the approach?

mint iron
#

not animate

tardy locust
#

:I

dull copper
#

the people who actually can use dots animation (outside of the unity staff) are probably countable with your hands fingers

warped trail
#

i guess for avg Joe dots animation does not exist πŸ˜…

tardy locust
#

So what, you'd have to make a prefab with that on it and convert it or what?

opaque ledge
#

you have to add a monobehaviour to your entity and do query and change your animation according to your datas

#

on paper anyway

tardy locust
#

But wouldn't that be closer to procedural animation then?

dull copper
#

dots sample (that newest 3rd person shooter) does use dots animation

#

it's like the most extensive example you can find for it I suppose

tardy locust
#

mkay

dull copper
#

but the package does ship with some samples I think

mint iron
#

its also probably still using like entities 0.4 no?

dull copper
#

but also I dunno if the dots animation we have access to right now is even compatible with latest entities

#

probably

tardy locust
#

Right.

dull copper
#

welcome to dots

mint iron
#

this is the world we live

tardy locust
#

So procedural might be something that can act as a bandaid

dull copper
#

where everything is wip

#

or just use the old renderer

tardy locust
#

It's not like I need complex animations. Need the flap flaps

dull copper
#

and have actually functional stuff you can use

storm ravine
#

It's not like I need complex animations. Need the flap flaps
@tardy locust simple shader, it's what you want for things like bee

tardy locust
#

A shader that looks like flapping wings?

coarse turtle
#

yes

dull copper
#

ah, if you can just drive it via shader, then that's one way

storm ravine
#

Yes

tardy locust
#

Okay

dull copper
#

vertex offset on shader

coarse turtle
#

that would be a decent way to integrate simple animations

tardy locust
#

Vertex animation it sounds like

storm ravine
#

My animation solution works on shaders

dull copper
#

did the fishes on the boid sample do something like that?

#

or do they even bend there

warped trail
#

yes, they bend

storm ravine
#

Same

tardy locust
#

Sam Jackson in Unity Park: "They bend...they do bend!"

#

maybe no one watched Jurassic Park

storm ravine
tardy locust
#

Shaders have always seemed like black magic to me

opaque ledge
#

because it is

tardy locust
#

It means I don't get how to do any of what was just shown to me

storm ravine
#

Pure math and matrices

tardy locust
#

Welp, no chance of getting that done then

#

Lol

dull copper
#

it does get easier when you realize it's all math programming πŸ™‚

tardy locust
#

That implies I do math

dull copper
#

for game programmer, one would hope so πŸ˜…

tardy locust
#

I have a really akward relationship with math

opaque ledge
#

i can handle vectors, but matricies ? naaaah

tardy locust
#

Long story short, I had a math teacher in highschool that made me genuienly believe that I was actually hopeless at math and that I shouldn't even try 'cause I'd never get better at it.
So every time I engage with math now, if I don't understand what I'm looking at almost immediately then my brain locks up and goes "Well, don't get any of this, time to give up"

storm ravine
#

Hope you're familiar with pointers an low level memory in C#? πŸ˜„ It will help a lot in writing your own Native containers and custom job types and just in avoiding different things which can feels like limitation with burst πŸ™‚

warped trail
#

but vector is just a 1x4 or 4x1 matrix😏

tardy locust
#

Pointers always vexes me because I've never been taught when to use one. I just know it points to something in memory. Never taught why I should give a damn about it.

storm ravine
#

For example have native array of structs which store array inside but like pointers which allow you have fast array of arrays without dynamic buffers and native multi hash maps πŸ™‚

opaque ledge
#

but you cant put them into an entity right ? how its going to work then ? your system holds the data ?

tardy locust
#

Do you store the pointer as an int?

#

A hex value?

storm ravine
#

depends. in some places is MyStruct* in other void* in other int*

#

but you cant put them into an entity right ? how its going to work then ? your system holds the data ?
@opaque ledge systems only relative for call dispose

#

Usually I using couple of my hand written native containers, project specific, and they support async disposing in dependency chain like any other things

dull copper
#

seeing occasionally low level stuff like that is going to scare a lot of people from DOTS

storm ravine
#

Well they make life easier πŸ™‚

dull copper
#

I'm avoiding low level stuff like that myself as it just multiplies the time spent on fixing that stuff when it inevitably breaks on next package updates

tardy locust
#

I'm sad that I was never taught proper C++. I was only taught some hardware architecture by a german dude who had some problems when explaining in English (which was the main language of the course) 😦

storm ravine
#

I'm avoiding low level stuff like that myself as it just multiplies the time spent on fixing that stuff when it inevitably breaks on next package updates
@dull copper opposite, how it can breaks if it's not relates to any package

#

In case of native containers it depends only on Collections package

dull copper
#

pretty sure @mint iron just fought with some burst issue related to something like that

storm ravine
#

which released and not changing in core things

#

Well depends of his usage case πŸ™‚

dull copper
#

but I do get the idea you are after (if you have your own implentation,it's not tied as tightly to stock container code

storm ravine
#

in context of native containers only DisposeSentinel and AtomicSafetyHandle which we using, all other is regular C# stuff

mint iron
#

still fighting it to upgrade my example project, a week later, encountered like 5 different editor crashes. Mostly not my code, just doing things in areas with very low coverage. It just comes down to risk, if nobody is using it, and they're not testing it, then you're more likely to hit issues.

storm ravine
#

Which sort of issues you stuck?

#

I mean what you does with pointers whic cause problems?

tardy locust
#

Can you store a pointer as an entity? A number?

mint iron
#

a pointer is a number

tardy locust
#

yea

storm ravine
#

it's just a memory, range of bytes, it can be any value

#

but pointer itself it's just number

tardy locust
#

I was thinking about it in the context of unity components

mint iron
#

int*, void*, byte*, MyStructOfAwesomeness* are all the same thing, a number for a memory address

tardy locust
#

"but you cant put them into an entity right ? how its going to work then ? your system holds the data ?"
Was asked earlier

#

It would seem that, yes, you can indeed put a pointer in a component

#

then

gentle osprey
#

Hey, I have a basic question just to clear something up. Are systems ever run in parallel in Unity ECS?

storm ravine
#

Systems itself - main threaded

#

only jobs multithreaded

#

systems runs sequentially on main thread and scheduling jobs, and job runs on worker threads

gentle osprey
#

Right, but jobs can "span" multiple systems?

#

That's what the sync points are for?

storm ravine
#

Synch points it's synch points, place where ALL jobs completes before structural changes

#

For jobs with multiple systems

#

if systems have same type dependencies

#

If systems not share any types and haven't dependency on each other, or all share only read dependency then they can work in parallel (jobs i mean)

#

for example SysA read component A SysB read component A SysC read component A, all systems runs sequentially shceduling jobs

#

and this jobs run in parallel

#

But if SysB, for example, write to A then in BeforeUpdate it complete dependency chain (not all jobs from all systems but only shared types dependencies and job handles involved in that chain)

#

This is why you can see error about "You should call Complete on previous scheduled Job bla bla bla" when your job not use system input dependency or use wrong dependency and not return own job handle in to dependency chain.

gentle osprey
#

Right.

dull copper
#

(you don't return job dependencies anymore manually in systembase unless you explicitly need to do so)

gentle osprey
#

Then, if SysB introduced a synch point, all jobs would be forced to complete before anything else could run?

opaque ledge
#

yes

storm ravine
#

Yes

gentle osprey
#

Awesome, thanks for clearing that up :)

opaque ledge
#

and no jobs would be schedule until SysB is done

storm ravine
#

Yes if it has Sync Point, usually all of EntityManager calls is sync point

gentle osprey
#

Awesome, thank you :)

fringe sinew
#

Is there any way to improve the main thread performance in ECS? (regarding the jobs scheduling)

#

IIRC FPS sample had something like that, a scripting define that forced a simpler job scheduling algorithm

#

Not talking about .Run() on the jobs though, just for scheduling them normally

#

It gets quite expensive with many systems unfortunately

storm ravine
#

Well Unity will make systems itself burstable

#

About define

fringe sinew
#

systems are going to be burstable?

#

Wonder how that would work

storm ravine
#

Yes, that's the plan

fringe sinew
#

I don't think I ever heard about such a plan on any of the unite talks. Was it somewhere on the forums?

storm ravine
#

Yes

zenith drum
#

*systems are going to be burstable?

#

HOW

storm ravine
#

About define you can enable simple mode which reduce cost of dependency calculation

#

Can't remember which define name, because not using that

fringe sinew
#

Yeah, that's the one. Forgot how it's called though, didn't find it in the docs either

storm ravine
#

But in this case

#

you'll sacrifice dependency chain

#

and every system will work like with Always Synchronize System attribute

fringe sinew
#

But yeah I really wonder how are they going to make the scheduling systems burstable. Are they really going to burst-optimize the code that fills out the job struct?

storm ravine
#

ENABLE_SIMPLE_SYSTEM_DEPENDENCIES

wide fiber
#

I am using the latest packages and after 20 minutes (wasted), I found out that [GenerateAuthoringComponent] doesn't work with enum variables.. 😩

storm ravine
#

ENABLE_SIMPLE_SYSTEM_DEPENDENCIES define can now be used to replace the automatic dependency chaining with a much simplified strategy. With ENABLE_SIMPLE_SYSTEM_DEPENDENCIES it simply chains jobs in the order of the systems against previous jobs. Without ENABLE_SIMPLE_SYSTEM_DEPENDENCIES, dependencies are automatically chained based on read / write access of component data of each system. In cases when there game code is forced to very few cores or there are many systems, this can improve performance since it reduces overhead in calculating optimal dependencies.

fringe sinew
#

Yes, that's the one

#

Thanks

mint iron
#

I really wonder how are they going to make the scheduling systems burstable I've scheduled from burst jobs before, you could do it before in earlier versions of Entities/Burst before they locked it down. Its definately possible, they probably just need to fix whatever safety concern they had previously.

north bay
#

Maybe we get struct based systems

storm ravine
#

I really wonder how are they going to make the scheduling systems burstable I've scheduled from burst jobs before, you could do it before in earlier versions of Entities/Burst before they locked it down. Its definately possible, they probably just need to fix whatever safety concern they had previously.
@mint iron From bursted job on worker thread not from main thread?

mint iron
#

it was like a year ago so i dont clearly remember but i believe it was scheduled from a sceheduled job

storm ravine
#

I guess you mean burst codepath on main thread. Because scheduling job not from main thread newer was possible from the every beginning. ~2 years of public DOTS existance

#

I guess burstable system will work similar to how EntityComponentStore now works, which allow ECB have burtsable Playback (based on function pointers)

#

We can only guess at the coffee grounds now, until Unity will give us some additional info πŸ™‚ But because it's their plane, they definitely will do that

mint iron
#

interesting, so CreateJobReflectionData i think it used to be exposed, i basically constructed the JobReflectionData in burst and it accepted the ptr/data you gave it on the schedule method.

storm ravine
#

Adding support for completely bursted struct based systems. So a system itself can be burst compiled.

#

From Joachim on forum

#

Well yeah make system burstable not a unimaginable thing, it's still will be main threaded code anyway, just mush faster

mint iron
#

yeah, shouldn't be too bad, they'll just need to sort out alterntaives for the class based functionality, like EntityQuery, EntityManager.

wide fiber
#

Can an IComponentData store an enum variable?

storm ravine
#

Yep, or make a joke and fixed their parts πŸ˜„ 🀣

#

Can an IComponentData store an enum variable?
@wide fiber Yes

#

@wide fiber and GenerateAuthoringComponent works with enums also

wide fiber
#

It doesn't work for me...

storm ravine
#

I just put enum in to my component

#

Show component code here

frozen halo
#

hello

storm ravine
#

GenerateAuthoringComponent currently very sensitive

#

and can just breaks from small things πŸ™‚

wide fiber
#

Yeah but if I select another option, when the entity is converted the value of the variable is always the first of the options..

storm ravine
#

like missed space

frozen halo
#

can somebody help me with anti aliasing because my unity looks terrible

storm ravine
#

@frozen halo go to shaders channel

wide fiber
#

If from the inspector I select OnHold, when it gets converted the value becomes OnClick..

frozen halo
#

this?

wide fiber
storm ravine
#

Shaders channel in discord

frozen halo
#

aa

storm ravine
#

This is DOTS channel

frozen halo
#

right

#

ok

storm ravine
#

@wide fiber still works fine

wide fiber
#

Put the component on a prefab and then put the prefab in the hierarchy

#

Maybe it doesn't work with prefabs

storm ravine
#

Doesn't matter, on prefabs it will work same it will call same code path

#

Which Unity version and packages you're using?

wide fiber
#

In the first frame it is the correct value, then it changes..

#

Unity 2019.3.8f1

storm ravine
#

It's not first frame πŸ™‚ Frame debugger show every time correct value

#

Where you get wrong value

wide fiber
#

Wait, I'll send some screenshots

storm ravine
#

After ToComponentDataArray?

wide fiber
#

(The packages are updated at the latest version)

storm ravine
#

Burst preview 10?

wide fiber
#

Yeah

#

After ToComponentDataArray?
@storm ravine ? (I don't use ToComponentDataArray)

storm ravine
#

Well it can be issue, which we investigated whole morning today with Lee Hammerton from Unity Burst team

#

Okay, first

#

close editor

#

open Library folder

wide fiber
#

Ok

storm ravine
#

And remove BurstCache

#

Only that folder

wide fiber
#

Ok

storm ravine
#

then open Unity, change your authoring, like add one more enum value just for test

#

or reorder fields

#

like trigger with fire

wide fiber
#

Ok

#

Unity crashes when I press the play button...

#

(now it doesn't crash) It still doesn't work

storm ravine
#

Well authoring definitely work

#

How you use that

#

I mean where you get wrong values

tardy locust
#

asking the people here

#

Is it possible to destroy a system during runtime?

#

Lets say I want to spawn something at the start of my game, though I have no other use for that system.

#

What do I do with it?

#

Does Unity dispose of it?

#

Or do I just put things in OnCreate() ?

wide fiber
#

@storm ravine sorry, I am stupid, I've found the error

storm ravine
#

Is it possible to destroy a system during runtime?
@tardy locust RemoveSystemFromUpdateList on group which contains that system

tardy locust
#

And then put logic in OnCreate?

storm ravine
#

But usually just have empty OnUpdate also fine when you only initialize some things in OnCreate and maybe Dispose other in OnDestroy

tardy locust
#

I'm thinking it would be optimised to get rid of the system so Unity doesn't have to care about it after init.

storm ravine
#

I have for example system with OnCreate and OnUpdate for initialization of some singleton entity and disposing data on destroy

tardy locust
#

Okay

storm ravine
#

I'm thinking it would be optimised to get rid of the system so Unity doesn't have to care about it after init.
@tardy locust Well it will be only cost of ShouldRunSystem

#

Also

#

Enabled

mint iron
#
public class SelfDeletingSystem : SystemBase
{
    protected override void OnCreate()
    {
        // Do Something
        Enabled = false;
        World.DestroySystem(this);
    }

    protected override void OnUpdate() 
      => throw new System.NotImplementedException();
}
storm ravine
#

one more easy thing

#

Yep like xzjv showed above

tardy locust
#

I won't have to catch that? @mint iron

mint iron
#

uhh no, the update never runs

tardy locust
#

Okay.

#

Another question

#

What would be the point of making multiple Worlds?

#

I'm assuming it gives you multiple sandboxes of entities

#

But what could be a nice usecase?

storm ravine
#

Save\Load game, data streaming, moving entity creation form the main thread by ExclusiveEntityTransaction, etc.

tardy locust
#

Is that related to the "subscenes" some mentioned?

storm ravine
#

data streaming part is how sub scenes works

tardy locust
#

okay

storm ravine
#

Under hood they have streamingWorld which using ExclusiveEntityTransaction for subscenes data streaming

tardy locust
#

Can you do instanced materials for the Hybrid Renderer @storm ravine ?

#

I did this by making 12 different materials and just assigning them randomly during creation.

#

But with GOs you could make instanced materials to get the same effect right?

storm ravine
#

Only in SRP, for built-in render pipeline HR not support that, for built in render pipeline you should write your own custom render system

tardy locust
#

I have the URP

mystic mountain
#

I really don't get how one should solve things with dependencies that doesn't revolve around components and in systems you have written yourself.
E.g. in my character movement I want to use the last frames PhysicsWorld (because Prediction group order n' stuff), but I don't know how I can specify the BuildPhysicsWorld system to be dependent on my system. Sure I can call Complete() on the handle to make sure it's done, and maybe even Clone the physics world before I run my system(not sure of perf on that one though), but isn't there a clean way to solve this?

tardy locust
#

So if I understand this correctly, you have to make your own shader for this to work @storm ravine ?

#

Using the MaterialProperty decorator?

#

Oh wait...it's only from 2020.1

#

I'm using 2019

#

fuck

storm ravine
#

So if I understand this correctly, you have to make your own shader for this to work @storm ravine ?
@tardy locust no

#

my custom system writes data to some compute buffers asynchronous with new API for compute buffers (Begin\EndWrite) and use DrawMeshInstancedIndirect for rendering

bold pebble
#

How can I make a SystemGroup which runs at the beginning of Update or at least at the earliest possible time inside the SimulationSystemGroup. I have tried to create a ComponentSyystemGroup with this attribute: [UpdateBefore(typeof(SimulationSystemGroup))]
However if I read the EntityDebugger correctly this group seems to run somewhere in the middle of the SimulationSystemGroup...

warped trail
#

@mystic mountain i'm not quite sure if this is what you want, but BuildPhysicsWorld calls at the begining of OnUpdateEndFramePhysicsSystem.FinalJobHandle.Complete(); and EndFramePhysicsSystem has NativeList<JobHandle> HandlesToWaitFor so you can add jobHandle via EndFramePhysicsSystem .HandlesToWaitFor.Add(jobHandle) this will make BuildPhysicsWorld dependant on your job πŸ€”

tardy locust
#

@storm ravine Well when you put it like that I feel like I can't even attempt that Lol

warped trail
#

oh, but it will not combine it until EndFramePhysicsSystem updatesπŸ˜…

mystic mountain
#

@warped trail yep, that is the problem <.<

#

@warped trail If they only just made the FinalJobHandle fully public πŸ™„

tardy locust
#

Expose it to the public. Make it feel the exhibitionism

mystic mountain
#

If there was an easy way to do this without duplicating package and keeping track of updates manually, sure.

storm ravine
#

How can I make a SystemGroup which runs at the beginning of Update or at least at the earliest possible time inside the SimulationSystemGroup. I have tried to create a ComponentSyystemGroup with this attribute: [UpdateBefore(typeof(SimulationSystemGroup))]
However if I read the EntityDebugger correctly this group seems to run somewhere in the middle of the SimulationSystemGroup...
@bold pebble Why you need that in first place?

bold pebble
#

I would like to make sure that my "init" systems (which for example initialize components on entites created in the last frame) are always run first in the update.

storm ravine
#

Usually all my systems order independent, considering that our game not simple and complex enough

tardy locust
#

Order Independent would also be preferred for performance reasons of course

#

But there might be cases where it can't be decoupled like that

storm ravine
#

I would like to make sure that my "init" systems (which for example initialize components on entites created in the last frame) are always run first in the update.
@bold pebble Put them inside InitalizationSystemGroup?

#

But there might be cases where it can't be decoupled like that
@tardy locust examples?

bold pebble
#

@storm ravine Ah, is that group running every frame?

storm ravine
#

of course

#

Initialization Simulation and Presentation runs every frame

warped trail
#

all groups are running every frame

tardy locust
#

Well you might have a system that needs to do a bunch of transformations on a couple of components but you use a different system to apply logic after those transformations.

warped trail
#

unless you make them not

bold pebble
#

OK, then that's the place to put it. thanks πŸ™‚

tardy locust
#

That's something I did at least for my first ecs project

storm ravine
#

Well you might have a system that needs to do a bunch of transformations on a couple of components but you use a different system to apply logic after those transformations.
@tardy locust and how it order dependant? πŸ™‚ order its only from which side you look

#

I'll show you image

tardy locust
#

Considering systems run every frame, B after A

#

Surly if it didn't matter, it wouldn't make sense for Unity to include ways to order when systems run would it?

storm ravine
#

And now I removed Frame borders

#

Which order here?

#

Systems run every frame

tardy locust
#

The initial state is still B after A

#

Removing the boxes didn't change that

storm ravine
#

Because there is no order

#

there is A after B and B after A

tardy locust
#

But then I ask; If there is no order why does Unity give you the ability to order when systems run?

warped trail
#

what about adding one more system C ?

storm ravine
#

Because people still thinking in OOP way and they think about that like how ScriptExecutionOrder works πŸ™‚ Case of UpdateBefore here mostly using inside some nested group which inside ordered for processing some specific algorithms πŸ™‚ Your and brookman cases doesn't fit that and can be absolutely independent.

tardy locust
#

But wouldn't you think that given Unity is Unity, they'd not give that option if it has no effect anyway?

#

Seems rather weird to let that be in there while making this package if it has zero effect

storm ravine
#

You can order them

tardy locust
#

What you are saying doesn't make much sense if it's just a case of "people still think too much in OOP"

storm ravine
#

but main goal not relate on that in most cases

bold pebble
#

Say I have a system which collects user input (clicks, key presses). Wouldn't the order matter here if I would like to reduce input lag?

storm ravine
#

Because in most cases it's not required

tardy locust
#

most cases is the important word

sand prawn
#

Hey folks, having a ton of trouble working through the NetCode/NetCube example here: https://docs.unity3d.com/Packages/com.unity.netcode@0.1/manual/getting-started.html ... Some easy hacks/fixes got everything to compile, but nothing moves or works right -- my cube does not seem to have ended up with the same components (none of the Render bits shown in the multiplayer github version of this, for example), for one thing. For another, I cannot seem to catch GoInGameRequest ever being sent or received in the debugger. A bit stumped as to how to debug or what I am doing wrong. Unity version is 2019.3.11f1

tardy locust
#

That means there are some cases

#

So it's not completely useless whats in there.

storm ravine
#

This is what I wrote above

#

Right after OOP

tardy locust
#

I said there was probably some examples

#

And then you asked me

#

"What examples?"

storm ravine
#

Say I have a system which collects user input (clicks, key presses). Wouldn't the order matter here if I would like to reduce input lag?
@bold pebble for networking it matter, for regular without multiplayer - don't. 1 frame don't give you a difference

tardy locust
#

Indicating you'd think there was no examples.

storm ravine
#

Who said that? It's only what you imagine

tardy locust
#

You said that

storm ravine
#

Yes

#

Where I said "Indicating you'd think there was no examples."?

tardy locust
#

That implies you think there are no examples of that being the case.

storm ravine
#

Nowhere

#

Well you think wrong πŸ™‚

tardy locust
#

Otherwise you'd have said "probably some, yea" or nothing at all

#

Anyway, small point there. So there are examples then. Cool. The ability to order system execution and why its there has been established πŸ‘

#

I don't even want to think about DOTS and networking...phew. I've looked into the FPS sample and...well

#

A lot is going on in there

sand prawn
#

Oh, fun. I figured out why my RPC wasn't happening. I had ConvertToClientServerEntity setup wrong

#

But now nothing renders

tardy locust
#

fun

sand prawn
#

Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 6)
I also see zillions of these

#

Is that a known bug?

tardy locust
#

You forgot to dispose of native arrays

sand prawn
#

Am I supposed to fix generated code?

tardy locust
#

Hm

#

I didn't know it was generated but

#

Are you allocating data anywhere yourself?

sand prawn
#

Lemme double-check

warped trail
#

unity's safety system is not very friendly with low frequency update systems πŸ˜…

sand prawn
#

All generated

tardy locust
#

hm

storm ravine
#

Main point was - example you will tell me right now from your mind wouldn't fit that, because I was sure in that πŸ™‚ And it's was it and I showed you that it's usually not the case as you think about that at first place, cases for matter order mostly exceptions than regular thing πŸ™‚ brookman example about networking - definitely good and partially fit that because in networking game it matter and you can't (but not always) spread this across 2 frames.

warped trail
#

if your systems will update much slower then your frame rate you will probably get a lot of Internal: deleting an allocationπŸ˜…

tardy locust
#

@storm ravine okay

storm ravine
#

Don't think about blaming or something

#

I only showed that if look at case from different direction you can exclude that order dependency, and it usually suitable for 90% of cases

tardy locust
#

I didn't blame. I pointed out how the language you used came across.

#

That's it

#

Either way we've moved on. It's resolved.

storm ravine
#

No I missed words here "Don't think about that like I'm blaming you or something"

#

πŸ˜„

gilded glacier
#

question: I have a collection of scriptable object containing all the fancy game stuff (prefabs, materials, stats, names, ...)

#

should I reference them using a blob asset reference, or using an identifier (array index) stored in entity component data and access the collection using that index from system ?

storm ravine
#

Depends, we're using both

tardy locust
#

I'm assuming the Addressable system was made for this?

gilded glacier
#

I even run some testing

storm ravine
#

At application start converting scriptable objects with stuff from Addressables to entities prefabs, materials maps etc and store some things inside blobs, other things in singleton entities

gilded glacier
#

looks like accessing scriptable object using an index is slightly faster than blob

#

so I should not work with SOs during runtime at all ?

tardy locust
#

For entities data just needs to be available best possible right? So if you need to convert then that's it

storm ravine
#

You can use them. Depends on type of data in your scriptable objects

#

if all blittable you can convert that to entity with component storing that, to blob, etc.

#

You for you mush convenient have some dictionary with indices - also valid way

gilded glacier
#

usually all the stuff that would be part of a regular game object, and is shared with multiple entities

storm ravine
#

but I don't prefer that because code become mess when growing

sand prawn
#

So, this shows the multiplayer cube on the left and my cube on the right... can't figure out why my cube doesn't have the Rendering components:

storm ravine
#

usually all the stuff that would be part of a regular game object, and is shared with multiple entities
@gilded glacier blobs

#

if data immutable

sand prawn
gilded glacier
#

I don't like dictionaries, they seem to be not very effective

#

for sorted data

sand prawn
#

Hm. But my plane doesn't show up in Play mode either

storm ravine
#

@gilded glacier then blobs is what you want for shared immutable data. Like MaxHealth, or DefaultDamage etc.

#

And just have BlobAssetReference in your component

gilded glacier
#

okay, but what about non-blittable data ?

storm ravine
#

For that I store that data on IComponentData class (not struct) associated with singleton entity

#

and every system can query that and access that data

gilded glacier
#

okay, interesting magic

#

I'll give it a try, thanks

storm ravine
#

It's easy to use, data usually read only for every system, thus not affecting dependency chain, can be accessed from any system

#

and fit whole code style

#

And you don't need to use any statics in here and this exclude unnecessary direct dependencies

#

Moreover it's useful for RequireForUpdate

#

which you can declare in your system an system wouldn't run until required entity appear

gilded glacier
#

and is there any reason to use shared data components ?

storm ravine
#

Filtering

#

Groupping things

#

It's main purpose of ISharedComponentData

#

not to be container for managed types

warped trail
#

@sand prawn dumb question, but did you install hybrid renderer package?πŸ€”

storm ravine
#

Because how ISCD implemented it's just side effect that it can have managed data (because it's not part of chunk)

sand prawn
#

@warped trail That's not a dumb question at all! I did not

#

BUT neither does the multiplayer package.json seem to include it?

#

AND the tutorial doesn't seem to call for it

warped trail
#

this rendering stuff is part of hybrid renderer

#

so install itπŸ˜…

storm ravine
#

No, you should install it by yourself

sand prawn
#

Thanks, trying that

#

ugh. it wants a newer entities than the one I'm using?

#

Or should I downgrade to an older hybrid renderer?

dull copper
#

you need newest entites for newest hybrid

storm ravine
#

or old hybrid for old entities

#

πŸ™‚

dull copper
#

yeah, it's just, old hybrid isn't all that great

sand prawn
#

I think I'll try an older hybrid first. Ran into mayhem last time I tried newest entities

#

oh, hm

dull copper
#

and hybrid v2 is really early

#

(+ needs 2020)

storm ravine
#

Yep, but if he don't use SRP it's doesn't much matter πŸ™‚

sand prawn
#

Not probably planning to use SRP for a while

dull copper
#

"Fix In Review for 2019.3, 2020.1"

sand prawn
#

Okay, much better. Added HybridRender 0.3.4 or something and I'm now seeing 2 cubes

#

but one of the moves, yay!

#

Not sure where the extra cube is coming from

storm ravine
#

Call exorcist

dull copper
#

is the other the gameobject version?

#

can't remember what authoring methods were on the older entities anymore

sand prawn
#

@dull copper That's my guess. How can I prove that?

dull copper
#

you'd see the gameobject on your scene in that case

sand prawn
dull copper
#

then no idea

storm ravine
#

What in EntityDebugger

#

select entity which moving

sand prawn
#

@storm ravine For while world?

storm ravine
#

and check Used by systems

#

@storm ravine For while world?
@sand prawn ?

sand prawn
#

Err, sorry. Which world

storm ravine
#

Both

sand prawn
#

I have quarantine brain

storm ravine
#

Firstly you should find which is moving and where

#

I guess you have just couple of entities

#

just check which one matrix changing

sand prawn
#

The cube with index 19 is the one that "moves" (based on its transform)

storm ravine
#

Well show full inspector for that cube

#

In entity debugger @sand prawn

sand prawn
#

That bit?

#

(can't grow that screen, which is annoying)

storm ravine
#

Not but this is also useful

#

Inspector tab

#

with selected in Entity Debugger entity

sand prawn
#

This, then

storm ravine
#

MovableCubeComponent it's your?

sand prawn
#

yes

storm ravine
#

Scroll below inspector

#

and expand Used by systems

sand prawn
storm ravine
#

If you disable MoveCubeSystem in EntityDebugger

#

will it still moving?

sand prawn
storm ravine
#

CubeGhostUpdateSystem?

#

Try uncheck that too

sand prawn
#

Yeah, now it does not move

#

And then when checked back on, the cube snaps to what I guess is the correct spot

storm ravine
#

Guess some initial values for prediction causing that problem

#

does your initial values 0 everywhere?

#

I mean Input etc

#

In first frame

sand prawn
#

Causing me to have multiple cubes?

storm ravine
#

Well cube should be on per world

#

1 for server one for client

sand prawn
#

yes, I agree

storm ravine
#

does your server world have render system?

sand prawn
#

Oh, maybe this is my problem

storm ravine
#

You should exclude that and it will exclude rendering additional cubes

sand prawn
#

I probably JUST want Server here, right?

#

oh, actually. heh

#

I didn't change the prefab, I changed the instance

#

when I added the render items

storm ravine
#

Your prefab haven't render mesh initially?

#

MeshRenderer I mean

#

and what component on that duplicated cubes (in entity debugger inspector)

#

I guess one of them is client world prefab entity and instance and 2 other is server world prefab and instance

#

Oh it's all in client world

#

well need to see inspector from entity debugger for that cubes

sand prawn
#

K, so. I have weirdly got 2 cubes on the server, and 4 on the client, heh

#

I was wrong though, I think... I'm pretty sure I cleaned up the checks and regen'd all the code and still see 2/4

#

@storm ravine K, definitely didn't follow exactly what you are asking for screenshots of, though

#

Prefab does have a Mesh renderer initially

storm ravine
#

Inspector form Enetity Debugger

#

of all this 4 cubes

#

And how you instantiate you cubes?

#

You mabe already posted that above

#

But now it's too far πŸ™‚

sand prawn
#

afaik I don't instantiate them, they're just in the initial scene

storm ravine
#

Well, you have 1 cube initially without MeshRenderer?

sand prawn
storm ravine
#

It's prefab

#

not showing on scene, that's fine, next

sand prawn
storm ravine
#

This is one of cubes which you see on scene, next

sand prawn
#

Yeah... I see the render comps on it

storm ravine
#

Prefab, not showing on scene

sand prawn
#

And I already showed #19

#

So where is 17 coming from is the question, I guess?

storm ravine
#

show 19 please

#

again

sand prawn
#

k

storm ravine
#

Well this is different players. 5 and 4 it's their prefabs. 19 is player 1, 17 is player 0

sand prawn
#

Hm, maybe I'm running two clients?

#

Don't think so?

storm ravine
#

Yep 1 player. Show you scene hierarchy in edit mode

#

not in play mode after conversion

sand prawn
storm ravine
#

And inspectors of cube collection and plane

warped trail
#

delete cube πŸ˜…

sand prawn
#

Oh, that's it?

storm ravine
#

Yep

#

guess it already in collection

warped trail
#

your prefab is already in ghost collection

storm ravine
#

Yep

#

this is causing your problem

sand prawn
#

okay, gotcha. Thanks for the head-extraction

warped trail
#

so you are spawning one cube from code when player connects and one with scene prefab is spawned as clinet/server stuff πŸ€”

sand prawn
#

Is "player 0" basically a reserved slot for the server?

#

(I know Unreal does this)

storm ravine
#

Don't know, maybe

#

I'm not using networking in current game and only checked packages code fluently just to be in general flow of how new networking growing

sand prawn
#

It looks tremendously cool

storm ravine
#

nothing super in that networking πŸ™‚

warped trail
#

last time i tried netcode it was jitterlandπŸ˜”

storm ravine
#

It's just to early for decisions

sand prawn
#

Seems pretty smooth here.. I should play with the tuning to see what bad networking looks like

warped trail
#

it was kinda smooth with moving cube(while i was moving it), but everything else was horribleπŸ€”

sand prawn
#

"everything else"?

warped trail
#

there is some interpolation components. but i haven't figured out how to use them and there is almost 0 documention about this stuffπŸ˜”

#

yeah like objects which are moving on server and client only gets change in position

sand prawn
#

hehe, I'm coming from recent Unreal hell, so even "this shit is brand new in Unity" documentation looks way better than what Epic provides

#

@warped trail So, losing rotation?

warped trail
#

jitter

sand prawn
#

ah

warped trail
#

very noticeable jitter

sand prawn
#

hm

#

Thanks for the help, @warped trail and @storm ravine and @dull copper and @tardy locust

tardy locust
#

Did I help?

sand prawn
#

You did, early on!

tardy locust
#

oh okay

warped trail
#

i guess they will fix that in couple of yearsπŸ˜…

tardy locust
#

Glad I could help

sand prawn
#

@warped trail You can override and fix yourself, can you not?

warped trail
#

fix netcode package?πŸ‘€

#

im just avg Joe

sand prawn
#

Well, I meant more specifically the interpolation of rotation data?

warped trail
#

i think this should work out of the boxπŸ€”

sand prawn
#

Oh, I'm not disagreeing there

#

I'm more asking if it's easy to end-around issues there for developers who just need to plough ahead

warped trail
#

i don't think smooth motion is some exotic featureπŸ˜…

sand prawn
#

Well, you're obviously super picky. /s

sand prawn
opaque ledge
#

Green ones means that system queries for it, white ones means system only check if that component exists (so WithAll<ComponentType>), red ones means system checks if that component does NOT exist (so WithNone<ComponentType>)

#

afaik

sand prawn
#

@opaque ledge Ah, thanks

wise monolith
#

What is the best practices for optional components with ecs?

tardy locust
#

Add them if you need them?

#

Make systems that looks for the optional components alone and if they find any, look for other needed components on the same entity (if any is needed in that context)

#

If none of those optional components are found and cannot be added during runtime, then delete the system and move on

#

Those are my first thoughts at least @wise monolith . There might be a better solution.

stoic mulch
#

How's DOTS so far in 2020.1? Last I was looking last year it was still not quite there yet, or at least not as approachable

dull copper
#

tooling is still pretty much the same

lusty otter
cosmic sentinel
#

I have a prefab (that contains multiple game objects) that I convert to an entities. What's a good way to give one of the child game objects a tag?

wide fiber
#

Can't you just add the component manually to the child GameObject? @cosmic sentinel

cosmic sentinel
#

I try to search for in after calling EntityManager.Instantiate() on the prefab. but it doesn't seem to work. I might try to go down the route of using IConvertGameObjectToEntity

mystic mountain
#

So I'm getting some weird differences in behaviour with Camera from when I'm using GameObject.Instantiate vs being in scene from start using Conver To Client Server Entity (marked to client) with convert&Inject. Basically I'm copying position in presentation group from my player entity, when I'm keeping it in scene it seems like it copies the camera, but the updating of position seems delayed? Basically if I do it with Instatiate it is smooth, but with keeping it in scene it laggs a few frames behind.

flat talon
#

Entities 0.10 and Hybrid 0.5 are out ❀️

opaque ledge
#

really, is it 0.10 ? i really thought it would be 1.0 πŸ˜„

bright sentinel
#

Haha I think 1.0 is a long way off

#

Maybe it will come before 2020 LTS

amber flicker
#

🀣 I seem to remember joking it would be 0.10 a few weeks ago

opaque ledge
#

yeah exactly, i thought it was just a joke πŸ˜„

flat talon
#

this is just modern versioning, a version isnt a fraction πŸ™‚

amber flicker
#

hmm but how do you tell the difference between 0.9 and 0.09 then? πŸ˜„

bright sentinel
#

There is no 0.09 πŸ˜…

amber flicker
#

anyway... new packages πŸ₯³

flat talon
#

its not a fraction, each part of the version is its own separate number

opaque ledge
#

can someone put the notes πŸ‘€

flat talon
#

version 0, minor version 10

amber flicker
#

it says I can't view it 'offline' atm 😏

opaque ledge
#

you have to check it inside the local package

amber flicker
#

yea, currently obtaining

flat talon
#

Last time I pasted it here someone got angry that I was "spamming" πŸ™‚

amber flicker
#

### Added

* Added `GetOrderVersion()` to ArchetypeChunk. Order version bumped whenever a structural change occurs on chunk.
* Added `GetComponentDataFromEntity` method that streamlines access to components through entities when using the `SystemBase` class.  These methods call through to the `ComponentSystemBase` method when they are in OnUpdate code and codegen access through a stored `ComponentDataFromEntity` when inside of `Entities.ForEach`.
* Added support for `WorldSystemFilterFlags.ProcessAfterLoad` which enable systems to run in the streaming World after a entity section is loaded.
* Added `DynamicBuffer.CopyFrom()` variant that copies from a `NativeSlice`
* Added `DynamicBuffer.GetUnsafeReadOnlyPtr()`, for cases where only read-only access is required.
* Added PostLoadCommandBuffer component which can be added to Scene or section entities. This plays back a command buffer in the streaming World after a entity section is loaded. Adding it to the Scene entity plays back the command buffer on all sections in the Scene.
* Added `WorldSystemFilterFlags.HybridGameObjectConversion` and `WorldSystemFilterFlags.DotsRuntimeGameObjectConversion` which annotates conversion systems that are used specifically for Hybrid or DOTS runtime.
* Added missing profiler markers when running an `Entities.ForEach` directly with `.Run`.
* Added support for storing metadata components in the header of converted Subscenes. `GameObjectConversionSystem.GetSceneSectionEntity` adds components to the section entities requested. The added components are serialized into the entities header and are added to the section entities at runtime when the Scene is resolved.
* ResolvedSectionEntity buffer component is now public and can be used to access metadata components on a resolved Scene entity.
#

* Bumped Burst version to improve compile time and fix multiple bugs.
* ChangeVersions behavior more consistent across various entry points.
* Updated package `com.unity.properties` to version `1.1.1-preview`.
* Updated package `com.unity.serialization` to version `1.1.1-preview`.
* Updated package `com.unity.platforms` to version `0.3.0-preview.2`.
* `ConvertToEntity` no longer logs a warning if there are multiples of a given authoring component on the converted GameObject. As such, it is now compatible with conversion systems that can support multiples.```
flat talon
#

btw some really cool changes in Hybrid renderer 0.5

amber flicker
#

* Deprecated `EntityManager.UnlockChunk`. 
* Deprecated adding components to entities converted from GameObjects using proxy components. Use the new conversion workflows with `GameObjectConversionSystem` and `IConvertGameObjectToEntity`.
* Deprecated `ComponentDataProxyBaseEditor`, `DynamicBufferProxyBaseEditor` from `Unity.Entities.Editor`.
* Deprecated `ComponentDataProxy<T>`, `ComponentDataProxyBase`, `DynamicBufferProxy<T>`, `SharedComponentDataProxy<T>`, `SceneSectionProxy` from `Unity.Entities.Hybrid`.
* Deprecated `MockDataProxy`, `MockDynamicBufferDataProxy`, `MockSharedDataProxy`, `MockSharedDisallowMultipleProxy` from `Unity.Entities.Tests`.
* Deprecated `CopyInitialTransformFromGameObjectProxy`, `CopyTransformFromGameObjectProxy`, `CopyTransformToGameObjectProxy`, `LocalToWorldProxy`, `NonUniformScaleProxy`, `RotationProxy`, `TranslationProxy` from `Unity.Transforms`.
* Deprecated `ScriptBehaviourUpdateOrder.CurrentPlayerLoop`. Use `PlayerLoop.GetCurrentPlayerLoop()` instead.
* Deprecated `ScriptBehaviourUpdateOrder.SetPlayerLoop`. Use `PlayerLoop.SetPlayerLoop()` instead.```
flat talon
#

it seems like the Dots Editor package isnt working properly (again). Getting a few errors with it

#

I've reported it already

amber flicker
#

oh, good job - I deliberately didn't update that one yet πŸ˜„

flat talon
#

yeah dont if you can get away with not doing it

bright sentinel
#

I think the problem is that editor isn't on the same schedule as entities

amber flicker
#

* Fixed the synchronization of transforms for Hybrid components to handle scale properly.
* Improved JobsDebugger error messages when accessing `ComponentDataFromEntity`, `ArchetypeChunkComponentType`, `ArchetypeChunkComponentTypeDynamic`, `ArchetypeChunkBufferType`, `ArchetypeChunkSharedComponentType`, `ArchetypeChunkEntityType`, and `BufferFromEntity` after a structural change. (requires Unity 2020.1.0b2 or later)
* Fixed an issue where Scene Camera culling masks weren't reset when using ConvertToEntity but not any Scene conversion
* Fixed IL2CPP compilation errors happening in IL2CPP builds with Entities.ForEach with nested captures.
* Fixed an issue where incorrect data for chunk components was shown in the Entity Inspector.
* Fixed an entity Scene load error when serializing hybrid components with conditionally compiled fields, which caused a type hash mismatch.
* `LambdaJobTestFixture` and `AutoCreateComponentSystemTests_*` systems are no longer added to the simulation World by default.
* `GameObjectConversionSystem.DependOnAsset` now correctly handles multiple Subscenes
* Fixed an issue where patched component access methods (`GetComponent/SetComponent/HasComponent`) broke `Entities.ForEach` when there were a lot of them, due to short branch IL instructions.
* Fixed deactivation of Hybrid components when the entity was disabled or turned into a Prefab.
* Improved the performance of singleton access methods (`SetSingleton`/`GetSingleton`).
* Fixed an issue where managed components were not being serialized during Player Livelink.
* Fixed an issue where `CompanionLink` was incorrectly synced during Player Livelink.
* Fixed a false-positive in the EntityDiffer when a shared component in a changed Chunk has its default value
* Fixed Entities.ForEach lambdas that call static methods as well as component access methods (`GetComponent/SetComponent/HasComponent`).```
flat talon
#

this happened the last time when 0.9 came out.. the Editor one broke then too πŸ™‚

amber flicker
#

Hybrid 0.5:


Changes that only affect *Hybrid Renderer V2*:
* V2 now computes accurate AABBs for batches.
* V2 now longer adds WorldToLocal component to renderable entities.

Changes that affect both versions:
* Updated dependencies of this package.```
#

* Improved precision of camera frustum plane calculation in FrustumPlanes.FromCamera.
* Improved upload performance by uploading matrices as 4x3 instead of 4x4 as well as calculating inverses on the GPU
* Fixed default color properties being in the wrong color space```
flat talon
#

"Improved upload performance by uploading matrices as 4x3 instead of 4x4 as well as calculating inverses on the GPU" this is quite big for performance πŸ™‚

#

I think this build also includes hybrid component fixes, so Lights and such should convert better than before

amber flicker
#

apologies for the spam but I look forward to these updates. Also Collections 0.8:


 * Added `UnsafeAtomicCounter32/64` providing helper interface for atomic counter functionality.
 * Added `NativeBitArray` providing arbitrary sized bit array functionality with safety mechanism.```
#

no idea what * Fixed Entities.ForEach lambdas that call static methods as well as component access methods (`GetComponent/SetComponent/HasComponent`). above means though

flat talon
#

I think there was a discussion on the forums about an issue with static methods from the lambda

amber flicker
#

still no srp bumps to 9.0 though 😧

flat talon
#

true 😦

warped trail
#

Bumped Burst version to improve compile time and fix multiple bugs. 😭

fair condor
#

Anyone know a good way to detect whether you're running on the process that is in charge of converting subscenes in the background, or if you're on the main Unity process?

warped trail
#

that means that i can't use new entities until they release new burst package with fix for me😩

opaque ledge
#

i really hope that, those one of the fixes was for my case where a system crashes editor but works fine in build

warped trail
#

they updated package manager in latest alfaπŸ€”

storm ravine
#

Maybe it will come before 2020 LTS
@bright sentinel 1.0 will be in 2020.1 release

amber flicker
#

I'm curious... what's the difference between adding WithStructuralChanges() or not to a lambda with Run & WithoutBurst()? (if there is one)

storm ravine
#

Allow to use EntityManager

#

Without .WithStructuralChanges() compiler will throw you error even with Run

#

Entities.ForEach Lambda expression makes a structural change. Use an EntityCommandBuffer to make structural changes or add a .WithStructuralChanges invocation to the Entities.ForEach to allow for structural changes. Note: LambdaJobDescriptionConstruction is only allowed with .WithoutBurst() and .Run().

#

WithoutBurst() and Run() can be used without EntityManager for avoiding hard sync point for example, or for work with some managed data, but if you want structural changes you should use WithStructuralChanges, wich will create sync point

bright sentinel
#

@storm ravine Where have you seen that? πŸ‘€

storm ravine
#

And don't forget that Sync Point is specific thing which completes ALL jobs not only dependency chain

amber flicker
#

Oh of course... the missing part in my head was that although Run would run main thread, that doesn't mean there aren't jobs on other threads safely running. This ensures a hard sync point. Got it.

storm ravine
#

@storm ravine Where have you seen that? πŸ‘€
@bright sentinel This is what compiler will tell you if you put EntityManager call inside ForEach without WithStructuralChanges

amber flicker
#

hmm I think new entities has caused entity debugger spam for me.. going to rollback to check

storm ravine
#

Meh they changed conversion mapping system....uuuuuuuf πŸ˜”

amber flicker
#

hmm errors are from ComponentObjects - wonder if they're not really supported any more

#

how have they changed conversion mapping system?

opaque ledge
#

wow i am screwed if they are not supported anymore

amber flicker
#

might only be the previewing in the entity debugger.. hard to guess

opaque ledge
#

i mean rip hybrid then if thats the case

#

i really really doubt tho

storm ravine
#

Why rip if you have Companion logic

#

This is hwo all hybrid built in things work

amber flicker
#

I haven't got my head around the Companion stuff yet - I only heard of its existence the other day.

storm ravine
#

like camera, light etc.

opaque ledge
#

i want to 'add' my managed scripts to entities

storm ravine
#

And we use only companions for monobehaviours which required in DOTS world

warped trail
#

WorldSystemFilterFlags.ProcessAfterLoad with this you can make system that can move all loaded entities before they moved to default world?πŸ€”

opaque ledge
#

i actually was thinking some kind of event system like that, like adding "KilledEvent" script to entity, then fire the event when entity is about to die etc.

storm ravine
#

Then just add them through conversion and AddHybridComponent

amber flicker
#

At the moment for hybrid workflow, I create an entity that tweens a classic GameObject Cube let's say. An entity with the tween components you'd expect is created and the cubes Transform is associated via AddComponentObject. Then in a lambda I can do e.g. (ref Transform cubeTransform, in float lerpedTime). I'm a bit unclear on the new suggested workflow in this context.

storm ravine
#

AddHybridComponent

#

this is what intended for hybrid workflow

amber flicker
#

And the lambda would stay the same right?

opaque ledge
#

yeah but thats conversion, not everything is GO -> Entity

storm ravine
#

For any other managed instances (like you wan't you script NOT MonoBehaviour associated with Entity) use class IComponentData (not struct)

#

yeah but thats conversion, not everything is GO -> Entity
@opaque ledge Seems you don't understand that πŸ™‚

#

It's still hidden GO

#

But with convenient processing through DOTS systems

#

under hoow they create hidden GO's which used for that

#

With that tool you can convert every thing from UI to Camera

amber flicker
#

AddHybridComponent only exists in a GameObjectConversionSystem right? But I'm not converting anything.. just creating a companion entity as it were.

opaque ledge
#

i am creating objective entities for my quests, and i am going to add controller monobehaviour to them so i can add some trackers which is monobehaviour, can you tell me how to do this thru conversion ?

#

isnt AddHybridComponent only viable when converting ?

storm ravine
#

Ah I see your point

#

Well

#

for that

#

use class IComponentData

opaque ledge
#

i think AddHybridComponent is more for GO components like camera, light etc like you said

storm ravine
#

with stored in field instance of your MB

amber flicker
#

More code gen πŸ₯³

storm ravine
#

Btw why you decided AddComponentObject not work?

opaque ledge
#

yeah i was doing that, i had a TextMeshProUGUI in my monobehaviour that i added to class IComponentData, but build failed because of it, so i had to convert to AddComponentObject

storm ravine
#

As I can see source code it's still here and used in many places include tests which pass successfully

amber flicker
#

I haven't decided it doesn't work.. I'm concerned that support may not persist if the entity debugger is broken

#

Worried that I'm using an out-of-date concept

storm ravine
#

AddComponentObject still here and works

#

For example Convert and Inject relates on that completely

amber flicker
#

I suspect you're right and that ICD classes are basically the replacement for this long-term - maybe I should seek clarity on the forums

storm ravine
#

It's not out of date πŸ™‚

opaque ledge
#

how does your game going btw Eizen, without any pain i hope πŸ˜‚

amber flicker
#

Posted on the forums for clarification - it works right now but as there's an overlap in functionality it would be good to get clarity on the future vision.

bright sentinel
#

@storm ravine Sorry before, I meant where did you see that 1.0 will be for 2020.1?

storm ravine
#

how does your game going btw Eizen, without any pain i hope πŸ˜‚
@opaque ledge Yes, I didn't stuck anywhere and upgrades goes smoothly. From time to time I have some Unity side issues, but I just copy package locally fix that and use it. And tell Unity teams (depends on which package I fix, it's different teams) and use local version until they fixed that (usually right in next release), like it was with shadows in HR in built in because of bounds, or addressables inspector issue for serialized fields etc. They work hard and fast, and I really appreciate that they fix problems so fast. Like in Burst was problem with small sized structs and fix arrived right after report πŸ˜„

#

@storm ravine Sorry before, I meant where did you see that 1.0 will be for 2020.1?
@bright sentinel DOTS roadmap

bright sentinel
#

Which roadmap? πŸ€”

opaque ledge
#

you dont know the roadmap ?

#

an heretic in our midst πŸ‘€

bright sentinel
#

But that's not really DOTS specific

opaque ledge
#

i actually dont know either

warped trail
opaque ledge
#

@mint iron
Library\PackageCache\com.vella.events@5322dcf5ba\Runtime\Extensions\UnsafeExtensions.cs(32,39): error CS0029: Cannot implicitly convert type 'Unity.Collections.AllocatorManager.AllocatorHandle' to 'Unity.Collections.Allocator'

#

i guess i have to remove your package, i would love to use it tho when its ready^^

#

Thanks for your hard work as well

lusty otter
#

I'm rolling with my own extremely simplified ECS, and I do NativeHashmap<int, Data> to store component data of entities.
Now I need a NativeArray as data which doesn't work (basically what DynamicBuffer solves in ECS). My data array has a fixed and known size so right now I'm doing away with FixedListFloatxxx but it's kind of a pain to work with them (and a smaller down side is that I only need 64 in length but the smallest that fits is FixedListFloat512 which is basically wasting half the memory)
Any simple alternative to this?

vagrant surge
#

moar abstraction @lusty otter

#

or use those unsafe lists some guy made

storm ravine
#

use pointers in data which points to required array

#

or use those unsafe lists some guy made
@vagrant surge Unity have built-in unsafe lists maps and arrays

lusty otter
#

I thought about using pointers, are unsafe stuffs good to use in production?

vagrant surge
#

yes

#

unsafe in C# basically means "typical C++"

lusty otter
#

Even with mobile?

storm ravine
#

if you understand that and can track properly (for exclude corruption and leaks) it's fine

lusty otter
#

I read somewhere that they are bad or something but maybe I'm only remembering it wrong.

storm ravine
#

You already using them

#

NativeHashMap is wrapper around UnsafeHashMap*

#

Which already pointer

#

Which in turn use one more pointer internally

vagrant surge
#

yes

storm ravine
#

UnsafeHashMapData*

#

Which in turn use more pointers

vagrant surge
#

unsafe in c# basically just "turns on" the cpp style stuff

#

with pointers and malloc

storm ravine
#

With custom field offsets

lusty otter
#

Okay good to know, that's something I'm pretty confident with.

storm ravine
#

This is what NativeHashMap under lowest level

#

Through 2 pointers on top levels

gusty comet
#

is there any hard data on how faster/slower the native collections are compared to the regular .net ones?

mint iron
#

last i read theyre basically all slower, except if you're using them in burst, then theyre faster

gusty comet
#

that's what I expected tbh but people are switching to native* left and right

#

even without dots

storm ravine
#

It's not the same

gusty comet
#

I was wondering if it's just a counterproductive fashion trend (because omg it's c++ so it must be faster)

storm ravine
#

NativeCollections slower not because of pointers

gusty comet
#

you're doing c++ calls for every little thing

#

oh sorry by native* I didn't mean a pointer, I meant the NativeSomethingSomething containers

storm ravine
#

Yes just use collections on main thread without burst will be slower

#

Working just with raw pointers and raw memory will be faster, if you use them properly

#

And know what you're doing πŸ˜„

gusty comet
#

sure but that's you doing it from c#, not doing unmanaged calls for every single operation

lusty otter
#

How do I enable unsafe code? Is it still adding some file in Asset folder or is there an option in Project Settings now?

#

Googling gives me things back in 2014.

opaque ledge
#

project settings/player i think

gusty comet
#

if you're using asmdefs this is a setting on the asmdef

storm ravine
#

sure but that's you doing it from c#, not doing unmanaged calls for every single operation
@gusty comet Yes and I never told you that it's opposite, this is why I told you that pointers not a problem of NativeCollections πŸ™‚

gusty comet
#

the first checkbox

#

@storm ravine we're in violent agreement

lusty otter
#

Okay thanks.

vagrant surge
#

@storm ravine all those void* pointers are such heresy

storm ravine
#

?

vagrant surge
#

all those untyped pointers

#

byte*

#

in the hashmap

storm ravine
#

why so?

#

and byte* is typed πŸ™‚ it's byte type πŸ˜„ not void*

vagrant surge
#

sure but its basically a raw memory adress with no type info, so same as a void*

storm ravine
#

Well all type info you needed is in generic arguments

opaque ledge
#

UnityEngine::UnityException: Log can only be called from the main thread. πŸ˜’

#

i thought Burst supported Debug.Log now

bright sentinel
#

Burst does, not multithreading

#

Burst is not multithreading

opaque ledge
#

aaaaaah! well its useless for me then

#

oh well

storm ravine
#

sure but its basically a raw memory adress with no type info, so same as a void*
@vagrant surge it's not the same πŸ™‚ Yes they "points" to memory, same as int* and other but void* have different behaviour, void* indicates the absence of type, it is something you can not dereference or assign to, byte* instead have defines on processor level instructions (like BYTE PTR , WORD PTR) which tell how many block processor should read. And if a is void* ++*a will give error , because it doesn't know how many chunks(bytes) should be incremented.

mint iron
#

@vagrant surge using byte* is pretty much to avoid having to cast to byte* every time you want to add/subtract :S

storm ravine
#

Yep endorse @mint iron

#

And I guess also Burst involved here, this is why they use just byte* instead of generic parameter pointer. But this is only thought.

#

Moreover you just cant do that

#

It will give you error with generics

#

Cannot take the address of, get the size of, or declare a pointer to a managed type ('TKey')

vagrant surge
#

damn thas busted

#

on cpp you can

#

so basically to write native containers in C#, you have to rely on essentially void*

#

and manual memory management with it

storm ravine
#

And there is no generic restraint that you can implement that would ensure compile-time safety to make sure the struct would satisfy those requirements. As such, you can't make a pointer to a generic type.

#

This is the reason

vagrant surge
#

very interesting

storm ravine
#

so basically to write native containers in C#, you have to rely on essentially void*
@vagrant surge not on void* πŸ™‚

vagrant surge
#

well, the difference beetween void* on cpp and byte* on C# is really not much

#

both used to represent "random" memory adressed

#

at least from a conceptual standpoint

dull copper
#

@opaque ledge are you using 2020.1?

storm ravine
#

Above void* indicates the absence of type, it is something you can not dereference or assign to

#

I understand what you mean

#

about byte*, and this is only because of C# limitations

opaque ledge
#

yeah

storm ravine
#

But just clearing up that it's not the same as void* πŸ™‚

dull copper
#

I dunno about debug.log but debug.draw works on jobs when using 2020.1

storm ravine
#

yep but have some limitation

dull copper
#

Maybe the logging support is still coming

storm ravine
#

Which you can expand

#

Size of buffer for drawing

#

Which can be expanded through -debug-line-buffer-size boot parameter

mint iron
#

a pointer to a managed type only option is unmanaged constraint or AsRef<T> / CompilerServices.Unsafe hardcoded workaround.

dull copper
#

So basically can use debug.draws in jobs but not in burst and can use debug.log in burst but not in jobs?

storm ravine
#

No I speak only about count of draws πŸ™‚

#

It just will ignore part of this calls

#

like we have ~50k draws for test

#

but obly 5-10k was in scene because of this buffer default size limit

dull copper
#

Ah I didnt have anywhere that much on my test

#

Wouldnt 50k debug draws tank the perf quite badly

storm ravine
#

Not much

#

But of course all depends on hardware πŸ™‚

#

And as I said that was just a test

amber flicker
#

oh great @storm ravine (and others) - I noticed in some earlier tests that I think entities with a BlobAssetReference load the associated data into cache even if the job doesn't actually require the ICD/data - it should be possible not to load that data and consequently fit more entities in a chunk right? Thinking it could be a nice little optimisation. Though there may be good reasons why it's not possible.

wide fiber
#

I have updated entity packages to 0.10.0 and now when I press the play button it gives me the error:
A component with type Camera has not been added to the entity..
I have a camera GameObject with ConvertToEntity script attached and now it doesn't work

mint iron
#

interesting that they've pretty much switched to explicit layout for everything with a pointer in it hardcoded to 8, i guess that avoids x86 ptr size complications entirely.

wide fiber
#

I have updated entity packages to 0.10.0 and now when I press the play button it gives me the error:
A component with type Camera has not been added to the entity..
I have a camera GameObject with ConvertToEntity script attached and now it doesn't work
I am using Unity 2019.3.8f1

storm ravine
#

Yep

#

HybridRenderer team wrapped camera conversion

#

in to define

#

because of bug with cameras in editor

#

You should put HYBRID_ENTITIES_CAMERA_CONVERSION in to project defines

#

And camera will convert again

#

Or mirror what they do in your GameObjectConversionSystem, if you don't want relate on defines Entities.ForEach((Camera cam) => { AddHybridComponent(cam); });

coarse turtle
#

hmm anyone have any notes on the new build pipelines and how they work with subscenes?

wide fiber
#

@storm ravine thanks :D

storm ravine
#

oh great @storm ravine (and others) - I noticed in some earlier tests that I think entities with a BlobAssetReference load the associated data into cache even if the job doesn't actually require the ICD/data - it should be possible not to load that data and consequently fit more entities in a chunk right? Thinking it could be a nice little optimisation. Though there may be good reasons why it's not possible.
@amber flicker Why you think so? I mean why you think this data in chunks

#

all blobs live in one big 200mb preallocated memory place - one per scene

amber flicker
#

hmm so I thought it was the case because in my previous tests it was slower to do work on entities (let's say, each with a unique blob) than it is if those ICD's were just an int. In jobs that didn't require the blob/icd.

#

I thought it still must be being loaded into the cache line

#

but perhaps not?

storm ravine
#

And this memory not used by chunks. Only space you waste with BlobAssetReference in ICD is size of 8 which hardcoded explicitly [StructLayout(LayoutKind.Explicit, Size = 8)] as @mint iron mentioned above

amber flicker
#

hmm... maybe I'm wrong.. guess I should do some more tests

warped trail
#

why 200mb exactly?πŸ€”

wide fiber
#

@storm ravine I should add this code in a system inheriting from GameObjectConversionSystem in the update function?

storm ravine
#

Yes. Or Use define which I posted above

wide fiber
#

The define doesn't work properly so I will use the code way

storm ravine
#

it work

#

I use that define for Camera

#

show where you put that

wide fiber
#

Can you put on Pastebin the code in the image?

#

@storm ravine ok

storm ravine
wide fiber
#

Yeah I've put it there

storm ravine
#

Well it's definitely work as previously in that case

#

Because it's just wrapped around previous code

wide fiber
#

The define gives me a lot of warnings and errors:
(Warning) The referenced script (MyScript) on this behaviour is missing
(Error) NullReferenceException: Object reference not set to an instance of an object

storm ravine
#

Well because you have missed script

wide fiber
#

?

storm ravine
#

if you click on that warning

#

it should select your GO

#

You have other components on camera&

#

Like MyScript etc?

wide fiber
#

I've restarted the editor and it works normally now

#

Ty

storm ravine
#

Cool

amber flicker
#

yup, looks like I was wrong.. πŸ₯³ πŸ˜„

mint iron
#

interesting that both EntityManager and EntityQuery are structs now

storm ravine
#

Yep

#

Guess as we all discussed yesterday - they prepare burstable systems πŸ™‚

scarlet inlet
#

Hello people of the dots channel!

tardy locust
#

prepare the Burstable systems lieutenant!

scarlet inlet
#

Random question of the day: what is the equivalent of [NoAlias] in Entities.ForEach ?

tardy locust
#

Is this the answer?

#

ExpectAlias
ExpectNoAlias

scarlet inlet
#

it's interesting because I am sebas77

#

so I wrote that question, very good

tardy locust
#

Lol

#

Well then

#

I thought it was interesting you both had "sebas" as your username but not entirely the same xD

scarlet inlet
#

but I don't think it applies to Entities.ForEach does it?

#

(the avatar is the same πŸ™‚ )

warped trail
#

@scarlet inlet i think you don't need have to specify [NoAlias] yourself

#

with Entities.ForEach

scarlet inlet
#

@warped trail does it assume no-alias?

warped trail
#

just open DOTS compiler and see for yourself πŸ˜…

scarlet inlet
#

I find it a bit weird

#

DOTS Compiler?

warped trail
#

yeah

scarlet inlet
#

look at that

#

πŸ˜„

#

let's see

warped trail
#

it shows generated code

scarlet inlet
#

oh very interesting

#

OK thanks I'll be back

#

doesn't put NoAlias on external containers

#

I would have found that weird, but also not that weird, because eventually having aliased containers would be werdier

#

but point is they should be NoAlias

warped trail
#

πŸ€” These attributes do not need to be used when dealing with [NativeContainer] attributed structs, or with fields in job structs - the Burst compiler is smart enough to infer the no-alias information about these without manual intervention from you, our users.

scarlet inlet
#

really

#

not sure if I agree with that, but anyway what would happen with pointers?

#

so data structures that are not native containers

#

time for a post on the forum maybe

wide fiber
#

Guys I am making a weapon system.. I have the LauncherProjectileSystem that instantiates the projectile.

https://pastebin.com/96u9dEz0

I want to apply a physics impulse to the projectile, so I instantiate the bullet and I apply the force but it says that I can't add the force because the entity has index = -1.

The projectile spawns correctly but I can't add the force, probably because the command buffer doesn't instantiate it immediately and the physics need it.. How can I solve it?

warped trail
#

commandBuffer.Instantiate() returns invalid entity

#

it will become valid when commandbuffer wil be played back

#

basically you are trying to get PhysicsVelocity from entity which doesn't exist yetπŸ€”

wide fiber
#

Yeah, is there a way to solve that?

warped trail
#

you can set physicsvelocity like this cs commandBuffer.SetComponent(entityInQueryIndex, projectile , new PhysicsVelocity { Linear= ..., Angular = ... });

wide fiber
#

Ok ty :D

warped trail
#

and you can get PhysicsVelocity and PhysicsMass from launcherData.ProjectilePrefab

mint iron
#

how do i add an existing subscene asset to a scene? if i drag it into hierachy it just creates a new normal scene from it 😦

warped trail
#

create empty object and add subscene script ?

mint iron
#

thnx that worked, what a weird workflow

warped trail
#

i think there is no such thing as subscene assetπŸ€”

#

subscene script just convert normal scene to some binary fileπŸ€”

storm ravine
#

@scarlet inlet about ForEach and different attributes, all attributes from job will work with Entities.ForEach it you create custom struct like you does that before for IJobForEach, (but without IJobForEach obviously) and use that struct inside ForEach. like that:

#
            {
            };

            Entities
                .WithName("Newborn_Handle")
                .WithNone<ParentBuildingState>()
                .ForEach((Entity                  e, int entityInQueryIndex,
                          in AttachParentBuilding parentBuildingData) =>
                {
                    handleNewbornCitizensJob.Execute(entityInQueryIndex, e,
                                                     parentBuildingData);
                })
                .WithStructuralChanges()
                .Run();```
#
        {
            //fields with attributes

            public void Execute(int index, Entity e, in AttachParentBuilding parentBuildingData)
            {
                //Do stuff
            }
        }```
#

If I understand your question right

wide fiber
#

@warped trail so instead of

//Apply the force to the projectile
varΒ bulletVelocityΒ =Β GetComponent<PhysicsVelocity>(projectile);
Β varΒ bulletMassΒ =Β GetComponent<PhysicsMass>(projectile);

I should use

//Apply the force to the projectile
varΒ bulletVelocityΒ =Β GetComponent<PhysicsVelocity>(launcherData.ProjectilePrefab);
varΒ bulletMassΒ =Β GetComponent<PhysicsMass>(launcherData.ProjectilePrefab);
warped trail
#

if your velocity is zero you can just create new PhysicsVelocity instead of getting it from prefab

wide fiber
#

πŸ‘

north bay
#

So when instantiating Prefabs inside Subscene conversion i have to remove the EntityGuid component of the instantiated Prefabs otherwise i get an DuplicateEntityGUIDException.
Is that supposed to be this way? Shouldn't that component be removed automatically or am i missing something obvious?

#

The comment for EntityGuid states that it can be used to map back to the authoring GameObject from which it was converted. It also states that the component is unique within a World.
Why would that be the case? Can't multiple entities be authored by the same GameObject?

mint iron
#

i don't think you're supposed to instantiate prefabs inside a subscene conversion. That would put it into the conversion world, but it won't be saved properly to show up at runtime unless you've used CreateAdditionalEntity

opaque ledge
#

Jobs package is updated, its only for updating dependincies

gentle osprey
#

With the new system base, how are we supposed to schedule dependencies for stuff that isn't Entities.ForEach? That's how I did it before, but that wont work with systembase, and so far none of my various permutations has gotten me the right result.

protected override JobHandle OnUpdate(JobHandle inputDeps)
    {
        var baseJob = new GetTargetJob
        {
            Aggression = Settings.Instance.Aggression,
            RandomizerType = GetArchetypeChunkComponentType<Randomizer>(false),
            EntityType = GetArchetypeChunkEntityType(),
        };

        var firstTeamJob = baseJob;
        firstTeamJob.CommandBuffer = mCommandBufferSystem.CreateCommandBuffer().ToConcurrent();
        firstTeamJob.Enemies = mSecondTeamQuery.ToEntityArray(Allocator.TempJob);
        var firstHandle = firstTeamJob.Schedule(mFirstTeamQuery, inputDeps);

        var secondTeamJob = baseJob;
        secondTeamJob.CommandBuffer = mCommandBufferSystem.CreateCommandBuffer().ToConcurrent();
        secondTeamJob.Enemies = mFirstTeamQuery.ToEntityArray(Allocator.TempJob);
        var secondHandle = secondTeamJob.Schedule(mSecondTeamQuery, firstHandle);
        return secondHandle;
    }
opaque ledge
#

Dependency property is the job handle now

coarse turtle
#
Dependency = new SomeJobStruct {}.Schedule(...);
opaque ledge
#

so Dependency = new YourJob().Schedule(Dependency)

gentle osprey
#

Great, that worked, thank you :)

naive parrot
#

is there new entities package? πŸ€”

warped trail
#

yes

naive parrot
#

1.0 ?

warped trail
#

0.10.0πŸ˜…

naive parrot
#

πŸ˜…

opaque ledge
#

does anyone actually got a good 'thing' out of the newest patch ? they all seem like... very abstract or for very specific purposes

#

like.. what is entity section exactly

wide fiber
#

The new unity release or the entity/hybrid renderer/.. new releases?

warped trail
#

Subscene has sections

#

it is like sub subscenes πŸ˜…

wide fiber
#

I can't open the link of the changelog of the Entity 0.10.0 package

#

I don't know what's changed

warped trail
#

i guess main thing is that you can edit stuff before entities are moved from streaming world to your world

#

i would love to test this things, but i have to wait for next burst package releaseπŸ˜”

#

and i hope they won't forget to include fix πŸ™

supple knoll
#

looks like entities wont be out for another year lol

safe lintel
#

seems like the latest entities package has some sideeffects

opaque ledge
#

πŸ‘€

safe lintel
#

aside from what I see on the forums, in my own project some things arent getting parented for whatever reason πŸ˜„ 😩

#

no errors, just no parenting

sand prawn
#

heh, so it actually has fewer side effects than usual? πŸ˜‰

opaque ledge
#

idm man, i really appreciate their work

#

i mean this shit works you know πŸ˜„

#

after i saw the thing i was doing with 35 ms in MB was only taking 0.06 in ECS, so i am ECS person now

vagrant surge
#

@opaque ledge unity ecs is very very memory efficent

#

except if you have a lot of archetypes and tons of empty blocks

#

tho should still be alright even there

opaque ledge
#

what is empty block ?

vagrant surge
#

@opaque ledge mem blocks are 16 kb, no matter what

#

if you have 1 entity they are kinda empty

#

so you can fragment stuff

opaque ledge
#

ah empty chunk then

loud matrix
#

Can't believe in 2 weeks I've made 0 progress in storing basic item data =.=

opaque ledge
#

😦

#

are you trying to convert scriptable object to component data ?

loud matrix
#

Still, yeah. I have had some success with storing them as blobAssets, but then referencing becomes a issue. I can pass the references bloody everywhere, but doing that makes no sense.

wide fiber
#

What are you trying to do? @loud matrix

#

What do you need to store?

loud matrix
#

Currently, basic item database without using entities for it. So I need to store item data, its name, price, sprite etc, and store say recipes that use those items, and assign items to entities inventories.
At the moment i have the data stored in ScriptableObjects thats then converted into a blobasset list

formal scaffold
#

Can some one tell me how to use Arrays in Components other than to use Buffers? I have to write so much code just to use Arrays, it feels wrong.

opaque ledge
#

dont make it blob assets

#

blob assets are for pros

#

just go with some singleton components

loud matrix
#

But that was the one thing that worked XD

coarse turtle
#

Can some one tell me how to use Arrays in Components other than to use Buffers? I have to write so much code just to use Arrays, it feels wrong.
@formal scaffold You can write your own implementation of an array and put it into a struct IComponentData or use UnsafeArray (believe that's what it's called)

wide fiber
#

Why are you using BlobAssets? Can't you just use normal components?

loud matrix
#

What do you mean by a singleton component for it?

#

The blob asset stores all the data, the components just store the index to the data

wide fiber
#

Ah ok, you are trying to store an item database in a component

loud matrix
#

So my cargo component stores index 1 and count 12, but it also needs to currently store the reference to the blob asset

#

as ill be damned if i can get a blob asset reference into a static class

amber flicker
#

blob assets are actually very straight forward.. don't be put off... @loud matrix do you have monobehaviours that get converted and need to ref the data or pure entities?

loud matrix
#

no pure ECS, only mono is my bootstrap currently

amber flicker
#

so when you create the data, you can give it a key and put it in some data structure right? Then when you create an entity, use that key to obtain the reference?

formal scaffold
#

@coarse turtle How would I define my own array?

loud matrix
#

I have the reference to the blobAsset, but being able to access it is my current issue. At the moment I have to pass it into my cargo component because I can;t find a way to just make it globally available

#

so at the moment my entire DynamicBuffer for cargo contains a reference on every index

amber flicker
#

you could just create a static NativeHashMap for example no?

#

and put your blobs in that

#

well, your blob references

loud matrix
#

you'll have to give me a second to google what that is.

amber flicker
#

NativeHashMap is just a dictionary basically

loud matrix
#

That sounds annoyingly like exactly what i need

amber flicker
#

the issue with it being static is the new editor assembly reload stuff can be a bit of a pain but I think I'd either do something static or else in an instance of something

coarse turtle
#

If you need to write your own you can start off with something like this (the caveat of this is your own implementation to allocate it and all its additional extensions you need), but the Collections package should have an UnsafeArray that you can use @formal scaffold

struct ArrayLike {
  // Where T is blittable
  T* ptr;
  int Size;

  public T this[int i] {
    get => ptr[i];
    set => ptr[i] = value;
  }
}
amber flicker
#

but NativeHashMap sounds worth looking into

opaque ledge
#

you can use Shared Static as well, so you can access your data inisde bursted jobs

amber flicker
#

@formal scaffold just my opinion but I'd stick with DynamicBuffers rather than messing with pointers