#archived-dots

1 messages ยท Page 55 of 1

rustic rain
#

not really a map, but it indeed resolves offsets for component types

#

it's stored somewhere in archetype afaik

stone osprey
#

So the archetype has some sort of dictionary<Entity,EntityInfo> to map the entity directly to its chunk and its index inside the chunk for acessing it ? ^^ Is there some way to get that info ?

rustic rain
#

it has data about how components are mapped in chunk

#

as in, what are offsets for each component type

stone osprey
#

Hmmm... but how does the world actually now in which archetype and in which chunk and which index my entity is located in ?

rustic rain
#

it works sort of like dictionary

#

dictionary<int,Chunk>

#

where int is entity index

stone osprey
#

Ah i see... so i assume its like a jagged array ? For instant acess ? ^^
Actually pretty smart, so component acess based on a entity id is O(1) i assume

#

Just one lookup to find the chunk/index and another to get the component itself

rustic rain
#

kind of, yeah

#

you can look at source of GetComponentData from entity manager to see it for yourself

#

it is in fact pretty simple and clever

pine sundial
#

does GhostComponent/GhostField work with shared components?

misty wedge
#

What pre-release? I was gone for a few days

rustic rain
#

it is indeed feels more stable

#

but baking errors are still here

#

unresolved subscene header

#

erroring editor

#

and etc

rotund token
#

UntypedDynamicBuffer - the things i need to write

rustic rain
#

so, it's just byte[] buffer?

#

damn, I got another fun idea for source generators

#

if there is an ISystem declared

rotund token
#

basically i just wanted dynamic buffer functionality from DynamicComponentTypeHandle and UnsafeUntypedBufferAccessor

#

so i just wrapped it

rustic rain
#

and it doesn't have implemented OnDestroy/OnCreate/OnUpdate/OnStartRunning/OnStopRunning, implement empty methods in other partial declaration

rotund token
#

just wait for default interface implementations

#

next entities release

rustic rain
#

?

rotund token
#

this is already done for you

rustic rain
#

oh

rotund token
#

you won't need to have implementations of OnDestroy/OnCreate

#

as a little birdy told us they finally setup default interface implementations on the ISystem interface

rustic rain
#

so how would it work?

rotund token
#

public struct MySystem : ISystem {}

#

is valid code

rustic rain
#

same as I mentioned or interface won't implement those?

rotund token
#

default interface implementations is just a c# feature

rustic rain
#

wait what

#

damn

rotund token
#

public interface ISystem
{
void OnCreate(ref SystemState state) {};
}

#

you can just define your implementation on the interface

rustic rain
#

I'v been using mostly unity, so I didn't even know it's a thing

#

๐Ÿ˜…

finite osprey
#

cann someone help when i try to dowload oculus integration this happens

strange wagon
#

if(HasComponent<Health>(damage.Target))
return true even if damage.Target was destroy (QueryMask give the same result)
what another option I have to check if entity exist without EntityManager?

solemn hollow
strange wagon
#

in command buffer

#

I have separate system for Destroying. In editor it looks like entityInvalid

solemn hollow
#

so SystemA is writing Destroy command to ecb
SystemB is checking HasComponent<Health> (entityToBeDestroyed)
EntityCommandSystem runs and destroys entityToBeDestroyed

#

SystemB is correctly telling you that Health is still there. the entity is not yet destroyed

#

You cant rely on what the Editor is showing you here. it shows the state at the end (or beginning im not sure) of each frame

strange wagon
#

I know how it process in 1.0 version, but I have 0.5.
In 1.0 i'm going to have disable DestroyTag on each entity, and enable it in this system. So, I can add WithNone<DestroyTag> in query.
But for now I wan't add this tag in run time cause sync point

#

So I got your idea thank you @solemn hollow

