#archived-dots

1 messages · Page 156 of 1

opaque ledge
#

are you doing custom prefab conversion in someway ?

pulsar jay
#

@opaque ledge I get this error on ceonversion: "No sharedMesh assigned to Unity.Physics.MeshCollider on Path_Pillar_Prefab"

#

yes I am using GameObjectConversionUtility.ConvertGameObjectHierarchy(variant, settings);

#

and it worked fine until I installed the physics package

opaque ledge
#

hmm, there should be DOTS->Physics->Convert(or something like that), on latest physic package many things change, so for old stuff to work you have to do that

#

maybe it will help

pulsar jay
#

I will try although I have no custom physics code atm

opaque ledge
#

its for converting physic materials, not for custom physics code afaik, nevertheless, hope it helps^^

pulsar jay
#

I dont even have this option after installing the physics package

#

I also had to change this line:
GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, null);
to this:
GameObjectConversionSettings.FromWorld(World.DefaultGameObjectInjectionWorld, new BlobAssetStore());

#

otherwise I get another error

pulsar jay
#

I found the error. The prefabs MeshCollider was missing a mesh. Thought I checked that 🙄

zinc plinth
#

sifting through the dots physics forum but can't seem to find it, how can I create a proper PhysicsCollider (let's say a cube) at runtime ?

#

^ for already created entities

vagrant surge
#

@dull copper they were talking about "removing safety checks" on some burst stuff

#

as there been any test on that?

#

given that current ECS jobs are like 90% overhead in small projects

mint iron
#

yeah, they need to sort it out, and its not even just an ECS issue, the schedule of an IJob without ECS is still at minimum 0.0040 on my machine but more likely 0.0100+ ms which is just not good enough. If the same job is repeated (unlikely to happen in ECS) then i can get down to ~0.0004 to 0.0009. But yeah, most of the time you're looking at the worse case. especially once you start adding the ECS stuff on top, iterating chunks, filtering archetypes etc.

vagrant surge
#

at that speed (100 per milisecond), we are on the scale of... ue4 blueprint Tick overhead

#

so thats not that bad

#

problem was the 0.1-0.2 ms i was seeing last time

north bay
#

Well my game currently has about 200-300 systems, some systems also run multiple times in a frame

#

So the overhead quickly becomes very noticeable

ocean tundra
#

is it the overhead of systems or the overhead of scheduling the jobs

#

like you i have a ton of systems, and im code gening out more of them

north bay
#

Well mostly iterating over small entity counts is just way to expensive

#

NetCode generates spawning systems which dont do anything but take 0.01 ms

ocean tundra
#

yea my net code kinda does the same

north bay
#

Im just waiting for burstable systems so i can rewrite the gen code myself lol

ocean tundra
#

oh yea i forgot those were comming

#

yea i 'might' be able to use those

zinc plinth
#

can you instantiate a LinkedEntityGroup ? or do you need to instantiate each entity of the group manually ?

ocean tundra
#

if you instantiate a prefab entity that has a linked entity group they will all be instantiated

zinc plinth
#

ho nice

#

thx 👍

zinc plinth
#

hemm what's the way to remove a dynamic buffer from an entity ?

#

just RemoveComponent ?

ocean tundra
#

@zinc plinth Yea i think so

#

i dont normally remove buffers

ocean tundra
#

Do the FixedRateUtils currently released work?

#

Turns out the simple fixed update manager dosnt work

#

have to use the catch up one for now

frigid needle
#

is this really the latest way of doing collider casts in Unity Physics?

#

or have I missed a piece of documentation

ocean tundra
#

na thats it

#

tho you can cache alot of that

frigid needle
#

tho you can cache alot of that
@ocean tundra o wow how

#

how do you cache stuff?

ocean tundra
#

just in a system make a public field

#

store the physics world sustem

#

and the collider

frigid needle
#

ooh i get what you are saying, like prestore the input

#

and just change it accordingly

#

cool cool ty

ocean tundra
#

yea

#

and do it in OnCreate

frigid needle
#

has anyone had any trouble using 2 physics shape on the same object?

ocean tundra
#

the collider input onwards is fast and burst compatable i belive so dont worry about that

frigid needle
#

is it normal that haviong 2 physics shape on the same object doesnt work?

ocean tundra
#

i think its possible but not simple

frigid needle
#

even if put on a children

#

yeah figured damn

ocean tundra
#

you need to use a composite collider i think

frigid needle
#

so like

#

when the frog lands on the lilypad

#

it stops it

#

but I want to somehow tell the other in the same lane too stop too

#

so im struggling between 1. using multiple colliders one small one big that fills the entire lane

#
  1. or at the time of landing, collidercast the ground to stop all in the same lane
#

guessing the second one is more efficient since I would only do collisions checks once at the time of landing right?

ocean tundra
#

not sure sorry

#

personally ill have a lane entity

#

that each lilypad has a reference 2

#

and set a bool or tag on that to tell it to stop moving all pads in the lane

frigid needle
#

nice ty

wary ibex
#

What's the most used way for transferring information between components and systems in ECS? For instance, say I have a wall and a ball - if the ball collides with the wall, then I want it to destroy the wall, or decrease its strength. What I have in mind to solve this kind of problem is the following:
Create a component such as WallHit which contains the following fields:

  • isHitting, force
    This component would be added to the ball, with isHitting = true and the hit force. The same component would be added to all walls, with isHitting = false. I would then have a WallHitDetectionSystem which loops through the WallHit and Translation components. If it finds a isHitting = true, then I compare that position from all others to find the component of the wall that was hit, and set force. Then, I would need another system, such as WallHitSystem looping through WallHit and WallComponent components to apply the force to the wall structure.

Is this a good way of doing this? Is there a better method?

deft stump
#

you can just use trigger events

vagrant surge
#

@wary ibex component doesnt work well

#

for example, what happens if a ball collides with 2 walls

#

or a wall gets hit by 2 balls

#

a much better way of doing this is through events of some sort

#

either an explicity collision queue, or creating new entities representing the collision event

#

collision queue is more rigid but can all be done multithreaded

#

creating new entities is most flexible and extensible, but it needs a sync point

vagrant surge
#

btw, creating entities will also be cheaper than modifying existing ones

frosty siren
#

creating new entities is most flexible and extensible, but it needs a sync point
@vagrant surge u can avoid job forced completion by sync points using ECBs

#

i know u know it, just repeat info for others))

north bay
#

Did burst 1.4 got removed? I cannot open the docs anymore

safe lintel
eager jungle
#

hey. Whats the best way to unload all ECS content and switch/load new scene ?

tawdry tree
#

Make a demon lord system to conquer and destroy the entire world?
More seriously, did you try simply loading a new scene?

opaque ledge
#

i mean.. that wont destroy entities since entity doesnt belong to a scene (except subscene i guess)

#

i probably would tag them "scene1Entity", "scene2Entity" etc

#

then delete the each entity with that tag once i am done with that scene

#

thats what i do at least

tawdry tree
#

That'd do. So a batch remove with a query on that tag?

opaque ledge
#

yeah, but apperantly when you are doing entityManager.Destroy(an_entity_query) doesnt work with entities that has linked entity group, so you have to destroy them one by one instead of thru query

eager jungle
#

yes entities are not destroyed, thats my problem

#

i disposed defaultworld and created a new one, seems to do the trick so far...

#

not sure whether there is a better option or not

opaque ledge
#

well i do entityQuery.ToEntityArray, and i do ForEach on returned array and destroy it 1 by 1, maybe not the most efficient way but whatever

eager jungle
#

problem is that systems does not restart

#

and in my case they do create singletons etc...

opaque ledge
#

you can expose it a public method named like "Restart" or "OnSceneEnd" and call it once your scene ends

rancid geode
#

yeah, but apperantly when you are doing entityManager.Destroy(an_entity_query) doesnt work with entities that has linked entity group, so you have to destroy them one by one instead of thru query
@opaque ledge I think it does work as long that all entities in the linked entity groups are collected by the query too

pulsar jay
#

had the same problem recently

#

you can get a native array from the query and then destroy the native array

opaque ledge
#

i dont think so, i actually tried that, but it gives error "the entity that is linked doesnt included in query"

pulsar jay
#

this will also remove the linkedentities

opaque ledge
#

it didnt work for me when i last tried 🤷

pulsar jay
#

took me a while to figure that out

#

you have to first do query.toarray

#

and then put the array into the destroy method

#

not the query

rancid geode
#

