#archived-dots

1 messages · Page 42 of 1

rotund token
#

what is the next exception

#

if there isn't one

#

means you're missing a handle

brave field
rotund token
#

are you passing it a dependency?

brave field
#

last time u tell me that ije.Schedule() it will auto gen the dependency and I dun need to care about how it works.

rotund token
#

yes

#

thats what i wanted to check

#

that you hadn't pass it something

#

it's like most common cause of htis

#

passing it a dependency but not handling the return

#

are you doing a getsingleton or something?

brave field
brave field
#

Weird. I dun think I use NativeText. Seems like it's unity stuff?

rotund token
#

does anyone know what causes
error CS0839: Argument missing
when adding a query to an IJobEntity schedule|parallel?

#

it works most of the time then i get these random cases of it not working

viral sonnet
#

that's pretty huge! so the main optimization comes from the query that doesn't even execute a chunk?

rotund token
#

it's just better

rotund token
viral sonnet
#

need to test this then. you have written IJE right?

rotund token
#

yeah i've converted about half my IJC to IJE

#

pretty much all the ones that were only IJC only because of change filtering

#

the rest have other chunk level stuff

viral sonnet
#

gonna look at the codegen then. i'll preserve the IJC for now

rotund token
#

be good if you could profile this to verify results

#

but yea my results

viral sonnet
#

how much are actually filtered for you in these tests?

rotund token
#