rotund token
#
object:wrapper_native_000001B790D8A8C0 (intptr,intptr)
Unity.Entities.SystemBaseRegistry:ForwardToManaged (intptr,Unity.Entities.SystemState*,void*) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:363)
Unity.Entities.SystemBaseRegistry:CallForwardingFunction (Unity.Entities.SystemState*,int) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:311)
Unity.Entities.SystemBaseRegistry:CallOnDestroy (Unity.Entities.SystemState*) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:381)
Unity.Entities.World:DestroyAllSystemsAndLogException () (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/World.cs:1011)
Unity.Entities.World:Dispose () (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/World.cs:306)
Unity.Entities.World:DisposeAllWorlds () (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/World.cs:332)
Unity.Entities.DefaultWorldInitialization:DomainUnloadOrPlayModeChangeShutdown () (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/DefaultWorldInitialization.cs:101)```
#

why is, OnCreate in a system being called on a domain reload destroying the world
it called OnDestroy but invoked OnCreate - it's like all my burst function pointers are getting muddled on domain reload

drowsy pagoda
#

How do I achieve this desired behavior by using the PhsyicsVelocity component? On main frame, via EM, duration single frame only.

#

This is what I got with PhysicsVelocity, I suck at math. Is there a utility I can use or can someone point me in the right direction?

#

Here is my code as-is

private void PlacementProtocol()
{
    var player = App.Player;

    if (!player.HasSomethingInHand || !player.IsLookingAtSomething)
    {
        player.SetControlMode(PlayerControlMode.Default);
        _ghost.Destroy();
        return;
    }

    var item = player.Inventory.ItemOnHand;
    
    // METHOD: Transform
    // EntityManager.RemoveParent(item, _ghost.Transform);
    // EntityManager.AddComponent<PhysicsVelocity>(item);
    
    // METHOD: Physics
    var itemTransform = GetComponent<LocalToWorld>(item);
    EntityManager.RemoveParent(item, itemTransform);
    
    var linearVelocity = _ghost.Position - itemTransform.Position;
    EntityManager.AddComponentData(item, new PhysicsVelocity { Linear = linearVelocity});

    player.Inventory.DropItem();
    player.SetControlMode(PlayerControlMode.Default);
    _ghost.Destroy();
}
solemn hollow
#

im so glad i dont run into those errors. i wouldnt even realize whats happening ๐Ÿ˜„

rotund token
#

i'm going to downgrade to 1.8.1 i swear all this started happening on .2 update

frosty siren
#

see no errors, but main thread system code is blue, and actually non of my system is bursted. In burst inspector there is no system struct at all, only nested job structs

strange wagon
#

@solemn hollow I've fixed my problem. My DamageSystem that create destroy request used BeginSimulationEntityCommandBufferSystem
and my Destroy system was use EndSimulationEntityCommandBufferSystem.
If I use BeginSimulationEntityCommandBufferSystem in Destroy System - everything is ok

rotund token
#

and break pointing inside burst

#

archaic

solemn hollow
viral sonnet
rotund token
solemn hollow
#

ill wait till you deem it safe ๐Ÿ˜„

rotund token
#

also no one else is seeing this jank

#

i just have a cursed project

solemn hollow
rotund token
#

your OnUpdate doesn't have [BurstCompile]

frosty siren
#

Wow, I thought it only requires whole struct marked as [BurstCompile]. Ok, thank you!

rotund token
#

that would require OnCreate etc to be burst compiled

#

which is not always desired

woven hinge
#

hi, guys, i have an odd issue think i tried run this code https://pastebin.com/4V6jX9T2 i did a bit of fixing but have an odd issue on line 173 on this code a.k.a "ecb.Instantiate" when i try to Instantiate i do see in it list but it not render at all have idea as why this happened as u see in the image

rotund token
#

jobs are special with their burst requirement

frosty siren
rotund token
rotund token
# frosty siren why?

because i might be doing reflection or reading managed data to setup the system

#

but yeah elliotc did a really in depth writeup about the burst compile tag

#

and the magic with jobs etc

frosty siren
solemn hollow
#

Preferences -> Entities

woven hinge
#

ok

#

checking

#

where i do see it here?

solemn hollow
#

hmm what version are you on?

rotund token
#

i haven't even entered play mode

#

so how is it disposing a system that has never been created

#

i already verified it's not in my editor world

woven hinge
#

god thanks

#

found it

solemn hollow
woven hinge
#

4 hours on this darn

#

i am on mac that is why

solemn hollow
#

i am too

#

honestly ive seen that issue now atleast with 10 different people. That setting should be at Runtime Setting by default IMO

rotund token
#

mine was defaulted on runtime

#

i'm curious if it is defaulted to authoring or if it's just reading from 0.51

solemn hollow
#

maybe its a mac thing then? but that would be weird

rotund token
#

i need to create an empty project to just check default state

#

because yeah, should be runtime

solemn hollow
rotund token
#

that seems wrong? hmm

#

i use authoring view anyway ๐Ÿค”

solemn hollow
#

well people are used to see whats happening ingame in sceneview too

rotund token
#

i have a feeling this is also related to open subscenes

#

so i don't really notice it

solemn hollow
#

ill test it

rotund token
#

because I think this value on affects the view with open subscenes?

woven hinge
#

tell the true i do feel lack of documentation about dots and such hard understand how do stuff

solemn hollow
#

but i remember having some issues when i updated. hmm

rotund token
#

i designed my architecture around never having open subscenes

solemn hollow
rotund token
#

what i've realized is

#

you can not have open world subscene amounts in the root

#

i think large subscenes should just be worked on as a scene

#

just open the scene normally

solemn hollow
#

i dont get your point yet sry

rotund token
#

ok it takes like 8min or something to bake megacity

solemn hollow
#

you mean you should be able to directly work in subscenes?

rotund token
#

if you make a code change that invalidates your subscene, and the open subscenes were in your working scene

#

you would be sitting there for 8 min before you can enter game again

#

every time you made a change

#

so i think separation of coding and world is the way to go

solemn hollow
#

yes i have a subscene thats bigger than needed.. pain in the ass

rotund token
#

so what i have is a prefab with required subscenes - settings, server/client/presentation etc

#

and then have 2 scenes setup

#

1 with just the prefab + a development subscene

#

1 with the prefab + 43298507523094753902487578902345 world subscenes

hushed lichen
#

Sounds like more subscenes than Megacity ๐Ÿ˜›

rotund token
#

megacity is not large

#

size wise

#

anyway continuing on, making changes and live baking megacity is also a huge pain

#

so you don't edit the world in a subscene

#

you just open the scene up and make edits, the level designers and artists they don't care about live baking

lusty night
rotund token
#

the manual

solemn hollow
#
Unity Learn

If youโ€™re working on a game (or other real-time simulation) that requires the most efficient CPU usage possible, then Unityโ€™s Data Oriented Technology Stack (DOTS) is a great way to get the performance you need. However, to use DOTS successfully, you canโ€™t simply grab the API documentation and dive straight in. Before you begin creating a projec...

rotund token
#

i don't think that's a good first start

#

i guess it does link a lot of good resources though

lusty night
#

ya both of these looks like an excellent place to start diving in

solemn hollow
#

depends on if you need to learn DOD too or not

lusty night
#

i am mostly interested in understanding the unity way of doing this ๐Ÿ™‚

rustic rain
#

that would give you velocity that is meant to move object to target position in one physics step

rotund token
solemn hollow
#

i havent used streaming yet. i guess its game specific how large you want the subscenes

rotund token
#

if it's large / open world

#

otherwise you're just going to load everything into memory

#

megacity does this well with per subscene hlod

#

and streaming

solemn hollow
#

never looked into it cause i wanted full random generation with wave function collapse. but thats on hold right now anyways

rotund token
#

aww i liked reading about that a year? ago when it was being discussed

#

was really interesting

solemn hollow
#

was early this summer

rotund token
#

well that'd be 2 weeks ago for me ๐Ÿ˜„

solemn hollow
#

yeah time is weird these days

#

i had a running version of WFC but the issue was it was way too slow and "undirected".
our tile density is too high to generate fast enough

#

we would just need to double / tripple the tilesize and its fine

rotund token
#

well just write it faster !

#

anyone done an inventory system in entities yet? i remember seeing discussions about this a while ago on the forums

#

i've been thinking about it a lot

solemn hollow
#

i was wondering about that. havent seen any inventory systems. i have no usecase for it yet either ^^

rotund token
#

here are my thoughts

#

Assumptions

  1. Items in world are entities
  2. Must handle all types of games
  3. You have slots where items go, certain items can stack

Options for slots

  1. Slots are entities, referenced from a dynamic buffer
  2. Slots are dynamic buffer with general meta data

Options for items in slots

  1. Items in slots are the same entities that would exist in the world)
  2. Items in slots are custom slot entities
  3. Items in slots are just data stored in the slot
#

the question i'm basically trying to figure out is, when an item is in a slot, what should be an entity?

#

at work we go the full entity approach, slots themselves are entities, items when stored in inventory are just the same entity

#

but it's been a huge pain but that might be more implementation than design

solemn hollow
#

id add the requirement for itemweights

rotund token
#

It gets tricky when you have stacking items, and large stacks of them

#

One of the flaws of our inventory at work are stacks of items become a single entity so you can no longer track individual item state

#

Durability is averaged or lost etc

solemn hollow
#

have you considered shared components for this?

rotund token
#

No

solemn hollow
#

like a slotID and UnitID as shared component maybe

rotund token
#

Few more thoughts first though. The biggest question I have been going back and forward about are
Item slots - should they be entities?

solemn hollow
#

so you sort slots into chunks. nvm single items would take a whole chunk...

rotund token
#

Item slot as inventory
Pro

  • Versatile you can attach data and do cool things

Cons

  • Slower; lookups required to access
  • Tiny archetype so 128 limit kind of sucks
  • Generally have no logic so does it make sense to be an entity
  • State harder to maintain
#

Then there is the whole, backpacks

#

How does that play into slots?

solemn hollow
rotund token
solemn hollow
#

yep. just got confused by the first line ^^

rotund token
#

i'm leaning against doing slots as inventories

#

but I am worried I am pigeonholing myself

#

how do i handle something having 2 separate inventories?!

#

do I just write this as a layer on top of a single buffer

#

this is basically been my thought process, layer the logic

Keep a very basic inventory operations on a single buffer
Add, Remove, Swap

#

Layer application specific logic on top of it
Inventory layout
Multiple inventories
Advanced inventory operations, transfer, slot restrictions, etc

solemn hollow
#

i wouldnt worry about any performance here at all. main considerations should be ease of use

rotund token
#

performance consideration for me here is simply avoiding 20,000,000 slot entities

#

inventory operation performance is not really a consideration

#

The 1 consideration is inventory operations usually need to run single threaded

#

So it can bottleneck if game went crazy but I'll deal with that when I get to it

#

So the other half of this is,
Items in inventory slots, should they still be the underlying item/entity

#

Or should they be replaced by a simple representation

#

My current thought process is, both
Keep the existing item entity around to help maintain state, disable it and no longer replicate to clients
And create a simple inventory representation to replicate

#

Issues -> updating representation with state from item if it changes
Easiest way would be to add a slot reference to the item - should this always exist though? I don't like structural changes.

drowsy pagoda
#

So I'd be looking for a utility or formula that would crunch all that out for me? lol

solemn hollow
drowsy pagoda
solemn hollow
#

i would also say to keep the item entity itself in the inventory

rotund token
#

and it's a nightmare to maintain

rustic rain
#

how your drop item looks?

solemn hollow
drowsy pagoda
#

Yes I'm sure. This EntityManager.RemoveParent(item, itemTransform); takes care of that.

public static void RemoveParent(this EntityManager entityManager, Entity entity, float3 newPosition, quaternion newRotation)
{
    RemoveParent(entityManager, entity);
    entityManager.SetComponentData(entity, new Translation { Value = newPosition });
    entityManager.SetComponentData(entity, new Rotation { Value = newRotation });
}
solemn hollow
#

oh and also why does item logic have to be single threaded?

rotund token
#

Inventory

rustic rain
drowsy pagoda
#

good thinking. I'll try

rustic rain
#

also

#

you might want to use sepsrate comp that will be picked up in fixed step loop

#

because doing chdnges to physics inside update often causes unwanted behaviour

#

or use command buffer

drowsy pagoda
#

yeah, then if that's the case, then in the very same frame I have to set the transform directly because of unparenting, which resets it's position to float3.zero.

#

ooff, I can't believe I haven't considered that as my first option. ๐Ÿคฆ

rustic rain
#

i hate using parenting for things like that

drowsy pagoda
rustic rain
#

I do that if I need temporary parenting without affecting scsle

woven hinge
#

guys have odd question when i dots do i make every object in dot or it kinda mix some all covert to dots and some will use normal MonoBehaviour?

drowsy pagoda
rustic rain
#

i mean literal msnual transform modification

#

exactly the way you need

drowsy pagoda
#

oh, my apologies, now I see why this would seem like a dumb problem. I forgot to mention that sometimes items have jointed (fixed) objects to it. And if I set the position of the root object, the other ones will start "pulling" it back to compensate for the very drastic joint constraint violation. And it start to do the ecstasy tweark. Even if I scan the item for jointed entities and set their positions, it's the same result. But if I move the root item via physics velocity, doesn't violate the joint constraints and no buggies.

rustic rain
#

then do snapping with physics

#

just no parenting ๐Ÿ˜…

drowsy pagoda
#

Hence my original question lol

#

Ok, I figured something out. if I multiply desiredVelocity * math.rcp(deltaTime), the object will snap right away, but it's the momentum afterwards that causes it to shoot forward, so looks like I'll have to throw on a tag and have a system reset velocity to zero and discard.

solemn hollow
#

how often is that loop happening?

#

branch prediction of that loop will fail alot. maybe try branchless code

mystic mountain
#

No idea what markers are, but if similar to profiler markers. They would not necessarily hit the end for every begin since you jump to loop with continue which might be the issue?

true mirage
true mirage
#

I need to check some conditions and if they are satisfies, add nodes to a list,..

mystic mountain
#

Might want to do

{
_markers[3].End();
continue;
}
solemn hollow
true mirage
#

Are Nullable types OK?

#

Branches are devil in Burst?

solemn hollow
#

unpredictable branching is bad in general. branch misprediction causes pipeline stall and flush IIRC

solemn hollow
true mirage
#

Thanks.

#

I do not know the meaning of markers perfectly

#

.

#

35 ms for each part?!

solemn hollow
#

as jaws said you probably use the markers wrong

#

but i havent used them either so not sure

true mirage
#

Yes, you are right

#

Appreciated

#

@mystic mountain

#

my wrong

#

and about nullable types, are they OK to use them in Burst?

#
  _markers[6].Begin();
  var neighborIsInCloseList = closeList.Contains(neighborPoint);
  _markers[6].End();
 _markers[8].Begin();
 var neighborIndex = openList.IndexOf(new Node(neighborPoint, 0, 0, 0));
_markers[8].End();

As I had predicted, Contains and IndexOf is the most expensive operation. O(N)

late mural
#

is there anyway to get access to a systembase from a monobehaviour? (planning on running some methods in the systembase from the monobehaviour)

true mirage
#

The bottleneck ๐Ÿ™‚

#

Is it valuable to store int instead of int3 in struct (Node) because it can cache more data?

#

but indices should be calculated int -> int3

public struct Node{
   public int3 Index;
   //...
}
public struct Node{
   public int FlattenIndex;
   //...
}
viral sonnet
#

use hashmaps, contains and indexOf are linear searches

true mirage
#

Yes

#

openList is priority queue

#

I have to define a new collection hashmap (check) + priority queue (find min)

viral sonnet
#

hm, why do you need a queue for that? are other results important?

true mirage
#

I should find the node with min cost

viral sonnet
#

isn't that just a neighbour check + heuristic?

#

doesn't make much sense to write to a queue and then evaluate the min cost.

#

i'm pretty sure some burst optimized a* are floating around for reference

true mirage
#

You mean priority queue? heap

#

Find min is O(1) why it does not make sense?
Add/Remove O(Log)

#

๐Ÿ˜
Add native hashset for close list

viral sonnet
#

ok, wasn't aware of the priority queue optimization. the way you described it threw me off, so it just optimizes the Contains lookup which sounds reasonable. the same could be done with a NativeList and a HashSet to lookup the F cost. that's not ordered but no astar version i've around does that. not sure why some have it then?

late mural
#

when using SystemAPI.GetComponent<LocalTransform>(WhateverEntity) does it give a reference to the entity's local transform or does it pass it in value only?

viral sonnet
#

that call will acquire it by value

late mural
viral sonnet
#

yes, var lookup = SystemAPI.GetComponentLookup and then lookup.GetRef

late mural
#

thanks a ton!

#

this is probably a stupid question, but how do i see what is actually happening in the game view, in the scene view? That probably doesn't make much sense, so basically in my game view i can see my entity, i can press wasd to move it around, but in the scene view the entity is still at 0 0 0...

viral sonnet
#

does scene view maybe show authoring instead of runtime?

late mural
late mural
rotund token
#

under preferences, entities, there's a drop down

#

to select whether to see runtime or authoring

late mural
#

yup worked, thanks so much!

late mural
#

not really certain which would be faster or easier to work with, so either i'll have entities with a chunk component which will then have a list of entities that belong to the chunk, or instead on every entity have a component saying which chunk they belong to, which do yall think would be faster or easier to work with?

safe lintel
#

anyone having the editor not respond on script changes with dots? feels like im constantly task killing the editor(current latest version)

#

its not a 100% of the time thing though, like a few changes here and there and before you know it editor stops responding

balmy thistle
#

I'd definitely be interested to hear more about that

safe lintel
#

dont know how to trigger it reliably unfortunately

rotund token
#

break point @safe lintel when it's stuck and force a break
is it stuck in
AssetDatabasExperimental.ProduceArtifact()

#

you would make 3 of us then!

#

GravitonPunch and I both get stuck in here on compile sometimes and unity just hangs

#

the more i test this, the more i'm thinking it's somewhat related to file locking with
burst, rider, unity and maybe a virus scanner
i'm sure anyone who uses rider and recent burst has seen the rider error due to burst locking files
[pure speculation of course]

#

but i have not been able to produce a solid repo

late mural
#

trying to convert a Dictionary<int2, Whatever> on a GameObject to be on an IComponentData. According to google i would use a NativeHashMap for this, but unfortunately dots hates nested container types so it is refusing, any workarounds?
edit: nevermind im an idiot, whoops

safe lintel
#

er set a breakpoint and enter debug mode in rider while unity has stalled?

late mural
#

wondering is there a unity math version of FloorToInt? I've looked around but cant seem to find one so far...

solid rock
late mural
solid rock
#

if your numbers are always positive, just casting is sufficient

late mural
trail valve
#

Hi guys, sorry for dummy question, but I don't know to fix this bug. Can you guys help me?
When I try to add movement direction and rotate a entity to the target direction like the attached image, I got this error

InvalidOperationException: The writeable ComponentTypeHandle<Unity.Transforms.LocalTransform> MoveInTargetDirectionJob.JobData.__Unity_Transforms_TransformAspectTypeHandle.m_LocalTransformCth is the same ComponentLookup<Unity.Transforms.LocalTransform> as MoveInTargetDirectionJob.JobData.MovementDirectionLookup, two containers may not be the same (aliasing).
rotund token
#

if unity locks up you can still attach a debugger

#

then you can just go to run -> debugging actions -> break all

#

and see where it's stuck

rotund token
#

and the aspect is allowed to write

#

so in theory you could write to the aspect which could modify data you are reading in the ComponentLookup

#

if you promise unity you won't do this, you can disable the safety to get around it

trail valve
#

oh, thank you, I got the problem. So in this case, what are the best practices to do that?

viral sonnet
#

Can I use some kind of element for PropertyInspector that renders a whole struct? (similar to DynamicBuffer element)

rotund token
#

as far as i'm aware, no

#

unless it's changed in 1.0

viral sonnet
#

KornFlaks had an interesting approach to visualizing blob data.

#

i'm losing my sanity if i have to write out every field for the blob data ๐Ÿ˜„

#

i hope this will be added. not seeing blob data is a total pain

rotund token
#

why can't you write a PropertyInspector for the blob?

#

(like I did for the physics collider)

viral sonnet
#

i'm only aware of writing them field by field. var text = new TextField("MainEffect -> StatChange pointer"); var index = new IntegerField("Index") { value = Target.index }; var statType = new EnumField("StatType", Target.reference->statType); var changeType = new EnumField("changeType", Target.reference->changeType); var value = new FloatField("Value") { value = Target.reference->value };

#

and i don't want to write, i dunno, 200 of these

#

under the hood there has to be some form of visual element that is able to render generic structs

rotund token
#

as a quick hack you could just give it [Serializable] and draw it via a PropertyField using unity serialization

rustic rain
rustic rain
rotund token
#

What packages?

#

My core package is definitely up to date

#

I just haven't got around to pushing anything to openupm

#

If that's what you mean

#

(honestly forgot I had core on openupm)

rustic rain
#

oh

#

i also tried downloading from gitlab

rotund token
#

Pain because I have to mirror to github

rotund token
rustic rain
#

yeah, i think that was one

rotund token
#

It will be merged to master soon as a 1.0

rustic rain
#

i kept getting error about namaspace unity.platforms

rotund token
#

But 0.9 definitely should work I update as recent as this morning

#

That doesn't sound like 0.9

#

That sounds like master

rustic rain
#

which appar

rotund token
#

Which is still on 0.51

rustic rain
#

hm

#

i guess i should check again

rotund token
#

Brb 45min let me know if you sort it out

true mirage
rustic rain
#

SceneManager.onSceneLoaded is not working in 2022.2 it seems

brave field
#

@rotund token Is there any burst compile compatible 2D Array like NativeArray that able to put into struct Component? Currently not really have time to flatten array and test this code changes.

rustic rain
#

but managing it will be as time consuming as flattening I believe

late mural
covert lagoon
#

How do you wrap long idiomatic foreaches at a certain column limit?

#

How do you split them into multiple lines?

#

Without it being too ugly.

rotund token
#

i think my longest is 3 elements

#

and even that was long

misty wedge
rotund token
#

i have strict ide enforced styling so whatever that did for me is how i layed it out ๐Ÿ˜„

#

i think that'd be my longest

#

and i guess that's how i format it, thanks ide

covert lagoon
#

Hm.

devout prairie
#

i'm getting these errors setting up a dots 1.0 project:

#

I'm sure i read something about this but can't find it

solemn hollow
#

why do you update to the exp package version? preview version is the latest one

#

1.0.0-pre.15

#

and you should use "ENABLE_TRANSFORM_V1" scripting define symbol while you have not yet implemented Transforms V2

devout prairie
#

yeah HybridRender has installed it, because i've obviously just hit update to latest it's jumped to exp version:

solemn hollow
#

ah its probably installed by Hybridrenderer. you should remove hybridrenderer and add entities graphics

devout prairie
#

i was upgrading a project from 2021 to 2022 so i think that's where the confusion has come from

devout prairie
#

is this valid inside a foreach with the new LocalTransform component:

#

or should i be using WithPosition/WithRotation or some combination of the helpers

#

none of the links in the Physics upgrade guide work which annoyingly means you have to search around for this information

rustic rain
#

new transforms are very simple and self explanatory components

#

unlike old matrices

#

helpers are just to help it be easier

devout prairie
#

yeah the new transforms look good i like it

#

helpers for forward etc, less painful i think and maybe more analogous to unity Transform

#

i'm down to 54 errors isn't that wonderful

#

and a lot of them are related to conversion ๐Ÿ˜ญ

void girder
#

We shouldn't be writing to WorldTransform right

devout prairie
#

right

#

LocalTransform

rustic rain
#

so nothing is read from it

#

and any changes are useless

#

everything but LocalTransform and LocalToWorld are like that

void girder
#

Feels weird iterating over LocalTransform or LTW instead of Translation because it's like a AOS and not a SOA, but I assume Unity does something to allow for it to be cache friendly and SIMD

rustic rain
#

not really

#

it's for reducing component size on chunks

#

32 bytes per matrix basically vs 64

void girder
#

Oh

rustic rain
#

they mentioned it explicitly in manual

#

also reduce amount of components

#

which indeed feels

#

rn I only need LocalTransform in most places

#

isntead of Rotation + Translation + LocalToWorld

pulsar jay
#

Does anybody has even the slightest hint how to get Prefab baking to work with Addressables Content Management?

pulsar jay
#

Upgrade my project from Addressable + Runtime Conveersion with Entities 0.51 to Entities 1.0

rustic rain
pulsar jay
rustic rain
#

so, what is it you don't get? Anything specifically?

pulsar jay
#

There are no docs on content management with prefabs (only subscenes)

rustic rain
#

because entities are only managed through subscenes

pulsar jay
#

Should be possible with content management. Just thought anybody might have tried it already

#

Guess I will try to figure it out

rustic rain
#

what content management are you talking about?

#

addressables?

pulsar jay
#

It was referred to as Entities Addressables but now it seems to be a dumped down version which is called content management

rustic rain
#

aah

#

this

dense crypt
#

Is it not possible to wrap over a IJobParallelForDefer? I have a job struct wrapper with 2 internal jobs: GatherJob : IJob and SortJob : IJobParallelForDefer
Whenever I try to instantiate and schedule my SortJob I get errors about Reflection Data not being set up, even if the job struct is completely empty (no fields, nothing in execute). If I wrap over 2 IJob while scheduling GatherJob : IJob and CoolJob : IJob it works just fine.

raw mica
dense crypt
# raw mica Sounds like a potential bug to me. Are you referring to the collections package ...

Not sure what you mean by the collections package? But I suppose so yes.
Basically I have this struct:

struct MyJobWrapper<T>
{
    struct GatherJob : IJob { }
    struct CoolJob : IJob { }
    struct SortJob : IJobParallelForDefer { }
    JobHandle Schedule(JobHandle) { }
}

If I schedule SortJob in the Schedule method I get the error about reflection data not being intialized. But if I do any combination of GatherJob and CoolJob everything works as expected.
I've based my code on the examples inside NativeSort.cs

#

I should also note that this is on ECS 0.51.1-preview.21 as we've still not upgraded.

raw mica
#

Not sure what you mean by the collections package? But I suppose so yes.
Do you have a reference to Unity.Collections for your assembly's .asmdef? I ask because we setup JobReflectionData eager creation using an ILPostProcessor and that ILPostProcessor comes from the collections package. This is necessary to avoid making lazy reflection calls during .Schedule which would prevent job schedule calls from being used in Burst compiled methods.

dense crypt
#

Yep there's a ref to Unity.Collections in my asmdef

raw mica
#

Which engine version are you using, if you're on 0.51? IJobParallelDefer support for eager job reflection data creation was added later since that job type comes from the engine rather than from the old com.unity.jobs package (which was merged into com.unity.collections)

dense crypt
#

2021.3.8f1

raw mica
#

I believe that is the issue. I'll double check but I'm pretty sure IJobParallelForDefer schedule from bursted code was added in 2022.2

dense crypt
#

Would this be bursted though? I'm instantiating the wrapper and calling (my) Schedule method in OnUpdate on a SystemBase system. Unless you mean some internal stuff?

raw mica
#

Ah I misread your snippet. This seems like a bug. Your wrapper type is generic so we use an ILPostProcessor to figure out what all the different forms of MyJobWrapper<T>.SortJob exist. If it works for IJob and not IJobParallelForDefer either we have a bug or you actually have a [assembly: RegisterGenericJobType(typeof(MyJobWrapper<SomeConcreteType>.CoolJob))] but no matching one for your SortJob

#

What is the specific error you're getting, and which collections version are you using (I'm guessing 1.4.0)?

dense crypt
#

I don't have any [RegisterGenericJobType] for these jobs, I much prefer to have the generics auto-resolved, hence me using the wrapper pattern. The auto resolve works fine for these IJobs so it's most likely to be specifically related to IJobParallelForDefer

raw mica
#

If you aren't trying to burst compile the schedule calls then you won't need RegisterGenericJobType

Using collections 2.0 on 2022.2 I do not have any issues with your snippet. Seems like a bug that we fixed. I can take a look to see if I have a diff that you can apply locally (if the fix is indeed in collections which I suspect it is)

dense crypt
#

Just installed and tried the snippet on 2022.2.b10 and ECS 1.0.0-exp.12 and it's working as expected as well. Getting an error about NativeList not being ReadOnly which is what I was expecting to get. If you wouldn't mind checking if there's a diff I would very much appreciate it ๐Ÿ™‚

raw mica
#

Looks like indeed IJobParallelForDefer had a bug in 1.4.0. This is the method to update Unity.Collections\Jobs\IJobParallelForDefer.cs

        private static unsafe JobHandle ScheduleInternal<T>(ref T jobData,
            int innerloopBatchCount,
            void* forEachListPtr,
            void *atomicSafetyHandlePtr,
            JobHandle dependsOn) where T : struct, IJobParallelForDefer
        {
            JobParallelForDeferProducer<T>.Initialize(); // <---- Add this line
            var reflectionData = JobParallelForDeferProducer<T>.jobReflectionData.Data;
            CheckReflectionDataCorrect(reflectionData);
            var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), reflectionData, dependsOn, ScheduleMode.Parallel);
            return JobsUtility.ScheduleParallelForDeferArraySize(ref scheduleParams, innerloopBatchCount, forEachListPtr, atomicSafetyHandlePtr);
        }
#

(note, you'll need to make a copy of the package and then refer to your copy of collections in your manifest.json since the package manager will overwrite any manual updates to downloaded packages)

dense crypt
#

I'll give it a try

#

Yeah that seems to have fixed it!

#

Yep confirmed working ๐Ÿ˜„ Thanks so much for the help!

true mirage
#

When a developer drinks beer and then code
UnsafeUtility.MemCpy
The first argument is destination and the second one is source?!

#

WTH๐Ÿคฃ

#

I was forced to reimplement an algorithm found somewhere because it had a lot of bugs. one of them is related to UnsafeUtility.MemCpy
and argument order

covert lagoon
#

And with other functions from the string.h standard library header in C.

#

And with instructions in Intel syntax x86 assembly.

true mirage
covert lagoon
#

And yet, when you want to copy A to B, you write B = A, not A = B.

true mirage
#

It is formula

#

but when you define a code (method), you are writing codes not math formula

covert lagoon
#

And yet, b = a; is valid C#.

hushed lichen
true mirage
#

There is an array of a struct type(Element) and would like to swap some elements in it. Each element keeps its index as well.
Outside, I keep an element of that array in a variable. Because it is value type, when swapping elements of the array and update index field, it does not reflect it, what is your idea?

public struct Element{
   //...
   public int Index;
}

var el = array[10];

swap element(10) with element(5) and update index field inside

viral sonnet
#

when you read it like destination = source, it's easy to remember

rotund token
#

destination, write, return - pretty much always on the left

#

oh except Func which always confused me

#

man adding history to my state implementation

#

ended up being such a pain

#

logically it's super simple but the whole thing is written with DynamicComponentTypeHandle as to avoid annoyances with generics/burst jobs on implementation

viral sonnet
#

but you solved it?

#

and yeah, overly generic solutions are really complicated to write

#

at the end it's worth it though. generic systems are cool

rotund token
rotund token
#

you implement just passing component types

pliant pike
#

basic question but is it possible to do an OR || or and && type conditionals for RequireSingletonForUpdate<>()

rotund token
#

use a query requireforupdate

#

Any == Or

#

state.RequireForUpdate(SystemAPI.QueryBuilder().WithAny<TestStateBack, TestStateForward>().Build());

pliant pike
#

I'm in 0.5 so I'm guessing it would be different

rotund token
#

same thing

#

just different syntax

#

RequireForUpdate(GetEntityQuery( new EntityQueryDesc { Any = new[] { ComponentType.ReadOnly<TestStateBack>(), ComponentType.ReadOnly<TestStateForward>() } }));

#

something like that from memory

pliant pike
#

of course, thanks a lot

viral sonnet
rotund token
#

@rustic rain i've updated core master on gitlab with latest (0.10) and I've pushed an update to github with a release tag so should update on openupm in ~30min

rustic rain
#

I'm out of Unity for now until they fix bug with onSceneLoaded callback ๐Ÿ˜…

#

btw, got time to check on your end?
I tested empty project (with only entities package), and this callback just doesn't work

#

SceneManager.onSceneLoaded

rotund token
#

oh yeah i saw you write this yesterday

rustic rain
#

I just want to be sure it's not smth on my end

rotund token
#

i don't have any scene changes so ah

#

let me set something up

rustic rain
#

just do test

#

[RuntimeInitializationOnInit(BeforeSceneLoad)] or smth like that and register some debug log callback

rotund token
#
        public static void Test()
        {
            SceneManager.sceneLoaded += Test;
            SceneManager.LoadScene("Test");
        }

        private static void Test(Scene arg0, LoadSceneMode arg1)
        {
            Debug.Log("sceneLoaded");
        }```