i dont think so, i actually tried that, but it gives error "the entity that is linked doesnt included in query"
@opaque ledge afaik, this is because some entity in the query has a linked entity that doesn't match the query

opaque ledge
#

hooo okay, that makes more sense Peaj 😄

pulsar jay
#

not sure if it makes sense 🤔 but it worked 😉

opaque ledge
#

well it does make sense 😄

#

i think 🤔

zinc plinth
#

ogod

#

I just searched for how to scale physics collider

#

this rabbithole is deep

#

and seems like there is no solution at all...

dull copper
#

in short, don't do it

#

it's always been an issue with every physics engine I've used

#

also, why would you need to scale it?

safe lintel
#

i dunno, why wouldnt you want the option to scale it 🙂

dull copper
#

unity (dots) physics being stateless could help on this though as there's no cached stuff

zinc plinth
#

is there a way to "rebake" a collider and apply it to an entity ?

and I want to be able to move my grid(which contain tiles, and those tiles have colliders) and scale it; I don't want to do that all the time tho so I wouldn't mind just having the colliders be wrong until I want to redo them

dull copper
#

normally, your objects don't need to change their scale

#

like, things don't usually just shrink

safe lintel
#

i think for the majority of cases it doesnt happen or the way it does can be handled with some size variations stored beforehand, but on the indie side of things you can do some fun stuff with adjusting scale on the fly so 🤷

zinc plinth
#

so, is there a way to bake colliders ourselves ? the pile of systems handling the conversion is a big black box ^^'

safe lintel
#

its not a black box the code can be viewed

zinc plinth
#

yea, but it's complicated af

safe lintel
#

well yeah but its not a black box

zinc plinth
#

.>

safe lintel
#

can you make variations beforehand and store them rather than rebaking at runtime? i would imagine any rebaking of colliders during the game could incur hiccups but ive not tested it personally

zinc plinth
#

would really probably be done in job on another thread if done at all, because it's not something that need to be done absolutly imediately

and nah can't know the new scales before runtime

#

I guess I'll just reconvert a go and make it an entity prefab for the new scale

#

and steal the collider off it

#

that's not that dumb of a way actually Eyes

#

1 conversion isn't that costly

dusk relic
#

A component with type:Child [B] has not been added to the entity. what does that [B] mean? I'm trying to access child buffer on an entity which definitely has the buffer, but unity disagrees.

zinc plinth
#

@dusk relic disable burst

#

thne you'll see the real error

lean cedar
#

If i'm new to Unity, should I wait until the 2020 releases or basically, more things support dots, before bothering to learn dots? so i can focus on the bigger picture.

zinc plinth
#

you're going to wait a long ass time if you do that @lean cedar

#

dots prod-ready is 2022+

#

you still can do alot now

#

just need to invent workarounds sometimes 😁

#

(like for my physics collider scale problem earlier)

safe lintel
#

@lean cedar if you're new to unity id ignore it for the time being. job system and burst if you're feeling adventurous, entities if youre feeling a little masochistic 🙃

zinc plinth
#

well, it can be good to not get the habbit of evil game objects Eyes

safe lintel
#

theres so much to learn and then so much thats in flux, i cant imagine learning dots ecosystem as it stands while being a newcomer to unity

zinc plinth
#

I kinda did ThinkMan

worked with go for +-4 months for a project for uni, then I looked into dots and it looked back at me monkaCan

#

the first few weeks were rough ngl

#

putting to the trash the whole concept of reference types was rly hard, cuz I only ever worked with OOP languages before

lean cedar
#

well the concept of entities didn't sound complicated to me, but i'm thinking that I should wait until i comfty with Unity because all guides I lookup won't be in dots.

zinc plinth
#

one thing is, you will find very few up to date dots tutorials

lean cedar
#

tbh dots sounds exciting, but I wanna get moving on my project

zinc plinth
#

yea don't start a first project will dots

#

the learning curve is wayyyy higher than regular unity

if you were just having fun in the engine, then why not; but if you want to get stuff done keep dots for later

eternal ice
#

yea don't start a first project will dots
@zinc plinth Why? Quite the opposite, DOTS is more useful for learning. Yes, it will take more time, but it will make understanding of programming much deeper.

lean cedar
#

ok. maybe after I complete the project i'll try to convert it.

dots sounds like it's just a Model and Controller kind of deal from web stuff with some c# interfaces

zinc plinth
#

@eternal ice but if you're graded for a project you don't want to lose time

#

I rather give back a mess that works great than clockwork engineering that does nothing

lean cedar
#

no this is a personal project

zinc plinth
#

ha ok

lean cedar
#

and it's mostly a visual text editor that i'm making. an IDE i guess for modding the XML of a game.

#

so mostly it'll just be UI elements

#

and scripts

#

no physics or rigid bodies

zinc plinth
#

dots doesn't do UI yet, so you're kinda out of luck

lean cedar
#

well that answers that then

zinc plinth
#

yup

lean cedar
#

ok ty

zinc plinth
#

np 👍

eternal ice
#

Perhaps in you project Xamarin is better for you?

#

There is still a rather interesting project under development uiforia.io
It lets you do UI with XML in Unity

safe lintel
#

@eternal ice well considering navmesh, animation and audio are more or less non existent or so work in progress that you would be better off rolling your own(or use the builtin which werent you trying to avoid by using dots), and rendering lacks critical things like more than a single light for urp, no lightmap baking, v2 super buggy, id say theres plenty of good reasons someone new should avoid it, just off the top of my head

#

if youre a beginner and want to build a project, easiest thing would be to just ignore it.

eternal ice
#

@safe lintel I am making a mobile game with a rather large number of units on the screen in the mode of constant search for the path and avoiding obstacles, and almost all units change the goal every frame.
DOTS is my only option ...
And to be honest, I'm even glad about it. I learned a lot of interesting subtleties of the engine. I wrote his shader animator and renderer of dynamic units, as well as static renderer. Bypassed the avoidance of obstructions through physical callers. Through NavQuery did a search for the path. And completed a lot of calculations through SIMD.

#

It's fun to understand that you are one step better at understanding the tool you are working with.

zinc plinth
#

damn, that's cool that you were able to use some simd

eternal ice
#

It was hard to figure out how to choose the best values and indices, but it was worth the x3 execution speed ...

safe lintel
#

honestly you already sound fairly advanced unless you also started learning unity at the time as well? sounds like it was the right choice for you though

eternal ice
#

I have been working with Unity for quite some time. But over the last year of studying DOTS, I rethought OOP and began to better understand the basic structures and the interaction of the software with hard parts.

safe lintel
#

just saying that imo a beginner to unity should steer away from dots for now 🙂

eternal ice
#

Maybe. As a self-taught programmer, I have always lacked some fundamental knowledge, and DOTS forces me to fill these knowledge gaps. If you have enough time to study, then when choosing OOP or DOD, the latter will be more profitable.

safe lintel
#

i do think in the future dots will be far more appealing than gameobjects and oop, the paradigm of systems and components just seems like it will make more sense to newcomers

frigid needle
#

anyone know if its possible to NOT use unsafe pointers when using casts?

safe lintel
#

i dont think so, but why?

frigid needle
#

honestly it just "seems" like not the correct way

#

i guess its a syntom of the library being on beta

eternal ice
#

Unity Physics and Havok Physics are pretty low-level stuff. I don’t think that they will soon change their api towards providing "safe" structs.

frigid needle
#

Unity Physics and Havok Physics are pretty low-level stuff. I don’t think that they will soon change their api towards providing "safe" structs.
@eternal ice guessing I should not asume that just because the "disable unsafe code" is unchecked it needs to be wrong somehow

#

new to unity

eternal ice
#

If you look at what's under the hood of Span and many other .NET structures, you will find a lot of unsafe code. If you act with him as part of a documented case, they will be as safe as the rest of the code.

#

"C#" is an excellent language since It gives two layers of api. Safe with garbage collection and other features and Unsafe which allows you to get a little closer to a clean "C" with manual memory allocation, working with pointers, allowing you to achieve significant performance.

#

"disable unsafe code" says that you agree to switch to advanced mode with С#. In principle, it is just as safe, but it allows you to do more things, some of which can break something. As Uncle Ben said to Peter Parker: "With great power there must also come great responsibility"

frigid needle
#

yeah I understand, I come from C its just that I because I had to tick a box in the UI my PTSD triggered lmao

#

but now I know that it can be done and its better that way

eternal ice
#

You can create an Assembly Definition in some folder specifying Allow ‘unsafe’ code to separate the unsafe part from the safe

real timber
#

