#archived-dots

1 messages Β· Page 256 of 1

safe lintel
#

interesting, new transform system coming

coarse turtle
#

nice, not sure how I can access that journaling menu and export it to a csv πŸ€”

dull copper
#

they have full playlist for gdc videos on their channel

coarse turtle
#

doesn't seem like I have it as an option

dull copper
#

well.. you can see the playlist on the side there too πŸ™‚

#

that's not hidden on the main channel either

gusty comet
#

The editor running in the video is 2022.2.0a4

#

Now I can totally make baseless timeframes and get disappointed when they don't match reality!

gusty comet
#

authoring workflow looks good, much better than I thought it would be.

#

Debugging tools look great.

#

I wish they'd show more about "aspects" though.

safe lintel
#

yeah save during playmode is finally here

worn valley
#

Everyone keeps saying "aspects" and I am too scared to ask

safe lintel
#

my uneducated take is they seem to be a way of simplifying complex sets of data, theres a very small blurb on the dots roadmap

rotund token
#

Hybrid renderer busted though due to major graphic api changes

valid haven
dull copper
#

better performance? πŸ€”

#

(it depends what you do with it)

#

practical impact is that you can't do as much purely on ECS side without hybrid rendering since you have to constantly sync the GOs to them for rendering

valid haven
#

i c.

#
DOTS feature compatibility
Hybrid Renderer does not support multiple DOTS Worlds. Limited support for multiple Worlds is intended in a later version. The current plan is to add support for creating multiple rendering systems, one per renderable World, but then only have one World active for rendering at once.
#

for our project this may be a limiter as well

dull copper
#

hybrid renderer has bunch of limitations

#

I'm guessing it's quite featured nowadays but still lacks some more niche features like raytracing etc

#

guessing since haven't used it for few years

#

oh wow, they still lack reflection probe support on URP

#

and point + spot lights πŸ˜„

safe lintel
#

urp with only a directional light is just brutal

spiral flint
#

Hey, I'm getting 16 error messages after trying to install the Entities package and the Hybrid Renderer package. Some say The type or namespace name 'Editor' does not exist in the namespace 'Unity.Profiling' (are you missing an assembly reference?)
and others are The type or namespace name 'ProfilerModuleViewController' could not be found (are you missing a using directive or an assembly reference?)
and no suitable method found to override. Did I miss a dependency?.
Does DOTS normally take this much unnecessary work to install?

coarse turtle
#

What version of Unity are running on?

spiral flint
coarse turtle
#

Upgrade it to a minimum of 2020.3.30

spiral flint
solar anvil
#

Hey All. What is the equivalent of OnTrigger events in DOTS 0.5?

#

Everything I've found online so far is out of date with the latest release. I would also be interested on what would be the equivalent of a OverlapSphere cast, which could also be used for my needs.

full epoch
#

I have similar question : how to use unity.physics just to detect collision events? I have my own physics and need only collision detection from dots physics

safe lintel
#

@solar anvil physics samples repo has examples of ontrigger stuff, its not yet officially part of the package though so(for now) you would have to update it to 0.50 yourself

#

also instead of a specific overlap cast, you just use a collider cast and specify the type of collider to cast with

#

similarly the samples also covers collision events

safe lintel
#

see pinned message for github

karmic basin
gentle harness
#

Hey guys, I need to iterate over chunks manually with IJobChunk and am wondering if It's possible to access the next chunk within the job. What I need is essentially random access into the entities of a series of chunks

worn stag
#

aspects is basically component families from project tiny (if someone remembers that)

rotund token
#

if so just use a IJobFor instead of IJobChunk

#

and do manual iteration

#

you'll have the collection of all your chunks in a NativeArray that you can read

gentle harness
#

I need to write

rotund token
#

well you you can't safely write to something you're reading from in parallel

half jay
#

i have errors with unity 2022 and Entities 0.50. Any ideas?

Library\PackageCache\com.unity.entities@0.50.0-preview.24\Unity.Entities.Editor\Unity.InternalAPIEditorBridge.002\ProfilerModules\StructuralChangesProfilerModuleBridge.cs(92,32): error CS0507: 'StructuralChangesProfilerModuleBridge.defaultOrderIndex': cannot change access modifiers when overriding 'private protected' inherited member 'ProfilerModule.defaultOrderIndex'

haughty rampart
rotund token
#

Finally got around to watching that authoring gdc talk

#

An ambitious plan to be able to design and build your game while never leaving play mode

rustic rain
pliant pike
#

yeah the stuff looks really cool, I especially like the entities journal thats really useful to me

#

This video covers the improved Editor tooling in the upcoming Data-Oriented Tech Stack (DOTS) 0.50 release, including the Hierarchy, Inspectors, Profiler modules, Systems window, and entities journaling. It also addresses a new Editor workflow, coming in Entities 1.0, which allows artists, gameplay programmers, and level designers to author with...

β–Ά Play video
worthy rampart
#

what's the "correct" way to create an entity prefab that needs a game object attached to it in 0.50?

little moon
worthy rampart
#

Same

pliant pike
#

I feel like all the UI stuff is kind of huge for debugging

safe lintel
#

yeah its all really welcome changes. the persistent playmode stuff is huge

pliant pike
#

your really missing out and making your job harder if you just use gameobjects

#

the way you can adjust things live turn systems on and off, see exactly what data has what relationship and where and when exactly its changing

safe lintel
#

yeah just enable/disable systems is super handy

wooden canopy
#

I can't imagine how well this will work in more complex/real scenarios

#

if some entity has a component with fields that get read at instantiation and then some other fields that are used continuously

#

if you change both fields in the authoring gameobject, one won't have any effect, the other will

#

when you are playing

pliant pike
#

I'm not sure how that would much of problem, but there's always edge cases and issues

#

but it would save a ton of time being able to design and adjust levels in real time without ever having to go into edit mode

safe lintel
#

I wonder if theres some high level wizardry for standalone save/load stuff in the works down the road, maybe post 1.0? seems like this example of save/load would open the way for it.

worthy rampart
#

I found some outdated stuff about Companion components that doesn't seem to exist anymore

vocal wing
#

@worthy rampart I'm using convert and inject game object plus the copy transform to game object authoring for something and it still seems to work on 0.50.

worthy rampart
#

yea but does that work for a prefab

#

that you can instantiate at runtime

#

I was hoping to be able to instantiate the entity prefab

vocal wing
#

yes, Im using it in a prefab

worthy rampart
#

are you instantiating the prefab via an entity manager

#

or is it already in the scene in editor

#

I've got a prefab that has convert and inject set

vocal wing
#

ah I just remembered I wrote a special system for that case, because I couldn't use it this way even with the previous version. It's instantiating with Object.Instantiate and then converting it at runtime.

worthy rampart
#

ok

#

so I have to manage game object instantiation myself

vocal wing
#

I guess. I remember trying a few things back then and couldn't get it to work otherwise.

#

Is anyone else seeing some kind of NativeArray leak with Entities 0.50? I just upgraded a project from 0.17 and noticed that a server build quickly ran out of memory that previously had a stable memory consumption. Upon further inspection in the editor I saw that when I take samples with the memory profiler, the NativeArray entry is consistently growing really fast. I disabled all systems, which stopped it growing, and enabled them one by one until it started growing again. My finding was that it happens when a system is executed that has a ForEach with Run, but does not even match and work on any entities. Just running the ForEach already begins to grow the NativeArray entry in the profiler. I also tried using the memory profiler package, but unfortunately that gave me no more insight into what this culprit NativeArray might be and who is allocating it, except that it seems to be a single one that grows over 1GB within a few minutes while the other native arrays don’t change much. It just seems to happen on any system that uses Run. When I change it to Schedule it stops growing, but I can’t do that everywhere. Since there are so many systems I’m not sure if it’s somehow related to my project setup and I haven’t tested an isolated case in a simple project yet, which I guess I’m gonna try next. Does anyone know if and how I could find out more about the NativeArray allocations in the memory profiler?

spiral flint
#

Hey, I keep getting a red line under using Unity.Entities; even after updating VS Code per reccomendation.

#

"The type or namespace 'Entities' does not exist in the namespace 'Unity'

hexed vapor
#

Hi @half jay, did you be able to make a compilation on iOS?

#

Actually my problems is on running, give me a error with EXC_BAD_ACCESS in Unity.Entities.SystemBase.Unity.Entities.UnmanagedUpdate_00000C82$BurstDirectCall.Invoke(System.IntPtr pSystemState, ref Unity.Entities.SystemDependencySafetyUtility.SafetyErrorDetails errorDetails) -> bool_f7c830754110dc9aeb9050443cd2a04b ()