IJC change filter -> query.changefilter
0.09-0.11 -> 0.07-0.09 (reliable and benchmarkable)
IJC -> IJE
0.07-0.09 -> 0.06->0.08 (this is too small to say for certain any difference and I don't understand why it would be)

#

^

#

first test here with some info

#

again performance wise it's minor it's just more convenience

#

i've deleted 600 lines of code today

gentle gyro
#

Ok, thanks!

proud jackal
rotund token
#

^ might be interesting as well

brave field
#

@rotund token Btw last time u mention there's easier way to remove those Translation, Rotation, LocalToWorld at Baker using GetEntity() method. How to do that?

rustic rain
rotund token
#

i have a script that does this (and its children optionally)

brave field
rotund token
#

i suggest reading the documentation on TransformUsageFlags

#

but yes pretty much

#
        /// Use this flag to specify that you want to take full manual control over the transform conversion of an
        /// entity. This flag is an override: When it is set, all other flags will be ignored. The transform system will
        /// not add any transform related components to the entity. The entity will not have a parent, and it will not
        /// have any children attached to it.
        /// This is different from None, because None will result in removing any previously added transform components during incremental baking.
        /// </summary>
        ManualOverride = 1 << 5,```
solemn hollow
#

how would i deal with flipping an entity with a hierarchy of spriterenderers in transforms V2 ? Atm im using NonUniformScale.

brave field
#

Does EntityQueryMask.MatchesIgnoreFilter(entity) same with HasComponent(entity) check?

solemn hollow
rotund token
#

so i feel like this heavily plays into the issues that baking is having atm

#

the value in the asset is actually 4 but baking workers reading old data during the bake

#

if i open subscene, it goes to 4

#

if i close subscene and reimport, back to 0

#

has like a cached old version of the scriptable object

solemn hollow
#

im struggling with that too. i am never sure whether the changes i made in baking pipeline actually got applied to all my cached scenes

rotund token
#

what i'm seeing is, in unity editor if you make changes to a scriptable object and don't save the asset file

#

and do an assetdatabase load asset etc you can still read the latest version before the save

#

but the bakers well they don't have access to this cached unsaved version

#

until you save

solemn hollow
#

oh well scriptable objects always act weird

rotund token
#

yeah

#

going to test gameobjects afterwards

#

might be time to replace my SO settings pipeline

solemn hollow
rotund token
rotund token
#

my SO settings have the baking built into them

#

whereas every other baking object in my project exists in a standalone authoring assembly

#

i don't like how the setting SO have the authoring data in my runtime assembly

solemn hollow
#

oh alright. couldnt you just have a singleton Entity that has the scrobject data baked?
i have a subscene which i load for every level where some settings get baked into.

rotund token
#

thats what i do actually

#
    {
        [SerializeField]
        private InputDefault core;

        /// <inheritdoc/>
        public override void Bake(IBaker bake)
        {
            bake.AddComponentObject(this.core);
            bake.AddComponent<InputCommon>();
        }
    }```
solemn hollow
#

okay then we got the same issues

rotund token
#

but the Bake is still on the settings

solemn hollow
#

yes i do the same

rotund token
#

i have a lot of tooling built around this

#

so I'd need to figure this all out

#

hmmmmmmmmmm

#

i've just realized i have no reason for these settings files to exist in the runtime assembly

#

they can just be moved to the authoring assembly

#

🤔

solemn hollow
#

yep since the data is baked already

#

aaaaaah BakingSystem queries ignoring prefabs by default is my nr. 1 bug source.

light mason
#

its rendering !!!

#

@gentle gyro

#

holy hell this was a lot of pain

#

@gentle gyro turns out it was in fact "bad code stripping or some type that should not have made it to the build". AndyWWWW on the forum suggested I try adding a link.xml which resolved my issues.

<!--Preserve entire assembly-->
<assembly fullname="Unity.Entities.Graphics" preserve="all"/>
</linker>
#

Quest 2 is rendering Entities 🙂

solemn hollow
#

@rotund token @rustic rain anyone of you experimented with instantiating gameobjects before any bakers run and have those gameobjects then baked?
If i have a unit prefab with a list of abilities and i need each instance of a unit to have their own instances of prefabs (prototypes) of abilities i currently have to create those prototypes at runtime.
What i would like to do is when baking the unit prefab to spawn each ability prefab as a child to the unit and afterwards bake this hierarchy. so at runtime if i would then instantiate a unit entity the abilities would be instantiated with it and all references id set at baking between unit and ability would be remapped.

rustic rain
#

nah, I didn't.

#

I decided to go another way

#

In SubScene I create prefabs, tons of them

#

hold on (got busy)

#

so basically SubSCene will contain authoring data for procedural generation

#

settings, with prefab entities stores

#

and then in runtime I Instantiate them

#

Generation itself is done by SystemGroup

solemn hollow
#

yep works for your usecase.

rustic rain
#

which runs only once with manual "Update"

rotund token
#

Why do you need to instantiate them as go instead of entities?

solemn hollow
#

because i cannot instantiate entities in baking. doing it with createadditionalentity would be a huge PITA

#

and instantiating the prototypes at runtime is just a lot of code overhead. i need to patch references that could be baked

rustic rain
#

and why do you need to instantiate smth?

solemn hollow
#

sure i could just add those abilities as children inside a unit prefab but that would create a big hierarchy in editor which is completely useless

rustic rain
#

my reason to instantiate was graphics that needs to be converted

rotund token
#

Baking is just the wrong time to do this imo.
Just generate it in editor before baking?

solemn hollow
# rustic rain and why do you need to instantiate smth?

i need an instance of each ability that the user can use that is used to instantiate the actual abilities. because those prototype abilities can be buffed by stats for example. and i dont want to apply each buff everytime i spawn an entity. instead i want to apply buffs to prototypes and then instantiate those

rustic rain
#

if it doesn't involve graphics conversion - just create entities manually

#

why not?

solemn hollow
solemn hollow
rustic rain
solemn hollow
#

by creating them manually you mean by doing CreateAdditionalEntity?

rustic rain
#

yeah

#

why not?

#

assuming you know all components you need on target entities

solemn hollow
#

every Ability has a hierarchy of subabilities that are a pain to setup.

rustic rain
#

what kind of hierarchy?

rotund token
#

Why not save it into the scene?

solemn hollow
#

i just prefer to hide stuff that noone is supposed to touch in the scene

rustic rain
#

I'd just use custom dynamic buffer

rustic rain
#

I just realised

#

that I need a custom way to setup hieararchy inside Hieararchy window

solemn hollow
#

this is how a very simple ability looks like

solemn hollow
#

should be no problem with OnValidate right?

rotund token
#

could use that

#

could use a serialize callback

#

could use a custom editor window

#

Not sure best approach

#

Validate probably easiest

solemn hollow
#

but validate will be annoying if you edit it in prefab. you actually only want it to change if you save changes to the prefab i guess

#

on the other hand its not something that is touched that often.
Still i think this is a usecase where instantiating from prefabEntities inside baking would be the best solution if it was possible

rotund token
#

Just doesn't seem what baking is designed for

solemn hollow
#

hmm but i am actually "baking" a unit. every unit needs prototypeabilities at runtime not at edittime. and i could bake that into the entityprefab of the unit

rotund token
#

Well you're wanting to create authoring data not runtime data?

#

Though out of interest why is this easier?

solemn hollow
rotund token
#

I mean, why is creating the go hierarchy easier than the runtime

solemn hollow
#

at runtime i cannot just spawn a Unit and it is correctly setup with all the prototypes it needs. i need to spawn every prototype and patch references to the unit. everytime i spawn something

if it was baked into the unit prefab id only need to instantiate the unit entity and everything is setup

solemn hollow
#

thinking about it i could also setup a prototypeunit at runtime that has the prototypeabilities spawned already. so instead of spawning a unitprefab + abilityprototypes i could spawn just a unitPrototype. still a pain to setup

light mason
#

anyone seen this before

#

something is invalid, just a guess

gentle gyro
light mason
#

ive never seen anything like this before

#

is the plan to replace SystemBase with ISystemBase entirely ?

rotund token
#

no

#

sometimes you just need to do some managed work

#

but you should aim to replace it as much as possible

#

it makes considerable difference to performance as your systems start to add up

light mason
#

So use the interface as much as possible, why are the majority of the docs in systembase

light mason
#

is sytemBase a lower entry

#

1.0

rotund token
#

probably because it's newer (ISystem that is)

light mason
#

but 100% entitie.foreach is not sticking around?

rotund token
#

99%

#

Been strongly suggested to switch off it but I don't believe I've seen a outright confirmation it will definitely be removed

#

It's reasonably easy to switch from efe to ijobentity at least

solemn hollow
rotund token
#

probably not but who knows

#

You probably wouldn't want it anyway

#

Codegen is not usually that pretty to look at

solemn hollow
rustic rain
#

EFE sucks due to lambda

#

makes IDE funny

rotund token
#

In fact I couldn't even find via notepad++ any reference of my ijobentity gen

#

Not sure how it was even working

solemn hollow
#

interesting. For me it looks like this in search. clutters alot of the useful information.

#

this is EFE though. maybe something is different with IJE codegen?

solemn hollow
gentle gyro
dull shell
#

What's the best ECS solution currently, is it DOTS (Entities)? 2D bullet hell game

rustic rain
#

generally though

#

I don't see any point to use anything but DOTS ECS in Unity

dull shell
rustic rain
#

yeah

#

by custom code I meant a couple constraints to physics

#

that will lock bodies in 2D space

dull shell
#

that's fine, i didn't expect physics to be a part of ECS anyway

#

basically i just need ECS architecture that i can work with

rustic rain
#

well, keep in mind

#

DOTS ECS

#

is unmanaged

solemn hollow
#

does IJE automatically add RequireForUpdate to query that is generated? or do i have to use the version where i specify the query and RequireForUpdate the query i wrote?

rustic rain
#

you need attribute

#

[RequireMatchingQueries]

#

for it to work

#

otherwise it's only registered as Dependency

solemn hollow
#

ah thx. i have to say i dont like that i need to use so many attributes :S

viral sonnet
#

testing aspects, what's this supposed to mean?

#

works with IAspect only. no idea what that's about 😄

rustic rain
#

undocumented changes it is

viral sonnet
#

do you know what the type is for then?

#

aspects are currently the way out of the create/update madness of ComponentTypeHandle.

#

but i rather wait for proper SystemAPI calls 🙂

whole gyro
#

I think they just changed the interface to no longer require the generic type parameter. Forgot to update the docs before release

whole gyro
viral sonnet
#

interestingly IAspect uses GetNativeArray in its codegen. seems like there's no real consensus what to use inside unity 🙂 IJE gets the pointers (which is a bit faster)

viral sonnet
whole gyro
#

yeah so that's the same as ComponentTypeHandle, right?

#

I agree that there should be SystemAPI calls to do the caching for you

viral sonnet
#

yep, it doesn't do anything different really. just codegens the whole thing to save typing

whole gyro
#

Oh you mean if you have 10 component type handles, it does it in one line

#

got it

whole gyro
#

I wonder if they are going to add a SystemAPI.CreateAspectLookup and SystemAPI.CreateAspectTypeHandle calls. Aspects need some love imo

viral sonnet
#

hm, Lookup is already created for Aspects

#

or wdym?

whole gyro
#

Yeah, but you also have to create, cache, and update it

viral sonnet
#

ah, right

whole gyro
#

And the fact that the type is created in codegen makes it awkward to use. I'd rather see an AspectLookup<> and AspectTypeHandle<> generic types instead of the codegen'd ones

#

Maybe its not possible though

rustic bear
#

Hey! New to dots and struggling a bit to build my boids project...
I have primitive cubes in both SampleScene and my SubScene that are visible, however none of my entities are visible. Anyone know what i could've done wrong?

#

Im using the URP template with these player settings:

#

I've also tried building via the BuildConfigurations from the ECS SystemSamples github page, but after reading through this chat it seems that it might be deprecated 😅

rotund token
#

Anyone see the unite stuff?

#

Surprised to wake up and see no mention of it

solemn hollow
#

had no time to watch it live 😦 hope the vods are available and findable soon

rotund token
#

Seems like you can already go watch vod

solemn hollow
#

where? i only see the keynote on youtube

whole gyro
#

I watched the keynote, but the not the sessions yet.

#

Main announcement was 1.0 pre-release in the 2022.2 tech stream

solemn hollow
#

Anyone already tried to build unity navmeshes from entities at runtime?

rotund token
#

31:30 in roadmap for dots stuff

rotund token
rotund token
#

Still can

#

New racing demo and megacity getting an update

#

Not much here in the roadmap

#

And a quick mention of animation

gentle gyro
#

DOTS is on right now...

viral sonnet
#

i can only see the keynote. where can i find the rest? 😄

gentle gyro
#

DOTS has ended but look at the link right above. You have to register but it's free

#

If you register you can still watch it on replay...

viral sonnet
#

guess i found it. bit hard to find

viral sonnet
#

any news. it's so quiet 😅

#

the important part, 1.0 still planned for december

novel moon
whole gyro
# viral sonnet any news. it's so quiet 😅

Well lots of bug fixes and upcoming changes confirmed by unity staff. There is live Q&A session happening on this discord so all the unity staff are there answering questions.

rocky dove
safe lintel
#

am i rthe only one getting this from the vimeo videos?

#

cant view the other talk recordings either 🤷‍♂️

#

ok my ipad plays them so i guess something messed up with my desktop 🥲

brave field
#

🥲 Is that known issue? Any idea how to fix it? Now I can't enter play mode anymore

rustic bear
#

@raw mica My unity bug ticket is IN-21766. Thanks for all the help!

raw mica
rustic bear
#

👍 have a good evening!

#

just as a final sidenote, i tried upgrading to 0b13 and increasing the amount of entities im spawning to 100000, however the build runs silk smooth so i don't think the entities are being simulated. this also gave me these warnings. I believe the last one is due to me using a RewindableAllocator world.UpdateAllocator to create a nativearray of all boids.

rotund token
robust scaffold
#

Just woke up. Is there anything important I missed in Unite? Quick glance at the agenda shows just the generic 'what is dots'

gusty comet
#

For some reason, using ComponentLookup<LocalToWorld> is returning a LocalToWorld that is completely reversed. For example, a cube that is clearly above (0,0,0) and seems to be at (0,5,0) instead shows (0,-5,0)

#

Basically, the renderer shows the cube above ground, but all ComponentLookups are wrong

robust scaffold
#

Also @rotund token neat editor. Now that buffer sizes are 0, all I want now is resizable chunks and, most importantly, editor stability...

robust scaffold
gusty comet
#

The correct value, which is a positive number for the y value

gusty comet
#

The L2W is reversed

robust scaffold
gusty comet
#

I'm calling var currentPosition = TransformLookup[positionEntity].Position;

#

and currentPosition is opposite of the editor and where the cube is displayed

#

Using ComponentLookup but with Translation seems to give the correct value

robust scaffold
gusty comet
#

but I'd rather work with absolute positions

gusty comet
#

I'm certain I'm misusing something somewhere

robust scaffold
gusty comet
#

Right, but I'm already using Position

robust scaffold
#

Yea, so this just makes sure you're getting the raw values.

gusty comet
#

It's really weird, since the Editor and what's rendered seem to be correct, but accessing L2W results in perfectly reversed values

gusty comet
#

Like, where the Scale is stored might be messe dup?

#

Maybe the scale is -1 for some readon

robust scaffold
#

No, L2W translation values are completely independent from scale and rotation

gusty comet
gusty comet
#

Do you see anything that's wierd? Right now L2W gives -4.412

#

for the y value

robust scaffold
#

No, there is a parent though. Is the parent up side down?

gusty comet
#

I traversed through the hierarchy and nothing has any rotation

#

This is in a subscene btw

robust scaffold
#

These values are pulled at the very end of presentation so if those values are what you see in the inspector, they should be what you get in the component lookup. Unless multiple things are touching it during update

gusty comet
#

I should mention that I use GetEntity(authoring, TransformUsageFlags.ManualOverride); several times in the hierarchy, including the parents of this entity, to remove all unused transform data

#

This is the authoring I use

public sealed class Positionless : MonoBehaviour
    {
        
    }

    public sealed class PositionlessBaker : Baker<Positionless>
    {
        public override void Bake(Positionless authoring)
        {
            var validPositionless = GetComponent<PositionlessException>() == null;
            if (validPositionless)
            {
                GetEntity(authoring, TransformUsageFlags.ManualOverride);
            }
        }
    }
#

The entity with the wierd behavior has the PositionlessException, so it keeps its transform

#

but all its parents have their transform data stripped

#

nevermind, that's not the issue

#

sorry for the false lead

robust scaffold
#

No clue. You're gonna have to dive into your code for all instances that touch L2W and see if it's doing any negative multiplication.

gusty comet
#

Okay. That can be dug up easy, because this is the only job that touches TransformAspect

#

            void Execute(
                ref TransformAspect transform,
                in PositionMoveCalculatedSpeedComponent speed,
                in PositionMoveDirectionComponent direction
            )
            {
                transform.TranslateWorld(direction.Direction * speed.Speed * DeltaTime);
            }
#

direction.Direction is confirmed to be correct

#

speed.Speed too

#

perhaps I'm not using the right TransformAspect method?

robust scaffold
#

I recommend using translation component directly rather than any aspects as the specific math to this is a bit murky

gusty comet
#

Sure. So use Translation/Rotation for writing, and L2W for reading?

robust scaffold
#

I just read and write from T/R. L2W is too big to load directly into Jobs.

gusty comet
#

I see. What would you do with parented transforms though?

robust scaffold
#

I don't have any.

gusty comet
#

I do recall there was a component that would cause the transform systems to write from L2W back to Rotation/Translation

#

Okay, writing to Translation fixed the issue, even though elsewhere I'm still reading from L2W

viral sonnet
#

so v-rising does the obvious for colliders. have a seperate BVH that never updates on a server 😄

#

now why it even updates static colliders is another mystery

#

i don't work in AAA so massive worlds are not a concern to me personally but i still wonder how unity actually planned of devs using a fully stateless physics engine when the first dev that uses it in a big project scraps the idea

robust scaffold
#

Now that change filter breaks incredibly easy but there is at least one check

#

I think it triggers on l2w changes.

viral sonnet
#

the bvh gets rebuilt even with no l2w changes

#

yeah i'm aware of the change filter

#

but i think my test case uses static rigid bodies ^^

robust scaffold
#

It early returns if the change filter returns nothing so it is working as intended.

#

The job still runs since the filter is computed asynchronously of course so the execution should be a lot shorter than if it actually regenerates the bvh

viral sonnet
#

it will still run the CreateRigidBodies job

robust scaffold
#

You're gonna have to remind me what that is.

viral sonnet
#

pretty much what it's named ^^

#

and that also runs for entities that just have a shape and are static

#

i haven't found out what's up with that

robust scaffold
#

I don't remember the construction of shape data but if the rigid body is necessary for collisions, there has to be some job that converts shape to collision detection capable data. As they might not have it cached.

#

You still need to convert individual vertices to WS points for proper collisions and that's not cached (stateless nonsense) so it makes sense this runs every frame, if that's what it's doing

#

I don't knowbwhat custom tags are though so eh

viral sonnet
#

my point is just, and was in the past, no job needs to run all the time for static colliders and creates the same data over and over again. stateless nonsense or not. now i know the stunlock team thinks alike 🙂

#

their talk outline was basically, it's great having the source of packages so we can change it

robust scaffold
#

Yea, if you're willing to maintain it manually as well

#

The problem with netcode is that it's fundamentally state synchronized as well, so there's 0 reason for a stateless physics engine. Although with the last q&a, one of th3 netcode guys said that havoc was working with netcode

viral sonnet
#

v rising is still on 0.51 and will probably stay on that version. i mean there's very little reason to upgrade for them. no idea what they use for netcode. i don't think anything from unity

#

would be interesting though why they chose for or against netcode

rotund token
#

probably same deal as us

#

netcode probably wasn't even released or was just an early release when they started/needed it

#

so just rolled their own

#

but yeah little chance they upgrade (we won't either) since they've released

light mason
#

ecs will be production ready with 2022.2 release?

brave field
rotund token
#

i guess it depends on your definition of and/or requirements for production ready

#

studios have already published games with ecs, so to them it's already production ready

solemn hollow
#

the ecosystem around dots is not production ready for sure. and it will take a while until it is even after official 1.0 DOTS release

maiden lichen
#

Shader [Universal Render Pipeline/Lit] does not support skinning Does anyone know how to fix this ?

wanton apex
#

Hello !
I just begin to look at experimental ECS 1.0.0.
I would like to prototype a mesh processing library in ECS to make a procedural modeling system. My first idea is to turn any mesh primitive (vertex, face, edge, etc...) in an entity to be able to take advantage of the query system of ECS. But i'm not sure about the efficience of it because it's going to create a very large amount of entity to represent a single mesh. What do you think about this ? Does somebody already work around this with ECS, or would have some advice to give ?

uncut rover
#

I'm not clear on what your library should do but one entity pre vertices/edge/face, does seem like a bad idea. I would look into native containers and the Graphics.DrawMeshInstanced API.

wanton apex
#

Thanks, that's what I thought.
What I want to achieve is a kind of modeling library able to do some basic mesh operations : Add/Remove vertices/faces, extrusion, bevel... And the library must be able to attach some custom arbitrary datas to mesh elements, a little bit like in Houdini

#

(the library is not supposed to be used for rendering, only for mesh operations)

uncut rover
#

I have not worked wit hte mesh api but I'm sure other people have. I would suggest looking at the DOTS Graphics sub forum and search for key terms to try to find interesting post to get you started.

wanton apex
#

I will to it ! Thanks !

#

I'm don't know if ECS is a good fit for it. It's just a pretext to experiment with dots

uncut rover
#

Entities can be useful to batch the rendering of same mesh/material or perform some culling or LOD. But generally speaking, mesh manipulation you are better using the jobs, native Collection and burst packages. they are also part of DOTS.
For entities, I am making a tutorial series that takes you through the fundamental principles while working toward a tower defence prototype.

wanton apex
#

My first prototype was only based on Job/Burst, I wanted to look if ECS would be interresing. I already made a project with ECS two years ago and really like it, and I wanted to take my hand in the new features of the 1.0 release 🙂

uncut rover
wanton apex
#

Haha, I looked you videos 2 days ago ! Thank you for this great content !

uncut rover
#

Thanks for the compliment. glad you enjoyed !

#

next will be will be on animating using hybrid approach 😉 should land tomorrow I think.

wanton apex
#

Perfect ! This is the content I'm looking for ! I have trouble understanding the hybrid approach at this time !

deft pilot
#

EntityManager.AddComponentData(entity, component);

#

when doing that

#

and component is of type IComponentData

#

how do you use RegisterGenericComponentType?

#

trying to find documentation on it

#
public List<IComponentData> SomePredefinedComponents;

public void Foo()
{
  var component = SomePredefinedComponents.First();
  EntityManager.AddComponentData(entity, component);
}
#

sample code

#

i've tried adding [assembly: RegisterGenericComponentType(typeof(ConcreteType))]

#

but still throws the error

rotund token
deft pilot
#

build

#

giving me a must know type during compile time error

pulsar jay
#

Is there any way to disable physics catch up? It is hard trying to figure out what causes performance issues in the first place if it is overshadowed by the physics trying to catch up

#

It is doing 5 physics steps per frame:

rustic rain
#

Yeah

#

If you remove rate manager

#

From fixed step

#

But beware of funny physics due to low fps

deft pilot
#

oh well

#

i guess i'll just hard cast everything for now

#

deal with figuring out how to generically do that some other day

pulsar jay
deft pilot
#

code is much more ugly thou

rustic rain
#

Just get reference to system

#

And overwrite it's field

pulsar jay
#

Ah thx. Will try that

rustic rain
#

?

rotund token
#

il2cpp generics are very restrictive

rustic rain
#

Mono for life

#

Until we get .net ofc

deft pilot
#

i'll figure out this one another time,

rotund token
#

Which imo is a bit restrictive these days

pulsar jay
#

It seems like ParallelCreateContactsJob is just taking a lot of time:

#

is there any way to debug these contacts?

rotund token
#

Usually just too many colliders close together

#

I swear physics has been getting slower in this worst case every release since 0.17

#

Maybe the large world scaling is improving instead?

#

But it seems to me that lots of close colliders really suffers these days

rustic rain
#

Renamed from core to just . net

#

As symbol of merging everything

pulsar jay
full epoch
#

i tried to spawn spaceships at the float3.zero(using unity.physics) - 10 works, 100 chuckles but eventually works 1000 is never ending story xd, but tbh my comp is weak cpu 4c,4t and older gpu also - but didnt try this using pre-1.0 versions of dots so cannot compare

robust scaffold
devout prairie
#

any idea if collider.Clone() will clone the whole compound collider

#

just to save me loading the vs project and actually checking

#

I think it does, as the compound collider is just one single PhysicsCollider object ( child entities do not have their own PhysicsColliders' )

rustic bear
#

realized none of my entities spawn for the first 10-20 updates or so for some reason

#

@raw mica this fixed my problems from yesterday regarding IN-21766, thanks again for all the help!

snow iron
#

Hi all, just wanted to make sure you saw some of the stuff from yesterday around DOTS:

viral sonnet
#

uhm, was b13 reverted? i only see b10 as latest.

viral sonnet
#

huh, weird. 2023 is also behind. i'm still on hub2

robust scaffold
viral sonnet
#

time to upgrade then 😄 hub3 was annoying me so much with default collab and "waiting for changes..."

robust scaffold
#

I've disabled and locked away as much of that nonsense in Unity as possible. Imagine working with other people *shivers*.

#

Solo dev best dev. Nothing like pressing control-A and backspace with 0 consequences.

viral sonnet
#

Collab was straight up garbage. i'm glad they cancelled it. even a 100mb project took ages to load. and with hub3 it was enabled by default. you could only disable it in some meta file. and hub3 reenabled it also. that was the case for several versions. collab wasn't the only problem. android sdk not working was on my list too, so i stayed at v2 because that worked fine and v3 did nothing better. probably still isn't

brave field
viral sonnet
#

i reported that 2 or 3 years ago. didn't bother to test again though. pretty sure it's fixed now.

misty wedge
#

Anyone getting really annoying baker issues in b13?

#
[Worker0] InvalidCastException: Specified cast is not valid.
Unity.Entities.BakerDataUtility.AddBaker (System.Type type) (at Library/PackageCache/com.unity.entities@1.0.0-exp.8/Unity.Entities.Hybrid/Baking/BakerDataUtility.cs:91)
#

as well as

#
[Worker0] Exception thrown during SubScene import: System.ArgumentException: Schnozzle.Networking.Systems.ClientServerBootstrapSystem+ClientServerBootstrapSystem_6811EE8F_LambdaJob_3_Job must already be filtered by ComponentSystemBase or ISystem
  at Unity.Entities.TypeManager.FilterSystemType (System.Type type, Unity.Entities.TypeManager+LookupFlags lookupFlags) [0x0004c] in com.unity.entities@1.0.0-exp.8\Unity.Entities\Types\TypeManagerSystems.cs:670 
#

I need to restart unity and delete the auto generated folders, then it will work again. Very annoying

rustic rain
#

Constantly

#

Have to restart editor all the time

misty wedge
#

well at least I'm not alone

rustic rain
#

Most annoying when it requires clearing cache and then restart

#

Barely work on project due to that

misty wedge
#

Well lets hope it's fixed soon

#

Are you also on b13?

rustic rain
#

Yeah + exo 12

viral sonnet
#

downgrade to b9 if you value your sanity

rotund token
#

just only write code and don't actually have anything in your game!

stone osprey
#

Do chunks lay in memory next to each other ?
I know that the chunk components lay in memory next to each other... but i wonder if chunks are also close to each other, or since each chunk is a block of allocated memory they are allocated all over the place and basically distributed

viral sonnet
#

if you batch create a lot of entities with same archetype the chunks are allocated next to each other. outside of that, they are randomly in memory

stone osprey
# viral sonnet if you batch create a lot of entities with same archetype the chunks are allocat...

Thats interesting... i actually thought that all chunks of an archetype lie next to each other... since that provides the best iteration speed, all chunks next to each other will cause less cache misses when we move from one chunk to the next one.

However having chunks randomly in memory is better for fast allocs since we dont need to copy all chunks to the new allocated area like a huge array. We can just append a new chunk.

Interesting design choices 😮

viral sonnet
#

if that was the case chunks would work like a list. the bigger it gets the longer it takes to alloc

#

and nobody likes random spikes

stone osprey
#

Yeah right, that would make adding/removing entities a nightmare. However the iteration speed would be slightly better ^^ But i guess thats not worth the cost here

viral sonnet
#

exactly, that's why it's important to get as much chunk capacity out of an archetype

rotund token
light mason
#

@stone osprey Stunlock Studios did a talk at Unite, I think that talked about how they wrote a custom chunk defragmentation system

stone osprey
#

Damn ecs architectures are just so interesting ^^
Chunks actually allocate a block of memory which basically stores the different arrays next to each other. Would it make any difference if the arrays wouldnt be next to each other ? As far as i know modern cpus are capable of loading multiple cache lines, therefore

var cmp1 = new T[];
var cmp2 = new T1[];
for index <= 10k; index++{
   var myCmp1 = cmp1[index];
   var myCmp1 = cmp2[index];
   // Entity logic
}

Should be as fast as having one block of memory and acessing it in the same manner... or am i wrong ? This is more like a lowlevel question, i just realise ^^

idle kernel
#

Is there a way to determine if a native collection has been deallocated? I am getting this error ObjectDisposedException: The Unity.Collections.NativeArray[Unity.Mathematics.int2] has been deallocated, it is not allowed to access it but I really just want test to see if it has been deallocated before trying to access it.

rotund token
#

Is created

#

Though this is a bit of a gotcha if you've copied the container around

viral sonnet
robust scaffold
viral sonnet
#

did you have this problem in b8 or b9 too?

robust scaffold
narrow ivy
#

Roslyn Generate Monobehavior

light mason
#

did the Create->ESC -> Runtime component type menu move?

uncut rover
light mason
#

awesome thank you Wayn

queen dome
#

Can anyone hint me what SystemHandle type idea is?

#

I am trying to use state.EntityManager.GetComponentDataRW<T>() but instead of Entity it wants SystemHandle.

#

That is inside ISystem and I am trying to burst it

rotund token
#

Each system has its own entity now

#

The overloads that take system handle are just for accessing this specific system owned entity

queen dome
#

How do I access a component that I can write to with EntityManager?

rustic rain
#
        [GenerateTestsForBurstCompatibility]
        public static unsafe ref T GetComponentReference<T>(this EntityManager em, in Entity entity)
            where T : struct, IComponentData
        {
            var access = em.GetCheckedEntityDataAccess();
            var typeIndex = TypeManager.GetTypeIndex<T>();

            access->EntityComponentStore->AssertEntityHasComponent(entity, typeIndex);
            access->EntityComponentStore->AssertNotZeroSizedComponent(typeIndex);
            if (!access->IsInExclusiveTransaction)
                access->DependencyManager->CompleteWriteDependency(typeIndex);

            // var ptr = access->EntityComponentStore->GetComponentDataRawRW(entity, typeIndex);
            var ptr = access->EntityComponentStore->GetComponentDataWithTypeRW(entity,
                typeIndex,
                em.GlobalSystemVersion);

            return ref UnsafeUtility.AsRef<T>(ptr);
        }
naive eagle
queen dome
queen dome
rustic rain
#

Put it into static class

#

And use it right from entity manager

naive eagle
queen dome
#

C# ` [BurstCompile]
private static void CheckCollision(ref SystemState state, ref Entity projectileExplosionPrefab, ref Entity collidedEntity)
{
if (state.EntityManager.HasComponent<ProjectileComponent>(collidedEntity))
{
LocalToWorld projT = state.EntityManager.GetComponentData<LocalToWorld>(collidedEntity);

        Entity fxEntity = state.EntityManager.Instantiate(projectileExplosionPrefab);
        var fxT = state.EntityManager.GetComponentDataRW<Translation>(state.SystemHandle);
        fxT.ValueRW.Value = projT.Position;

        SystemAPI.GetComponentRW<Translate>(fxEntity);

        state.EntityManager.DestroyEntity(collidedEntity);
    }
}`
uncut rover
#

state.EntityManager.GetComponentDataRW(state.SystemHandle);

#

you have the state so you should have the handle

queen dome
#

Here is the code I am working on. When a projectile collides I want to spawn a prefab with FX in the position of the collision.

naive eagle
#

var component = SystemAPI.GetComponent<ComponentTypeHere>(entity); component.CoolValue = 10f; SystemAPI.SetComponent(entity, component);

Here's what I was suggesting. Probably not optimal but should work?

queen dome
#

Honestly, I could care less for performance at the moment when I cannot get basic stuff to work 🙂

#

@naive eagle I am getting this: Assets\Scripts\Systems\ProjectileCollisionSystem.cs(49,17): error CS0120: An object reference is required for the non-static field, method, or property 'ProjectileCollisionSystem.__Unity_Transforms_Translation_RO_ComponentLookup'

#
    [BurstCompile]
    private static void CheckCollision(ref SystemState state, ref Entity projectileExplosionPrefab, ref Entity collidedEntity)
    {
        if (state.EntityManager.HasComponent<ProjectileComponent>(collidedEntity))
        {
            LocalToWorld projT = state.EntityManager.GetComponentData<LocalToWorld>(collidedEntity);

            Entity fxEntity = state.EntityManager.Instantiate(projectileExplosionPrefab);
            Translation translation = SystemAPI.GetComponent<Translation>(fxEntity);
            translation.Value = projT.Position;
            SystemAPI.SetComponent<Translation>(fxEntity, translation);

            state.EntityManager.DestroyEntity(collidedEntity);
        }
    }```
naive eagle
#

Get and SetComponent generate code that use ComponentLookup, which doesn't seem to play nicely with your static function. Try making your function non-static?

queen dome
naive eagle
queen dome
#

What does "entity associated with a system." mean? I do not understand this.

#

Systems query for certain entities, they can be in different architypes.

wanton apex
#

Hi,
It looks like a ComponentData could have UnsafeList as field. What is the recommanded pattern to allocate/deallocate this Unsafe Lists ? On a Monobehaviour objects we had the Destroy() method that was perfect for this kind of deallocation, but we don't have such events in ECS. How to avoid memory leaks ? Is there a dedicated SystemGroup that could handle this ?
Thanks !

rustic rain
#

Generally you want to use dynamic buffer for lists

wanton apex
#

I would have use DynamicBuffer, but I want to have a List of ComponentData which is not allowed with DynamicBuffer, UnsafeList seems like the only one solution for it

#

(to be honest, I don't really know what i'm doing)

rustic rain
#

Just use wrapper

#

Ibuffer element with only field - icomp

#

Then you can interpret arrays as component

wanton apex
#

That's sounds good ! Thanks 🙂

rustic rain
#

For code clarity

queen dome
#

I am still getting this exception:InvalidOperationException: Expected simulation type: UnityPhysics, current simulation type is: NoPhysics Unity.Physics.SafetyChecks.ThrowInvalidOperationException (Unity.Collections.FixedString128Bytes message) (at Library/PackageCache/com.unity.physics@1.0.0-exp.12/Unity.Physics/Extensions/SafetyChecks.cs:271)

I have PhysicsStep added to a gameobject inside subscene and I still get this error.

naive eagle
queen dome
rotund token
#

anyone looked into burst compiling the scheduler of a generic job type?

#

for example, IJobNativeParallelHashMapVisitKeyValue<TKey, TValue>

robust scaffold
rotund token
#

unity basically removed all their generic jobs so I have no reference so i've had no luck handling custom jobs and i'm not even sure it's possible

robust scaffold
#

Generic custom jobs should still work. I've done jobs with generic type handles but nothing that reached deep into execute.

rotund token
#

i looked at this a few months ago and looking at it again today

#

the issue is basically the way reflection data is setup for jobs

      internal static void Initialize()
      {
        if (!(IJobExtensions.JobStruct<T>.jobReflectionData.Data == IntPtr.Zero))```
#

is done within a burst discard

robust scaffold
#

This was back in 2020LTS though, there was a big change to the job scheduler that may have changed things

rotund token
#

you couldn't even run job scheduling in burst back then

robust scaffold
#

yea, generics might still have to do a typeof() call which isnt burstable

rotund token
#

they do a typeof call

#
      internal static void Initialize()
      {
        if (!(IJobExtensions.JobStruct<T>.jobReflectionData.Data == IntPtr.Zero))
          return;
        IJobExtensions.JobStruct<T>.jobReflectionData.Data = JobsUtility.CreateJobReflectionData(typeof (T), (object) new IJobExtensions.JobStruct<T>.ExecuteJobFunction(IJobExtensions.JobStruct<T>.Execute));
      }```
#

but it's all done in a burst discard

#

so it's already setup before the burst actually runs

#

i might need to try manually set this up outside of burst which is a bit gross

robust scaffold
#

Seems like it. If you want a custom job scheduled in burst, gotta use burst discard. I think this is for all jobs right? JobStruct is a wrapper around the job itself so even IJobs needs this discard in the scheduling.

#

Is there any difference with how they're doing schedule by ref?

rotund token
#

random call in a constructor to
JobNativeParallelHashMapVisitKeyValue.GetReflectionData<RemapLinks, Entity, UnsafeList<SavableLinks>>();

#

well it stops unity crashing

#

System.InvalidOperationException : The UNKNOWN_OBJECT_TYPE NativeListDisposeJob.Data can not be accessed. Nested native containers are illegal in jobs.

#

doesn't like my nested containers though

#

even though it's not native

robust scaffold
#

I thought the IJobs targeting MultiHashMaps were dead and buried.

rotund token
#

not in my library

#

i have a copy that i've maintained for years

#

super useful

#

but this isn't just related to those, i have other custom jobs

#

i'll probably just rewrite this to be a bit more unsafe

#

and instead just pass in the index to the key/value pair

#

but so much grosser \

#

custom jobs have been so useful for me over the years, bit sad they are somewhat dead to me now 😦

rotund token
#

dead!

#

even my IJobEvent<T>

#

(not that i use my event library much anymore)

robust scaffold
#

Wait, all generics are dead?

rotund token
#

im pretty sure you can't schedule any generic job from burst

#

without pre-initializing the reflection data

robust scaffold
#

well, burst scheduling isnt that much of an issue...

rotund token
#

kind of is

#

since i'm 99% isystem

#

my current library has 0 systembases now

robust scaffold
#

Full burst systems are nice but, from my admittedly very limited experience, I'm job thread limited and, if I crank up quality settings, GPU bottlenecked.

#

And scheduling doesnt seem to have a significant impact on the performance of the system anyways. 0.1ms at most.

#

Not since 2022 at least.

rotund token
#

0.1ms is a lot

#

when you have 500 systems

robust scaffold
rotund token
#

Yeah that's about how many systems we have at work

#

and i think ~1500 jobs

#

loading up a previous message, 501 system 1400 jobs 2 months ago

#

m_DependencyManager->GetDependency
179/frame - Median 1.23ms, Mean 1.24ms, Min 1.02ms, Max 1.41ms

m_DependencyManager->AddDependency
171/frame - Median 0.20ms, Mean 0.24ms, Min 0.17ms, Max 0.48ms

JobHandle.ScheduleBatchedJobs
171/frame - Median 0.62ms, Mean 0.61ms, Min 0.47ms, Max 0.69ms

#

scheduling taking 0.61ms/frame (note the only 179 actions average, it's because we slice our systems over 3 frames)

#

but yeah projects grow big

robust scaffold
rotund token
#

yeah

#

GetDependency is start of system
Add dependency and ScheduleBatchedJobs happens end of system

robust scaffold
#

wow, hrm. That's concerning

rotund token
#

the schedule batch jobs should be improved a lot in 1.0 but we can't test

#

i'd expect that to be halved

#

get dependency should be significantly improved by ISystem

#

which this project only has about 20 of (still 0.51 and most of it was written before it was even available)

#

also this is on a 3900X so a decent CPU

#

point is really just that

#

0.1ms here and there

#

grows after and suddenly is noticeable after 3+ years

robust scaffold
# rotund token grows after and suddenly is noticeable after 3+ years

Hrm, you got me concerned about my own systems. I got 3 ISystems that are unbursted due to requiring actions with classes and other managed components. Basically my render upload systems and input system. Both requiring execution every frame at least, the inputs happening multiple times depending on the physics.

#

Do you have burstable alternatives to these systems? I've been trying to find a burstable GPU buffer upload method but both ComputeBuffer and GraphicsBuffer are classes.

#

Short of using my own C++ DLL to compile in extern calls. Which is probably equivalent to [BurstDiscard].

rotund token
#

A couple of systems is fine

#

I wouldn't go that far with optimisation

light mason
#

I was wondering if someone with more experience could give me some input regarding getting data from a mono behavior in Update and passing it to a system.

#

do I just use EntityManagerin my monobehaviour ?

#

do we have some live link or conversions ?

robust scaffold
light mason
#

so we just update an entity in OnUpdate using World.DefaultGameObjectInjectionWorld.EntityManager with the data we want.

robust scaffold
#

Yes. Assuming you do not have multiple worlds (e.g. using dots netcode)

light mason
#

what if the data is from AudioListener.GetSpectrumData() and constantly streaming in ?

robust scaffold
#

Then set the data every frame

light mason
#

wont this really slow?

#

be*

robust scaffold
#

For a single entity, no. For many, probably. Although if you're using MB driven update, you might be better off not using Entities.

light mason
#

what do you mean not use Entities

robust scaffold
#

You can leverage the Job system without needing entities. Just use a pile of NativeArrays or whatever collections you need.

#

The Entities package. Not use DOTS but instead just parallel processing.

light mason
#

oh, ok.. so I just need read only data from spectrum data for entities, as in the rest of the game is in ECS

robust scaffold
#

Oh, why not do it in a SystemBase then?

light mason
#

Query the spectrum data in systemBase?

robust scaffold
#

Yea. Pull the data from whatever audio stream you have then set the data in your relevant entities all inside a systembase class

light mason
#

sounds like a good plan, ty KornFlaks

brave field
#

Hi @robust scaffold. I believe u are using dots netcode. Do u know how to make auto connect work at 1.0? Previously it's working at 0.51 but I'm not sure how to make it work at 1.0

brave field
#

ArgumentException: System.ArgumentException: Unknown Type:`{0}` All ComponentType must be known at compile time & be successfully registered. For generic components, each concrete type must be registered with [RegisterGenericComponentType]. This Exception was thrown from a function compiled with Burst, which has limited exception support.

#

How to fix this? I just rename some asmdef then get this error

rustic rain
light mason
#

if I have a MyMonoBehaviour used by Baker<MyMonoBehaviour >

#

what happen do data created in Update() Awake etc

#

especially if the baker uses data from a var that is set in let say start()

#

Am I not supposed to use any of the MonoBehaviou event methods to set data that my Baker needs to pass on?

rustic rain
#

Add logs

#

And close some subscene

viral sonnet
#

only thing called by bakers is the Bake method

#

the interesting case is when the [ExecuteInEditMode] attribute is used. no idea what's happening then

#

from some error messages in the past a new instance is made with reflection so the attribute will not do anything, unless statics are used 😄

light mason
#

ok thank you for the information Enzi

#

is the whole dstManager thing gone?

viral sonnet
#

yes

light mason
#

Why is the baker constantly called during runtime?

#

wait look like if you change the editor runs, so audio clips will just wreck it

rustic rain
#

aLSO have a same feeling about OnStart

#

but better check with log messages

viral sonnet
#

just tested, no it's not

light mason
#

is there a way to get data from a gameObject in the main scene into subscene ?

rustic rain
#

so whatever hacks you'll have to use to achieve that - beware

#

it's not worth it

light mason
#

ok, thank for the warning

#

the issue with subscene is it doesnt support a lot of components

#

so you need to keep them out of the subScene and try get the data some other way

#

eg put an audio clip in a subScene, it just loop and loop game running or not

ocean portal
#

Is there a way to access the current entity in the new idiomatic foreach?

rustic rain
#

that's the first time I ever hear about it

light mason
#

mmm

#

maybe i have a bad session here?

rustic rain
#

just tell what happened xD

ocean portal
light mason
#

create a go with audio clip, put in subscene

#

and audio Armageddon

rustic rain
#

Unless it's ECS based framework

#

it won't be converted

#

you need to create your own bakers

#

and own audio framework

#

my suggestion is to use FMOD since it's audio API is Burst compatible

light mason
#

that ok, I just need a ref to it for authoring some other buffers

#

that why im trying to keep it outside the subSecene and grab a ref

rustic rain
#

just save it in managed component then

light mason
#

what do you mean

rustic rain
#

class MyComp : IComponentData

naive eagle
rustic rain
#

it will be serialized

rustic rain
#

FMOD is compatible because it's API is c++ extern functions

#

those can be called inside Burst

naive eagle
#

It's the other big audio engine alongside FMOD

light mason
#

ok let me try it

rustic rain
narrow ivy
#

How do you use DOTS platform build within cloudbuild?

#

Currently on 0.51 version

rotund token
#

hmm last i heard (was 18 months ago)

#

wasn't supported using build configurations which is required for 0.51

#

should be supported in 1.0 though

narrow ivy
viral sonnet
#

@rotund token is your company using cloud build?

robust scaffold
# brave field Hi <@262065945936134144>. I believe u are using dots netcode. Do u know how to m...
private void Ignition()
{
    int port = _port.value;
    if (port is > ushort.MaxValue or < ushort.MinValue)
        return;

    // * Spin up the main scene and kick off sub-scene loading.
    SceneManager.LoadScene("Scenes/SampleScene");

    ClientServerBootstrap.AutoConnectPort = (ushort)port;

    if (ClientServerBootstrap.RequestedPlayType == ClientServerBootstrap.PlayType.Client)
        // * From CSB source code:
        // ? "In the editor, the 'editor window specified' endpoint takes precedence, assuming it's a valid address"
        ClientServerBootstrap.DefaultConnectAddress = NetworkEndpoint.Parse(_address.value, 0);

    // * Clients and server auto-connect using the properties set in ClientServerBootstrap.
    // ? Neat, isn't it?
    switch (ClientServerBootstrap.RequestedPlayType)
    {
        case ClientServerBootstrap.PlayType.ClientAndServer:
            ClientServerBootstrap.CreateServerWorld("ServerWorld");
            ClientServerBootstrap.CreateClientWorld("ClientWorld");
            break;
        case ClientServerBootstrap.PlayType.Client:
            ClientServerBootstrap.CreateClientWorld("ClientWorld");
            break;
        case ClientServerBootstrap.PlayType.Server:
            ClientServerBootstrap.CreateServerWorld("ServerWorld");
            break;
    }
}```
robust scaffold
#

Does anyone know of a use-case for system entities? I thought about using it for output data of a system but the inability to pass them into a job seems to be a no-go.

rustic rain
#

Their handle

#

I'm thinking of similar approach

#

Create some kind of burst compatible type manager

#

Which will register any type by jndex

#

And then you can create type specific entities to access it

#

For now I have this for NativeReference

#

Really pog feature

full epoch
#

Getting that "Loading Entity Scene failed because the entity header file couldn't be resolved" whenever i make some asset change even when just add a new script - clearing cache sometimes helps but usually not - need to restart Unity or open subscene or else game wont play - pretty annoying bug which was first reported back in 2020 or 2019 but not fixed till now

rustic rain
#

Nah, it's different bug

#

It was good in 50 version

robust scaffold
rustic rain
#

And now 1.0 is just a nightmare

full epoch
#

yeah still annoying

robust scaffold
#

But right now, the baker is broken. And the issue is already known and being fixed by the time 1.0 pre comes out

rustic rain
#

I don't even know whether it's a good thing I can't code 😅

robust scaffold
#

If you really dont like it, downgrading to 0.5X and going back to the GOCS baking workflow is your only option.

robust scaffold
rustic rain
#

I meant that I literally can't

#

I'm away from home and the only laptop I have is back from 2010

#

Not even compatible with Rider kek

robust scaffold
rustic rain
#

Jeez

#

It's not even compatible with codegen

robust scaffold
#

imagine the intellicomplete

#

you got control-F, that's all you need

#

but more seriously, use VSCode. Im pretty sure that is the bare minimum and works on a fermented potato.

rustic rain
#

No codegen though

#

And still

robust scaffold
#

You wont get any code completion or linting but it's mildly useful

rustic rain
#

My laptop is way below min specs of U ity

#

Unity

#

Kek

#

Forced rest for me

robust scaffold
#

I dont even have unity open most of the time I code now. Not having it open means the baker bug and other corruption doesnt occur

rustic rain
#

It restarts quickly for me

#

So that's what I do

#

I have no assets basically aside from code

robust scaffold
rustic rain
#

I got used

frosty siren
#

I'm getting such an error
The system NSprites.SpriteRenderingSystem writes NSprites.PropertyPointer via SyncPropertyByQueryJob`1 but that type was not assigned to the Dependency property. To ensure correct behavior of other systems, the job or a dependency must be assigned to the Dependency property before returning from the OnUpdate method.

SyncPropertyByQueryJob looks like

[BurstCompile]
internal struct SyncPropertyByQueryJob<TProperty> : IJobChunk
    where TProperty : unmanaged
{
    // this should be filled every frame with GetDynamicComponentTypeHandle
    [ReadOnly] public DynamicComponentTypeHandle componentTypeHandle;
    public int typeSize;
    [WriteOnly][NativeDisableParallelForRestriction] public NativeArray<TProperty> outputArray;

    public void Execute(ArchetypeChunk chunk, [NoAlias] int chunkIndex, [NoAlias] int firstEntityIndex)
    {
        var data = chunk.GetDynamicComponentDataArrayReinterpret<TProperty>(componentTypeHandle, typeSize);
        NativeArray<TProperty>.Copy(data, 0, outputArray, firstEntityIndex, data.Length);
    }
}

The job is really simple, it just takes DynamicComponentTypeHandle through GetDynamicComponentTypeHandle(compType) and just copy data to output native array. There is no problem with ranges or something like this. Also I set Dependency property right, so no handle lost in nowhere 🙂 I can't figure out why error says that this job WRITES to component, because it actually writes nothing, it is even has [ReadOnly] attribute on DynamicComponentTypeHandle componentTypeHandle field. If i add [NativeDisableContainerSafetyRestriction] then just console is clear, no errors. Also this error appears only if i schedule more then one of such a job.
Also i see no way to get actually readonly DynamicComponentTypeHandle through GetDynamicComponentTypeHandle(compType), there is no overload with readonly option, so maybe system think i'm writing something.

So what can be wrong?

rustic rain
#

I think that's it

robust scaffold
#

Cant you just do a ComponentTypeHandle<TProperty>?

frosty siren
rustic rain
#

Then it seems like it's write access

frosty siren
frosty siren
# rustic rain Then it seems like it's write access

whooooooooah, i've found error. That's a story!
What I do is caching ComponentType from Type gathered with reflection, so I have little boilerplate code with type registration. And there is really no overload of getting DynamicTypeHandle with readonly argument, because passed ComponentType already have this argument by itself. It works the same way with SystemBase.GetComponentTypeHandle<T>(bool isReadOnly), it just creates ComponentType depending on bool argument AddReaderWriter(isReadOnly ? ComponentType.ReadOnly<T>() : ComponentType.ReadWrite<T>());
I didn't know about that, and I was registering my component types like new ComponentType(type, ComponentType.AccessMode.ReadOnly), but after little refactoring (which was not noticed by me) registering became just type which is regular Type, so implicit cast was happening and it seems it goes with ReadWrite access, so all my dynamic handles was created with ReadWrite access

umbral veldt
#

I'm trying to create a DOTS/ECS project, but on Unity 2021 LTS, after importing com.unity.rendering.hybrid, I get errors saying tha there is no definition for <something> in JobsUtils. I've also tried Unity 2022.1, but it straight up gives an error upon creating the project (something about Shadergraph). For both attempts I've used the 3D (URP) template. What am I doing wrong?

umbral veldt
rotund token
#

Out of interest, on a new project why would you start on an old version instead of starting with 1.0?

jolly palm
#

0.51 is more stable

umbral veldt
#

Well, on Unity 2021 LTS, that seems to be the latest supported version. And, as I mentioned, on Unity 2022.1 (which I suppose supports Entities 1.0), the 3D (URP) template gives me errors straight away. And I do want to use URP.

robust scaffold
#

I'm using urp right now, with custom shaders of course, but it works

jolly palm
#

Speaking of 1.0, has anyone found a good way of referencing gameobjects in systems without Singletons?

rotund token
#

2022.1 is not supported

jolly palm
#

I want to spawn a healthbar UI with my entities, but UI has to be managed, and doesnt work in ECS land

whole gyro
jolly palm
rotund token
#

You need a class icomponentdata

jolly palm
#

using a class also throws an error

umbral veldt
jolly palm
#

wait

whole gyro
#

Use AddComponentObject

rotund token
#

There are overloads for it

whole gyro
jolly palm
#

Using "AddComponent" doesnt work with classes it seems

robust scaffold
#

In the baker there's no overload of AddComponent<> with a Managed ICD sadly.

safe lintel
#

@jolly palm as an alternative you can make it a pure ecs entity and get around that by making the healthbar a quad and making a shader to adjust the uv space "fill"

jolly palm
#

Well actually by using Render textures with ui toolkit

#

but both seem like overkill. Or rather that a more susinct solution would exist

rotund token
#

oh in baker yeah no overload

#

i think it's coming next version

#

just EM has the overloads atm

whole gyro
#

When are we supposed to use AddComponentObject then?

#

for adding UnityEngine.Components and the like?

safe lintel
#

well its more involved doingthe shader setup but its way way faster and can plop them everywhere

rotund token
#

AddComponentObject existed before class ICD did! and yeah exactly what you say

#

you can attach anything

#

addcomponetnobject(int[])

#

addcmoponentobject(material)

#

etc

#

most common case is, AddComponentObject(Transform) and there is special handling for this

#

with transform access etc

jolly palm
#

Sigh. I just wish it was a bit faster to setup things in ECS. Once you get things going it is certainly faster, but the initial setup is a slog

rotund token
#

IMO that's just experience

#

I find ecs very fast to setup things these days

#

i wont say it's flawless and some things do need work

#

but it's really not that bad

#

(and obviously a bunch of features missing which is the biggest issue)

#

(animations please!)

jolly palm
#

it really isn't that bad
But its still quite involved to setup compared to traditional gameobjects

rotund token
#

see i don't believe so

jolly palm
#

ANIMATIONS PLEASE

rotund token
#

i can game jam a project faster in ecs than i can in gameobjects now

#

i've been using it approaching 5 years

#

and i think it takes longer to learn than gameobjects

#

which has been a hurdle for our studio

jolly palm
#

ECS is certainly complex.
But it is so much more effective!

#

It solves what I would consider to be the largest problem im modern videogame development.

It makes it easy for objects to be interactive

#

And videogames are all about interactivity

#

Uhhh.... Different question.
When using "AddComponentObject", it looks like the system can no longer access it with "GetComponent" or "GetSingleton"

rotund token
#

need to use EM to get component objects

whole gyro
#

Use GetSingletonEntity + EntityManager.GetComponent I think

rotund token
#

if it's an ICD you can use EM.ComponentData, otherwise if you attached some arbitrary data you need to use GetComponentObject

jolly palm
#

Ok. I understand why it works like that, but that is way too involved just to get a GameObject reference into a system.
I can see why all the tutorials just use singletons...

robust scaffold
jolly palm
#

wait does that work for systems?

whole gyro
#

No reason why it wouldn't

jolly palm
#

Still not a great solution because you are using magic strings

whole gyro
#

right

jolly palm
#

Ideally you use a Config Entity class or something with a ScriptableObject

jolly palm
#

So there is a "URPMaterialPropertyBaseColor" struct for modifying colors of entities. But can this be used to modify materials directly? Or are materials still part of managed space

#

What I really am asking is can I use a job to modify material properties

viral sonnet
#

i think there's a urp color demo but i'm afraid that won't work in burst jobs

#

i've read something about it though. maybe scan the forum for that property

winter depot
#

If I have RequireForUpdate() on a query with enableable components that when calculated == 0, and the job itself does not run, is the system still supposed to run? If so is there a cleaner solution than early out on update because I was kind of thinking that was the point of enablable components

rotund token
#

Filters aren't factored in for require for update

winter depot
#

Unfortunate. So early out still I guess

rotund token
#

It would require a sync point to complete previous jobs that were changing the enabled bits

#

To know if they were enabled or not

#

You can't know if the components are enabled on main thread until all jobs that could change them have finished running

#

So this is not really something you want to do

winter depot
#

Learning that most of this is not something I want to do 😦

rotund token
#

They will be filleted (efficiently) when the job is running

#

They do whole chunk filtering if nothing is enabled, then per entity filtering

winter depot
#

I guess I misunderstood, I thought they didn't require sync point, and I thought ISystem was not on main thread, only SystemBase was. So I thought that we had some magic where a system wouldn't run if a query didn't have enabled bits. I guess only prevents the job itself, which I am not getting to that point because I am early out anyway. Probably just flawed logic again on my part on how I wrote systems

rotund token
#

Isystem is on main thread, it's just burst compiled

#

That's the only real difference

#

(except obvious struct / class limitations)

late mural
#

hey, does 0.51.1 not work with unity 2022.1.21f1?

late mural
rotund token
#

Nothing works in 2022.1

#

0.51 for 2021.3

late mural
#

fascinating, thanks for the info!

rotund token
#

1.0 for 2022.2

jolly palm
robust scaffold
#

Oh wow, I just brainstormed a valid reason to use ISCD. Reusable read-write buffers for repeated large scale diffusion simulation.

#

Problem is that chunk utilization is gonna be garbage, 24 entities at most per chunk. But weighed against a reusable 16MB array per thread, hrm.

#

God, dynamic sized chunks cant come soon enough. Maybe in 2 years at this rate

dense storm
#

gameObject.hideFlags = HideFlags.HideAndDontSave
Gives this error when Entities Hierarchy is on editor

rotund token
#

seems like a virtual (ecb) entity o_O

dense storm
#

Just noticed the index went crazy lol

crisp ember
#

hi there does the ''Warning: failed to fetch saved variables from player prefs'' and '' Error building player: 2 errors'' related? Im kinda new to unity and I cant really understand what those forum and discussions are talking about when I search for help online

viral sonnet
rotund token
#

but he'd probably want unmanaged iscd

viral sonnet
#

true, yeah such a pain we can't turn off the 128 limit :/

robust scaffold
robust scaffold
viral sonnet
#

we could invest some time into hacking out the limit. i'm pretty sure it's not a big deal if you don't use enabled comps

viral sonnet
#

well seems to be easy enough. there's TypeManager.MaximumChunkCapacity and the rest is in EntityComponentStore.cs line 2494 with a maxCapacity = math.min(maxCapacity, cType.MaximumChunkCapacity);

#

hacking this out should get rid of the cap

devout prairie
#

Annoying, 2020.3 felt pretty much rock solid for 0.5+, moved over to 2021.3 to get access to some newer stuff and it's just so much buggier.

#

Feel a bit like a rabbit caught in headlights, do i finally take the leap to 2022.2 and 1.0, invest the time into transitioning everything over, or is that going to be just as buggy or more

balmy thistle
#

The interaction between the pre-release releases and beta editors has been a little rocky, although it's mostly been various manifestations of the same thing.

The good news is that the further along Entities packages get to full release, the better integrated the testing gets, so I expect the situation to improve as we go on.

robust scaffold
muted star
#

Hi everyone, how can I bake to a specific world in 1.0?
This is how I did it in 0.51

public class ConvertToEntityInPhysicsSimulationWorld : ConvertToEntity // ConvertToEntity is deprecated
    {
        void Awake()
        {
            var worlds = World.All;

            World physicsSimulationWorld = null;
            foreach (var world in worlds)
            {
                if (world.Name == WorldNames.PhysicsSimulation)
                {
                    physicsSimulationWorld = world;
                    break;
                }
            }

            var system = physicsSimulationWorld.GetOrCreateSystem<ConvertToEntitySystem>();
            system.AddToBeConverted(physicsSimulationWorld, this); // No longer possible
        }
    }
viral sonnet
#

might want to look at netcode and how they did it.

muted star
#

okay, I'll have a look 👍

jolly palm
#

I'm having an unreasonable amount of trouble getting custom shader properties to work with multiple objects.

[MaterialProperty("_Fill")]
public struct HealthShaderFill : IComponentData
{
    public float Value;
    public Entity AttachedHealthEntity;
}

This code works at changing the material property, but only 1. I have multiple instances of a material and other instances don't appear to work. (the Value is forced to 0)
The shader declaration is set to Hybrid per instance

#

The Value does show correctly in the Entity inspector, but the material does not reflect the proper value

#

Has anyone else dealt with using IComponent Material property overrides?

#

Found the issue.
Components with Material Property overrides cannot have other fields in them. The documentation doesn't mention this clearly, and it didn't give me an error so I thought it was ok.

Interestingly, if you also use the MaterialOverride monobehaviour, then you DO get an error that extra fields are not allowed.

muted star
#

How is the BakingSystem created? It has [DisableAutoCreation]

rustic rain
muted star
rustic rain
#

There are default ones

#

Built in unity systems

#

It's not Singleton

muted star
#

Perhaps this works by baking from within a subscene which is configured to load to a specific world. I'll have to look more into this.

robust scaffold
muted star
#

I have a new problem, I can't access the entity from a idiomatic foreach

public partial struct CleanUpStrobeLightsSystem : ISystem
    {
        private EntityCommandBuffer ecb;

        public void OnCreate(ref SystemState state)
        {
            ecb = SystemAPI
                .GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>()
                .CreateCommandBuffer(state.WorldUnmanaged);
        }

        public void OnUpdate(ref SystemState state)
        {
            foreach (var strobeLight in SystemAPI.Query<StrobeLightSSCD>().WithNone<IsSelectedTag>().WithEntityAccess())
            {
                ecb.DestroyEntity(strobeLight.Item1.strobeLightEntity);
                ecb.RemoveComponent<StrobeLightSSCD>(strobeLight.Item2);
            }
        }
Assets\Scripts\ECS\Default\Systems\Interaction\CleanUpSelectionLightsSystem.cs(25,70): error CS1061: 'QueryEnumerableWithEntity<StrobeLightSSCD>' does not contain a definition for 'Item2' and no accessible extension method 'Item2' accepting a first argument of type 'QueryEnumerableWithEntity<StrobeLightSSCD>' could be found (are you missing a using directive or an assembly reference?)```
clever cobalt
#

try

            foreach (var (strobeLight, entity) in SystemAPI.Query<StrobeLightSSCD>().WithNone<IsSelectedTag>().WithEntityAccess())
            {
                ecb.DestroyEntity(strobeLight.strobeLightEntity);
                ecb.RemoveComponent<StrobeLightSSCD>(entity);
            }
muted star
clever cobalt
#

Hi, I'm having issues with catching physics events. I am constantly getting a weird error. I've tried many things and didn't fix the error / never got a response.

namespace Systems.Bullets
{ 
    [BurstCompile]
    [UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
    [UpdateAfter(typeof(PhysicsSimulationGroup))]
    public partial struct CollisionJobs : ISystem
    {
        [BurstCompile]
        public void OnCreate(ref SystemState state)
        {
            state.RequireForUpdate<BulletData>();
        }


        [BurstCompile] public void OnDestroy(ref SystemState state){}

         
        [BurstCompile]
        public void OnUpdate(ref SystemState state)
        {
            //  Setting up
            
            Simulation simulation = SystemAPI.GetSingleton<SimulationSingleton>().AsSimulation();
            EntityCommandBuffer ecb = new (Allocator.Temp);
                
            //  Determining the type of event to handle
                
            foreach (CollisionEvent collision in simulation.CollisionEvents) {
                Entity a = collision.EntityA, b = collision.EntityB;

                if (SystemAPI.HasComponent<BulletData>(a)) {
                    BulletPhysicsAspect aspect = SystemAPI.GetAspectRW<BulletPhysicsAspect>(a);

                    if (SystemAPI.HasComponent<BulletData>(b))
                        HandleBulleted(ref ecb, collision, aspect, SystemAPI.GetAspectRW<BulletPhysicsAspect>(b));
                    else
                        HandleGroundHit(ref ecb, collision, a, b);
                }
                
                else if (SystemAPI.HasComponent<BulletData>(b)) {
                    HandleGroundHit(ref ecb, collision, b, a);
                }
            }

            //  Playing back
            
            ecb.Playback(state.EntityManager);
        }


        [BurstCompile]
        public void HandleGroundHit(ref EntityCommandBuffer ecb, CollisionEvent cEvent, Entity a, Entity b)
        {
            ecb.DestroyEntity(a);
            
            //  TODO handle bounce
        }


        [BurstCompile]
        public void HandleBulleted(ref EntityCommandBuffer ecb, CollisionEvent cEvent, BulletPhysicsAspect a, BulletPhysicsAspect b)
        {
            float damageA = a.properties.damage;
            float damageB = b.properties.damage;

            float dif = damageA - damageB;
            
            if (dif <= 0) ecb.DestroyEntity(a.entity);
            if (dif >= 0) ecb.DestroyEntity(b.entity);
        }
    }
}
#

errors

viral sonnet
#

you are processing the foreach on mainthread while the physics simulation isn't done yet

#

best to put it all in a job and schedule it

clever cobalt
#

any reccomendations on how to do this?

rotund token
#

Your Handle methods is what I'm talking about

clever cobalt
#

I guess, but thats not quite the issue

rotund token
#

It's not I didn't even read your error log yet

devout prairie
viral sonnet
#

what you can do if you are bored is at least transitioning to bakers. pretty mindless task but worth it to do sooner than later. bunch of if defs so you can stay in the same codebase

devout prairie
clever cobalt
# viral sonnet best to put it all in a job and schedule it

I got it to work, but without jobs, when I tried adding it in a job (IJob, ICollisionEventsJob) I got a lot of errors, even when depending on simulation.FinalJobHandle. Eventually I did this:

Simulation simulation = SystemAPI.GetSingleton<SimulationSingleton>().AsSimulation();
simulation.FinalJobHandle.Complete();
```and fixed the issue.

If you can educate me on how to do this in a job I would greatly appreciate it! I think the main problem was that I used SystemAPI in the job without a reference of SystemState. But I can't get a reference of SystemState in the job so I'm clueless on how to check for components / get them in jobs like this
rotund token
#

Can you show your example of doing it with a job?

clever cobalt
#

But then it gets executed in a job

rotund token
#

were you passing simulation.FinalJobHandle to the job?

clever cobalt
#

When I scheduled the job I put it as the depend on parameter

rotund token
#

were you combining it with your local dependency?

#

if you were doing it this way you probably need to do something like
state.Dependency = JobHandle.CombineDependency(state.Dependency, simulation.FinalJobHandle)

#

and then pass that ot the job

#

but the easiest way is just to implement ICollisionEventsJob

#
private struct CollisionEventsJob : ICollisionEventsJob
{
    [ReadOnly] public PhysicsWorld World;

    public unsafe void Execute(CollisionEvent collisionEvent)
    {
    
    }
}```
clever cobalt
rotund token
#
{
    World = SystemAPI.GetSingleton<PhysicsWorldSingleton>().PhysicsWorld
}.Schedule(SystemAPI.GetSingleton<SimulationSingleton>(), state.Dependency);```
#

so yeah, there's a specific job for this

clever cobalt
#

My main issue was that I got a bunch of errors because I used SystemAPI in the job

rotund token
#

yeah you can't do that

#

systemapi can only be done inside a system

#

not in jobs, not in monobehaviours, etc

clever cobalt
#

And I don’t know how else I can check if the entity has a specific component

rotund token
#

you pass in a ComponentFromEntity<T>

clever cobalt
#

thanks for the help, il look into it tomorrow

rotund token
#

Sorry, renamed to ComponentLookup now

#

same thing though

clever cobalt
#

No problem

#

Oh 1 more thing

clever cobalt
rotund token
#

oh its just copied from some existing code

#

that required it to be unsafe

#

so no

clever cobalt
#

Alright, thanks for your time

misty wedge
#

Is there a way to enable the component on an entity while scheduling it parallel without disabling safety?

rotund token
#

what job

misty wedge
#

IJobEntity

rotund token
#

if you're using lookup though you'll always need to disable safety

misty wedge
#

:[

rotund token
#

no operation on that is safe in parallel

#

what if 2 separate threads wrote to same entity

#
{
    var delegates = ReflectionUtility.GetAllAssemblyWithReference(this.GetType().Assembly)
        .SelectMany(t => t.GetTypes())
        .Where(t => t.IsClass && t.IsAbstract && t.IsSealed) // Find all static classes
        .Where(t => t.GetCustomAttribute<BurstCompileAttribute>() != null)
        .SelectMany(t => t.GetMethods(BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))
        .Where(t => t.GetCustomAttribute<BurstCompileAttribute>() != null)
        .Select(m => (MethodInfo: m, Attribute: m.GetCustomAttribute<MigrateAttribute>()))
        .Where(m => m.Attribute != null && m.Attribute.From != 0)
        .Select(m => (Key: m.Attribute.From, Migrator: (MigrateDelegate)Delegate.CreateDelegate(typeof(MigrateDelegate), m.MethodInfo, false)))
        .Where(m => m.Migrator != null);

    foreach (var (stableHashKey, migrator) in delegates)
    {
        this.migrators.Add(stableHashKey, BurstCompiler.CompileFunctionPointer(migrator));
    }
}```
#

look at this monster

#

I've rewritten most of my save library to be unmanaged which means my old migrators just don't work

#

So I have to dynamically grab function pointers for them all now instead

#

Before

public class TestMigrator : ComponentDataMigrate<TestMigrator.Before, TestMigrator.After>
{
    public override ulong From => 1392796844747678277;
    public override ulong To => 17841778420484547873;

    protected override void Migrate(ref After newComponent, in Before oldComponent)
    {
        newComponent.Value = oldComponent.value;
        newComponent.NewValue = 5;
    }
}```
After
```[BurstCompile]
[MonoPInvokeCallback(typeof(MigrateDelegate))]
[Migrate(1392796844747678277)]
public static bool TestMigrate3(ref SystemState systemState, ref Deserializer deserializer)
{
    var migrator = new ComponentDataMigrate<Before, After>(ref systemState, ref deserializer, 17841778420484547873);
    while (migrator.MoveNext())
    {
        var (from, to) = migrator.Current;
        for (var i = 0; i < from.Length; i++)
        {
            to[i] = new After { Value = from[i].Value, NewValue = 5 };
        }
    }
    return true;
}```
#

it didn't turn out as bad as expected

misty wedge
#

looks pretty sleek

#

but yeah i've also had some issues migrating stuff to ISystem

#

still haven't solved my il2cpp marshaling issue

#

just gonna ignore it for now jamcat

gusty comet
#

Are there any Baker<T> methods for having an Entity destroy itself during baking? Something other than BakingOnlyEntity, since I want to be able to insert some logic to decide if the Entity should destroy itself

#

Otherwise, would the only other option be to have a BakingSystem do that?

#

Oh, and adding BakingOnlyEntity (the component, not the authoring) to an Entity with children, but not to the children, would cause these warnings to appear. Something about missing Parent component GUIDs

rotund token
#

i have a feeling destroying the entity owned by authoring causes issues

gusty comet
#

I see, so it's better to do it in a BakingSystem?

#

Another question is: how can I access the Entity from SystemAPI.Query<T>()? It only every returns the components

rotund token
gusty comet
gusty comet
rotund token
#

Don't 😅

#

Generate new ones instead I guess?

#

(You'll have to test this though, I've never had or considered a case where I wanted to delete an authoring entity so I haven't personally tested. Just heard it doesn't work and causes issues)

gusty comet
#

I'm not sure how to do that. I'd like to delete entities because my Authoring hierarchy, in order to be easily configurable, has a lot of disabled GameObjects or empty "folder" GameObjects.

#

I have a "Soldier" with every possible type of Authoring in its pre-conversion hierarchy, even for stuff it doesn't need, like Spear, Sword, Bow, Helmet A, Helmet B, etc. In order to easily configure new Soldiers, I just enable and disable the stuff it needs and doesn't need. However, this doesn't work well with the new baking system, since disabled GameObjects are still converted

#

Also, I'd hate to have a bunch of dangling "folder" GameObjects/Entities

gusty comet
rotund token
#

just discussion in here

#

and maybe forums

#

i'd suggest just trying it

gusty comet
#

Right, I tried it before and having a custom DestroyImmediately authoring/baker/system didn't cause any issues as long as I was using a custom DestroyImmediatelyComponent. However, if I use the pre-existing BakingOnlyEntity component, and let its related systems do the work, I get these weird warnings related to missing GUIDs in Parent

viral sonnet
# gusty comet What's your recommended way of deleting an Entity during baking?
public struct Delete_BakingEntity : IComponentData { }

[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
public partial struct RemoveDefaultComponentsBakerSystem : ISystem
{
    public void OnCreate(ref SystemState state)
    {
    }

    public void OnDestroy(ref SystemState state)
    {
    }

    public void OnUpdate(ref SystemState state)
    {
        var ecb = new EntityCommandBuffer(Allocator.Temp);        
        
        foreach (var (_, entity) in SystemAPI.Query<Delete_BakingEntity>().WithEntityAccess())
        {
            ecb.DestroyEntity(entity);
        }
        
        ecb.Playback(state.EntityManager);
    }
}``` simplest form
gusty comet
#

I'll reimplement DestroyImmediately to take care of those folder GameObjects, but for easily disabling and enabling GameObjects in a transparent way, that I haven't solved yet. By transparent I mean in a way that's easy to see and minimize mistakes

gusty comet
rotund token
viral sonnet
#

i haven't continued reading 😄

rotund token
#

maybe one of the filters just happens to filter it out while LEG is being setup

viral sonnet
#

there should be a good case for it to delete authoring entities. anything with LEG or because of laziness isn't it ^^

#

i use it to destroy an entity that serves as a converter to blob data. haven't found any other way

viral sonnet
#

disabled GOs get a Disabled comp so it shouldn't even be necessary to delete them

gusty comet
rustic rain
trail valve
#
[BurstCompile]
        public void OnUpdate(ref SystemState state)
        {
            var dependsOn                 = new JobHandle();
            var scalableFloatMagnitudeJob = new CalculateScalableFloatMagnitudeJob().ScheduleParallel(dependsOn);
            var attributeBasedMagnitudeJob = new CalculateAttributeBasedMagnitudeJob()
            {
                CasterLookup         = state.GetComponentLookup<CasterComponent>(true),
                AffectedTargetLookup = state.GetComponentLookup<AffectedTargetComponent>(true)
            }.ScheduleParallel(dependsOn);
            var calculateMagnitudeJob = JobHandle.CombineDependencies(scalableFloatMagnitudeJob, attributeBasedMagnitudeJob);
            
            var applyStatModifierJob = new ApplyStatModifierJob();
            state.Dependency = applyStatModifierJob.ScheduleParallel(calculateMagnitudeJob);
        }
        

How can I do this in the correct way? Because .ScheduleParallel must have a JobHandle param

rotund token
#

}.ScheduleParallel(dependsOn);

#

change that to state.Dependency

#

you've just completely overridden the systems dependency handle

muted star
#

Currently I'm thinking the most straight-forward way to have multiple worlds with the new baking and subscene workflow is to

  • Not use UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP
  • Create and destroy additional worlds depending on which scene is loaded
  • Add [DisableAutoCreation] to all systems, except the ones I want in the default world
  • Have systems in the default world which move entities with certain tags from the default world to other worlds where they are needed

Is that a good way to go about this?

rustic rain
#

Sounds awful

muted star
#

suggestions? ^^

rustic rain
#

Create all worlds manually

#

Or use custom world bootstrap

#

To create all additional worlds in it

muted star
#

How can I set up the editor world manually?

rustic rain
#

Why do you need manual editor world?

muted star
#

Isnt the editor world responsible for doing the subscene / baking stuff?

rustic rain
#

Idk, but I don't see any reason to touch it

muted star
#

I tried not touching it while keeping my custom default world initialization logic and it doesn't work

rustic rain
#

What doesn't work?

muted star
#

GameObjects within subscenes aren't converted to entities

rustic rain
#

What compiler attribute did you use?

muted star
#

I used UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP_RUNTIME_WORLD only

rustic rain
#

Isn't there attribute to disable automatic world creation?

#

Not systems

#

Besides

#

You don't even need this

#

Just do your custom world creation using intetface

#

Custom Bootstrap

muted star
rustic rain
#

Yeah, instead I recommend not to use it

#

Any of those

#

And just override bootstrap

muted star
umbral veldt
#

In my project I have a system which instantiates an Entity prefab through a ECB. The instanced enteties appear both in the entities hierarchy and in the game view, but not in the scene view. What could be the cause for this?

muted star
muted star
umbral veldt
muted star
# rustic rain And just override bootstrap

I'm now using ICustomBootstrap for the default world but conversion of GameObjects to Entities is still now working. Something missing from my code perhaps?

public class CustomBootstrap : ICustomBootstrap
    {
        public bool Initialize(string defaultWorldName)
        {
            Debug.Log("Bootstrapping Default World");
            var world = new World(defaultWorldName); 
            World.DefaultGameObjectInjectionWorld = world;
            var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
 
            DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(world, systems);
            ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop(world);

            return true;
        }
rustic rain
#

Seems good

#

Appending needs compiler if though

#

Feels like you're doing smth wrong with baking

void girder
#

After upgrading to 1.0 I'm getting this error constantly running in the editor:
Leaked BatchRendererGroup: Native object doesn't have a handle in the scripting domain. Potentially indicates a problem with domain load/unload.

#

2022.2.b13 and I'm using Vulkan

rustic rain