good luck

gusty comet
#

anyone knows why after adding [NativeDisableUnsafePtrRestriction] to this struct

public struct DracoJob : IJob {
        [NativeDisableUnsafePtrRestriction]

        public NativeSlice<byte> data;
        public IntPtr outMesh;
        public int result;

        public void Execute() {
            DracoToUnityMesh* tmpMesh;
            result = DecodeMeshForUnity(data.GetUnsafeReadOnlyPtr(), data.Length, &tmpMesh);
            outMesh = (IntPtr)tmpMesh;
        }
    }

i still keep getting an error about unsafe pointers not being allowed when calling the Run() function of the IJob?

inland herald
#

Could someone please offer some guidance as to the best way to render skinned meshes with bones and animations that can still have things attached to them (swords/weapons/armor etc)

wary ibex
#

I'm wondering if this issue I'm having is due to the physics library or some part of it. I believe I'm doing everything correctly, but: I am applying gravity to the player towards the centre of the sphere (-normalize(playerPos - spherePos) * gravity) and it seems like whenever I jump, the player is attracted to either of the poles instead of landing where it jumped from. Also, when I get close to the equator line, I just get put into orbit. I don't think it's just an issue with friction because as I said when I jump, I land in a different spot. I'm just confused as to why that happens.

deft stump
#

can I use the 2D entities package without project Tiny?

lean junco
#

hiyall, anyone using the visual editor for dots? how far is it from v1?

gray copper
#

anyone know when the new netcode is going to be release

#

d

deft stump
#

@gray copper in 2021 version.

gray copper
#

is that delayed? @deft stump

zinc plinth
#

delayed would be an understatement

stiff skiff
#

The beta releases are still adding APIs so im a bit worried about the stability once it releases

deft stump
#

A Hybrid Renderer V2 batch is using a pass from the shader "Shader Graphs/New Shader Graph", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer.

mint iron
#

@gusty comet because your NativeDisableUnsafePtrRestriction is positioned above the NativeSlice. Its a per-field thing, so you need to put it directly above the IntPtr outMesh

deft stump
#

so 2D entities doesn't work without tiny? whyyyyyyy

mint iron
#

going back to 2020.1 seems to have solved the hybrid crash i was having; same package versions/code.

zinc plinth
#

you were on 20.2 ?

#

don't cut yourself on that edge Eyes

mint iron
#

yeah i was on 2020.2 last weekend, it blew everything up

leaden hatch
#

Every few seconds I'm getting a 30 ms spike from garbage collection performed as part of "onperformculling"

#

my world is made up of ~100k entities with meshes, of which almost none are ever moving, so I'm wondering if this is normal or maybe I'm doing something wrong

#

nvm, after turning off all dots safety checks it stops.

frigid needle
#

hey guys, should I stay away from using other render pipelines aside from the Standard with DOTS? or is it all 'supposed' to work atm

mint iron
#

i would stay away, they're overhauling hybrid rendering right now and its not stable.

zinc plinth
#

is there a way to use ConvertGameObjectsToEntitiesField in a system instead of inside a IConvertGameObjectToEntity's Convert ?

#

it asks for a GameObjectConversionSystem but I don't know what to provide it

mint iron
#

ive never heard of ConvertGameObjectsToEntitiesField but a game object conversion system converts all instances of a MB when its found within a subscene.

zinc plinth
#

eizenhorn talked a bit about it a few weeks ago, and how it was kilometers better than ConvertGameObjectHierarchy because it doesn't create a conversion world on each call

#

I really wish calling manually every system involved into the conversion of a specific object was easier and more transparent..

#

ConvertGameObjectsToEntitiesField would be even more efficient for me here because I have like 20 go trees I need to convert, not just one

mint iron
#

what does it do?

zinc plinth
#

takes an array of GO, spits out an array of entity

#

and it uses a single world for that

mint iron
#

is this for runtime conversion? ideally you wouldnt convert anything, its all just baked into a subscene

zinc plinth
#

yea runtime

#

basically I'm going around the problem of scaling for physics colliders by rebaking entities with the right scale as prefabs then to use for all the other stuff

mint iron
#

its probably possible to rebuild/edit the colliders at runtime

zinc plinth
#

maybe it is

but the code for it is not readable for me lol

#

rebuild definetely not afaik

frigid needle
#

@zinc plinth do you want to spawn a prefab or something like that?

#

as an entity

zinc plinth
#

I have my array of go prefabs that I Instantiate, set the right scale, then immediately convert to entity; add Prefab component to the entity, and store the entity away to use as prefab later

frigid needle
#

iinteresting

#

why dont you set the scale before?

zinc plinth
#

it's at runtime

#

happens when I change the scale for w/e reason

frigid needle
#

oh so i guess the scale depends of something at runtime

zinc plinth
#

yea

mint iron
#

what if you put a scale component on, and change that at runtime, the colliders dont consider it i assume?

frigid needle
#

^

zinc plinth
#

I admit I'm completely overengineering this because I have no idea why I would ever change the scale

nah scale is baked into collider at convert time

frigid needle
#

FooData { currentScale = 1f; }

zinc plinth
#

all of those types have diferent properties and ways they work

#

so big no

frigid needle
#

i edit scale at runtime its not that hard

zinc plinth
#

scale at runtime yes easy

#

scale of physics colliders, hellnah

frigid needle
#

word

#

physics colliders are low level

zinc plinth
#

yea

#

ecs & 2020.1 is enough madness for now without pulling my cpu appart 😁

#

owait

#

I have an idea ThonkEyes

#

what if instead of calling ConvertGOH 20 times, I create a empty GO, and put all my instantiated prefabs as children of it

#

and I just grab the Childs of that converted empty go lol

#

pog

frigid needle
#

im wrapping my ahead

#

about how your code is

#

because

#

I used prefabs

#

but i never use these funtions you talk about

#

whats

#

ConvertGOH

zinc plinth
#

GameObjectConversionUtility.ConvertGameObjectHierarchy

#

it's because I do alot of runtime conversion without ConvertToEntity; while you would prefer for ConvertToEntity to do all the work for you >.>

frigid needle
zinc plinth
#

I do that because I need to grab back the converted entity within that system's OnUpdate

frigid needle
#

and lilypadprefab looks like

#

this

#

i suppose we are doing different things for sure

#

i havent looked at your game

zinc plinth
#

"Prefab" in editor is a GO, it gets converted to Entity at start time

frigid needle
#

yeah yeah its just that you can get that automatic

zinc plinth
#

and I can't use that authoring mechanic because
1: I don't want an endless list of properties for every asset of my game
2: physicscollider problem

#

I have some codegen to generate a component with a property for every asset needed; and use reflexion to iterate and do work on each property

#
using Unity.Entities;

namespace Game.Scripts.ECS.Components.Grid {

    // this file is auto-generated by GridPrefabsComponentCodeGen
    public struct GridPrefabs : IComponentData {
        public Entity GridTile;
        public Entity GridMemberTest;
    }
}
#

^ that thing stores all the currently good entity prefabs

frigid needle
#

yeah that pretty much exactly the same as my code

#

we on the same page

#

looks*

zinc plinth
#

yup but with codegen & without the automatic conversion

frigid needle
#

thats interesting ive never heard of codegen being used for unity

#

whats your use specifically?

#

what does it facilitate?

zinc plinth
#

not writing properties that I will forget about by hand lol

frigid needle
#

lmao nice

#

quality of life then

zinc plinth
#

my code for it is pretty trash ngl

#

yea definetely

#

I battled for days to get AssetBundles to get compiled within AssetPostProcessor to not have to rebuild them manually because I know I will forgot; that ended up not working

#

using Addressables now; and AssetDatabase for all that editor/codegen stuff

#

I have like an interface that I add to the "spawner/converter" component of every type of go I have; and the codegen just uses the getter set in that interface to know what to name the field in the component

#

so now the only risk is to accidentally edit that field in editor ^^'

frigid needle
#

what the fuck is AssetPostProcessor lmao

#

enlighten me

zinc plinth
frigid needle
#

OOOH

#

cool cool

#

i never used unity before :p

#

i jumped straight into ECS

zinc plinth
frigid needle
#

so i know nothing about normal unity lmao

zealous shoal
#

can someone help me with my game real quick

zinc plinth
#

don't ask to ask

zealous shoal
#

what

zinc plinth
#

unless you wanna go recursive about it

frigid needle
#

i can whats up bro

zinc plinth
#

don't ask to ask a question

zealous shoal
#

its a problem thats been bugging me for days with scene management