#

works fine for me

rustic rain
#

๐Ÿฅด

#

do you have entities package?

rotund token
rotund token
rustic rain
#

wait

#

no

#

does it work on initial scene?

rotund token
#

no

#

i personally wouldn't expect it to

rustic rain
#

It used to

#

I relied on it

#

damn

rotund token
#

๐Ÿคทโ€โ™‚๏ธ

#

hmm i guess it would make sense

#

i did kind of think your bootstrap was hacky though

#

but it seems easy enough to work around?

#

but yeah i can repo your case of

rustic rain
rotund token
#

it won't run on first scene

#

i've seen it before, i think it's very hacky

rustic rain
#

but why?

#

I use meant interface

#

all I do is just create my own components per world

#

with different stage callbacks

rotund token
#

it doesn't play nice with any other library

rustic rain
#

like what?

rotund token
#

you have events inside systems

rotund token
rustic rain
#

I'm not sure, how it's related

#

it's just internal client only callback

#

which should be same for every client, no?

rotund token
#

if it works for you, it's fine

#

i personally consider anything that isn't just default initialization kind of hacky

#

basically i can't just take your systems/libraries and add them to my own project

#

if i need to have a custom setup then that's a no go for me

#

i want things to just work

rustic rain
#

why not though?

rotund token
#