#

I think this a issue for Entities 0.50 with Xcode 13.3

#

anyone have problems with Xcode 13.2.1?

misty wedge
#

What's the best way to use CollisionWorld.CastCollider with a filter? I assume I need to write a custom IQueryResult, but I have no idea how to get the collision filter from that

#

I was going to pass the Bodies list and use the RigidBodyIndex to get the body, and then the collider, and then the filter, but there might be a better way?

hexed vapor
rotund token
rotund token
#

Unity has a new per frame allocator that everything within entities uses

#

Which is reset by a system

#

If you don't add this system to your loop you'll leak all internal entity operations

vocal wing
#

Ah interesting. Yeah I'm setting up multiple worlds with different systems. Can I add this system myself?

rotund token
#

Yes

#

In bed atm and can't remember name, but I'll check it once I get up

vocal wing
#

I'll check all the default systems if I find one with a name that sounds related. Thanks for the pointer already.

rotund token
#

It's an ISystem

vocal wing
#

WorldUpdateAllocatorResetSystem?

rotund token
#

That's the one

vocal wing
#

Nice thanks, saved me a lot of time and worries. Just disabled it in a test project and it' showing the same leak. Will now fix the real one.

spiral flint
rotund token
#

Edit -> Preferences -> External Tools -> Regenerate project files

#

Also make sure visual studio code editor package is up to date

#

That said we don't support vscode for our developers so limited experience troubleshooting it

spiral flint
rotund token
#

VS studio and code are very different!

spiral flint
spiral flint
#

This is my code, I followed a tutorial almost word for word, but I can't get anything to render. In the console there's a message (not a warning or error) saying "No SRP present, no compute shader support, or running with -nographics. Hybrid Renderer disabled"

#

The mesh and material are set, ofc;

haughty rampart
rotund token
#

If that's tutorial code I need to have a word with them...

haughty rampart
#

i mean that's how most tutorials look like

safe lintel
#

even unity's own samples has a really high reliance on monobehaviour centric examples πŸ™ˆ

safe lintel
#

@coarse turtle mind if I pm about nimgui?

coarse turtle
#

yea go for it

spiral flint
#

Should I use the URP?

spiral flint
#

Is there a good way to create entities without any reliance on the GameObject system?

rotund token
#

Best life advice I can give is make a copy of the entities package, change permission of CreateEntity from public to internal and try to never touch it again

spiral flint
rotund token
#

You should not be creating entities at runtime

spiral flint
#

Ah

rotund token
#

You should be authoring your entities

#

All the tech Unity is showing off in 1.0+ etc does not work if you create entities at runtime

#

It requires and they expect you to use the authoring workflow

spiral flint
rotund token
#

I'm pretty sure you're missing a bunch of components

#

There's some helper function I can never remember the name of (because I never use it since I author all my entities) that will add all required components for you

#

I'm sure someone here knows the name though

#

oh actually you also never assigned RenderBounds

#

so you're bounds are 0 and will always be culled

#

also your rotation is 0,0,0,0 and not identity

spiral flint
#

Wow, lots of stuff the tutorial didn't cover at all, lol

rotund token
#

how old is this tutorial?

spiral flint
#

It looks like someone had the same issue as me and posted about it today

rotund token
#

i have a pretty good idea how i want this to work now and if I can bebothered since I know this is such a common pain i might look at releasing it in some form

#

basically be my 3rd crack at this

little moon
#

Did anyone manage to figure out scene switching with Entities 0.50? It used to work fine for me on 0.17 when just before loading another scene I just cleared entities with entityManager.DestroyEntity(entityManager.UniversalQuery); But now something's changed with entity physics and I get the following error. Physics entities just stop moving around after this happens. If I just start from the same scene without loading it form another scene everything works fine.

InvalidOperationException: GetSingleton<Unity.Physics.Systems.PhysicsSystemRuntimeData>() requires that exactly one Unity.Physics.Systems.PhysicsSystemRuntimeData exist that match this query, but there are 0.
Unity.Entities.EntityQueryImpl.GetSingleton[T] () (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/Iterators/EntityQuery.cs:1073)
Unity.Entities.EntityQuery.GetSingleton[T] () (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/Iterators/EntityQuery.cs:1843)
Unity.Entities.SystemState.GetSingleton[T] () (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/SystemState.cs:913)
Unity.Entities.ComponentSystemBase.GetSingleton[T] () (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/ComponentSystemBase.cs:487)
Unity.Physics.Systems.PhysicsRuntimeExtensions.RegisterPhysicsRuntimeSystemReadOnly (Unity.Entities.SystemBase system) (at Library/PackageCache/com.unity.physics@0.50.0-preview.24/Unity.Physics/ECS/Base/Systems/PhysicsInteractionSystems.cs:18)
Arc.Weapons.Laser.ShotLaserBeamSystem.OnStartRunning () (at Assets/Scripts/Arc/Weapons/Laser/ShotLaserBeamSystem.cs:30)
Unity.Entities.SystemBase.Update () (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/SystemBase.cs:390)
Unity.Entities.ComponentSystemGroup.UpdateAllSystems () (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/ComponentSystemGroup.cs:583)
rotund token
#

i don't believe in scene switching for entities projects, that said your issue is you can't do this entityManager.DestroyEntity(entityManager.UniversalQuery) as it destroys the safety singleton physics uses

#

if you want to do this you'll need to get internal access to the physics library and either recreate this entity after you destroy it or put it in the exclude query for your destroy

#

personally i'd advise against this, just because it works now who knows maybe unity adds 100 internal components in a future version that are required to exist. creating utility or state entities in OnCreate is a reasonably common pattern and what you're doing breaks this.

#

better off just never switching scene and use subscenes (my recommendation) or destroying the world and re-creating it on scene switches

worn valley
left oak
# worn valley That is really disappointing. Entities have so much flexibility if you know what...

Dots authoring is getting a lot better https://youtu.be/p4ct4vHWYt0

This video covers the improved Editor tooling in the upcoming Data-Oriented Tech Stack (DOTS) 0.50 release, including the Hierarchy, Inspectors, Profiler modules, Systems window, and entities journaling. It also addresses a new Editor workflow, coming in Entities 1.0, which allows artists, gameplay programmers, and level designers to author with...

β–Ά Play video
rotund token
#

watch like 17:30 onwards for 1.0 and the future

valid haven
#

2022.2a7 was released, but not entities 1.0 😦

#

We need that 2022.a6.dotse build the dev in the video has πŸ˜‰

rotund token
#

That's optimism

rustic rain
#

Did they promise 1.0 in 2022?

haughty rampart
rustic rain
#

I mean

#

year of release

haughty rampart
rustic rain
#

still pog

haughty rampart
#

but i gotta say unity is kinda inconsistent. in the forum posts they said it'd be: 0.50, 0.51, then 1.0 in the video ^^ they said they'd go back to normal experimental releases now

little moon
#

Or is there a simplier way to do this?

little moon
uncut rover
#

Hello @rotund token , if I'm not mistaken you recommended in discord to use log4net over the basic unity debugger. Have you managed to use log4net from a burst job ?

worthy rampart
#

anyone know if there are any examples anywhere for simulating multiple physics worlds using the PhysicsWorldIndex component

rotund token
#

You can hook in whatever you want in other side by overriding ilogger

spiral flint
#

Can anyone point me to an up-to-date tutorial on how to render entities with the hybrid renderer V2 and ECS 0.50?

#

I'm having trouble finding ones that are updated or still relevant

#

Someone said that the conversion workflow is the best way to do it, so I guess I'll quit trying to use pure ECS rendering.

worthy rampart
#

it just means you edit game objects in the editor

#

add a cube to scene, hit convert to entity checkbox

gusty comet
#

Does ECB.Instantiate still return a negative-indexed entity which should not be stored in other components?

uncut rover
haughty rampart
harsh onyx
#

Hi I am creating Transformaccessarrays with the constructor new Transformaccessarray( [TransformArray] ) .

I want the transformaccessarray to persist permanent but dispose it when I end the game with the pause button.
How do I dispose it?

rotund token
#

curiously why are you manually creating transform access array

inland depot
#

You know ECS 0.50, does that still support GenerateAuthoringComponent?

#

cause I get a lot of errors about "Runtime" missing in the generated code files...

haughty rampart
#

[GenerateAuthoringComponent] still works perfectly fine

inland depot
#

Huh

#

Wonder whats up with my project then :/

#

Seems I have multiple code gen issues... "Duplicated parameter name" also 😦

inland depot
#