frigid needle
#

ow shit is this DOTS related?

zinc plinth
#

oboi, subscenes

zealous shoal
#

no

frigid needle
#

try me i dont promise

#

ooh then i have no idea

#

sorry

zealous shoal
#

you know where i could find someone who might?

zinc plinth
glacial bolt
zinc plinth
zealous shoal
#

i have tried

#

no one answered

zinc plinth
#

as I said

#

don't ask to ask

#

ask your specific problem so that people can actually help you

frigid needle
#

wells this is for DOTS discussions

#

:p

zinc plinth
#

yea I meant in the right channel ofc

frigid needle
#

sure

zealous shoal
#

i dont even know what dots is aha

zinc plinth
#

but just in general

frigid needle
#

do you know how discord works?

#

for real

#

not trying to bully

#

:p

zealous shoal
#

yes

frigid needle
#

at the left side

zealous shoal
#

yeah i know

#

just thought might find someone who could help me

glacial bolt
#

@zealous shoal Pick the channel and ask the question. Don't post off-topic.

frigid needle
#

@zealous shoal Pick the channel and ask the question. Don't post off-topic.
@glacial bolt thank you

mint iron
#

Are there any samples updated for animation package 0.5.1 yet?

safe lintel
#

only requests for updated samples 😅 😒

leaden hatch
#

does anyone know if the DOTS animation package uses instanced meshes, or if its just using dots to drive the animation calculations for a gameobject?

gusty comet
#

I have a question about "EntityQuery". It says in the documentation that "Get a NativeArray containing all the selected entities". How do I get the native array of those entities?

deft stump
#

"ToEntityArray()" returns an array of the selected entities.

gusty comet
#

@deft stump do you have to dealocate it afterwards and if so how

#

wait don't answer that I know what I just did....

#

Since "IJobForEachWithEntity" is now obsolete

#

and the system reccomends that we use Entities.ForEach

#

How do I now get an Index for the Entity?

#

Nevermind found the answer to that as well..... I hope

gusty comet
#

Entity entity = entityManager.CreateEntity(typeof(Translation),typeof(LocalToWorld),typeof(RenderMesh),typeof(Scale),);

#

This code does not produce a visible entity on screen. is there something missing

gusty comet
#

Never Mind .... Found the answer

gusty comet
#

@robust canyon you got a min

#

anyone here?

safe lintel
#

like int entityInQueryIndex in your foreach

willow plaza
#

Is there any point in using unity ecs in the next way:
simulate the game logic in ecs, but have actual gameobjects with animators and renderers that are controlled by the said simulation? Would it be better to just not use ecs at all?

odd cipher
#

Soo how would I have a 4D array as a 1D array?

opaque ledge
#

lol 😄

#

same with 2D i suppose

gusty comet
#

yeah, the indexing is the same just extended to 4 ds

tawdry tree
#

Protip: Make a helper to convert between flattened index and multidimensional coordinates so that your bugs can all be found in one file 👍

odd cipher
#

Any example though?

gusty comet
#

start with a 2d example then try to move it to 3d then add in the 4th

#

you'll find a pattern

tawdry tree
#

A simple 2D array
[[0,1,2]
[3,4,5]
[6,7,8]]
accessed like arr[1][1] --> 4
You want to convert it into flattened 1D array
[0,1,2,3,4,5,6,7,8]

#

The difficult part is to convert between 1D flattened index and 2D position, but you should be able to think up the math, and there's tons of resources if you search a bit online.

odd cipher
#

Yeah I tried searching directly for 4D ones and didn't really find much on google.

wary ibex
#

It's quite easy actually. For 2d the 1d index is just (rowLength * columnIndex + rowIndex)

odd cipher
#

Yeah I know, I use 2D ones as well.

gusty comet
#

try making it 3d then

#

[[0,1,2] [[9,10,11]
[3,4,5] [12,13,14]
[6,7,8]] [15,16,17]]

odd cipher
#

Already have

#

I have a 3D one that I want to make into a 4D one for well more data

gusty comet
#

[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17]

#

try to find the pattern there

wary ibex
#

as you increase dimensions, you add the product of all rows/columns (this assumes rows and columns are fixed). i.e:
(accessingDimensionNumber-1) * (maxRows * maxColumns) + (rowLength * columnIndex + rowIndex)

gusty comet
#

😦

wary ibex
#

?

gusty comet
#

I wanted him to figure it out, tbh

odd cipher
#

Yeah honestly I rather want a working method to do it and just use it, I don't really have a reason to learn how it really works.

#

Not sure what you mean by "accessingDimensionNumber-1" and the difference between "maxRows" and "rowLength"

wary ibex
#

maxRows and rowLength are the same, sorry

#

and accessingDimensionNumber is actually the plane you're accessing (3D). Starting by 1

odd cipher
#

That's still 3D no?

wary ibex
#

yes it was a 3d example

odd cipher
#

ah

gusty comet
wary ibex
odd cipher
#

Thank you! I got it working

wary ibex
#

👍

willow plaza
#

Is it normal to have this warning when importing the entities package?

Library\PackageCache\com.unity.entities@0.11.1-preview.4\Unity.Entities\ApiCompatibilityLevelTest.cs(2,10): warning CS1030: #warning: 'Project is expected to have API Compatibility Level set to .NET Standard 2.0'
#

I thought it requires .Net 4?

tawdry tree
#

.NET Framework 4.x (4.5+ IIRC) supports (is a superset of) .NET standard 2.0

#

.NET standard is more generic than .NET framework, .NET core, or the few other API compatabilities

willow plaza
tawdry tree
#

Since you're getting a warning, that's probably a good idea

willow plaza
#

Alright, thx!

#

also, it seems like some things have changed since the time a tutorial that I watch was made, I can't find a GameObjectEntity component. Is there any place I can read about it?

#

Is there any up to date tutorial about hybrid approach where we can use the standard unity components along with the ecs?

tawdry tree
#

Put "Convert To Entity" on the gameobject and any authoring components will be converted for ya. Also, one moment and I'll link a recent enough tutorial

#

Oh, "standard unity components along with the ecs?"

willow plaza
#

but that's not exactly what I want

#

I can't convert an animator for example

tawdry tree
#

You mean link monobehaviors and entities?

willow plaza
#

yeah kinda

#

in the past there was that GameObjectEntity component that allowed to kinda link between systems and standard components. Why was it removed? Is there a different way now?

tawdry tree
#

If you're starting from scratch, you should avoid that in general

#

Go for fully entity or fully gameobject objects

willow plaza
#

Hmmm... I thought a hybrid approach is a good idea. At least that's what I heard from other people...

tawdry tree
#

For the time being you want to author, ie. build your objects in gameobject and convert them, and there are some things that must be gameobjects(particles), but if you link it too heavily you get less and less benefits from the DOTS model

willow plaza
#

Yeah, I realize that, but there's no other way at the moment. And I want my project to be transitionable to pure ecs in the future.

#

No way to achieve animation and particle systems via ecs

tawdry tree
#

As much as possible, your gameobjects should have a convert to entity component with destroy gameobject or in an entity subscene (two different workflows, look them up if you want to), but for some things you might need convert to entity and inject gameobject.
Similarly, you want as much logic as possible in ECS vs gameobjects

#

"As much as possible" here means that, yeah, animation and particles, among others, must be elsewhere.

willow plaza
#

alright, I'll look it up.

#

thx!

#

I wish there was a full-fledged updated tutorial on dots, explaining how to get stuff done =/

tawdry tree
willow plaza
#

but that's more about pure ecs, is it not?

tawdry tree
#

Aye

#

The logic is pure ECS

willow plaza
#

What I mean is like a tutorial about how they deal with these questionable topics like animations and stuff that is not yet implemented properly...

tawdry tree
#

Aha

#

I think there are some of those in the sample project, but haven't looked into em myself

willow plaza
#

From what I've seen in the samples, they don't touch on anything like that. Maybe I should recheck it...🤔
Anyways, thanks for the info!

tawdry tree
#

In general, as long as you have the reference to the entity that you're going to animate/entity from which you want particles, you can then you World.EntityManager.GetComponentData and such to get the appropriate data for setting animations and particles

willow plaza
#

I see

opaque ledge
#

you dont need to use ECS stuff at all, just use structs and use bursted jobs for good performance

tawdry tree
#

That's true, you can get a lot of perf simply by putting heavy work, or work that's done a lot into well-made and bursted jobs

#

depends on why you want to do DOTS in the first place, of course

willow plaza
#