because i need your bootstrap

#

to run your systems

#

if i don't use your bootstrap can your systems run in my project?

#

i need to use netcodes ClientServerBootstrap

#

so i can't use your bootstrap

rustic rain
#

it's just 1 system with event that called in OnDestroy

rotund token
#

therefore i could not use your systems

rotund token
#

IInjectWorld

rustic rain
#

I could use Default world, or inject through this

#

OnPost create is also just similiar callback

#

for systems that implement interface

#

none of it is required for bootstrap to work

#

it's just extra functionality to suit my needs

#

tbh, OnPostCreate is kind of rudimentary ever since CreateAfter attribute was added

rotund token
#

it's about the systems working in another project

#

without your bootstrap

#

that's all

rustic rain
#

๐Ÿค”

rotund token
#

i like systems that will just work in any project

rustic rain
#

What would be a way to have a callback on World dispose without a system though?

rotund token
#

i really dislike walled gardens

rotund token
rustic rain
#

World type doesn't have this member

rotund token
#

oh not a system?

rustic rain
#

no system yeah

rotund token
#

what do you mean

#
            foreach (var system in _world.Systems)
            {
                try
                {
                    if (system is ISceneLoaded post)
                    {
                        post.OnSceneLoaded();
                    }
                }
                catch (Exception e)
                {
                    Debug.LogException(e);
                }
            }```
#

this is running on systems?

#

i don't care about anything outside of systems

rustic rain
#

That's just callback that's called on managed systems that implement this interface

rotund token
#

That's exactly my point

rustic rain
#

I use it to obtain MonoB references

rotund token
#

I'm not saying there is any issue writing your stuff like this for your project

#

I'm just saying i hate it because I can't literally copy/paste your system and put it in my project

#

because it will not work with default entity workflow

#

that's all

#

i don't like code that requires custom setup so isn't just modular

rustic rain
#

ah

#

well, my systems do rely on this bootstrap

rotund token
#

i'm just a huge purist is all

#

systems couple to nothing

rustic rain
#

But how would you solve a problem

rotund token
#

it's fine, this is just why i consider it hacky - most people probably have no issue with it

rustic rain
#

of obtaining mono b references

#

with default bootstrap?

rotund token
#

all my monobehaviour references are done via baking

#

and components

#

or just FindObjectOfType

#

for like the 1 that's the scene

#

(UI)

rustic rain
#

yeah but you can't use FindObjectOfType in OnCreate

#

objects are not created yet

rotund token
#
        {
            if (this.root != null)
            {
                return;
            }

            var document = Object.FindObjectOfType<UIDocument>();```