Lol "IntPtr" isn't in the namespace... but that's System

karmic basin
#

Math should be 1 patch above

#

and try to delete gen'ed files so it regen them ?

haughty rampart
#

hm, seems ok. try going to preferences and regenerate project files

inland depot
#

I mean I'm looking at some strange error messages

#

How?

karmic basin
#

Fix first one in order

haughty rampart
inland depot
#

"Regenerate Project Files" makes no difference, Maybe a reimport assets will do the trick, kinda doubt it though

karmic basin
#

well you can manually delete Temp folder if you wanna be sure :p

haughty rampart
inland depot
#

20.3.32

haughty rampart
#

and ide?

inland depot
#

Rider

#

Still doesn't work after Reimport All

#

Go home compiler, your drunk πŸ˜›

karmic basin
#

and deleting Temp/GeneratedCode neither ?

inland depot
#

Don't really get how a fully namespaced usage can be missing, esspecially in the system space

karmic basin
#

could be assembly def broke reference

#

if you messed with that

inland depot
#

I checked them and they look ok

#

Those don't affect the standard libraries though

haughty rampart
inland depot
#

21.3.2

haughty rampart
#

are there other errors except those from the temp/...?

inland depot
#

Nope

#

They are all about missing namespaces. All of them seem to be System.X

haughty rampart
#

very curious

inland depot
#

Runtime, IntPtr, IDisposable, etc

#

Stuff that should always be there

haughty rampart
#

reopen the project?

inland depot
#

Unless asdef files found a way to break the reference somehow

#

Had to close before I could delete the entire temp folder

#

So that's not it 😦

inland depot
#

Oh

#

There is one unique error

#

but it's just as bad

#

"The parameter name 'shared' is a duplicate"

#

in a generated file

haughty rampart
#

try removing all partial keywords from your system classes

inland depot
#

Did WithSharedComponentFilter change?

haughty rampart
inland depot
#

cause these is the generated method arguments:

#

and this is the setup for that:

#

why would one be ref and the other not?

#

do they need to get passed in now?

haughty rampart
#

looks fine

inland depot
#

Hmm, then why is shared declared twice?

haughty rampart
#

oh. uhhh, i have no idea. but i doubt that that's the issue

inland depot
#

well it's the only thing not complaining about missing system namespace....

#

and the only one that looks like an actual compile error

haughty rampart
#

can you remove all the partial keywords? so it doesn't generate anything, then put them back one by one to find which one actually causes an issue?

inland depot
#

I can try

#

So if I remove the partials it works?!?

#

Well it has runtime errors cause of missing references but it compiles

haughty rampart
rotund token
#

do you have multiple entities.foreach for the same system in different files?

inland depot
#

I think I need to restart the editor again

haughty rampart
#

do you have nested Entities.Foreach()?

inland depot
#

I don't think so

rotund token
#

be easier if you just posted the full system

inland depot
#

It's everything

#

every system has this issue

#

everything with GenerateAuthoringComponent has it too

#

It's like unity dosen't import the System package into the solution

haughty rampart
#