It started from a question in general code. I was asking about an idea that I had a for a prototype. Basically this:
For ease of prototyping and to avoid rewriting code when I finish the prototyping phase, I wanted to use something similar to MVC pattern, where my character controller logic is separate from it's visual representation. In other words, there will be a script/s that handles movement, collisions, combat and many other character states. That will be the model. Then there will be a script that is responsible for view which can be extended via inheritance and stuff. For example a prototype capsule character's view script will respond to Model events, like movement and taking damage, by simply moving the capsule and changing it's color. While if I won't a full-fledged character with animations and stuff, I just need to extend that view script to respond to the Model with animations and such.
The point was to separate game logic from visual representation, in order to reuse code and split responsibility.

However, in response I've got many suggestions to just use ECS pattern, because that's the equivalent to MVC in gamdev. Now, the person that suggested that didn't mean dots explicitly, however after some research I found out that in the past it was possible to use a hybrid approach where you use Gameobjects mainly and delegate some of the functionality to the ecs systems. However, when I tried following one of the tutorials(from 2018) I found out that many things were changed leaving me now uncertain about how to proceed with this "hybrid" approach...

#

Specifically, I'm not sure what is the common approach now to sync data between ECS components and gameobject components. In the past there was that GameObjectEntity component that took care of both creating the ecs representation of the Transform and also synced back to it whenever a system updated the ecs representation of it...

opaque ledge
#

the thing is.. DOTS is preview, and you have to figure out stuff on your own, if you dont have time for it simply dont go in 😄

#

to sync Transform-Translation, you should put "CopyTransformFromGameObject" or "CopyTransformToGameObject" depending on what way you want to sync

#

and you have to add a GameObject to entity thru entityManager.AddComponentObject(entity, new GameObject())

#

you can do that in an authoring component

willow plaza
#

Ah, that's what I was looking for!

opaque ledge
#

👍

willow plaza
#

I wonder why they changed it from the GameObjectEntity approach. It seems like a step backwards to me =\

opaque ledge
#

i am sure they have their reason 😛

#

such a shame that Unity dont have any samples to work with in an hybrid way, would help many people

willow plaza
#

yeah

#

Anyways, thanks for your input!

#

Now I know in what direction to move at least.

tight blade
#

are collision filters in Unity Physics not a thing yet? I cant find any information about what collision filter the entity belongs to in the entity debugger, even though its an option you can set in the inspector

#

and, it doesn't seem to be filtering anything

tawdry tree
#

Pretty sure you can do BelongsTo and CollidesWith, but no idea if it works?

tight blade
#

right, yeah, you can set BelongsTo and CollidesWith in the inspector, but it doesn't seem to do anything

zinc plinth
#

@tight blade filters does work

#

it's just a bitmask

tight blade
#

so is something not being propogated to the simulation? is there something in the authoring component that is missing?

zinc plinth
#

you need to use a CollisionFilter (for raycasts at least)

#

didn't try the rest yet

tight blade
#

yeah, this isn't a raycast, its literally dropping one entity on another and expecting it to fall through if not in the same filter

frigid needle
#

how did you test that CollidesWith wasnt doing anything?

#

guessing everyone is referring to this

tight blade
#

I have Collision Response set to "Collide" - my objective is for certain things to collide and arrest movement and certain things to clip through. Is this a case where I'm a fool and don't know how regular unity works?

frigid needle
#

Well that does seem like what you have to do

#

But I dont think Collision Response is DOTS related is it?

warped trail
#

Collision Response is for generating collision or trigger events🤔

tight blade
#

Its confusing to discuss because the term collision is overloaded. I am attempting to create the following behavior:
3 Objects, 2 types: AAB. If I drop an A object it falls. if it hits another A it stops. It will fall right through a B object.

So by collision I'm referring to whatever Unity Physics is doing once I add Physics Shapes to prevent two objects from passing through each other. I don't think that's implemented with a monobehavior so surely it is DOTS related

#

A -------><-A A------B----->

frigid needle
#

that looks like you should be able to handle all that with only the COllidesWith tag

warped trail
#

yes you can achieve this behavior with Collision Filter

frigid needle
#

do all entities have physicsshape?

tight blade
#

so, experimentally, collideswith has no effect whatseover. go create some objects and set them all to collideswith: None. give some of them physics bodies so they fall. Observe they all collide, ignoring collidesWith

frigid needle
#

im gonna do exactly that

warped trail
#

did you set belongsto correctly?🤔

frigid needle
#

how did you see physicstags?

#

found it nvm

#

I think this guy isnt wront

#

look

warped trail
#

works perfectly fine 🤔

frigid needle
#

show settings please

#

I guess you ahve to set the belongsto

#

too

#

but show shape settings please

warped trail
#

i have plane that belongsTo A and 2 boxes that belongsTo B, plane can collide with everything, boxes can collide with A, but not with B

#

boxes clip through each other but collide with plane

frigid needle
#

first the ball, second is the platform

#

is this what you are talking about @tight blade ?

tight blade
#

yeah, im observing what Magda is

frigid needle
#

we might be doing something wrong and just assuming the wording must do X

#

but IMO that SHOULD work like we expect it to

#

yeah because how can an object that belongsto and collideswith NOTHING still do that

#

even if you set both to nothing they still collide

#

is this a bug?

warped trail
#

in my project it clips through 🤔

tight blade
#

really?

frigid needle
#

really?

#

video

#

unity version?

#

im using all the newest

#

newest unity, newest libraries

tight blade
#

Unity,Physics,ECS -> 2019.4.2f1, 0.4.0, 0.11.1

frigid needle
#

so it might be a problem with the newest unity physics library

#

cause our unity versions are differents

#

and the version JUST released

tight blade
#

Well, we need to know drUiD's version first. I have the same behavior as you do

frigid needle
#

yep

#

@warped trail whats your UnityPhysics package version?

tight blade
#

be back in a bit, I'm interested in finding this out, though

warped trail
#

latest physics package 🤔

frigid needle
#

what the fuck

#

of course

#

what an idiot

#

i wasnt removing the other colliders that come with the default meshes

#

it works as intended now, thats probably what gearless is experiencing too

warped trail
frigid needle
#

yep

tight blade
#

other colliders? oh whaaat?

#

haaaaa

#

welp. that'll do it

#

Huh, I didn't realize those colliders were taken into account at all

#

other than calculating the physics shape during the conversion process

#

well, thank you both exceedingly. @frigid needle thank god you made that same error while reproing, or I may have never figured that out

#

@warped trail thank you for not making that mistake lol

warped trail
#

😅 👍

tight blade
#

Hey @frigid needle this is off topic and I'll move it to a DM if anyone else comes in with actual #archived-dots questions but: I like your post process toon shader! did you follow a tutorial or is that a Magda original?

frigid needle
#

oh man im not using any shaders 😦 i wish i knew

#

i just did my voxels in MagicaVoxel

#

and set the lighting to white and thats pretty much it

#

lil bit more intensity too

tawdry tree
#

There's a number of shader graph tutorials for toon shaders. Not sure how compatible (ie. easy to get working) that is with DOTS, though

frigid needle
#

the problem with that is that

#

shaders graphs arent compatible with the standard pipeline, are they?

opaque ledge
#

there is no standard pipeline, you mean built-in renderer ? then yeah, they are not compatible, shadergraph is only compatible with scriptable render pipelines which is lwrp/urp and hdrp right now

frigid needle
#

yeah thats what I meant

#

for the ones still interested

#

its possible to get scriptable pipelines with the hybrid renderer

#

unity 2020 + required

#

and the define symbol to be set too, to enable hybrid render v2

zinc plinth
#

isn't v2 enabled by default on 2020.1 ?

frigid needle
#

i dont know

#

downloading it right now

#

probably is, although documentation says otherwise

zinc plinth
frigid needle
#

it is 😮

#

you should also get a console warning?

zinc plinth
#

huh ?

#

what console warning

frigid needle
#

allegedly

zinc plinth
#

nope

frigid needle
#

lies

#

all lies

#

lmao

#

does DOTS have a subreddit?

#

or an IRC or any other discussion platform?

zinc plinth
#

there's the forum, but I guess here is where you'll get the most support

dull copper
#

there's more Unity staff on the forums

#

but yeah, don't use reddit for DOTS

#

I mean you can but I bet you'll just have horrible time if you do that

frigid needle
#

has URP 9.0.0 released yet?

#

or do I have to download from github to use it

deft stump
#

urp 9.0.0 preview versions are

ocean tundra
#