#

this is the only gameobject

#

i have in my scene

rustic rain
#

yeah, for me too basically

rotund token
#

i'll probably move this to a prefab and initialize at some point

#

just because i hate FindObjectOfType so much

#

but for now, it just works

rustic rain
#

how do you make your OnStartRunning run only after Scene loaded though?

rotund token
#

pretty sure onstartrunning only runs after scene load

#

i don't have a bootstrap at all

rustic rain
#

๐Ÿค”

safe lintel
#

i also dislike anything that messes around with the default bootstrap, but then again I think unity sort of violate this in their own examples like fps and megacity

#

(and my opinion really counts for nothing ๐Ÿ˜€ )

rotund token
#

a lot of the time it just comes down to objectives i guess

#

most people are just writing the game for themselves with no thoughts of future projects, public libraries etc

#

so it really doesn't matter

#

either i have done something amazing to completely break unity really badly or there is something really inconsistent about the shutdown sequence when leaving play mode

#
        {
            Debug.Log("OnStopRunning");
            if (SystemAPI.ManagedAPI.HasSingleton<InputCameraActions>())
            {
                Debug.Log("Woo");
            }
            else
            {
                Debug.Log("WTF...");
            }```
#

the entity is deleted before OnStopRunning is called 50% of the time when leaving play mode
(please note it's not alternating, it got 3 woos in a row then 2 wtfs after this)

My guess is subscenes are being unloaded before the world shuts down, but this is making life cycle management impossible without constant checks...

woven hinge
#

hi guy have. a question why i get this odd error

rotund token
#

what is 'float'?

#

should that not be a component

rotund token
#

SubScene.OnDestroy sometimes gets called before World.Dispose

#

how do i make this deterministic

viral sonnet
#

hey tertle, do you know how a PropertyField in the context of a PropertyInspector can work? They seem incompatible

rotund token
#

how so? it's just a UI element

#

that said I don't recall trying

viral sonnet
#

i've only looked briefly at it. PropertyField needs a SerializedProperty which I seemingly can't get just from the struct

dire crown
#

can entity aspect code be breakpointed? or not because its only used for code gen? or am i just running into a bug?

rotund token
#
    stub.Value = entityData.blahblah;

    public class PropertyStub : ScriptableObject
    {
        public YourData Value;
    }```
#

no idea how well this will work

#

it's a huge hack and not sure you should go down this path

viral sonnet
#

thanks, i'll consider trying when i'm out of options ๐Ÿ˜„

#

some codegen for blobs in general sounds useful

devout prairie
#

is this how i'd get thread index inside an IJobEntity ( first time using it today ):

true mirage
#

Have you worked with nullable types and value tuples in jobs? Are they OK? performance wise
or define custom struct types

tribal pollen
#

So... I had a StageStartup monobehaviour that I used to create my stage entities, but I thought I had to move it to a baker since I was previously using serialized fields, and now I'm getting "InvalidOperationException: Entity Entity(19:1) doesn't belong to the current authoring component."
How do you guys normally handle this?

full epoch
#

is there some code example(pls add address if you know one) - which makes possible to use relay along with netcode for entities like explained in this post / thread : https://forum.unity.com/threads/relay-with-netcode-for-entities-how-to-connect-local-client.1365681/#post-8648016 ?

woven hinge
#

hi guys i wrote this system https://pastecode.io/s/2768czbx i have 2 question a, why i dont see it loaded (not see it in systems) do i missing something b. will this work i mean will move the entity?

rotund token
#

by don't see it you mean don't see it in system window?

#

not sure, looks fine

#

b. test it? ๐Ÿ˜„

woven hinge
#

ya not show

#

i am in a pickle

rotund token
#

initially concerned about that ProtectorAspect though

#

but it's fine and handled by systemapi, you'd error anyway

woven hinge
#

sec will post all the that file

#

see have better look

rotund token
#

any issues should appear as an error

woven hinge
#

no errors

#

also this system not loaded but not clear as to why

#

gezz this hard cookie

stone osprey
#

Btw how are the command buffers architectured ?

Do they just "record" plain commands and playing them back after each other ?

Or are they basically simulating a shadow entity world with their own archetypes and stuff ?

rotund token
#

they just store the command

#

and play it back via the entity manager on playback

stone osprey
#

Hmmm thanks, isnt that extremely slow ? Atleast it sounds like that ^^

I could imagine that the operations will also execute after another and not being batched.

So :

  • Add "Ai"
  • Add "Velocity"

Would first make the entity to the ai archetype and then to the velocity & ai one.

This could be batched and it would make sense to move to velocity&ai archetype directly

rotund token
#

well yeah, commandbuffers are often the slowest part of operations

#

but the slowest part is what it does more than the playback itself

#

structural changes are slow and should be avoided

stone osprey
#

Alright thanks ^^

However, i hope that unity probably reworks them to be "smarter" to batch such changes

viral sonnet
#

it's pretty hard to batch the commands without introducing another write that is then memcopied to a chunk. what i rather want is multithreaded ecb

#

but that's also in the realm of near impossibility

rotund token
#

and entitymanager provides batch operations already if you wnat to do lots of work fast

drowsy pagoda
#

I'm on 2022.2 and it appears that incremental build feature is not working. It always does a clean build. Is there a way to enable it?

rustic rain
#

query commands for example

#

last time I checked

#

it didn't

late mural
#

is there anyway to make sure a gameobject gets baked into an entity before a certain systembase's OnCreate() happens?

rotund token
#

do you mean more, ensure your subscene loads before OnCreate()?

#

the short answer is not really

#

you'd have to use an approach of deferring partial system creation until after the subscenes are loaded

late mural
#

i have no clue, currently i have 1 entity with a bunch of info my systembase needs once at the beginning ish sort of time

#

i suppose i could check once a frame to see if the entity exists yet and once it does then treat OnUpdate() like usual?

rustic rain
#

In Oncreate

late mural
#

ooh ok, ill look into that thanks!

#

can i make it be required for other methods aswell or just OnUpdate()?

rustic rain
#

it is requirement for update

#

OnStartRunning is called during update

#

if previous update cycle, this system was not updated

late mural
#

ok fascinating, im not quite sure what that means, but ill mess around with it and see if i can get something working, thanks a ton!

late mural
rustic rain
#

I don't remember one

late mural
#

ah unfortunate, got any examples of how to use it then that you know of?

rustic rain
#

OnCreate() { RequireForUpdate<MyGameSettings>()}

rotund token
#

or if in ISystem
state.RequireForUpdate<MyGameSettings>();

late mural
#

ok good, then in the update i can set a bool to be true, and then in all my other methods check if the bool is false and return if it is, thanks so much!

#

ok problem is that now i need something to run once, but only if the thing exists, i could always check the bool, and then have a counter for how many times it has ran, and only do it on the first 1, but is there perhaps a better way?

rotund token
#

your update won't run until game settings exists

#

so i'm not sure what you mean by other methods

late mural
rotund token
#

i do have a way to make it so no system onupdate will run until your subscene is loaded

#

because i personally dislike having all these requireforupdates and checks

late mural
#

i barely use OnUpdate as it is so it isnt a hassle for me currently

#

with subscenes if you do parenting like you would with gameobjects does it automatically workout how to do the parenting in the entity form, or does it just undo all parenting?

rotund token
#

it will bake with parenting

late mural
late mural
#

is there an entity version of the camera yet?

rustic rain
#

Any idea in what system, Physics world already setup physics bodies and their velocities, but hasn't done anything with them yet?

late mural
trail valve
#

Hi guys, Do you know why my entity prefab has a component with type ICleanupComponentData, after it is instantiated, that component disappears?

half owl
#

Hello there,

  • I am having trouble properly understanding the open/closed state of subscene, mainly, I don't understand the streaming part where When a subscene is closed, Unity streams in the contents of the baked scene. On my side, when a scene is closed, nothing appears at all.
  • Then, I am trying to understand how to properly dynamically load scenes with ECS. Let's say I want to go from SceneA to SceneB, I load the scene the old way, using SceneManager.LoadScene. But the SubSceneB (Subscene of SceneB) is closed when doing that. Thus leading to my stuff from there not appearing.
rustic rain
#

such components are meant to be runtime only

rustic rain
trail valve
# rustic rain looks like bug in baking phase

no, I add ICleanupComponentData to prefab entity in runtime, I already check in the editor, prefab have that component, but when instantiate it, that component disappears. I try to change that component to IComponentData, it worked normally

rotund token
#

yes

#

that's intended

#

ICleanupComponentData can only be added

#

it will not be instantiated or serialized

trail valve
rotund token
#

it is clearly left out in code when serializing/moving worlds/instantiating

#

will this behaviour change at some point? who knows

trail valve
#

oh, so I have to add this kind of component after it's instantiated, right?

rotund token
#

it's been brought up multiple times so you aren't the first person to run into this

half owl
rotund token
#

the original implementation of this was as a reactive component on an entity

half owl
#

I will look that way. Thank you

trail valve
woven hinge
#

hi all say dose anyone knows what this odd error it happened when i start unity pre-release or sometimes i just let it idle or update the assets happening

#

it has no stock so not sure what make out of it

rotund token
#

do you have a catch in a job?

#

also go have a look at normal console not console pro

woven hinge
#

i have one in system not a job

#

to prevent any errors

#

basiclly it here

rotund token
#

yeah

#

thats in burst

#

you can't use catch in burst

#

burst only supports try/finally not catch

#

exceptions are crashes in burst

woven hinge
#

ok... odd

#

one more question i have hard time understand if i want within a job get all entities so i can change their transform how i do that?

rotund token
#

simpliest of jobs would look something like

[BurstCompile]
private partial struct MoveJob : IJobEntity
{
    private void Execute(ref TransformAspect transform)
    {
        transform.LocalPosition += new float3(1,0,0);
    }
}```
#

just move everything along the x

#

1 unit per frame

rustic rain
woven hinge
#

ya i removed it it just seems odd that all

#

i kinda do this project learn the dots

#

so it fun to be wrong:)

rustic rain
#

burst code = native code
It has no C# features

#

it's as good as C++ code practically

woven hinge
#

i c

hushed lichen
#

Burst code can be better than C++ code, it's good stuff

rustic rain
#

but it is indeed easier to use within Managed C# environment

#

rather than compiling some C++ separately and loading extern methods

hushed lichen
woven hinge
#

have quick question i got this code https://paste.ofcode.org/iH3zu24krdrLxxAVey9swd i try make all the created entities orbit an object now my issue it look like the system never been added to system and i try understand what i have missed

rustic rain
hushed lichen
#

Not wrong, but there was also never a claim that it's necessarily often or with typical code.

It's probably reasonable to say that you can make Burst code that outperforms equivalent C++ code.

minor sapphire
#

Part of that claim will come from the fact that the compiler can make certain assumptions for optimisation given the rather tight constraints/rules. Also SIMD with the math library. But to get the most out of it you have to know what you're doing.

hushed lichen
#

Doesn't make the statement less true

twilit cipher
#

DOTS is more performant than C++ in the sense that it provide a set of programming paradigms that allow to trivially produce machine code that is :

  • Thread safe and fully parallelizable by default.
  • SIMD accelerated by default
    While the same can be achieved with C++, the amount of programming work required in non-trivial, real world scenarios is several orders of magnitude higher.
pliant pike
#

yep DOTS is so great even an idiot like me can code super fast multithreaded code relatively easily

lethal cairn
#

[Solved]
Hi, I'm doing something a little bit unusual compared to what Unity is promoting and I got stuck for what should be normally intuitive.

  • I'm manually creating Prefab entities for my character (I'm avoiding Bakers).
  • I have successfully created some prefabs for my character entities.
  • But I got stuck at the spawn system where I need to query for any entity that has a Prefab component.
  • The query is always empty no matter what.
void girder
#

What's a reasonable way of storing frequently changing data that belongs to a group of entities (same archetype)?
Using shared components is a little funky b/c of chunk fragmentation + the fact that updating shared components can only be done through the main thread or an ecb

rustic rain
#

and store it somewhere you can access for your application

#

one way - blobs

#

but it's rather heavy, for small data

void girder
#

I used to store blobs per entity to store read-only shared data between entities until unmanaged shared components came out

solemn hollow
#

@rustic rain is tertles package up to date?

void girder
#

Then I realized unmanaged shared components are pretty difficult to update with an entityquery

rustic rain
#

yeah

rustic rain
#

0.9 repo

solemn hollow
#

ah damn i think its not working for me anymore cause im still on Transforms V1

rustic rain
#

v2 feels good after new changes

#

nouniform scale

#

and etc

#

allthough it's a bit borked I think

solemn hollow
#

i just have other problems than transfering to V2 atm

#

i tried to switch but instantly ran into problems with transform lookups

woven hinge
#

hi guys i get this error "System.ArgumentException: Key: {0} is not present in the NativeParallelHashMap.
This Exception was thrown from a job compiled with Burst, which has limited exception support.
#3 Unity.Jobs.IJobExtensions.JobStruct`1<Unity.Entities.Editor.HierarchyNodes.BuildExpandedNodes>.Execute" what dose this means? how i can fix it?

pulsar jay
woven hinge
#

but from where it coming for the stock not lead any of my code

#

i dont think it got a stock what u see it what i have

solemn hollow
solid rock
#

there's plenty of those around ๐Ÿ˜›

woven hinge
#

ya i have some how guess i also get crash unity alot ๐Ÿ™‚

#

also fun

#

but found work around

brave field
#

What's the equivalent of LocalToParent at transform v2?

pulsar jay
woven hinge
brave field
#

What's the equivalent of CompositeScale at transform v2?

pulsar jay
#

There is no exact replacement I think

solemn hollow
#

but i am not sure if that will fix all your problems. i suspect there is more going on. is there no error in console?

woven hinge
#

i wise there were

#

it run but without it

#

and the control is clean but for stuff that i add when i create the objects

pulsar jay
#

Or even just an empty ISystem

woven hinge
#

i will create empty ISystem just for kicks

#

ok the empty works

#

i remove the upadte in group as well so why that system not in the list

woven hinge
half owl
#

I guess the hidden question is : How to have a (edit: loaded) closed subscene actually render

solemn hollow
half owl
#

In none of them

#

As long as my subscene is closed, I don't render anything

whole gyro
half owl
#

right now, I simplified my subscene, I have only a Plane with a Mesh Renderer

whole gyro
#

What kind of material on the plane?

half owl
#

"lit" material

#

same issue with default material

whole gyro
#

from which render pipeline? I don't think entities work with standard shaders. Only urp/hdrp shaders that support dots instancing

#

The default URP/Lit should work

#

Also, are any errors getting logged? If it is a shader issue, it should log to the console if an invalid shader is being used

half owl
#

I have a Warning The referenced script on this Behaviour (Game Object '<null>') is missing! without further information.

#

I am using URP-HighFidelity pipeline settings

drowsy pagoda
#

Because I have my offsets all setup based on world object space, and I create joints based on that. But for some of them they rotate 180 in opposite direction. I assume it's because the X,Y,Z axis for joints don't follow the X,Y,Z axis of the traditional unity world/scene space?

#

If so, can someone please help me with what additional calculation I need to make to convert the object world space to joint local space?

half owl
woven hinge
whole gyro
half owl
#

no worries

#

I have found a sample project on the side that does that

solemn hollow
# rotund token Haha I just removed support

i dont mean you add support for it back. just define out the 2 files which throw errors. but nvm if you dont want to. was just a little annoying today cause i had to delete the library folder multiple times

drowsy pagoda
whole gyro
drowsy pagoda
#

Oh, I see.

rotund token
#

But yeah I can wrap those files

#

I conditionally compile a bunch of stuff for netcode physics already

#

I removed support because I didn't expect many on pre to still use v1

rotund token
#

is leak detection ever going to work again... =\

rustic rain
#

considering most employees went on a vscation...

rotund token
#

well 1.0 was release a while ago now

#

and i personally don't think it should have been released with broken leak detection

#

safety is a the fundamental pillar that dots was built upon and it's a huge regression over 0.51

solemn hollow
rotund token
#

i swear to god everything in unity is crashing me these days

Obtained 78 stack frames
0x00007ff666112bc1 (Unity) YGRoundToPixelGrid
0x00007ff6661132e3 (Unity) YGNodeCalculateLayout
0x00007ff664e178ee (Unity) Native_CUSTOM_YGNodeCalculateLayout
0x000001b5b80fc87c (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Yoga.Native:YGNodeCalculateLayout (intptr,single,single,UnityEngine.Yoga.YogaDirection)
0x000001b5b80fc473 (Mono JIT Code) UnityEngine.Yoga.YogaNode:CalculateLayout (single,single)
0x000001b5b80fb6d3 (Mono JIT Code) UnityEngine.UIElements.UIRLayoutUpdater:Update ()```
#

i'm just stress testing entering/exiting play mode over and over

#

and i've had probably 7 different crashes

rotund token
#

i'm just testing a controversial change i've added to core

#
    public static class EditorWorldSafeCleanup
    {
        static EditorWorldSafeCleanup()
        {
            Application.quitting += OnQuit;
        }

        private static void OnQuit()
        {
            var playerLoop = PlayerLoop.GetCurrentPlayerLoop();
            foreach (var w in World.s_AllWorlds)
            {
                ScriptBehaviourUpdateOrder.RemoveWorldFromPlayerLoop(w, ref playerLoop);
            }

            PlayerLoop.SetPlayerLoop(playerLoop);

            World.DisposeAllWorlds();
        }
    }```
#

this

#

i noticed a couple of days ago exiting play mode is very nondeterministic

#

half the time the world shuts down before subscene unload, the other half subscenes shutdown first removing their entities

#

pushing something like this to core is kind of against the principle of the library though

solemn hollow
rotund token
#

it should make no difference to users

#

my first attempt i was just calling

#

DefaultWorldInitialization.DomainUnloadOrPlayModeChangeShutdown();

#

which is all unity does from a secret monobehaviour

#
    {
        public bool IsActive;

        public void OnEnable()
        {
            if (!IsActive)
                return;

            IsActive = false;
            DestroyImmediate(gameObject);
        }

        public void OnDisable()
        {
            if (IsActive)
                DefaultWorldInitialization.DomainUnloadOrPlayModeChangeShutdown();
        }
    }```
#

this is how they cleanup stuff

#

the issue is just that this OnDisable somethings executes before sometimes executes after OnDisable of SubScene.cs

#

it also has a forced execution order of
It is private and hidden, but has executionOrder: 10000 in the meta file,

#

so should update after everything but for whatever reason, doesn't?

#

so i just want to make it consistent

#

basically i just want consistency and determinism

#

subscenes unloading before world was destroying me OnStopRunning code

#

which had singletons to cleanup half the time only

#

and was causing a very obscure crash from input events not being unsubscribed

rocky dove
#

Is there a way to invert [RequireMatchingQueriesForUpdate]
It'd be nice to have an initializer system run only when some necessary things aren't spawned yuet

viral sonnet
#

afaik the method also takes a query. that query can have an exclude

#

talking about RequiresForUpdate

#

but i handle initializers usually with a singleton. in your case, when the singleton exists, disable the system

solemn hollow
rocky dove
solemn hollow
rotund token
#

ExitingPlayMode probably similar

#

but timings are weird

solemn hollow
# rotund token ExitingPlayMode probably similar

i needed to force an AssetDatabase refresh before entering playmode to get all codegened classes loaded just in time. there those weird timings were important. cause "PlayModeStateChange.ExitingEditMode" happens before any unity scripts related to starting the playmode are running.

half owl
#

idk why really though

devout prairie
#

i was wondering - is there any performance benefit to accessing ( readonly ) data in a blob as opposed to a dynamic buffer

#

say for example i have animation data that is accessed every frame inside some jobs

#

would that data be better stored on a blob or a buffer

rotund token
#

if the buffer is in the chunk it's probably faster

#

if all entities in the chunk were using the same blob or a mix of the same blobs and the buffer wasn't in the chunk

#

blob probably faster

#

i wouldn't really worry too much about this though

#

blob can save a lot of memory

#

but just use what makes sense

viral sonnet
#

animation data is usually quite large, right? so a chunk DB would probably don't fit much anyway. when the DB is outside the chunk access is comparable to blobs. though blobs win because they have slightly less overhead. it's minuscule though

devout prairie
#

thanks yeah that's useful information, makes sense

#

in one case i have anim data that is obviously quite long, currently a blob storing multiple animations, each storing arrays of pos/rot values

#

in another case i have a blob storing unit/weapon/stuff data that is used for spawning - just structs containing health/strength/weaponid/ etc

rotund token
#

@solemn hollow gitlab updated with V1 support, also noticed I had pushed a bunch of conditional stuff that broke builds so fixed that

#

also updated upm because of those broken build issues

solemn hollow
#

thanks alot! hadnt noticed. not building anything atm :/

#

still 0.9 branch?

rotund token
#

master

rotund token
solemn hollow
late mural
rotund token
#

there's no native version

#

the graphics package does support 'converting' a hybrid version

#

but it's just the regular camera though

late mural
#

ah ok, thanks for the info!

rotund token
#
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.Memory/Unmanaged/Array:Resize (void*,long,long,Unity.Collections.AllocatorManager/AllocatorHandle,long,int) (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/Memory.cs:89)
Unity.Collections.Memory/Unmanaged/Array:Resize<byte> (byte*,long,long,Unity.Collections.AllocatorManager/AllocatorHandle) (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/Memory.cs:96)
Unity.Collections.Memory/Unmanaged:Free<byte> (byte*,Unity.Collections.AllocatorManager/AllocatorHandle) (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/Memory.cs:41)
Unity.Collections.RewindableAllocator/MemoryBlock:Dispose () (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/RewindableAllocator.cs:93)
Unity.Collections.RewindableAllocator:Dispose () (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/RewindableAllocator.cs:233)
Unity.Collections.DoubleRewindableAllocators:Dispose () (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/DoubleRewindableAllocators.cs:94)
Unity.Entities.ComponentSystemGroup:DestroyRateGroupAllocators () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/ComponentSystemGroup.cs:708)
Unity.Entities.ComponentSystemGroup:OnDestroy () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/ComponentSystemGroup.cs:123)
Unity.Entities.ComponentSystemBase:OnDestroy_Internal () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/ComponentSystemBase.cs:306)
Unity.Entities.World:DestroyAllSystemsAndLogException () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/World.cs:1007)```
#

i am extremely good at breaking things ๐Ÿ˜

viral sonnet
#

or DOTS is easily breakable

late mural
#

wondering, is it possible to do entity queries in a monobehaviour?

viral sonnet
#

yes, just get an EntityManager from a world

late mural
#

ok thanks!

dire crown
#

any advice on how to avoid containers may not be the same (aliasing) errors when creating jobs with aspects that reference LocalTransform?

rotund token
#

you can't avoid it because it's inherently unsafe unless you can promise you aren't writing / reading to same transform

#

and if you can promise what you are doing is safe, then you just have to turn off safety on the container

stone osprey
#

Do queries iterate backwards over entities and their components ? Is that possible ?

Or how is it possible that we can query and destroy entities at the same time ? Normally backwards iteration is being used for such cases.

dire crown
#

maybe i am missing something basic with how the dependencies are set up?

solemn hollow
#

@rotund token any idea how a system in DefaultWorld could call OnCreate when i am never hitting play?

rotund token
#

that's the issue i'm having!

#

i have no idea

#

it's being called from OnDestroy

#

Editor world is disposed, and for some reason 1 of the System.OnDestroy() is calling System.OnCreate() - on a completely different system

#

it only happens with burst on

#

burst function pointers seem to be scrambled

solemn hollow
#

ill check if i can see from where its called

rotund token
#

i wiped my library, still happened

#

i wiped it again last night, it hasn't happened today...

solemn hollow
# rotund token that's the issue i'm having!

im sorry its not ๐Ÿ˜ฆ
i have a lazy hacky way to generate a concrete system class from an instance of a system. it was supposed to be used runtime only but now i create a system in editor. thats what called OnCreate

rotund token
#

booo

#
This Exception was thrown from a function compiled with Burst, which has limited exception support.
...
Shattered.Game.States.OptionsStateSystem.__codegen__OnCreate(System.IntPtr self, System.IntPtr state) -> void_aef4d46f9ec6d18a03913cfa3cd76414 from Shattered.Game, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.burst@1.8.2/.Runtime/unknown/unknown:0)
object:wrapper_native_000001B790D8A8C0 (intptr,intptr)
Unity.Entities.SystemBaseRegistry:ForwardToManaged (intptr,Unity.Entities.SystemState*,void*) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:363)
Unity.Entities.SystemBaseRegistry:CallForwardingFunction (Unity.Entities.SystemState*,int) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:311)
Unity.Entities.SystemBaseRegistry:CallOnDestroy (Unity.Entities.SystemState*) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:381)```
#

is whats happening for me

#

SystemBaseRegistry:CallOnDestroy -> OptionsStateSystem.__codegen__OnCreate

solemn hollow
#

yes you showed the other day

rotund token
#

i can attribute at least 30% of my crashes in last 2 days to dx12

#

so i've downgraded that...

solemn hollow
#

have you seen that behaviour for Isystem and Systembase?

rotund token
#

what one sorry?

#

oncreate?

solemn hollow
#

the Oncreate OnDestroy swap

rotund token
#

only seen it on isystem

#

and only burst compiled methods

#

and it doesn't happen if burst is off

solemn hollow
#

explains why ive never seen it

rotund token
#

i dont think anyone has seen it

solemn hollow
#
  1. i doubt everyone is running bursted ISystem yet
  2. I use OnDestroy rather sparingly not sure how others use it
rotund token
#

well i dont think ondestroy has anything to do with it

#

all systems have ondestroy

solemn hollow
#

sry might be a stupid question but cant burst skip compiling it if its empty?

rotund token
#

if i see it again i might try remove the burst compile from ondestroy and see what happens

rotund token
#

it still has to be compiled to something

#

because the function pointer is being called from mono

solemn hollow
#

ah i see

rotund token
#

maybe they have a default empty do nothing loop back

#

i avoid putting burst compile on empty methods simply because even if it doesn't add overhead at runtime, it's still 1 more thing burst has to check to compile at least

#

and i can't imagine that is great for iteration performance

coral bluff
#

Does anyone know if a VR build using latest DOTs its currently possible , or is it not supported right now?

rustic rain
#

they appear in burst debugger

rotund token
#

even more reason not to burst compile them if they aren't just stubs

remote crater
#

I had a dynamicBuffer of entities to ignore collision with, but that is not cromulent... What is a better way to hold an array of entities to ignore collision with?

rustic rain
remote crater
#

From that thread it says not to use dynamic buffers in Jobs

#

I was getting a [writeonly] error

safe lintel
#

that thread is old.

#

dynamic buffers are very much safe to use inside of jobs

hushed lichen
#

There are things from a couple of months ago that are outdated. Things from years ago should not be considered gospel truth ๐Ÿ˜›

remote crater
#

Alright... Then I wonder what is going on if it ain't happy with [WriteOnly]. The system isn't critical, just sometimes you shoot yourself with your own laser for now.

true mirage
#

Is it worth converting int fields to short or byte in struct types (Burst)? or int3 to int (Flatten indices)

rustic rain
#

the smaller component - the higher chunk capacity

#

but there's still cap

true mirage
covert lagoon
#

com.unity.platforms is not deprecated with the latest Entities 1.0, it's just that the Build Settings menu can now also be used for simple cases, right?

#

Also, I could make my own Build Configuration component to programmatically set the application version using git describe, right?

covert lagoon
#

Oh.

delicate swan
#

Huh, weird, created a new project, installed entities/graphics/physics, but entities won't render in an open subscene, did I miss some changes to this I somehow accidentally did up until now?