(i just want to note here that compared to source generators written by microsoft (and therefore also the generated files), unity's source generators (and therefore the generated files) are ....gross. but i hope / am optimistic that they might improve them)

inland depot
#

I doubt it

rotund token
#

there's likely 1 file that is breaking everything

#

and stopping it all linkiing

haughty rampart
#

+1

inland depot
rotund token
#

and i have a post with like 5 different things that break the code gen

#

and unless you post some code we can't see which cause it is

haughty rampart
#

and i doubt that the code that you posted actually breaks anything

inland depot
#

ahh but it does

rotund token
#

we can clearly see the result is broken

inland depot
#

I mean not my code but the generated code

#

wouldn't that stop the compiler too and possibly break linking?

rotund token
#

yes but your code is what triggers the generated code

#

and there are currently a bunch of things that you can write that are legal c# that will break code gen

haughty rampart
#

ah man, i'm slow right now....yeah that should break something..

#

yeah, best post the whole system pls

inland depot
#

I'd do screen share but this server has no chat channels 😦

rotund token
#

OK if was to guess, is what is breaking your code gen

#

WithShardedComponentFiltering likely passes in a copy of the shared component itself, but you are also capturing the same variable

inland depot
#

shouldn't the lambda capture that?

#

Hmm, how would I use it without referencing it?

rotund token
#

i pretty much never use scd in jobs but i have an idea, give me a sec need to test

haughty rampart
#

what i can contribute is that....uhhh.....putting entities.foreach into a foreach loop does not feel right.

rotund token
#

just pass hte shared component in the ForEach

#

ForEach((Entity entity, SpriteSheetMaterial ssm, ref BufferHook) => {}

#

can confirm it's the capturing of the shared component that does it

haughty rampart
#

good to know

inland depot
#

Well that error went away but the rest of them are still there 😦

rotund token
#

if you clear, what's the first

inland depot
#

Temp\GeneratedCode\Code\PathfindingSystem__System_2109874506.g.cs(16,13): error CS0234: The type or namespace name 'Runtime' does not exist in the namespace 'Code.Pathfinding.System' (are you missing an assembly reference?)

rotund token
#

can you show the system

#

oh quick question, are you using assembly definitions?

inland depot
#

yes

#

But Runtime is System.Runtime

#

Unless you need to link to System now which would be a bit crazy?

rotund token
#

are you using .net standard 2.0 or .net 4.x

inland depot
#

2 I think, let me check

#

Yeah 2

#

(wish they would update to 6 but but 2 will do for now)

rotund token
#

well latest net standard is 2.1 so 6 would be a leap πŸ˜„

haughty rampart
inland depot
haughty rampart
rotund token
#

yes i know what you were meaning

#

i was just being pedantic

haughty rampart
rotund token
#

yeah fair

#

2022 currently has partial c#8 right?

#

or was it 9

haughty rampart
inland depot
rotund token
#

so 2021 was c#8, 2022 c#9? (partial support)

haughty rampart
rotund token
#

yeah

#

only used 2022 for half a day but i really want the new namespace

#

anyway show us a system crener

haughty rampart
#

you mean file scoped namespaces?

rotund token
#

yep

haughty rampart
#

yeah...that's c# 10

#

i really want implicit usings as well

rotund token
#

hmm i'm pretty sure that worked in 2022

inland depot
#

The global namespaces is c# 9

#

Oh c# 10 I guess

haughty rampart
#

told ya

inland depot
#

C# 10 is .net 6 Right?

haughty rampart
#

c# version and .net is not necessarily connected

inland depot
#

Cause I know it got added in .net 6

rotund token
inland depot
#

.net 5 and 6 have shipped with new versions though

haughty rampart
inland depot
#

and MS are trying to stay on a yearly schedule with releases now

haughty rampart
#

....for the most part at least

inland depot
#

Not in the framework series but from standard onwards that was the goal

haughty rampart
#

the release of a new version is, yes....but not the usability of the new version. that's what i meant

inland depot
#

Hmm, why would they release an unusable version?

haughty rampart
#

.....what? i think we're not understanding each other currently

rotund token
#

hmm i'm totally wrong, file scoped namespaces don't work in 2022. Swear i used them for a little while.

rotund token
#

i wasn't doubting your c#10 statement

#

but i explicitly recall downgrading my project and having to remove a bunch of file scoped namespaces 😐

inland depot
#

2022 can create a .net 6 project with is C# 10

haughty rampart
rotund token
#

i can only seem to make it generate a 4.7.1

inland depot
rotund token
#

well that's not the feature i'm talking about

haughty rampart
haughty rampart
rotund token
#

of course

#

i was just testing the .net framework

#

that it was generating because he mentioned it

inland depot
rotund token
#

yeah but this isn't a unity app?

inland depot
#

No

haughty rampart
inland depot
#

OOOOH

#

got you

#

Still annoying how Unity are always so far behind

rotund token
#

too many platforms to support

inland depot
#

I figured with .net standard being more of a thing they would drop Mono

#

More speed and better support

haughty rampart
rotund token
#

i think it just feels long atm because we're stuck on 2020

haughty rampart
#

yeah......it even feels long when you're at 2022

inland depot
#

Didn't 2.1 come out in 2018 though :/

rotund token
#

c#10 was only released 5? months ago

#

yeah nov 2021

#

(they aren't going to support it in preview as much as you'd like)

haughty rampart
inland depot
haughty rampart
inland depot
#

yeah but .net 7 will be out in Novemer if they can keep up with the yearly schedule

haughty rampart
#

anyway unity will make the .net core transition with .net 7 or 8

inland depot
#

Really?

haughty rampart
inland depot
#

Huh

#

Time will tell

#

they don't have the best track record

#

I mean I hope they do it but I have low confidence

haughty rampart
rotund token
#

josh peterson pretty decent with communication

haughty rampart
#

yeah πŸ‘

#

but it did hurt when i asked: 'when?' and the response was: '.net 7 or 8' 😒 πŸ˜†

#

since i've been following this from before .net core 3.0 release

inland depot
rotund token
#

OH

#

you have a namespaces called X.System

#

don't you

inland depot
#

Yeah

rotund token
#

yeah that breaks everything

#

it references your code instead of System

inland depot
#

What? but wouldn't the generated code have todo Mycode.whatever.System.X not System.X? You can't just have a random namespace expect to carry on from your current location?

#

OMG thats so dumb

haughty rampart
inland depot
#

If I rename to "Systems" the errrors start going away

inland depot
#

since when is that a thing

rotund token
#

you need to use global::

haughty rampart
#

.....mostly

rotund token
#

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

haughty rampart
rotund token
#

i had an light discussion with someone on the internet a few months ago why using System as a namespace was bad

#

well who's laughing now

rotund token
haughty rampart
#

?

inland depot
#

Uuuuh such a stupid issue to have 😦

rotund token
#

i follow stylecop guidelines in my libraries which mandate usings inside namespace

inland depot
#

Well at least Rider lets me bulk fix namspaces super easily

haughty rampart
rotund token
haughty rampart
rotund token
#

well yeah that is a terrible idea

#

but that has nothing to do with that link i posted?

inland depot
haughty rampart
#

and the standard project templates also put usings outside the namespace @rotund token

inland depot
#

namespace a { public class same{} }
namespace b { public class same{} }
namespace ab { using a; using b; public class example{ public same instance; } }

#

I don't think I've ever heard of using inside a namespace

haughty rampart
#

i've seen it, and i hate it

inland depot
#

Then you have todo a.same and then it just gets really messy

rotund token
rotund token
#

and until file scoped namespaces it's staying that way

rotund token
#

it's a compile error with the using outside

worthy rampart
#

is there an easy way for me to prevent the physics systems from being added to the default world

rotund token
worthy rampart
#

without going full custom bootstrap

rotund token
#

why would it not be a compile error?

rotund token
haughty rampart
#

which is always good

worthy rampart
inland depot
rotund token
#

why would it change in this example

#

it's still ambiguous

spiral flint
#

I'm starting to get fed up with DOTS in Unity 2020. Tutorials just don't work and I can't seem to get anything done. Should I just wait until the package is out of preview?

rotund token
#

depends if you want to wait a year+

#

if you just want to smash out some games and not spend 6months learning it, then probably best to avoid

haughty rampart
inland depot
rotund token
#

allowing what?

inland depot
#

using inside a namespace

rotund token
#

for the reason i linked above?

#

microsoft created stylecop from their internal standard of using c#

worthy rampart
haughty rampart
haughty rampart
spiral flint
rotund token
haughty rampart
spiral flint
worthy rampart
#

if anything I find DOTS to be significantly less magical than Monobehaviours

rotund token
#

what's calling my Update and Start methods 🧐 (/s)

haughty rampart
inland depot
haughty rampart
rotund token
#

is 4 spaces on a few lines at the top of file really that big a deal

haughty rampart
#

if you have 4, yes

rotund token
inland depot
haughty rampart
rotund token
#

i literally can not think of a time in the past maybe 4 years

#

i've ever looked at my namespaces

#

so i'm quite happy keeping them perm closed

haughty rampart
haughty rampart
rotund token
#

i dont

inland depot
rotund token
#

i have a hotkey that removes unused namespaces

#

which i hit before i save file

haughty rampart
rotund token
#

unused namespaces are a warning in my project

#

and i dont allow warnings

#

i literally turn warnings as errors on every few weeks

#

and fix them all

haughty rampart
#

warnaserror only

haughty rampart
#

and if there's more than 1 class, that should be extracted into a seperate file

inland depot
haughty rampart
#

i mean i won't argue on that, but i can only imagine a monolithic class that uses that many

rotund token
#

if you use rider, use this, cleanup namespaces constantly

#

never need to look

haughty rampart
rotund token
#

im sure there is (probably that hotkey since i use VS hotkeys)

inland depot
haughty rampart
#

idk, still just doesn't feel right

inland depot
#

Give it a while when you get into a really big codebase πŸ˜‰

haughty rampart
haughty rampart
inland depot
#

I guess ECS helps keep the usings down if you only work with that

#

though here is 200 lines of pathfinding using 12 so πŸ€·β€β™‚οΈ

spiral flint
# haughty rampart what isn't working? we're here to help afterall

I've sorta given up on DOTS for the meantime as tutorial code doesn't work and no google search has offered enough info to even get close to finding the problem. I can't even render an object. I'm gonna delete the current project and make a new one, and if that doesn't work I'll try downgrading to 2019, but if neither of those are fruitful I'm gonna put learning DOTS on the back shelf for another year or two.

rotund token
#

just download the samples

#

they have rendering cubes in that for you

#

it's a much better source than most of these tutorials

spiral flint
worthy rampart
#

moonboy just stick the object in a subscene or add the convert to entity mono to it

haughty rampart
worthy rampart
#

it should "just work"

rotund token
haughty rampart
rotund token
#

it's not a bad read though

#

i don't think anything in this has changed since feb 21

inland depot
#

I wish that ECS worlds were separate though, from a threading perspective 😒

haughty rampart
#

nooo

inland depot
#

yessss

haughty rampart
#

nooo

inland depot
#

1000 short ticks on world 1, 2 long ticks on world 2

#

but you can't exceed 4 frames before it doesn't like world 2 which sucks

rotund token
#

well you can now

haughty rampart
#

exactly

rotund token
#

with the new world allocator

inland depot
#

since 0.5?

rotund token
#

though even though the changelog said they updated ecbs, they didn't

#

oh yeah i was meant to follow that up with unity

#

to see if it's going to make 0.50.x or 0.51 or delayed to 1.0...

inland depot
#

So I can now have world 2 take 2 seconds to update and have world 1 run at 60fps?

spiral flint
rotund token
inland depot
rotund token
inland depot
rotund token
#

just like you have a prefab gameobject and make copies if it regular GO world

#

you do the same thing for entities

inland depot
#

The main issue was that it would get stuck waiting for jobs in world 2 to finish in order to complete rendering world 1. So world 1 got the penalty of long jobs in world 2.

rotund token
#

so yeah if you want long running jobs, don't

#

use Run() and execute it in a separate thread

inland depot
#

Like managed thread?

rotund token
#

yep

#

use burst

#

and just let it run until it's done

#

if you want long running multi threaded jobs, think about your problem again πŸ˜…

inland depot
#

Yeah....

rotund token
#

because it doesn't make sense

inland depot
#

I wanted like 20 of my threads to work on world 2 and 4 to remain on world 1

rotund token
#

if you use all your cores up on a long running job, your game can't run

#

that's good, what if a player only has 4

inland depot
#

World 1 = Max(2, threads * 0.25)
World 2 = threads - World1
πŸ™‚

#

If they have less than 4 just close

#

or 3, you can probably get away with 3

#

1 for burst threading, one render thread and one for the second world

#

(and I know the render thread does a little of the burst work when it's idle)

#

But I can't have that 😦

spiral flint
inland depot
spiral flint
#

Just pretty down and discouraged about the knowlege base rn

haughty rampart
#

the docs are actually pretty good. but you have to do digging yourself

inland depot
inland depot
rotund token
#

or were you wanting to use an old version of entities

worthy rampart
#

he said he wanted 2019 cause it should match the old tutorials

worthy rampart
#

PhysicsWorldIndex seems like a really weird addition

#

considering how much work you have to do to enable useage of non zero values

rotund token
#

isn't there a field on authoring?

worthy rampart
#

yea you can add entities to other worlds

#

but only world 0 gets simulated

#

I was expecting something like, they loop over the unique values of that shared component

#

and run all the worlds

#

but they do not

rotund token
#

it's like, RegisterSimulation or something isn't it

#

oh wait no

#

that just adds to each index

#

hmm not sure haven't looked enough

#

i had some ideas for some uses of this though

#

but i haven't looked how hard to set it up

#

if it was easy to setup, nice to have a world with no actual colliding objects and is just used for spatial queries

worthy rampart
#

I build and maintain a bvh

rotund token
#

yeah so do i

worthy rampart
#

just for spatial queries

#

what bvh are you using?

#

custom one? or built in

rotund token
#

i have a modified version of unities bvh

worthy rampart
#

ah gotcha

rotund token
#

though i have a much faster nearest neighbour search

#

well its about the same lookup speed

#

but i can build it magnitudes faster

#

just using a hashmap with a custom AddRange method

#

actually speaking of, i should release this method

worthy rampart
#

what build speed do you get?

rotund token
#

using 16 cores it takes like 1ms to add 100,000 entities
i can add 100,000 on a single thread using AddRange in 0.1ms

worthy rampart
#

wut

rotund token
#

oh i think i missed a total thing here

#

AddRange method for NativeMultiHashMap

#

but yeah it's ridiculous

#

before

worthy rampart
#

jesus christ

#

what's the query speed like for the bvh?

#

built in this way

rotund token
#

this isn't a bvh

#

this is just a quantized hashmap

#

it performs about 4x faster than unitys bvh though for nearest neighbours lookups (about all it's good for)

worthy rampart
#

ah

#

mine does like 900ns or so to resolve a ray against 120k objects in it

rotund token
#

let me load up my simulation i haven't looked at this recently

#

but the demo has 200k entities finding their 10 nearest neighbours in a few ms i think

worthy rampart
#

I don't have a nearest neighbor method

#

haven't had a reason to use that yet

rotund token
#

the lookup is really 'dumb'

worthy rampart
#

I think I would be able to calc the nearest neighbor in an array lookup or two though

rotund token
#

it's just hashmap.TryGetValue(quantize(point), out values);

#

iterate all values doing distance checks

worthy rampart
#

gotcha

#

so you just chunk things into quantized cubes

#

and linear search

rotund token
#

pretty much

worthy rampart
#

makes sense

rotund token
#

it performs 10% slower than fastest quadtree i could find

#

4x faster than unitys bvh

#

but it builds like 10x faster than the quadtree

worthy rampart
#

yea optimized trees are expensive to build

rotund token
#

ok demo still runs

#

hilarious how slow this runs without burst

worthy rampart
#

my rust code always runs the same speed 🀣

#

I might have to investigate some cheaper but less accurate build strategies

rotund token
#

oops this was only 100k

#

but that's the cost

#

that first 2 tiny sections is the building the map (done every frame)

worthy rampart
#

wow

#

writing to multihashmap is faster than I'd expect

rotund token
#

no no no

worthy rampart
#

I haven't played around that at all yet

rotund token
#

it's my addrange method

#

is faster

worthy rampart
#

ohh

#

extension method?

rotund token
#

yeah here i'll post the code

#

i can memcpy the keys and values into the hashmap

#

then all i have to do is iterate the keys and generate hashcodes

#

and the whole thing is built

#

it's fucking beautiful

#

but yeah super happy with how much i've optimized this simulation over time

#

been like a little side optimization project i just keep coming back to when i have a new idea

worthy rampart
#

do the circles do anything

#

besides bounce around

rotund token
#

they're not bouncing

#

they're avoiding each other

worthy rampart
#

ahh

rotund token
#

they are following paths

#

and not colliding

#

it's a burst implementation of ORCA (rvo2)

#

yeah 200k elements added to a hashmap, 0.56ms only using a single worker

worthy rampart
#

nice

rotund token
#

how does your bvh compare to unity's? much faster for what you need?

worthy rampart
#

I built it for use in gameobject land without the use of unities ecs packages

rotund token
#

ah

#

funny enough that's what i was using the unity bvh for

#

figuring out what static gameobjects to stream in

#

i just store the bounds and index to the gameobject

worthy rampart
#

gotcha

#

I think unities should build faster

#

but mine probably has better query time

#

I'll have to bench to check

#

mine is binary

#

I've benched it against another quad bvh

rotund token
#

it's not as fast as i would like, but i think it's because it does a lot

worthy rampart
#

and that's what the result

#

it builds too fast

#

to be optimal query

rotund token
#

yeah the thing the unity one i use in the work project never needs to rebuild

#

it builds once and it's good

#

it's not used enough for me to warrant looking at improving query time

#

but i'm always interested in things out there for future problems

worthy rampart
#

code is here

#

I generate C# bindings for it

#

query perf is mostly about build strategy

#

hm

#

I wonder how fast I could do nearest neighbor search in my bvh with partial updates

rotund token
#

to register a component for serialization all you need to do is create tiny class

    {
        public override int Key => -1;
        // Burst generic job support
        protected override SerializeJob CreateSerializeJob => default;
        protected override DeserializeJob CreateDeserializeJob => default;
    }```
#

these map 1:1 to components so at some point in future i'll codegen them from an attribute on the class

#

this is a big difference to the system that we wrote at work where save systems map 1:1 to 'archetype' which might save an arbitrary amount of components

#

migration, while not implemented yet, will be done via a collection of small class just like this (so you can migrate multiple versions at a time if loading a really old save).
entity references are also supported

worthy rampart
rotund token
#

that's what i'm hoping for, migration api is currently leaning towards


    public class TestMigration1 : ComponentMigration<TestMigration1.Test, Test>
    {
        protected override void Migrate(in Test oldComponent, ref ComponentSaving.Test newComponent) => newComponent.Value = oldComponent.Value;
        
public struct Test { public byte Value; }
    }

    public class TestMigration2 : ComponentRawMigration<Test>
    {
        protected override unsafe void Migrate(in void* buffer, ref ComponentSaving.Test newComponent) => newComponent.Value = UnsafeUtility.AsRef<byte>(buffer);
    }```
depending on use comfort on unsafe code
#

we wrote 2 different save systems at work, the original with serializeworld which while very convenient for saving is absolutely useful for migrating data and making changings to your prefabs

#

while the second system, which i actually wrote, saves on a per archetype. it's been working well but it has a few quirks that i'm trying to iron out in this version in my own library

#

so i'm kind of merging them together to get best of both worlds

worthy rampart
#

how do you do the serialization?

#

chunk by chunk?

rotund token
#

yep

worthy rampart
#

what's the interface for SerializeJob?

rotund token
#

protected unsafe struct SerializeJob : IJob

#

it's just a job

#

you don't need to implement anything

#
            {
                var idx = this.Data.AllocateNoResize<Header>();
                int entityCount = 0;

                foreach (var chunk in this.Chunks)
                {
                    var entities = chunk.GetNativeArray(this.Entity);
                    var components = chunk.GetNativeArray(this.Component);

                    entityCount += entities.Length;

                    this.Data.AddNoResize(entities.Length);
                    this.Data.AddBufferNoResize(entities);
                    this.Data.AddBufferNoResize(components);
                }

                var header = this.Data.GetAllocation<Header>(idx);
                header->Key = this.Key;
                header->EntityCount = entityCount;
                header->LengthInBytes = (this.Chunks.Length * UnsafeUtility.SizeOf<int>()) +
                                        (entityCount * (UnsafeUtility.SizeOf<Entity>() + UnsafeUtility.SizeOf<T>()));
            }```
the job currently
#

the file sizing is not ideal as it has to save entity for every component

#

but this is the cost of doing per component rather than per archetype

#

i could just save the index though for the key, i actually wrote a stride/slice method already for this to do that but just for the proof of concept easier to just use the whole thing
but yeah, serialization isn't really the hard part. lots of ways you can do this

white island
#

You still can't generate a subscene from a list of gameobjects right

rotund token
#

what do you mean by generate subscene?

#

there's nothing stopping you opening scene using editor scene manager, creating the gameobjects and saving the scene

#

bam subscene created - though i suspect this is not what you are looking for?

white island
#

Yeah I meant from c#

rotund token
#

yeah, so do i

#

a subscene is just a regular scene attached to a subscene component

#

what part can't you do in code for setting one up?

iron narwhal
#

wait can u save an entire scene using DOTS?

chilly crow
#

File -> Save Scene (Ctrl+S)

gentle harness
#

How did you get the entity within a job again?

#

Need to get the entity the job is currently performing work on

gentle harness
#

By that I mean the entity which owns the components currently accessed in the execute method
void Execute( Entity ent , ref Delta delta, in Position position, in Neighbors neighbors, in Capsule bounds) is how I remember it being done before

karmic basin
#

That's for a job declared with a Foreach lambda

#

not from the execute method of a job struct

#

which job declaration are you using ?

white island
gentle harness
harsh onyx
#

Can you Dequeue a nativequeue in a job?

karmic basin
# gentle harness IJobEntity

I don't use it yet (not migrated to 0.50) but manual says it will autogen an IJobEntityBatch. So you'll get a chunk matching the Query

#

So you could loop over the entities in the chunk like IJEB I assume

#

Does that help ? :p

#

or do you need details ?

#

long story short you need an EntityTypeHandle, and retrieve a nativearray from this handle, then you can loop your entity array like you'd expect

#

I mean from the chunk with the help of the handle :p

#

project is not open on my computer rn but feel free to ask if need an example

stone osprey
#

Anyone here ever experienced a dots related crash ? Im actually using entities in production and i have some users reporting that their app crashes.
Those crashes appear randomly, no pattern. I couldnt reproduce it on my devices. But i make heavy use of dots, so its either dots or android related. Unfortunately no one could send me their crash log yet, so im still stuck.

Anyone ever experienced a dots crash ? What was the reason for you ?

gentle harness
#

Hehe, that's why you don't use it in prod 😊

stone osprey
#

I know i know... but i didnt want to use entitas or any other ecs lib ^^ Its actually more like a alpha testphase but still pretty annoying... especially because i cant reproduce it.

rotund token
#

100s of crashes

#

Most crashes that look random are ecb cranes

stone osprey
#

Damn :/ Well i just saw theres a "backtrace" plugin which automaticly tracks crashes and errors and uploads them to a cool dashboard... gonna try this, hopefully it tells me why my clients are crashing

north bay
gentle harness
#

Do I have to dispose ECB manually?

#

Getting thousands of memory leaks

#

Of course I have to

#

Where's the facepalm emoji?

haughty rampart
rotund token
gusty comet
#

I have Unit which spawns these prefab Entities: a single Officer, a single Formation, and many Soldiers. Officers, Formations, and Soldiers need to reference each other in their components. However, this can quickly become extremely complicated since instantiated Entities have negative indices right after creation, and should not be stored in components until the ECB has played back and converted the negative indices to positive ones. Are there any good patterns for creating and linking these spawned entities?

rotund token
#

since instantiated Entities have negative indices right after creation, and should not be stored in components until the ECB has played back and converted the negative indices to positive ones.
ECB can update these indices for you

#
EntityCommandBuffer ecb;

var entity1 = ecb.Instantiate(prefab1);
var entity2 = ecb.Instantiate(prefab2);

ecb.AppendBuffer(owner, new CreatedEntities {Value = entity1});
ecb.AppendBuffer(owner, new CreatedEntities {Value = entity2});

ecb.SetComponent(entity2, new MyParent {Value = entity2});```
#

these entities will be remapped to the new created entities on playback

gusty comet
#

Thank you. The

ecb.SetComponent(entity2, new MyParent {Value = entity2});

I know gets remapped. However, regarding your two lines above that, would something like

var soldierEntity = ecb.Instantiate(soldierPrefab);

ecb.AddComponent(officerEntity, new SubordinateComponent { entity = soldierEntity });

not cause any issues? Where officerEntity already exists. Your example of

ecb.AppendBuffer(owner, new CreatedEntities {Value = entity1});
ecb.AppendBuffer(owner, new CreatedEntities {Value = entity2});

seems to imply that only certain ECB methods like AppendBuffer work

#

Also out of curiosity, how does ECB even detect if an IComponentData or IBufferElementData its manipulating has an Entity field, and thus knows when to remap newly instantiated entitues? Wouldn't this require reflection on the fields?

rocky dove
#

Are the DOTS talks from GDC going to be available?

haughty rampart
tranquil goblet
#

I kinda didn't get it, ECS related to Hybrid renderer v2 or this is separated projects?

safe lintel
#

@rotund token how do you actually handle blobs? also could you just codegen it to grab every ICD? Dont see modifying builtin packages to add an attributes everywhere being desirable

safe lintel
#

yeah

rotund token
#

i dont need to save blobs they're immutable

#

they will already exist on the prefab when i create it

safe lintel
#

there were some finer grain details regarding entity prefabs I was going to ask but its late and my mind is frazzled

rotund token
#

the type of entity is saved then how i deserialize is, instantiate entity from prefab with all the default values then apply save data to this entity

#

this means you can update the prefab, add components, remove components etc

#

this is another flaw with using serializeworld it just gives you back what you serialized exactly you cant make changes to your game in the future

#

you can save entity references on components really easily, thanks to unity

#
            private void RemapEntityFields(ref T data, TypeManager.EntityOffsetInfo* offsets, int offsetCount)
            {
                var ptr = (byte*)UnsafeUtility.AddressOf(ref data);
                for (var i = 0; i < offsetCount; i++)
                {
                    var entity = (Entity*)(ptr + offsets[i].Offset);
                    *entity = this.Remap.TryGetValue(*entity, out var newEntity) ? newEntity : Entity.Null;
                }
            }```
safe lintel
#

oh yeah came to me, uh how do you treat entities that exist in the scene that dont necessarily have a prefab equivalent floating about?

rotund token
#

so existing entities (from subscenes) is something i'll tackle next weekend

safe lintel
#

thats one aspect from the one entity -prefab remap workflow(i think eizenhorn talked about) that kinda eluded me at least for some scenarios that I believed apply to my project

rotund token
#

well i'll probably enforce all savable stuff in subscenes to be prefabs in my project

#

i could just use the actual asset in the subscene as the prefab

rotund token
safe lintel
#

think it involved storing a hash of the blob asset during serialization and then remapping to the prefab when deserializing

#

anyway Im probably not seeing the big picture but the idea of creating a prefab for every single asset that might be in a scene kinda makes me wince

rotund token
dull copper
#

(in case you didn't find it already)

pulsar jay
#

Anybody has an idea how it is possible for a hybrid component (vfx) to be only visible in game view but not in scene view?

rotund token
#

are you on 0.50?

#

and what do you mean by hybrid componennt

pulsar jay
#

It is a vfx effect on a converted prefab

rotund token
#

vfx isn't an approved hybrid component

#
        {
            typeof(Light),
            typeof(LightProbeProxyVolume),
            typeof(ReflectionProbe),
            typeof(TextMesh),
            typeof(MeshRenderer),
            typeof(SpriteRenderer),
            typeof(VisualEffect),
#if PARTICLE_SYSTEM_MODULE
            typeof(ParticleSystem),
            typeof(ParticleSystemRenderer),
#endif
#if SRP_7_0_0_OR_NEWER
            typeof(Volume),
            typeof(SphereCollider),
            typeof(BoxCollider),
            typeof(CapsuleCollider),
            typeof(MeshCollider),
#endif
#if HDRP_7_0_0_OR_NEWER
            typeof(HDAdditionalLightData),
            typeof(HDAdditionalReflectionData),
            typeof(DecalProjector),
            typeof(PlanarReflectionProbe),
            typeof(DensityVolume),
#if PROBEVOLUME_CONVERSION
            typeof(ProbeVolume),
#endif
#endif
#if URP_7_0_0_OR_NEWER
            typeof(UniversalAdditionalLightData),
#endif
#if HYBRID_ENTITIES_CAMERA_CONVERSION
            typeof(Camera),
#if HDRP_7_0_0_OR_NEWER
            typeof(HDAdditionalCameraData),
#endif
#if URP_7_0_0_OR_NEWER
            typeof(UniversalAdditionalCameraData),
#endif
#endif```
these are the only valid hybrid components that work
pulsar jay
#

I can see the rest of the prefab (mesh etc.) in both but the vfx is only visible in game view

rotund token
#

if it's not on this list, it will be excluded from hybrid conversion

pulsar jay
#

It still works half way as it is visible in game view

rotund token
#

unity locked down hybridcomponents in 0.50, no longer allow public use of the api and have a hard coded list of components they support

pulsar jay
rotund token
#

CompanionComponentSupportedTypes

#

com.unity.entities@0.50.0-preview.24\Unity.Entities.Hybrid.HybridComponents\CompanionComponentSupportedTypes.cs

tranquil jay
#

Hello! I am working on a racing game in **DOTS ** and right now I am tinkering with the concept of speed UP and **speed Down **zones.

I know how to make a TRIGGER collider but since in dots there's no Trigger ENTER and EXIT, I can't figure out how to approach stacking the speed modifiers on the objects that stay in there.

I was thinking of having a dynamic buffer with the **floats ** and adding them in a system before I math out my velocity, but it will keep being re-added into my buffer nonstop because I can't tell when it JUST entered the zone and staying in there.

rotund token
#

there's a trigger enter and exit in the physic samples

pulsar jay
#

So it should just not be converted at all? Because it works perfectly fine when putting it in a subscene

rotund token
#

actually yeah you say it works in game view but not scene view is extremely interesting

haughty rampart
#

You probably just have vfx disabled in scene view

pulsar jay
#

to me it looks like they already implemented some part of this authoring/runtime view they showed at GDC

pulsar jay
#

Only the runtime converted prefabs work only in game view

rotund token
#

as far as i'm aware no hybrid components should work that aren't on that list so i don't know why it's working

pulsar jay
#

also the entity prefabs now pollute the active scene with disabled game objects πŸ™„

rotund token
#

what script is it called again

haughty rampart
#

The new runtime changeability things look great, but I still think switching between play / edit mode will be common. Afterall you can't add code even with the new editing stuff

rotund token
#

i think it's more for game designers tbh

pulsar jay
haughty rampart
#

Definitely. And really nice. Unfortunately not something huge for the programmers

pulsar jay
rotund token
#

ah well then

#

i am just blind

#

that is good to know

pulsar jay
#

But doesnt explain why it stopped working correctly when converting a prefab 😬

rotund token
#

was going to look at some vfx in a few weeks

pulsar jay
rotund token
#

let me just re-read what you wrote originally

#

yeah so only runtime converted prefabs dont work

#

but subscene do?

pulsar jay
#

yes

rotund token
#

doesn't surprise me

pulsar jay
#

but if the subscene is open while entering playmode the behaviour is still kind of wierd

rotund token
#

yeah open subscenes break a lot of things atm

pulsar jay
#

it still works but the companion objects start showing up in the hierarchy

rotund token
#

if you look at netcode they specifically stop you entering the game like that

#

i do the same thing in my library

#

i don't expect this to work properly until 1.0 tbh

pulsar jay
# rotund token doesn't surprise me

sad thing is there is still no solution for prefabs other than converting them at runtime. Would be nice to just be able to store converted prefab entities as assets. But till then I dont see any other option to populate my tilemap

rotund token
#

i just store them all in a subscene

#

i use a similar system to the dots shooter sample with weak asset references

#

so i can reference across subscenes

pulsar jay
#

Hmm. Do you know if its possible to put subscenes in addressables?

#

I am trying to keep the game extensible. Thats why I currently load and convert the prefabs from addressables. I dont really like the idea of using subscenes as containers for everything but if that works that might be the way to go

rotund token
#

don't believe so

#

subscenes are kind of built like addressables already

#

but not sure how extendable they are

#

they actually load via streaming assets though

pulsar jay
#

Argh. Just found this statement by Joachim:
"SubScenes and Addressables don't work together. They package their data independently if the same resources are used, they will be duplicated. We are planning to bring a lot of concepts from Addressables into DOTS as builtin functionality SubScenes is the first step. Next is addressable prefabs & deduplication of shared assets etc. "

#

Would love to have those addressable prefabs 😬

upper tiger
#

Hey all, does anyone know how I can automatically destroy particle effect entities when they have completed

#

the entities are hanging around despite looping set to false

pulsar jay
upper tiger
#

yeah I have that system already, was hoping there was an automated way with particles. All good, it works fine with explicit destroy control

pulsar jay
upper tiger
#

good idea

#

thanks for the hel

pulsar jay
#

@rotund token Do you know if its possible to reference and load a subscene? Or does it have to be embedded in a scene at edit time?

rotund token
#

yes

#

2 primary ways to load subscenes
SceneSystem.LoadSceneAsync()
or the better way you can do it from jobs
add a RequestSceneLoaded component to the ResolvedSectionEntity.SectionEntity

#

you can unload
SceneSystem.UnloadScene
or the better way you can do it from jobs
remove the RequestSceneLoaded component

pulsar jay
worthy rampart
#

not sure if they are calling it internally somewhere

#

AddTypeToCompanionWhiteList on GameObjectConversionSystem

#

all I know is that I also see all the non-convertable monobehaviors on gameobjects I'm converting attached to the entity as well

rotund token
#

it requires internal access, but yes

#

i would not expect this to work in the future

worthy rampart
#

yea I'm not relying on it in anyway

rotund token
#

(but that future is quite far away)

pulsar jay
#

I may have found the root of my problem:

// Code never hit currently so outcommented:
// When live linking game view, we still want custom renderers to be pickable.
// Otherwise they will not even be visible in scene view at all.
//else if (!hasGameObjectBasedRenderingRepresentation && liveLinkGameView)
//{
//    m_DstManager.AddSharedComponentData(entity, new EditorRenderData
//    {
//        PickableObject = pickableObject,
//        SceneCullingMask = EditorRenderData.LiveLinkEditGameViewMask | EditorRenderData.LiveLinkEditSceneViewMask
//    });
//}
pulsar jay
# rotund token yes

Turns out instancing entities from a subscene has the same visibility problem. The VFX loaded in the subscene shows in Scene and Game view but its copy is only visible in Game view despite having the exact same components

gentle harness
#

Quick question, anyone know if there's a count of how many commands are in an ECB?

#

Or at least a way to know if it will playback

pulsar jay
gentle harness
pulsar jay
#

Depends if the ecb gets cleared on playback. I am not sure but I dont think it is. I guess it will usally just be disposed after playing

#

As far as I can see it does not get cleared automatically so it will still be false

#

The ECB even has an m_RecordedChainCount and m_DidPlayback but sadly its internal and not exposed in any other way than IsEmpty

shut pewter
#

I've been wondering, what's a good way to plug in a (separate) networking system to ECS ?

I receive network messages with an ID that is associated to my Entity. I want to call something that will let me queue up these messages into either an entity (probably via buffers?) or into a system.

white island
#

What is the advantage of using subscenes?
Say I had a level editor for an open world game, where different groups of objects are loaded and unloaded as the player walks around.
If I put GameObjects into the group in the level editor, exported the subscenes in an assetbundle , and then loaded those in my game, those GameObjects would be there presumably.

#

Am I able to add and delete GameObjects from a sub scene?

#

That was very convoluted

#

My question is: what is the advantage/point of using subscenes

safe lintel
#

subscenes are fast, gameobjects are slow

white island
#

But subscenes contain gameObjects?

safe lintel
#

gameobjects get converted into subscene entities

shut pewter
# shut pewter I've been wondering, what's a good way to plug in a (separate) networking system...

To add to this, here's what I want to do from outside of any existing System

public void Move(int id, float x, float y, float z)
        {
            var entity = _characterEntities[id];
            var buffer = EntityManager.GetBuffer<MovementCommandBufferElement>(entity);
            buffer.Add(new MovementCommandBufferElement()
            {
                TargetX = x,
                TargetY = y,
                TargetZ = z
            });
        }

I'm sure there's a much better way. "Move" is called by my networking code when it receives a "Move" packet

dull copper
#

more GDC content:

#

Explore the lessons learned from early adopters of DOTS, then addresses how Unity plans to transition this promising technology from experimental development to a released set of fully supported tools for the production of your games.

Speakers:
Laurent Gibert (Senior Manager, Product Management, Unity)
Lauren Frazier (CTO & Co-founder, Ramen VR...

β–Ά Play video
harsh onyx
#

-> jobified my whole catmullrom spline calcualtions in one go
-> activates every leak detection and debugger.
-> no errors and it just works πŸ€” Something I have never experienced before

worthy rampart
#

pepesaber enabling support for simulating physics for all values of PhysicsWorldIndex turned out to not be that bad

rotund token
#

Do tell

white island
rotund token
#

monobehaviours get converted to components, outside of that they don't work

#

(except for a small set of hybrid components)

worthy rampart
# rotund token Do tell

it was basically just, disable existing physics build, step, export, and final physics systems. Copy them into my codebase and adjust each system to do exactly what it was doing before except in a loop over all the unique values of PhysicsWorldIndex currently in the world

rotund token
#

oh so not built in support

#

shame

worthy rampart
#

yea :/

#

hopefully they just build this in

#

it was like 50 lines of code to edit

rotund token
#

they must, it seems like they added this support for a reason

#

i am curious what prompted them to do it though

worthy rampart
#

I was pumped when I saw the new component

#

but really confused

#

when I realized it wasn't really used yet

white island
rotund token
#

i would have to see what you're doing, but in general they should be stripped

white island
#

Hmm. I feel like I’m close to understanding how all of this works, but I’m not quite there yet.

gusty comet
#

I tried something almost exactly the same in my code except with Instantiate with a prefab entity rather than CreateEntity. I confirmed that that part of the code was being hit, but after playback, the entity still doesn't show up in the inspector. It doesn't seem to have played back. Here's what it looks like:

#
var spawnOfficerECB = new EntityCommandBuffer(Allocator.TempJob);

            var random = Math.NewRandom();

            Entities
                .WithName("Unit_Spawn_Officer")
                .ForEach((Entity unitEntity, in DynamicBuffer<UnitOfficerTemplateElement> potentialOfficers) =>
                {
                    // Instantiate is confirmed to have been called inside here
                })
                .WithBurst()
                .Schedule();

            Dependency.Complete();

            spawnOfficerECB.Playback(EntityManager);
            spawnOfficerECB.Dispose();
rotund token
#

there's no reason that wouldn't work if what you say is true

gusty comet
#

I'll show the actual Instantiate call

var chosenOfficerEntity = potentialOfficersFast[i].entity;
var newOfficerEntity = spawnOfficerECB.Instantiate(chosenOfficerEntity);
spawnOfficerECB.SetComponent(newOfficerEntity, new UnitMembershipUnitComponent
  {
    entity = unitEntity
  });

potentialOfficersFast is a DynamicBuffer with prefab entities stored in the entity field

dusk crystal
#

So I'm trying to set up a project with DOTS to learn how to use it. I found out that Burst had a new version available (1.6.5 from 1.6.4) and I had a bunch of errors, so I installed the new version, which got rid of all the old errors and replaced them with one new one about some 1.6.4 features being missing

#

oh hey I found 1.7.0 as well

#

okay so I found 1.4.11 which is the verified version, maybe I should downgrade to that one to improve the likelihood that everything's compatible?

robust scaffold
gusty comet
#

It's actually another oversight by me. The system that my example runs in actually runs from a Monobehavior's Start() callback. Basically, I have a coroutine that updates all systems inheriting from StartSystem, then disables those, then enables all normal SimulationSystems. I made the ECB work by introducing a one-frame delay in the coroutine so that all StartSystems run one frame after the Start() callback

robust scaffold
gusty comet
#

Yeah it’s frustrating and full of gotchas

dusk crystal
#

So I'm trying to install necessary packages to set up a DOTS project but I have a file missing.
error CS0006: Metadata file 'C:/Users/Marcus/Documents/GitHub/Unity_DOTS_Learning/Library/PackageCache/com.unity.collections@1.2.3-pre.1/Unity.Collections.LowLevel.ILSupport/Unity.Collections.LowLevel.ILSupport.dll' could not be found
I checked the Collections package and there isn't any other version I need to install. I tried regenerating the project files but that didn't work either

dusk crystal
# rotund token what version of unity

2020.3.21f1
that might be causing it, I made the project in a newer version, although I didn't get the 'you're opening this with the wrong version' message

rotund token
#

entities 0.50 requires 2020.3.30+ (but doesn't support 2021 yet)

dusk crystal
#

well I tried changing to a different version, it caused an error and when I tried changing back the error still occurred

dusk crystal
#

I might need to make a new empty project in that editor version (which I've now installed) and try reinstalling all the packages

#

Thanks though @rotund token

pulsar jay
#

Just confirmed that companion objects of runtime instanced entities do not render in scene view. No matter if converted at runtime or copied from a subscene:

#

Just made a system that copies all the entities of the subscene and offsets their position on the y axis

knotty linden
#

Hey all,
Am I understanding this right? - ECBs will always execute on the main thread, never in parallel (even with .AsParallelWriter())?.

Essentially, add/remove entities & components must always be done on the main thread?

frosty siren
knotty linden
#

@frosty siren Cool, thanks

gentle harness
#

How do I get entities from the main thread?

#

Would like to fetch entities within a chunk with a certain component

#

Doing this gets invalidated on structural changes

#
public void Update()
{
    var handle = e_manager.GetEntityTypeHandle();
    var chunks = e_manager.GetAllChunks(Allocator.Temp);

    foreach (var chunk in chunks)
    {
        if (chunk.Has(e_manager.GetComponentTypeHandle<Node>(true)))
        {
            var ents = chunk.GetNativeArray(handle);
            foreach (var entity in ents)
                e_manager.SetComponentData(entity, new Capsule());
        }
    }
    chunks.Dispose();
}
frosty siren
#

@gentle harness why you getting entities in a way like this?

gentle harness
#

Removed the data for brevity

frosty siren
#

I mean why iterating entities like this? Why not just use EntityQuery with component you need and then just use EntityQuery.ToEntityArray(Allocator) ?

gentle harness
#

Okay just thought of a way to do it within a jobified system

#

But this is not how I will be doing it in the end anyways, but I'd like to know how to fetch entities within the main thread

worthy rampart
#

all systems are on the "mainthread"

#

in onupdate

#

you only go off mainthread when you dispatch to a job

gentle harness
#

Yes, but how can you get the entities of a chunk from the main thread?

worthy rampart
#

well you can always do job

#

and run it on mainthread

#

via run()

#

instead of schedule

#

that's probably how I would write it

frosty siren
#

@gentle harness

private EntityQuery _nodeQuery;

override void OnCreate()
{
  _nodeQuery = GetEntityQuery(ComponentType.ReadOnly<Node>())
}
override void OnUpdate()
{
  var entities = _nodeQuery.ToEntityArray(Allocator.Temp);
  for(int i = 0; i < entities.Length; i++)
    EntityManager.SetComponentData(entities[i], new Capsule())
}
gentle harness
gentle harness
frosty siren
gentle harness
#

Oh, I see

#

Sweet

frosty siren
gentle harness
#

I couldn't use IJobEntity for some reason, NullReferenceExceptions for just scheduling it

knotty linden
#

Has anyone gotten this error before?

Assets\2. RockStar\Spawner.cs(1,1): error SGICE004: Seeing this error indicates a bug in the dots compiler. We'd appreciate a bug report (About->Report a Bug...). Thnx! <3 System.InvalidOperationException: Sequence contains no elements

I can't get rid of the message. I tried deleting the script that it complained about, then it just complained about another script that was working fine all along.

dense crypt
knotty linden
#

I was writing some gametick logic when it happened, but it was on a separate monobehaviour. I tried commenting out anything related to Time but didn't help.

knotty linden
#

Hmm found the source. Seemed to be something related to a component of IBufferElementData with a [GenerateAuthoringComponent]. If I switched to IComponentData or removed the attribute, the bug would go away.

karmic basin
#

With some restrictions like 1 component per file with this tag and no MB

#

in the file

#

but you can put it close to a related system if you want, that works

#

Was it your case ?

knotty linden
rocky dove
#

The stuff about Baking in the talk by uDamien, thats for later right? We're still supposed to use authoring components? or?

whole gyro
rocky dove
#

I was confused because he showed that way in the beginning during the "refresher" rather than during the "coming in 1.0" part

safe lintel
#

i think its just a terminology change given baking is a more prevalent industry term

gusty comet
#

EntityStaticOptimization seems to remove Translation and Rotation, leaving only LocalToWorld, but does there exist a way to remove LocalToWorld as well for entities that have no notion of position at all? LocalToWorld takes up a huge number of bytes yet is unused for my entities that govern AI behavior

#

A way other than manually removing LocalToWorld during Authoring conversion

nova ferry
#

How does Unity ECS compare to Entitas as of the latest update?

rotund token
worthy rampart
#

Ha u typed faster than me

gusty comet
worthy rampart
#

No there's nothing built in

worn valley
#

Is the authoring better? I don't want Translation or Rotation automatically added to Authored GameObjects

worthy rampart
#

Just make a conversion system called StripTranslation or something

#

And put it on all the GOs you don't want to have the positional components

worn valley
#

That seems like such a pain in the butt for something that should be customizable.

rotund token
#

have you ever been able to remove transform from a gameobject

#

it's nice to simply have this option

worthy rampart
#

Well I'd argue that most things have position

#

So it makes sense to default to keeping it

worn valley
#

LocalToWorld is already on the obejct

worthy rampart
#

This is like 2 clicks to get rid of it after you set up

rotund token
#

if you want localtoworld then just use EntityStaticOptimization

#

it does what you want already

#

remove transform/rotation

#

and just keeps localtoworld

#

if you don't want localtoworld then you need to write your own system to strip it which is what Abbrew was asking for

worn valley
#

Except it wouldn't be a static object, so that may introduce other stuff

#

The transform system supports just using LocalToWorld and LocalToParent. I was having major update issues between setting Translation and Rotation. Which is why I opted to just modify the LocalToWorld

rotund token
#

if you want to manually move the ltw around it will still work

worn valley
#

which as far as I can see is the core thing that tells everything where something is

#

Whereas Translation and Rotation can be modified during a scene but then the end of the frame is when things are updated to LocalToWorld

rotund token
#

StaticOptimizeEntity*

worn valley
#

Plus I don't want to create an Entity, and then immediately have to move all it's data to another archetype just because of Unity's decision of how their transforms will work