Can I treat world.SequenceNumber as a world ID?

#

in the world code it looks like it is set in the constructor and never changed

hollow sorrel
#

seems like that'd work

#

as long as you don't serialize it

ocean tundra
#

yup

hollow sorrel
#

i don't think it's guaranteed to be the same every time

ocean tundra
#

i just want a way to say this gameobject belongs to this world

#

without each gameobject having a reference to world

hollow sorrel
#

yea seems safe enough then

#

or you'd have to subclass world

#

if you want to give a persistent id

#

speaking of worlds does anyone know what i need to do to automatically load subscenes into a custom world

ocean tundra
#

Ooo

hollow sorrel
#

i've set DefaultGameObjectInjectionWorld but that doesn't seem to be enough

ocean tundra
#

i just fought with that

#

oh automaticly...

#

i can do it manually

hollow sorrel
#

manually would be fine too i just have no idea what kind of magic subscenes are doing to replicate

ocean tundra
#

ok so the first big issue i had

#

is you need a catalog.bin

#

which is made via the build, i cant seem to find a way to make them generate in editor mode

#

super annoying

hollow sorrel
#

whhaaat

ocean tundra
#

yea drove me up the wall

#

so so stupid

hollow sorrel
#

how do you even find that out

ocean tundra
#

so much code diving

#

and you have to use that new build pipline

#

heres what mine looks like

#

im not 100% sure if you need your subscenes in that list

hollow sorrel
#

isn't that the new outdated one since new new is script only

ocean tundra
#

but i just added them

#

dude what

#

i have no clue

#

i thought it was the current one

hollow sorrel
#

yea they deprecated the build configs even tho they were only just added

ocean tundra
#

wtf

#

what

#

but its so nice

#

oh well

hollow sorrel
#

[Platforms 0.3.0] - 2020-04-09

Build pipeline major overhaul: build pipelines are no longer asset based, and instead must be implemented in code by deriving from BuildPipelineBase class. Build steps are no longer mandatory but can still be used by deriving from BuildStepBase.

ocean tundra
#

i made a build

hollow sorrel
#

yea no idea why

ocean tundra
#

i dont know

#

ill just leave that for now

#

anyway

#

make a build

#

and check in your build data directory, the streaming assets folder

#

and steal its catalog.bin

#

and put that in your streaming assets in edotr

#

then to load you do:

var sceneSystem = _targetWorld.GetExistingSystem<SceneSystem>();
            var sceneId = sceneSystem.GetSceneGUID("CoreGameAssets_SubScene");
            _loadSceneEntity = sceneSystem.LoadSceneAsync(sceneId, new SceneSystem.LoadParameters()
            {
                Flags = SceneLoadFlags.LoadAdditive,
                Priority = 1,
                AutoLoad = true
            });
hollow sorrel
#

wow

#

and you gotta rebuild every time you change a subscene?

ocean tundra
#

to check to see if its done you can do sceneSystem.IsSceneLoaded(_loadSceneEntity)

#

god probably

#

i havnt touched it

hollow sorrel
#

ohman

ocean tundra
#

yup

#

not a fan of subscenes atm

hollow sorrel
#

is scenesystem something you made

#

or unity

ocean tundra
#

unity

hollow sorrel
#

ahh i see

#

do you add other unity systems to your custom world

#

for subscenes

#

or just that one

ocean tundra
#

um im using the default init stuff

#

kinda

#

look for

#

SceneSystemGroup

#

you need every system under that

hollow sorrel
#

oic

#

thanks

ocean tundra
#

all good

#

was a pain tho

#

im sure there must be easier ways

hollow sorrel
#

i sure hope so

ocean tundra
#

also

#

subscenes are very 'noisy'

#

like they bring in a ton of extra components on your stuff

hollow sorrel
#

what do you mean

ocean tundra
#

you get a entity like this

hollow sorrel
#

ahh

ocean tundra
#

theres another entity too

#

but unity just died

hollow sorrel
#

i guess that's not too bad, would prob end up with the same if you wanna unload scenes anyway

#

i assume editorrenderdata doesn't end up in your build right

ocean tundra
#

yea i guess my stuff is weird

#

ill just kill the whole world instead of unloading stuff

hollow sorrel
#

what kind of project are you working on

#

you had like a billion worlds right

ocean tundra
#

MP RTS

#

😛

#

kinda

#

1 for server

#

1 per player

hollow sorrel
#

ah

ocean tundra
#

but wanting to have 'realms' or some such feature

#

which each realm would be 1 world

hollow sorrel
#

what's a realm in this context

ocean tundra
#

um a game map

#

with units/buildings/ game stuff happening in it

hollow sorrel
#

ah

#

ye that makes sense

ocean tundra
#

its a ton of fun to work on

#

but i keep messing with the core networking

#

almost got it happy

hollow sorrel
#

still ENet?

ocean tundra
#

yup

hollow sorrel
#

noice

#

are you going the full determinism route

#

since it's a rts

ocean tundra
#

nope

#

client server

#

like planetary annihilation

#

i just dont have the skills to do determinism

#

on top of all the other stuff

hollow sorrel
#

yea it'd prob be more work

ocean tundra
#

definitly

hollow sorrel
#

are you not gonna run into bandwidth problems then

#

with all the units

ocean tundra
#

i hope not

#

😛

#

they talked about their underlaying data tech

#

and i copied it

#

and there are a TON of optmizations i still need to do

#

like Fog Of War, only send unit info that you can actually see

hollow sorrel
#

oo

#

haven't seeen much about planetary annihilation but damn they even do replays

#

nice

ocean tundra
#

yea

#

free perk of their networking data layer tech

#

i have replays too

#

but havnt saved/loaded it out yet

#

had a super annoying bug, and i could just 'scroll' back in time to see what was happening

#

ive actually broken that feature now, but will build it back into my proper debug tools soon

hollow sorrel
#

yea that sounds really useful for debugging

#

@ocean tundra btw thanks, seems adding the systems in SceneSystemGroup is what was needed to make Auto Load Scene work 👍

ocean tundra
#

sweet

#

so how do you load the sub scenes?

hollow sorrel
#

i just make them inside my scene

#

regular scene

#

and they have a property for Auto Load Scene on the monobehaviour

#

so when you load the regular unity scene it auto loads the subscenes in it

ocean tundra
#

Oooo

#

so do you start in that scene?

#

or change to it?

hollow sorrel
#

haven't tried yet but changing to it is the idea

#

starting in it seems to work so i assume changing also does

ocean tundra
#

hmmm yea so thats probably what i missed

#

i should load the scene addictivly

#

and then try to load my sub scenes

#

might not need that weird catalog rubbish

hollow sorrel
#

yea

#

i plan to have scenes consisting of only subscenes so only have to worry about loading the actual scene instead of loading individual subscenes

#

and let unity handle loading subscenes

#

tho i don't think they automatically unload when you unload the scene but that's a problem for another day

ocean tundra
#

i think the subscene entity has some sort of reference to scene

hollow sorrel
#

whoaa could be wrong but seems it does actually unload the entities when you unload scene

#

thought i read somewhere this wasn't planned because they don't want to assume your entities should disappear when you unload a unity scene

ocean tundra
#

man no clue

#

these subscenes feel so annoying to use

ocean tundra
#

So disabling the presentation group dosnt hide the entities of that world

hollow sorrel
#

you using hybrid renderer?

ocean tundra
#

yea

hollow sorrel
#

i remember something about it caching stuff so if you're disabling it at runtime it might not care

#

might have to add a DisableRendering tag to your entities

#

unless you're disabling before it ever runs in that case i dunno

rancid geode
#

[Platforms 0.3.0] - 2020-04-09

Build pipeline major overhaul: build pipelines are no longer asset based, and instead must be implemented in code by deriving from BuildPipelineBase class. Build steps are no longer mandatory but can still be used by deriving from BuildStepBase.
@hollow sorrel BuildPipeline are no longer asset based, BuilfConfiguration still is, before we had BuildPipeline and BuildSettings, now we have only BuildConfigurations (previously names BuildSettings)

hollow sorrel
#

ahh i see

#

thanks for clearing that up

stiff skiff
#

A debugging question. Is there a way for me to track when certain change versions update?

#

There are some components that I'm pretty sure I'm not updating, but still seem to pass the ChangeVersionsFilter

#

I'm guessing there is some API call that changes the filter which i've missed, but there doesn't seem to be any tooling to debug this

amber flicker
#

This kind of stuff is tricky to debug isn't it. Two quick things - I think Eizenhorn mentioned that if you're doing anything with buffers they're marked changed every frame even if you only read? (I could be mis-remembering) and 2, there was some work on the forums for a generic reactive system thing which may help debug/test certain scnearios - https://forum.unity.com/threads/reactive-system-generic-way.919997/

stiff skiff
#

Yeah, normally i'd set some sort of memory write breakpoint, but alas its all in native land

zinc plinth
#

@amber flicker you can't tell when you write to a buffer because it's just an array

And overall there's an attribute in EM's method that say "this is a 'breaking' change"

stiff skiff
#

Do you mean the StructuralChange attribute?

mint iron
#

last i heard everything that is not marked as read-only (via In) has its change version updated, even if you don't do anything to it.

wary ibex
#

Is there any way to run pass a method for Entities.ForEach instead of the lambda within the same method?

zinc plinth
#

@stiff skiff yea that one

#

@wary ibex there's codegen involved in Entities.ForEach, so I quite doubt you can do that

tho you can call your func in the lambda and have nothing else in it Eyes

stiff skiff
#

@zinc plinth note that that is slightly different from the change version stuff or the reactive systems Timboc is talking about

zinc plinth
#

ha

stiff skiff
#

a structural change is a change in archetype, or other change in data layout

willow plaza
#

I'm still trying to get into ecs, specifically the hybrid approach. And there's something I don't completely understand. In the docs for IComponentData it says the next thing:

Fields of an Entity type in the IComponentData are reflected as fields of GameObject types in the generated MonoBehaviour. GameObjects or Prefabs you assign to these fields are converted as referenced prefabs.

Does that mean that I can access the gameobject via an entity and call stuff like GetComponent and such from anywhere in my project that has access to that specific entity?

#

or what do they mean by "referenced prefabs" here?

tawdry tree
#

Sounds like it does the conversion process on them, so you have a prefab entity with a pointer to a gameobject

#

Where did you even find that quote? I can't seem to find it

#

When you make an authoring component from an entity with an entity reference, the generated GO script has a field for another gameobject instead.
On conversion, if said gameobject is also converted, you get a reference to that.

tawdry tree
#

I assume it otherwise does a copy-conversion and adds the Prefab tag to the generated (and referenced) entity

willow plaza
#

hmmm

#

Guess I just need to dive into the samples, since the docs just confuse me the more I read them 😄

#

Like I understand the Core ECS section more or less. But the Creating gameplay is just so abstract...

#

If they were to give some more concrete examples, that'd help a lot...

tawdry tree
#

In other words, at authoring time you have a gameobject, and in the script you reference another gameobject.
If said object is in the scene and is converted, you just get a reference to that. (so you end up with two converted entities)
Otherwise you end up with your converted entity, plus a converted entity of the gameobject it pointed to. This second generated entity will have the Prefab component, which stops systems from affecting it (unless specifically told otherwise)

#

The easiest way to understand that is to make an empty project and some very basic components, really

#

As for

Does that mean that I can access the gameobject via an entity and call stuff like GetComponent and such from anywhere in my project that has access to that specific entity?
No

#

Unless you point to a convert-and-inject gameobject in your scene

#

But that's business as usual - convert and inject makes an entity and makes you able to access entity from GO and other way

willow plaza
#

Oh, I couldn't find a lot about that convert-and-inject thing in the docs... Is it documented anywhere?

tawdry tree
#

Probably?

#

When you add the convert to entity script to a gameobject, you can either convert and destroy or convert and inject

#

I think there are other components you can add if you are doing other workflows, such as entity subscene

willow plaza
#

Yeah, I kinda got what it does from some unofficial videos and articles, but I just finished going through the latest docs version and there was literally not a single word about it...

#

at least not in the manual part. I bet there's something in the scripting api, but these review package scripting docs don't provide any description at all ><

#

guess I'll go back to code monkey's tutorials and sample scenes =/

opaque ledge
#

what are you trying to do ?

willow plaza
#

just trying to understand the common workflow of communicating between ECS and non ecs stuff...

#

I realize that in ideal it's all gonna be ecs, but that's not the current state of affairs now, right?

opaque ledge
#

you can always add a monobehaviour to your entity thru entityManager.AddComponentObject, and create systems that queries that class, however you need to run that system with WithoutBurst().Run()

#

you can also create a monobehaviour assign an entity field and check it's datas thru entity manager, could be great for UI, such as player hp etc.

willow plaza
#

you can also create a monobehaviour assign an entity field and check it's datas thru entity manager, could be great for UI, such as player hp etc.
@opaque ledge what's the common workflow for that? For assigning an entity to a monobehaviour.

#

is it done during the conversion?

opaque ledge
#

when you create your entity 😄

tawdry tree
#

Which is either during conversion or when you spawn it at runtime?

opaque ledge
#

oh, never really did advanced stuff in conversion

#

i generally add it later on

willow plaza
#

So I can create a component that holds a reference to monobehaviour?

opaque ledge
#

yeah that too

tawdry tree
#

A class ICD could do that, but it would be not optimal, and all interactions would be on main thread

opaque ledge
#

public class MyComponent : IComponentData{
public MyClass Value;
}

tawdry tree
#

I say "not optimal", but I don't think there's any other way

#

It just breaks the unity ECS model and is harder to reason about and debug

zinc plinth
#

@willow plaza what would be your usecase for this

willow plaza
#

So IComponentData is really the one common workflow that most people use for that task?

#

@zinc plinth I don't have a use case yet, but if I were to say, probably to pass some data to the Animator component on a Gameobject

opaque ledge
#

or like i said, you assign an entity to a monobehaviour and check its data on update method

tawdry tree
#

It depends

it depends
it depends

//it depends
zinc plinth
#

I think there's a Animator package for dots ?

opaque ledge
#

i think Hodhandr tried to say "it depends"

willow plaza
#

@zinc plinth I had a look at it but it's really in the beginning stages of development and they even warn that you need to be "tech savy"...

tawdry tree
#

As long as you have an Entity reference, you can access everything about that entity using the EntityManager, even from gameobjects.
Could probably even do it in random classes outside the unity game loop if you really wanted to break things.

zinc plinth
#

I'd prefer to become "tech savy" rather than butcher ECS that way 😁

tawdry tree
#

As for the other way... Same thing, kinda?

#

The simplest way i can think of is that your animated gameobject just has a reference to the entity and grabs all the data it needs from there

#

That way you don't dirty the ECS side, and updating the gameobject is not a responsibility any part of ECS should have

willow plaza
#

As long as you have an Entity reference, you can access everything about that entity using the EntityManager, even from gameobjects.
Could probably even do it in random classes outside the unity game loop if you really wanted to break things.
@tawdry tree I guess that's what I wanted to hear. I always had this image that entities and gameonjects are kinda separated by this impenetrable wall...

opaque ledge
#

yeah, unfortunately many people think like that because Unity has no example of it, but in reality it is pretty easy

#

i didnt know class ICD was a thing and i didnt know ForEach actually supported class ICDs

#

which makes things much easier 😄

tawdry tree
#

ForEach needs .WithoutBurst() and .Run() to use any managed types, though. Which is... literally any class.

opaque ledge
#

if its simple you can still go with Entity field in a monobehaviour and do stuff in Update method

tawdry tree
#

I always had this image that entities and gameonjects are kinda separated by this impenetrable wall...
It's not exactly an impenetrable wall, but it is a wall, and by design and pattern, you could consider it a one-way mirror; gameobjects can see, but not change entities, while ECS doesn't know gameobjects exist.
If you separate things like that you should have minimal issues.

willow plaza
#

ForEach needs .WithoutBurst() and .Run() to use any managed types, though. Which is... literally any class.
@tawdry tree they have this piece of information documented very well, but not what you said earlier. 😄

tawdry tree
#

That's a bit of a slip
"oh yeah you can use classes"
(forgets to mention class ICDs)

zinc plinth
#

huuh, I can't find the animation package in the docs ?

willow plaza
#

@zinc plinth I think there's a pinned message to it's docs and samples.

tawdry tree
#

it's super WIP, so not that surprising? If you're referring to the DOTS one

zinc plinth
#

huuh thx

willow plaza
#

I was thinking of using it, but it's not quite clear how to deal with transitions between animations and states. I guess they expect us to implement our own state machine in ecs...

tawdry tree
willow plaza
#

Alright, gotta experiment with that to understand it completely! Thanks for clarifying things again, people!

gusty comet
#

what is the general consensus on running jobs within jobs.

opaque ledge
#

you cant, what are you trying to do ?

gusty comet
#

@opaque ledge I was just wondering

#

I'm still wrapping my head around SIMD

opaque ledge
#

well, you cant 😄 something about determinism, there is a chapter in entities manual i think

gusty comet
#

I realized what I said, after I said it. I have entity and foreach entity I spawn new entities in a regular foreach loop. Furthermore the spawned entities spawn further entities. So 1->2->3

#

1 is the parent of 2s and 2 is the parnet of 3s

#

It wasn't a job but now I want to see if I could make it a job

#

it works but, sometimes I can't leave well enough alone

#

So the way I would go about handling this would be to create a job for 1s (right now only one is created but that is for testing purposes)

#

Have a native array returned from the job

#

have that array as input into the 2's job. this will create entity and set it's parent as one of the 1s

#

return a native array of those and feed that into the 3's job

#

?

opaque ledge
#

yeah most likely something like that

#

do note however, if you are using command buffer to create your entities, they wont actually exist until they are playback later on, so if you are trying to put child entity to parent entity's data, it wont work

scarlet inlet
#

Hello I would like to have a world to use as "reset world" so that I can dispose of the actual worlds anytime and create new ones with the systems and entities of the "reset world" or default world if you prefer

#

is there a way to do so?

#

copying systems is not a problem as we do it already (maybe not the best way), but copying entities I am not sure

low tangle
#

Custom bootstrap to get the type collection of systems you want. Create a empty world there to store the entities.
When you want to get a copy of it, you create a new world, init using those systems. Then do a bulk copy of the entities into that world

scarlet inlet
#

yes it's the last bit I miss

#

how can I do a bulk copy of entities?

low tangle
#

Since the world that is holding the entities is not updated the entities will stay in the form you initially place then e

#

Uh forgot the exact way, I'll look in a bit. I remember there being a entity manger transfer something something method

#

Oh there's a new one too for this actually

#

One moment

scarlet inlet
#

thank you

low tangle
#
 public void CopyAndReplaceEntitiesFrom(EntityManager srcEntityManager);
        [StructuralChangeMethodAttribute]
        public void CopyEntities(NativeArray<Entity> srcEntities, NativeArray<Entity> outputEntities);
        public void CopyEntitiesFrom(EntityManager srcEntityManager, NativeArray<Entity> srcEntities, NativeArray<Entity> outputEntities = default);
#

all within entity manager, likely want the last one

frigid needle
#

Does someone know the performance implications of chunks?

#

like what exactly are they and what mantra should I keep in order to 'maintain' them correctly

#

they somehow group entitites right?

low tangle
#

you don't really maintain chunks

frigid needle
#

are they like a linked list?

low tangle
#

they are managed by the runtime

#

no they are fixed buffer of bytes, interpreted as a SOA

frigid needle
#

service oriented architecture?

low tangle
#

structure of arrays

frigid needle
#

ooh wow

#

so just a fixed size buffer

low tangle
#

yes

frigid needle
#

and they prolly save entity info right?

#

like the pointers or something

#

or the IDS

low tangle
#

once per whole structure

#

the ID array is included in the SOA

#

I don't know if the chunk archetype is actually stored within but it could be

#

it doesn't matter in the end

frigid needle
#

interesting so i guess the chunk archetype

#

is the struct thats being used

#

to save info in the chunk right

low tangle
#

not exactly no

#

its only used to get the structs within to do a pointer offset for each of the arrays of each of the components + entity structs with the ID's

#

they do compacting as well so theres likely a id-offset array as well

frigid needle
#

ooooh ok ty

#

is there an advantage

#

to having your entities in the same chunk?

low tangle
#

yeah this is as fast as it gets

scarlet inlet
#

thank you June!

low tangle
#

yes, very high chance of caching which is exactly what you want

#

no problem

frigid needle
#

NICE, thats what I was looking for!

#

so entities in the same chunk = cache = good

#

thanks!

low tangle
#

yep

warm panther
#

Here's a terrible antipattern, "find the first n entities that fulfill the requirements".

#

I suppose this would be better with an entityquery and a nativearray?

#

but anyway, is there a way to break out of an entities foreach?

frigid needle
#

return;

#

or prolly continue?

warm panther
#

continue doesnt work of course.

frigid needle
#

yeah

#

its a function lmao

warm panther
#

return is a "continue"

frigid needle
#

what exactly do u want to accomplish with your code?

warm panther
#

I guess EntityQuery.ToEntityArray() or something.

frigid needle
#

yeah ^

safe lintel
#

honestly it should be fast enough that its not a concern, if you have that many entities that it is a concern then yeah maybe consider adding another way of separating it into a different query?

warm panther
#

In this case, "find the first player-owned Vessel entity that's not got a TagUIfocus"

#

(the code does something with the local variable afterwards)

frigid needle
#

in this context who is "frist" and who is second

#

first as in

#

the first that got instantiated?

warm panther
#

first as in "any"

#

don't care which, just need one.

frigid needle
#

what you are doing should be fine

#

although if i remeber correctly

#

you can filter foreach

warm panther
#

WithChangeFilter is interesting I guess.

#

but probably throws the entire chunk at me.

frigid needle
#

however

#

your code is wrong i think

warm panther
#

Nope works great.

frigid needle
#

vessel != Entity.Null

warm panther
#

yes.

frigid needle
#

that will never run will it?

#

oooh no i seee

#

didnt see the first line

warm panther
#

That will run on every run but the 1st

#

I mean in SIMD code, you often try to be as branchless as possible. this code branches all the time. Could invert the if, but it's still smelly.

#

So I'd consider this foreach a total antipattern in DOTS.

#

obviously in this case it's harmless - player seldom owns more than 100 ships, more likely 5 or so.

warm panther
#

I want a system that runs once whenever whenever an entity has LOST a certain tag.

But this query is illegal, because I can't filter for it AND ensure it's not there.

#

I guess I need to set up a tertiary tag, like "TagUnfocus" or something.

tight blade
#

I don't want to interrupt/add noise to this conversation, but I have a question of a different kind to put out to everyone when this topic is winding down.

warm panther
#

My topic is kinda wound down, ask away 😄

tight blade
#

nice. sweet

#

I want to make "ice skates" style friction work in unity - by which I mean that when ice skates move laterally, they have more friction than when they move on the axis of the blade. Im not using it for ice skates, so if the topic moves into workarounds I can go into more detail about the use case.

#

but let me show a video of how drag works in unity physics now:

#

sorry I just filmed it on my phone, I dont have capture set up

#

but those are two cubes rotated 45 degrees with an initial X axis velocity of 5

#

one is, obviously, rotated 90 degrees against the axis

#

you can see the result is not the same as the way ice skates work, lol

frigid needle
#

yeah so

#

you basically want to reduce the velocity of an object IF its moving laterally

#

right?

#

so like based on the orientation

#

if its moving forward or backward its fine

#

but you want to lessen the effect of how it drifts side to side?

tight blade
#

well, actually, I want to reduce the velocity of an object in proportion to the amount of contact its making with the friction surface

frigid needle
#

the amount of contact

tight blade
#

this is actually for water, and the hulls of boats

#

if a boat is moving in line, there's less drag, which is why boat hulls are designed with a narrow profile

frigid needle
#

so your question is how do you simulate less drag if moving in a line?

tight blade
#

so, if the answer is to homeroll the physics calculation, I can keep looking into it myself. I was mostly just wondering if theres like an option in unity physics that would make this easy and out of the box

frigid needle
#

im 100% sure there isnt

#

you have to program that behaviour yourself

tight blade
#

okay, dope. thats a very useful answer

#

that rules out a lot of searching

frigid needle
#

good stuff

tight blade
#

by the by, any idea whats going on with unity physics that causes that one cube thats moving laterally to just drift forever?

#

there must be some kind of dividing by zero situation going on lol

frigid needle
#

just another thing from your past question

#

i think you could simulate what you want

#

by adding angulardamping

#

so the engine could help you a little

#

if you are in a bout

tight blade
#

well, angular damping is reducing angular velocity, no?

frigid needle
#

"turning" would be difficult

#

yes

#

if "turning" is diffucult

#

then moving laterally is too

#

just a thought

tight blade
#

oh, I see, you're saying in general for a sailing sim. Yeah, I see what you mean

#

yeah, I'll keep it on the radar

frigid needle
#

how do you apply the force to the cube?

#

just set its linear velocity?

tight blade
#

in that video? I have the initial velocity set in the physics body authoring component in the inspector

frigid needle
#

so in theory