#archived-dots

1 messages ยท Page 134 of 1

opaque ledge
#

but perhaps someone with more experience can explain better

vagrant surge
#

it does it per-component i believe

#

it then, when it executes, it keeps track of the last time stuff changed

#

and if last time was.... last frame, then all good

scarlet inlet
#

yeah I know it's awkwawrd to ask about internals, but how can all this stuff be "fast"

vagrant surge
#

because it early-outs

scarlet inlet
#

I assume that the framework knows automatically if something changed

#

but how does it know what I want to track?

loud matrix
#

And today the burst compiler has decided that trying to debug log a float is too much and is throwing errors.

vagrant surge
#

it does the version numbers on all chunks

#

no matter what

#

on all comps

#

and yeah, the granularity is per-chunk

scarlet inlet
#

so are you saying I can't know if one specific entity changed?

vagrant surge
#

indeed you cant

scarlet inlet
#

how can this be useful?

vagrant surge
#

but generally its not that much of an issue if you execute the entire chunk of like 100 entities

#

and if you really, really want that per-entity tracking, then you will have to have a "X_old" component, and do the tracking yourself

#

@scarlet inlet because its basically zero overhead

#

having properly done change tracking, like entitas does, costs a huge amount of perf, and oblierates parallelism

scarlet inlet
#

I know that's why I was asking

vagrant surge
#

it is indeed very useful. Think of the transform system. You only need to update matrix if the params change

scarlet inlet
#

in svelto I don't do entity tracking, I leave to the user the responsibility to "publish" an entity change. It's basically a publisher/consumer stream

#

but the cost is the that user must call publish for the entity, it's not automatic

vagrant surge
#

what i was thinking of doing in my own ecs, is to have "bitmask" components

#

so user can just set "changed = true" on a specific bit inside a chunk

#
  • the version numbers as that is easier to filter
scarlet inlet
#

ok thank you I think it's fair enough

frosty spoke
#

Hey im pretty new at unity and i need help
when i try to add a button on the unity main camera screen it generates a canvas and the button created is too huge and dosent fit in the camera view can anyone please help me

stone osprey
#

@coarse turtle Thanks ! I guess im gonna take a look at that ๐Ÿ™‚ not quite sure if i really wanna consume the entity... i probably need multiple consumers

#

Thats where the event queue could be usefull

#

@frosty spoke Wrong chat

frosty spoke
#

sorry

stone osprey
#

Is there a way to get a job from a Entities.ForEach.Schedule() ?

frosty spoke
#

where do i go??

stone osprey
#

Using SystemBase for my System... is there a way to convert a Entities.ForEach().Schedule() into a jobHandle ? I found a Schedule() which takes a job handle as a param... but the describtion is missing... any idea ?

warped trail
#

@stone osprey var jobHandle = Entities.ForEach().Schedule(Dependency)

stone osprey
#

@warped trail Thanks ! So i only need to pass a newly created job handle into it ?

warped trail
#

Dependency is property of SystemBase

#

this thingEntities.ForEach().Schedule() is doing this under the hood Dependency = Entities.ForEach().Schedule(Dependency)

wary ibex
#

why are all DOTS packages in lowercase?

loud matrix
#

Anyone know why quaternion.Euler and Quaternion.Euler would provide radically different outputs?

amber flicker
#

radians vs degrees

loud matrix
#

ahh damn I forgot about that, that needs to be made bold on the docs

odd cipher
#

is there a way to call a function when a job is completed?

#

I think I'm trying to get values before they are completed

stone osprey
#

@odd cipher Use jobHandle.Completed() this waits till the job is completed before you execute the code after it

#

Is there a c#/NativeCollection which allows me to use non blittable structs and datatypes with parallel writing ?

odd cipher
#

I guess that isnt the problem then, how can I just set a NativeList's items from a different NativeList?

#

it seems to just not work

stone osprey
#

Is a IComponentData with a stored interface reference blitable ?

untold night
#

no, unless it's a generic type constraint for an unmanaged concrete type:

// This isn't blittable:
public struct MyComponent : IComponentData
{
   public IMyInterface Value;
}

// concrete instances of this should be, but each concrete struct type will require registration with the [RegisterGenericComponent(...)] assembly attribute
public struct MyGenericComponent<T> : IComponentData
 where T : unmanaged, IMyInterface
{
   public T Value;
}
stone osprey
#

@untold night Thanks ! Is there a little trick to store a reference to a interface inside a component ?

#

I heard about FuncPointers, but im not sure if they work here

odd cipher
#

I've tried clearing the list and just setting it to a different list but it doesnt seem to work

untold night
#

I don't know if the componentdata serializer can handle that for structs. You might just want to use a reference component type instead:

public class MyInterfaceReference : IComponentData
{
   public IMyInterface Value;
}

I've not messed with this much yet but there's *ComponentObject() variants for most of the entity manager operations now

Won't be usable in burst jobs, but as long as the reference is stable it could work on non-burst jobs

#

also make sure the struct or class itself is marked with [System.Serializable]

#

otherwise unity won't even pick it up for serialization

stone osprey
#

@untold night Alright, thanks a lot ! ๐Ÿ˜„

#

Another question i just came up with... is there a way to use "..." managed strings inside a burst compiled job ?

untold night
#

No, there's work being done on using FixedString* and friends

#

but I don't think it's landed yet

stone osprey
#

It looks like those structs already exists in 0.8.0

untold night
#

what you can do for logging and other cases is use [BurstDiscard] on functions you want to be able to use strings in.

For logging I've found this generally works.

FixedString* does, but I don't think the Debug.Logs have variants that work with them

#

If you want to do manual operations on FixedString or use them for lookup/hashing, that already works

#

but if you want to log them currently, you have to pass them to a [BurstDiscarded] function and then convert them back to a normal string for Debug.Log

stone osprey
#

Well thats good... is there a way to convert a FixedString into a NativeString32 ?

untold night
#

FixedString* == NativeString*, the nativeString versions are being deprecated, as FixedString more accurately describes the structure of the data

#

they are byte-for-byte identical

stone osprey
#

Thanks ! Just tried that... unity still says "Unmanged strings not supported inside burst compiled jobs"... had "new FixedString("eventKey");" inside a Entities.ForEach loop :/

untold night
#

oh yeah, literals aren't supported yet

#

you could create static readonly versions and cache references to those, then use them in the job

stone osprey
#

@untold night Thanks !

#

I tried out that FunctionPointer idea... looks like its working, atleast no error... just have no clue how i set that FuncPointer to a value

#

Anyone having experience with FuncPointers ? I cannt find any code examples on it... invoking them is no problem, but how do i set them to a value ?

stone osprey
#

@warped trail Thanks gonna take a look at that ๐Ÿ™‚

#

Alright... a new approach... im trying to create a struct which acts as a event... it should contain a message and a array of passed trough params...

#

The message is no problem, but how should i store a array inside the struct when unity does not allow this ? Im not using that event struct for the ecs, its needed for nativearrays...

warped trail
#

there is fixedlist ๐Ÿ˜…

stone osprey
#

@warped trail Thanks ! That actually helps... sooo the second problem are the references... i basically want to have a dynamic event struct which is able to store up to 5 parameters of all types... so i need to store "object" somewhere... but the fixedlist only allows primitive types and certain structs asfar as i know

#

FixedList needs a valid unmanaged type

warped trail
#

i don't think you can store object in components๐Ÿค”

zenith wyvern
#

You should be able to using unsafe code

stone osprey
#

@warped trail And heres where the fun begins... exactly... i cant store those types into components... but i still need a way to store them in there... doesnt matter if those are pointers etc...

#

@zenith wyvern Unsafe code ? Regarding the usage of pointers ? Or burst ?

zenith wyvern
#

Using pointers yes. I don't know how to do it personally but I've seen people talking about it. Obviously since it's unsafe code you shouldn't be doing it unless you actually know what you're doing.

stone osprey
#

@zenith wyvern Thats honestly a real problem... atleast for data structures which include references to other objects :/ The other problem here is that theres no way in c# to obtain a pointer adress of a managed type... that makes it even harder

zenith wyvern
#

I think something like that would generally be done using a self-contained custom NativeContainer

warped trail
#

maybe store your objects in array and index to this array in component? ๐Ÿ˜…

zenith wyvern
#

There's PinGCObjectAndGetAddress

#

Maybe you could store the pointer from that inside a component. I have no idea if it works but I know we can store UnsafeLists in components which are just pointers to the actual list. The caveat is you have to do the cleanup yourself or you'll leak memory (and it won't tell you about it).

#

Since you're basically just bypassing the safety system by doing it

naive parrot
#

whats the simples way to pass entities iterated within a ForEach into another ForEach? add to NativeContainer ?

#

within same system

stone osprey
#

@zenith wyvern Thanks ! Im gonna try that and play around a bit... probably theres still a way to let the garbage collection kick those out... c++ atleast had automatic pointers

warped trail
#

@naive parrot or copy them from query๐Ÿค”

naive parrot
#

how?

warped trail
#

query.ToEntityArray

#

query.ToEntityArrayAsync

naive parrot
#

that simple? wow cool

stone osprey
#

Soooo thats getting exciting right now... heres my own "Event" struct for storing and sending events... IParams is a high level interface which is simply used to store the param references inside a dictionary with their original type, needed some way to make that struct compatible with my original event class https://pastebin.com/AgLvcFZR

stone osprey
#

So all in all that shit does not work out... unity does not allow boxing

#

@mint iron Someone told me that you wrote a event system for dots ? Is it public ? ^^

stone osprey
#

@opaque ledge Thanks !

#

Is there a way to acess a managed method inside a foreach scheduled loop ?

raw mica
#

Good day,

I have a question concerning DOTS + GO Architecture. I am planning to do a project with DOTS entities for physics, collisions and events but have a GO that will used for rendering purposes only. What is the most seamless way or recommended way to setup a Entity->GO sync relationship?

dull copper
#

@raw mica easiest is to just make sure you don't have hybrid rendering package installed, use convert and inject and make authoring script that puts CopyTransformToGameObject component to the entity with physics body

raw mica
#

Thanks.

dull copper
#

it's not ideal but it does make your GO follow the entity counterpart

#

I have this looking script on my old proto: ```cs
using Unity.Entities;
using Unity.Transforms;
using UnityEngine;

[DisallowMultipleComponent]
[RequiresEntityConversion]
public class AddCopyTransformToGameObject : MonoBehaviour, IConvertGameObjectToEntity
{
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddComponentData(entity, new CopyTransformToGameObject());
}
}

raw mica
#

I'm basically using it for dumb rendering :P. I suspect I may run into issues when it's time for effects but I'll see.

dull copper
#

if you need something that you can customize, basically you could just copy CopyTransformToGameObjectSystem from entities package and make it do whatever you want

#

you can also assign entity a transform ref from other gameobject and make the different GO track that entity with this setup

raw mica
#

I'll give it a shot now.

dull copper
#

CopyTransformToGameObject is actually a leftover from old GameObjectEntity setup

#

you can't use the existing proxy as it'll add that GO entity class as well

#

it'll go away eventually

#

if it's just few entities you need to track, you could just get the entity id to your gameobject and poll the entity's position and rotation via getentitycomponentdata (or whatever it was specifically called)

#

but that previously mentioned system is better as it copies the transforms on the job system

raw mica
#

Sadly for Unity.Physics to work, everything that's physics interactable must be an entity.

#

So even the static world GOs are entities.

dull copper
#

yes, of course

#

I mean, it's a ecs physics system

raw mica
#

So it's more than a few ๐Ÿ˜› I meant to imply.

dull copper
#

ah, yes

#

for static objects, you can just use convert and inject tho

junior fjord
#

hi, I know this is pretty offtopic, but I know here are loads of people that use stuff that is still in preview and I only have 4 hours left until ludum dare deadline.

I built the UI with the UIElements package and therefore downloaded a folder UIElementsRuntime from github (the runtime version it is not in packagemanager yet). It works in editor but as soon as I built it says unknown element: UIElements.TextElement

dull copper
#

there's nothing to track dynamically

junior fjord
#

does anyone know how one can get unity do somehow compile that stuff too?

dull copper
#

@raw mica do note that convert and inject probably gets removed in the future, but it's there today still

raw mica
#

I don't mind if they remove it once HDRP supports rendering properly.

dull copper
#

nothing prevents you from having separate GO's for rendering and physics (which you'd then convert to entities)

raw mica
#

Honestly, it'll be a good day when GOs are deprecated.

dull copper
#

I'm actually going this path myself atm

#

it's bit more involved but it's super safe regardless what happens to entities on the future as I can even now use convert and destroy

raw mica
#

But a lot of workflow and other tooling needs to natively and visuall suport ECS.

#

Yes

dull copper
#

DOTS editor tooling is not in a good place

raw mica
#

I discovered this the hard way lol

dull copper
#

and wouldn't expect to see anything amazing on that front this year

#

it's been super slow development on the tooling side

dull copper
#

apparently I've broken the hybrid rendering again

#

I wonder if it's broken on newest hdrp staging which I'm using or just the 2020.2 alpha ๐Ÿ˜„

#

gotta love bleeding edge

#

trying to do some benchmarks here to get better understanding of the perf

#

I'll try github master first

#

oh snap, it was because I had netcode package installed

#

wonder if it just placed things into different world then

#

didn't even come into my mind to check that

safe lintel
#

i know its available to try but do they consider hybridv2 officially out?

dull copper
#

well, it's documented in official docs

#

and all dots is a big preview ๐Ÿ˜„

#

from hybrid docs: IMPORTANT: Hybrid Renderer V2 is experimental in Unity 2020.1. We have validated it on Windows DX11, Vulkan and Mac Metal backends in both Editor and Standalone builds. Our aim is to validate DX12, mobile device and console platform support for 2020.2.

#

I'd read that it being experimental for the time being, that doesn't exactly tell it'll be any different on 2020.2 for the experimental part

safe lintel
#

i know, it kinda like lurked out into availability when the srps were github only and they talk alot about last minute bugs etc that need fixing but now 9.x is on packageman and im still not sure what their expectations of it are with whats available

dull copper
#

there's still PRs going in to patch it on HDRP

raw mica
#

How does Unity.NetCode break hybrid renderer?

dull copper
#

it probably just threw things on different world or something

#

at least that would explain what happened

#

but most of the DOTS packages are in not so tightly integrated place

#

when you couple them together, things can break

#

it's kinda thing you get when things are still in preview and developed by different teams

safe lintel
#

in that dungeon samples repo i did note they mention scale not being properly supported, wonder if that will end up changing sometime later or just acknowledging the obvious

dull copper
#

I must say, hybrid renderer pretty much chokes the editor play for me

safe lintel
#

urp is still too broken for me to consider it, though i am kinda contemplating switching back to hdrp, lack of point light shadows is kinda driving me mad

#

no baked light, ambient light fully missing in v2, no point light shadows, doing an indoor game ๐Ÿ˜ฑ

dull copper
#

HDRP lighting is still broken on current hybrid v2 as well

#

mainly in a way that it uses wrong lighting intensity

safe lintel
#

well only when you press play right ๐Ÿ˜‰

dull copper
#

yea :/

safe lintel
#

i seem to recall hdrp kinda caused slower compilation overall quite a while ago(or was it a dream)? and it seems to not be such a problem now?

dull copper
#

they've made it a bit better but I'm frankly a bad person to ask about that as I upgraded cpu last spring and it kinda makes it impossible for me to compare current state to past anymore

#

for me it used to make basically the actual builds super slow

#

right now I'm getting 1-4 minute builds with IL2CPP and HDRP (both slow down the build a lot)

#

anyway, I just did a comparison with a level filled with mainly static geometry (but a lot of it)

#

if I don't convert for hybrid renderer, it renders ~5.4ms/183fps....with hybridv2 it took 9.0ms/111fps

mint iron
#

i felt like HDRP was much slower when i made a new project with it the other day. 2020 in general is much slower, i wish i could get v2 in 2019, i'd go back in a second.

safe lintel
#

longer build times dont bother me(for now), was just the script compile time which was definitely creeping up but this was a while ago and i removed all asmdefs and switched to urp so cant really be sure what was the cause

dull copper
#

initial project opening is slower for sure

#

oh bloody h*ll

#

I can get hybridv2 to render on about same perf or tad better than the GO counterpart

#

start the exe with that -job-worker-count 1

#

I wonder if I do something really wrong here

#

do I need to manually flatten the GO hierarchy for ECS conversion?

#

there isn't really deep hierarchies here tho

#

bunch of parent GO's that hold all the child meshes

warped trail
#

static optimize entity?๐Ÿค”

dull copper
#

it's same with dynamic physics bodies as well

#

any more worker threads than 1 and everything runs worse

#

it's like this is designed for dual core :d

#

well, it actually utilizes like 3-4 hw threads with that worker count 1 due to main thread + other threading in unity

#

@warped trail what do you mean by that?

warped trail
#

there is special authoring component static optimize entity

dull copper
#

heh, they removed the star rating system on recent docs:

#

"Did you find this page useful? Please give it a rating:"

#

yes, this empty api page is super useful, thanks ๐Ÿ˜„

#

(I hate autogenerated docs)

warped trail
#

with this component your entities won't get translation rotation and stuff

#

just localtoworld

dull copper
#

yeah, but I'd need to add this to each object with mesh renderer?

warped trail
#

at the top of you hierarchy

dull copper
#

ah

warped trail
#

no parenting and stuff

dull copper
#

that I can do

warped trail
#

this is what they used in megacity

dull copper
#

yeah, makes sense.. if it actually does that ๐Ÿ˜„

#

@warped trail thanks for the tip

#

now unlimited workers is only 0.1 - 0.2ms slower than 1 worker ๐Ÿ˜…

#

unlimited workers also consume 60% of the cpu where the better performing 1 worker version takes 10%

#

I guess I should make some repro project and take it to the forums

amber flicker
#

I touched hdrp for the first time the other day.. not sure if I was doing something wrong but I donโ€™t know what kind of min spec they are targeting. Certainly nothing faster than 60fps going by having a few spinning cubes. Canโ€™t tell if itโ€™s preview performance or expected.

dull copper
#

it makes no sense that I actually have to limit the job system to use as few workers as possible to get the fastest possible result when using unity's own stock systems for dots

#

I wonder if same happens with dots sample (3rd person shooter) or on megacity

amber flicker
#

Are you giving it enough to process? ScheduleParallel is like 5x slower than Schedule for small numbers

dull copper
#

I'm now talking about unity physics and hybrid renderer

#

without any of my own systems

amber flicker
#

Yea but theyโ€™re parallel under the hood right?

safe lintel
#

yeah im also curious about hdrp's minspec. last time i was using, disabling stuff in the config file didnt really have too great an effect

amber flicker
#

Or some systems anyway

dull copper
#

well, they sure run best with one worker forced to them on my end

#

I'd totally not expect this to happen

#

I can see that some things don't run that well on parallel but it does get just worse the more workers I allow

amber flicker
#

If youโ€™re running eg less than 1000 entities through the systems Iโ€™d expect the combined cost of scheduling all the systems to be higher than the cost to run

dull copper
#

there's like 18k entities now, where most of these are just meshes

amber flicker
#

Which is why Iโ€™ve been asking on the forum for a ScheduleParallel that takes a chunk count threshold - below which it would just use Schedule

dull copper
#

but it scaled like this even with under 1k entites too

#

oh I've seen ScheduleParallel always perform the worst on my own systems

#

but I only have very limited amount of entities that even use them usually

#

so that's expected

#

but this is now rendering and physics we are talking about

amber flicker
#

wouldn't their systems suffer from the same issue though?

dull copper
#

well apparently

#

because now I tried forcing worker count to 0 and it runs even faster :p

#

like, what for we need this fancy job system at all?

#

my use case here is super typical for any normal game

#

if you need to push like 100k simulated entities to get any advantage for the job system, I dunno if things are going that great for any regular game

#

I do welcome the burst boost though

#

also I'm bit worried about needing to manually limit the worker amount

amber flicker
#

yup - on the same page.. I can understand that scheduling across 22 threads+ is time-consuming... but something more intelligent needs to happen

dull copper
#

yeah, I mean, if it can't utilize the workers, it should scale down automatically

amber flicker
#

at the moment I'm manually switching the job that runs (schedule v scheuldeParallel) because of this

dull copper
#

it's just waste of energy right now

#

and I mean actual power running through the cpu now ๐Ÿ˜„

#

btw, for the ref, even with static optimize entity and zero worker count, I'm still 0.2-0.3ms behind the GO renderer version now

amber flicker
#

that sounds not right

#

but who knows

#

it's all experimental

#

I know urp performs much better.. but then it's kinda broken so

dull copper
#

it would help if there were some guidelines somewhere, telling what kinds of things this excels at and how to optimize for it ๐Ÿ˜„

#

but yeah, that's sort of thing you'd only see when the thing is fully released

#

actually, playing with various worker counts... it does seem to peak at 5 workers now with hybrid + static entities

#

it's about same ballpark in perf as with GO rendering with 1 worker

amber flicker
#

In case it's mildly interesting as a point of reference - 3900x rendering 200k cubes takes v roughly ~7ms cpu time (not total job time) - all moving - single, instanced mat not rendering properly.

#

Doesn't really say much but thought I may as well post it as I was looking at it.

#

Heading off now though - good luck with your thread explortation

warped trail
#

i thought DOTS was performance by default๐Ÿค”

raw mica
#

lol if you think anything is performance by default. Most of Unity's bad reputation comes from inexperienced Devs' code. It still takes experience and skill to make something performant.

#

Most of the ECS demos/videos are either very simple or the product of Unity's dev team (experienced).

#

Even before ECS, multithreading and struct/cache line memory optimizations for a lot of game code was still very much doable.

zenith wyvern
#

I thought StaticOptimizeEntity did nothing with Hybrid v2

raw mica
#

ECS + Jobs is aiming to make the standard development workflow that which is very easily optimizable and multithreaded and doing so on the engine level as well.

naive parrot
#

Burst + Jobs is where true value lies as of today for the 'performance by default' tagline.

raw mica
#

Yeah, "Burst" is just the marketing term for Native Code compilation.

zenith wyvern
#

And from my testing with URP with hybrid v2 rendering is ridiculously fast for non-moving entities, moving entities causes a huge performance hit from the transform system and updating render bounds

mint iron
#

i think we should refer to scriptableobjects as scrobs from now on

naive parrot
#

so

zenith wyvern
#

Stick your scrobs in your blobs

north bay
#

I dig that

raw mica
#

My face is imploding from cringe

odd ridge
#

I have problem with unity dots physics

#

If I put my dots physics sphere manually in the scene with convert and destroy, I can see it has 4 physics components and the collision works

#

if I try to instantiate the same sphere prefab in code

#

World.DefaultGameObjectInjectionWorld.EntityManager.Instantiate(hybridSphereEntity);

#

and collision doesn't work

odd ridge
#

okay, I found why. problem is during the entity conversion process before the instantiatino

#

I used to pass null to blobAssetStore, because it worked. changes to unity ECS now don't allow that anymore

#

so

#

I just need to find out how to get this blobAssetStore from..

#

okay, I just had to create a new one.

#

new BlobAssetStore()

dull copper
#

currently testing hybrid v2 on urp vs hdrp but I'd really need to get my crapputer back to working condition

#

testing on rtx gpu isn't ideal :p

#

my low end test rigs mobo is done, been looking for cheap spare for it now

#

I have i5+gtx970 on another rig here but that's not ideal for low end testing either

#

my low end rig has i3+gt640 and gtx670

#

I kinda expect hdrp to struggle there but urp should still work fine

#

on my current rig, I'm getting like 2.0ms on urp and 2.6ms on HDRP with hybrid v2 on my mainly static mesh scene when trying to disable all fancy feats and squeeze the best perf without caring about the visuals that much, for comparison I'm getting ~4.7ms on HDRP's somewhat default settings on the same scene now

#

it's kinda pointless to even measure when the figures are that low

low tangle
#

it still important

#

just remember that HDRP is going to use more compute shaders and be waiting on the gpu thread the slower the gpu gets

#

you will be able to view the graphics thread and see how long the compute operations are taking

dull copper
#

yeah, hence wanting to test on weaker rig ๐Ÿ˜„

#

my current cpu doesn't even have integrated gpu so can't try on it only

#

that i5 would have one though ๐Ÿค”

#

but I know even without testing that integrated intel is asking for trouble on hdrp

#

there used to be tons of rendering issues due to some intel driver bugs

#

btw, urp and hdrp probably still work on same project

#

I have both on my test project now where I'm just swapping between the two in the editor but I don't really have fancy material swap script on this one

#

could do hotswap on scripts if needed though as it seemed to strip urp and hdrp shaders separately for the build (so both probably work on actual build as well)

#

this has always been possible and unity has always strongly adviced against doing it ๐Ÿ˜„

#

I can totally get why, but at the same time, it's a nice plan B for low end graphics settings

low tangle
#

yeah it would be

#

I can't stand the split between the two

#

it makes it impossible for me to update my project to either as I need to support as wide of content as possible

dull copper
#

wonder how well the dynamic resolution would work on HDRP, could possibly get the last bit extra with it lowering the rendering resolution on the fly

#

heh, without shadows, urp 1.0 ms vs hdrp 2.1ms

#

this isn't some empty level either, there are those 18k static meshes here

low tangle
#

unique or same?

dull copper
#

mixed

#

there's like 250 unique meshes total

#

what's funky about having urp and hdrp on same project, despite that I'm having URP asset assigned, this project somehow resets the directional light intensity back to 10k every time I open the project

#

it's kinda weird, I wouldn't want it to do that even on HDRP

#

I have some faint memories of similar oddities back in the days when I made runtime hotswap test between LWRP and HDRP

#

it's not a big deal if you just swap the shaders and lighting values via script anyway

#

same pattern repeats with extremely low end setup urp, I get 1.0ms with one worker thread, and 1.6ms with uncapped workers

#

wonder if they could do something about this as this is far from ideal

#

anyway, I'll try to do some simple repo later on and post it on the forums, maybe get some feedback on this

low tangle
#

please do, thank you

vale nymph
#

Does anyone have any experience with this error? It shows up every time I open a scene with SubScenes after switching out the old BuildSettings with the new BuildConfiguration files. Even setting them back or going back a few versions won't fix the error

vale nymph
#

Nvm. Deleting the Library and reimporting it fixed it!

dark mauve
#

Is there a way for me to check if two PhysicsCollider's are intersecting?

#

For normal colliders I'd use bounds.intersect, but PhysicsCollider doesn't seem to have that

opaque ledge
#

ICollisionEventJob or ITriggerEventJob

#

yesterdays SBP's patch notes

- Merged in DOTS specific functionality into SBP core.
- Scriptable Build Pipeline settings now stored in ProjectSettings/ScriptableBuildPipeline.json
- Added option to remove extended debugging information from WriteResults before caching for better cache performance
- Added option to log Cache Misses to the console
- Switched to SpookyHash for Unity 2019.3 and higher for most hashing methods to edge out just a bit more performance
- Added multi-threading support to the archive and compress task
warped trail
#

@dark mauve do you want to cast one collider against another?

dark mauve
#

Yeah

#

Normally it'd be Collider.bounds.intersects(collider2.bounds)

#

but with these physics colliders and ecs it's different

warped trail
#

get physics collider and use .Value.Value๐Ÿ˜…

#

for example like this .Value.Value.CastCollider()

dark mauve
#

What input would I use? I see I have to use a ColliderCastInput, but this requires a Collider (doesnt allow PhysicsCollider)

warped trail
#

use .Value.Value from another PhysicsCollider๐Ÿ˜…

dark mauve
#

ignore the origin stuff

warped trail
#

try .ColliderPtr ๐Ÿค”

dark mauve
#

pointers and fixed buffers may only be used in an unsafe context

warped trail
#

then use in unsafe context๐Ÿ˜…

dark mauve
#

Alright, got that to work

stone osprey
#

Do you have any idea how i could create a "Event"-Struct for storing a event message and a set of passed trough objects ? The main problem here are the objects, because unity dots does not allow to work with objects in multi threaded code... any ideas ?

#

Already had a prototype... it used pointers... but well, dots also wont allow the usage of GCHandles, so it didnt worked either

mint iron
#

sounds like you're trying to pass class objects in an event entity? making an event entity is straight-forward, create an entity, and put components/bufferData on it.

stone osprey
#

@mint iron Thanks ! Thats exactly what i tried to do... played around with pointers, even tried to write byte data into it... the reason i tried this approach is, because my original event system worked similar and i could really need a bridge between the dots events and the UI events for example

#

Isnt the entity event approach limited by its consumer architecture ? You basically need one system which consumes those events... but how should we deal with there multiple consumers ?

low tangle
#

a trick I dont see mentioned often is to use two ecb systems, produce it from a initialization group ecb system (start of frame)
then query destroy it at the end of a frame (presentation ecb system)
you can then just access them throughout the frame from as many consumers as you want. you already pay for that sync point and bursted ecb playback is pretty fast now

stone osprey
#

@low tangle That sounds like a good idea... are there already tricks or classes to implement that kind of "frame start/end" behaviour ?

low tangle
#

You just take a ref to both systems and create in init and run a query destroy on the presentation

gusty comet
#

I've recently run into a spot of bother upgrading to Entities 0.9.1 where serialization with SharedComponent breaks, giving me this error:
MissingPropertyBagException: No PropertyBag was found for Type=[Some.Namespace.Stuff.SomeSharedComponent]. Please make sure all types are declared ahead of time using [GeneratePropertyBagAttribute], [GeneratePropertyBagsForTypeAttribute] or [GeneratePropertyBagsForTypesQualifiedWithAttribute]
Any ideas?

low tangle
#

World. Get existing system

#

Check that the properties package is correct, I got a error like that a long time ago from it updating to a newer unity. Properties than it wanted @gusty comet

#

Also always try a restart with package errors

#

One it allows for a native plugin reload, and the package manager scans and updates on editor start

stone osprey
#

@low tangle And how exactly do i destroy them after the frame and create new events before the frame ? All my other systems run during the frame... so i guess theres a way to inject entities ?

low tangle
#

You destroy at the end of the frame, and you create at the start

gusty comet
#

@low tangle Thanks, I'll give it a shot.

low tangle
#

You have a full frame and all systems updating to react to the event entities

stone osprey
#

@low tangle I understood that, but how ? What method is called on start of a frame and what method is called at the end of a frame ? Havent found any methods to override ๐Ÿ˜„

low tangle
#

EntityCommandBuffer.CreateEntity() .DestroyEntity(EntityQuery)

#

You get ae ecb from the InitalizatonEntityCommandBufferSystem

stone osprey
#

And that automaticly gets called before/after the frame ? Heard about the buffer, but didnt thought it works like that

low tangle
#

All of those systems are a sync point that automatically plays back all command buffers you aquire from them

#

They have a .CreateCommandBuffer() method on them

#

I'm on mobile otherwise I would have wrote a example for you already

stone osprey
#

@low tangle Thanks for your help ! ๐Ÿ™‚ Well... i have found a BeginInitialisation and a EndSimulation buffer... guess we could use those, but still need to take a look at the docs when exactly those are getting called

low tangle
#

In a system try typing World.GetExistingSystem<TypeEndingWithEntityCommandBufferSystem>()
Then . CreateCommandBuffer () on that

#

Yeah that's it

#

Presentation is after simulation

#

It's basically late update

stone osprey
#

@low tangle Thanks ! Do you know its its possible to create multi threaded events using this approach ? We cannot use objects in scheduled jobs, furthermore how should we create a event which has multiple other parameters ?

#

Like other structs or primitives in it ?

mint iron
#

you can use an ECB in theaded jobs, no you can't use classes in burst, multiple pieces of data would just be you adding different components or extra fields on a component.

stone osprey
#

@mint iron Thats right, im just not that familiar without using any objects... just not sure how exactly i should do that... i thought about creating a system for events... that one creates and destroys the event... and i pass in archetype to construct that event... guess that would also work multithreaded... but how the hell should i actually fill that passed archetype with data ? The reference is missing,

#

Because the multithreaded code defines the archetype but does not get a callback of the event creation

#

So theres no way to insert data into that created event

mint iron
#
    public struct MyEventTag : IComponentData { }
    public struct MyEventData : IComponentData { }

    public class MyProducerSystem : SystemBase
    {
        protected override void OnUpdate()
        {
            var commandSystem = World.GetOrCreateSystem<BeginSimulationEntityCommandBufferSystem>();
            var myEventsECB = commandSystem.CreateCommandBuffer();
            var entity = myEventsECB.CreateEntity();
            myEventsECB.AddComponent<MyEventTag>(entity);
            myEventsECB.AddComponent<MyEventData>(entity);
        }
    }
#
    [UpdateInGroup(typeof(InitializationSystemGroup))]
    public class MyEventEntityCleanupSystem : SystemBase
    {
        protected override void OnUpdate()
        {
            var allEventsQuery = EntityManager.CreateEntityQuery(ComponentType.ReadOnly<MyEventTag>());
            EntityManager.DestroyEntity(allEventsQuery);
        }
    }```
#

obviously you'd want to cache stuff in OnCreate but i just did it this way for brevity, whats happening here is that a normal system runs somewhere in SimulationSystemGroup. So they queue an event, which will be created in the next frame. The cleanup system would destroy all old events before creating new ones.

#
    public class MyResponderSystem : SystemBase
    {
        protected override void OnUpdate()
        {
            Entities.ForEach((in MyEventData data) =>
            {
                // do stuff with the event
            });
        }
    }
stone osprey
#

@mint iron Thanks a lot ๐Ÿ˜ฎ im gonna try that

dark mauve
#

Is there an easy way for me to get children of an entity? For example, my camera is a child of the player, they are all converted to entities. I have a reference to the player entity. How do I get the camera?

opaque ledge
#

Child buffer

dark mauve
#

How do I use one?

opaque ledge
#

you put into your ForEach query "DynamicBuffer<Child> children"

dark mauve
#

I got that far, but the Child class doesn't seem to have much in there. How do I actually access it as a proper entity?

#

My guess would be something with the index value

opaque ledge
#

well its probably converted the way you put in your game objecy hiearchy, so if your camera was first child of your player, children[0] would give camera entity

#

but i havent really done anything with Child buffer before, maybe someone with more experience can explain things better

dark mauve
#

I get that, but more like, it returns a Child, not an Entity

#

My guess would be thisEntity camera = EntityManager.GetAllEntities()[children[0].Value.Index];

opaque ledge
#

so children[0].Value is the camera entity

#

if you are trying to reach out to children with Entity Manager then you can simply do, EntityManager.GetBuffer<Child>(yourEntity), which will give you the child buffer of that entity

stone osprey
#

Hmmm... do i need some special class for using EntityCommandBuffers in scheduled jobs ? It always tells me that my buffer already has been disposed

opaque ledge
#

example shows how to use it

dull copper
#

hmmmm, I've known you can access profiler data via scripts but never really used it before

#

this can be handy (only works in editor and in development builds)

#

that's just Simulation System Group and Presentation System Group but can do more specific timings as well

#

just trying to do something that gives overal data about the worker counts impact on these

stone osprey
#

@opaque ledge Thanks ! ๐Ÿ™‚

stone osprey
#

Somehow my command buffers are pretty lazy

#

They simply dont execute the creation of that one entity

#

That config.CreateEvent(...) simply calls beginCommandBuffer.CreateEntity(archeType)

#

But a entity never gets created

dull copper
dark mauve
#

@opaque ledge thanks Curly, that fixes it ๐Ÿ™‚

dull copper
#

must be a new issue

opaque ledge
#

@stone osprey you are doing nothing with command buffer, you are not even creating it.

#

you have to create a command buffer
"var ecb = endBuffer.CreateCommandBuffer()"

stone osprey
#

beginCommand = beginBuffer.CreateCommandBuffer() did the syntax changed ? Thought thats the way we create one

warped trail
#

@stone osprey you have to create new command buffer every frame

opaque ledge
#

ah nvm, i was looking at OnUpdate ๐Ÿ˜„

stone osprey
#

Ohhhh

#

Every frame ? Thought it would get reused automaticly

opaque ledge
#

and yes you have to create it every frame AND you have to register it

stone osprey
#

register ?

opaque ledge
#

"endBuffer.AddJobHandleForProducer(this.Dependency);"

#

once you are done with ForEach

#

but your code still wont work, you have to create your command buffers every frame

warped trail
#

this is not "registering", by AddJobHandleForProducer you make sure that job that uses ecb is finished before ecb playback๐Ÿ˜…

stone osprey
#

Thanks ! I just fixed the first part and im now creating every frame one... that already works ๐Ÿ™‚ now im gonna do that job stuff

opaque ledge
#

gl^^

stone osprey
#

thanks ^^ and does that job related command buffer stuff only work with concurrent buffers ? that concurrent buffer is a bit ugly... only allows creation of entitys by ids e.g.

warped trail
#

you can use simple ecb if your job is singlethreaded

#

Schedule() and Run() with simple ecb, SchedulleParallel() with concurent

opaque ledge
#

for Concurrent buffer you need to put "int entityInQueryIndex" in your ForEach query, exact word btw, and then feed that to concurrent command buffer

stone osprey
#

Alright, guess its single threaded ๐Ÿ˜„ Whats the different between Schedule and Schedule Paralellel ?

opaque ledge
#

Schedule schedules the job on a single thread, ScheduleParallel schedules the job on multiple threads

#

if your job's work is light you should use Schedule, otherwise ScheduleParallel

stone osprey
#

Great, thought i would already use multithreading... just realized i only used multiple jobs ^^

#

Well the only issue left is, that i get a error telling me " CommandBufferSystem not initialized"... without a stacktrace ๐Ÿ˜ฎ

opaque ledge
#

you are not doing new CommandBuffer() right ?

#

thats the only time i got that error i think

stone osprey
#

Nope... no clue right now... im just trying to spawn in entitys on BeginSimulationEntityCommandBuffer, let other systems use them, and to destroy them on EndSimulation

#

Not quite sure if this is how it works... but shouldnt this piece of code create a entity on begin of the frame and delete that entity at the end of the frame ? https://prnt.sc/s3f7l0

Lightshot

Captured with Lightshot

#

config.create/destroy simply calls the command buffers

dark mauve
#

Hmm oddly enough itโ€™s saying my object has no children

#

But the camera is clearly moving with the player

warped trail
#

@stone osprey you have to use different command buffers๐Ÿ˜…

#

probably๐Ÿค”

stone osprey
#

@warped trail Well my endCommand is different from my begin command... endCo = EndSimulation beginCo = BeginSimulation

zenith wyvern
#

You can't use buffers like that unless you're manually playing them back. Any entity spawned from a command buffer is only valid within that scope until the next frame

warped trail
stone osprey
#

@zenith wyvern So if i create a entity in that system... and destroy it at the end of the frame... its only visible in this system ?

warped trail
#

its only visible in command buffer

zenith wyvern
#

If you try to destroy it at the end of the frame you're destroying an invalid entity

#

When an entity command buffer plays back an instantiate command, it's creating a "temporary" entity. That entity is only valid within that scope, to that particular command buffer, like Druid said

#

Until the next frame, then it gets set up as a proper entity visible to the rest of the world

stone osprey
#

Oh well... than i missunderstood that complety... so in order to let other systems process my created event... i would need to destroy my created event during BeginPresentation ? Or how should i construct that EventSystem ? :/

warped trail
#

you can pass to your endBuffer whole query

zenith wyvern
#

I don't think ECB is the right tool for an event system that needs to produce and consume within the same frame

#

Tertle's system is using NativeStream I think

warped trail
#

i guess there is 2 event systems๐Ÿ˜…

zenith wyvern
#

Not sure what xzjv is using but he's making an event system too

warped trail
#

one with entities as events and one with nativestreams

stone osprey
#

The first one is the system im trying to achieve... as i asked xzjv he told me i could use ecb's for that kind of behaviour ^^

mint iron
#

the code i posted above should work i think

zenith wyvern
#

If you play them back manually it could work

stone osprey
#

It actually just started to work

zenith wyvern
#

Oh yeah I see the code, that will work, it won't be same frame though

mint iron
#

is it even nessesary to both produce and consume on the same frame? i cant think of a use case if we're talking 30+ FPS

zenith wyvern
#

Not sure if that matters really

warped trail
#

why not destroy this event entities via query?

stone osprey
#

@warped trail Did that and it started working ๐Ÿ˜›

opaque ledge
#

@dark mauve Check entity debugger if it has a child buffer

stone osprey
zenith wyvern
#

What xzjv showed was pretty much the canonical way to do ECS events I think, is there a reason you need a custom event system instead of doing that?

#

That's how I'm doing them at least

mint iron
#

@vagrant surge is your C++ ECS available on git or its a private thing?

vagrant surge
#

@mint iron its on git

mint iron
#

awesome! thanks

#

mind if i badger you with questions on it from time to time? ๐Ÿ˜‰

vagrant surge
#

its ok

#

atm im trying to implement "bit" components

#

components that hold a boolean (true/false), buuuut, they are stored as just 1 bit

#

instead of typical bools that are 8 bits

mint iron
#

sounds fun

vagrant surge
#

yeah i need them for culling

#

ive implementing culling similar to megacity, at the chunk level

#

but at the moment i store the bitmasks of visble entities in separate structures

#

would like to have those be more native to the ecs

#

i m also implementing chunk components

#

not shared components, but just chunk comps

#

so i can store an AABB per-chunk for culling

#

they do complicate stuff quite a lot on the ecs itself... but i think its useful to have this sort of thing

mint iron
#

i want to learn C++ and learn best from examples, seems like a cool project to figure out how u made it work.

vagrant surge
#

it does do some fairly black magic memory shanenigans

#

tho it doesnt do a few things, like move operators

#

so storing stuff like a std vector in the components might be unsafe

#

tends to work tho

mint iron
#

wow, its small, do you have any kind of test projects that use it?

vagrant surge
#

this is the simulation/benchmark ive posted a few times

#

its a pretty tryharded superparallel thing

#

dont expect to be able to compile it, you would need to setup dependencies properly, so its not easy

stiff skiff
#

Has anyone tried using Assembly Definition Reference assets to extend Unity.Entities ?

#

It seems to work really well, and compile. But my Rider seems to get extremely confused

formal scaffold
#

Hey, I'm trying to put together a Finite State Machine with ECS. To differentiate states I could use "Tag" components or "Enums". Using the predefined buffers to remove "Tags" works but I found it became very slow when doing that with 1k Entities. 6ms when changing Tag components every frame on 1k Entities.

I wonder if anyone has done a FSM in ECS already and can give me a few Tipps on how to get started.

safe lintel
#

if its every frame just use a bool or something similar inside the component to change state

#

just my own use but i only use a tag to differentiate when something is recently spawned, and when it dies, other times its just an enum inside a component that handles changes

formal scaffold
#

I thought about having a System for each possible State. I wonder how I should represent that State, my Ideas are: by Component or by Enum
How do you handle changes? Do you "switch" "case" the Enum and then change the type of enum based on input?

#

I'm having trouble with the transition part of the FSM.

safe lintel
stiff skiff
#

Whats the FSM for?

vagrant surge
#

component changes are fairly expensive, so only do state machines that way if you know they will not be frequent

#

can you put unions in components?

opaque escarp
#

for the FSM you definitely want to avoid structural changes ever frame, and may want to avoid them on transitions depending on how often you have things transitioning. Instead for each state try having it copy data from a "prototype" state, that way no structure changes occur

vagrant surge
#

or function pointers

opaque escarp
#

burst FunctionPointers work, and you can make "unions" using explicit struct layout

vagrant surge
#

then there you got it

#

function pointer + union is another possibility

mint iron
#

thats a pretty good idea

formal scaffold
#

@opaque escarp Could you explain to me what you mean exactly? I'm new to programming and don't quite understand what you mean by that

opaque escarp
#

don't add or remove components, as that is very very slow comparitively. Instead, copy values from other sources, for example using ComponentDataFromEntity.

#

so you might have data on a state that says "look here for what to do", then it looks there and copies the data from there to itself

vagrant surge
#

@opaque escarp thats pretty slow

#

due to the non-linear access

opaque escarp
#

the copy only happens on transitions

vagrant surge
#

union + enum state works better if you will go like that

#

unity ecs is pretty notoriously bad at "random" access (access data from entity id)

opaque escarp
#

in any case, I have an FSM running in a very similar way on my end, that makes use of Burst FunctionPointers and Unions as well, and it's extremely performant

vagrant surge
#

doesnt the job system complain? @opaque escarp

#

with the function pointers

#

as you dont really know what will they access. Or are they gauaranteed to be pure?

opaque escarp
#

no, the burst functionpointers are structs, so they're fair game

safe lintel
#

@vagrant surge do you see the random access improving down the road(like just an unoptimized thing for now) or is it fundamental to how theyve implemented things?

vagrant surge
#

@safe lintel fundamental

#

i see it pretty quick due to my cpp ecs

#

which is a similar model

#

its just an inherent weakness of the model

#

there are tricks to improve it if you do memoization or cache parts

#

on my engine/experiments i implemented a "cached component access" that stores "part" of the search, and basically checks if entity moved or not

#

if entity moved, then donormal path

#

if entity didnt move, grab data from pointer directly

#

problem is that you need to find where is the component actually stored inside the chunk

#

so you need to search for it somehow

#

would need to look at the exact implementation to find the specifics, its possible unity runs some hashmaps to speed that up

formal scaffold
#

Thanks for the Input @opaque escarp and @vagrant surge this has been very helpful. I just have one last question: I would then complement that with Systems using "switch, case" to filter which State I'am in and transition by using those Unions/functions pointers

opaque escarp
#

you probably wouldn't want to use a switch thing for determining what state you're in unless you had very few states. Instead the function pointer will tell it what to do in that state

#

for example, say you have a burst functionpointer that does something to your velocity. In the idle state, you might have it move the velocity towards 0. In a run state, you might instead set the functionpointer to one that corresponds to moving it towards some other value, which is itself the direction tilted on the control stick, or something

formal scaffold
#

Oh man this is exactly what I want yes. Thanks alot this will help me solve my VelocitySystem mess, which is the reason I started reading on FSM. In the end I will have more states and it will get out of hand. Thanks again, very helpful

dark mauve
#

Anyone experience with this issue? InvalidOperationException: The NativeArray ApplicationJob.UserJobData.pickupGroup must be marked [ReadOnly] in the job PickupSystem:ApplicationJob, because the container itself is marked read only. Unity.Jobs.LowLevel.Unsafe.JobsUtility.Schedule (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters) (at <05f2ac9c8847426992765a22ef6d94ca>:0)
Code: https://pastebin.com/HMB6mApz
It was working fine a minute ago. No clue what I changed ๐Ÿ˜…

safe lintel
#

thanks @vagrant surge alot of this is beyond my comprehension, another question but what are the tradeoffs of unity's model vs say what you used?

formal scaffold
#

It wants you to make pickupGroup [ReadOnly] because you are reading from it I assume, but you don't write to in inside the job

opaque escarp
#

@dark mauve try adding [ReadOnly] in front of your pickupGroup variable delcalariton

#

nice

dark mauve
vagrant surge
#

@safe lintel im using something similar to unity

#

unity ecs model strenght is near-free matching (query overhead is essentially zero) and very flat memory so it all hits cache allways

safe lintel
#

ah

opaque escarp
#

I guess try [ReadOnly(true)], though I haven't needed to do that before

#

maybe it's a different readonly

dark mauve
#

It's weird that it would require it at all

#

it was working fine minutes ago and I haven't used ReadOnly at all today

opaque escarp
#

"this is ReadOnly. Yes it is" makes sense to me lel

#

yeah I 've had some weird stuff with readonly shenanigans, includeing one where I had it marked as ReadOnly for a long time, and then it complained that it was being written to even after reverting the code. ๐Ÿคท

dark mauve
#

didn't work :9

#

still the same error with [ReadOnly(true)]

#

sigh I finally had everything done and working

opaque escarp
#

add (true) as the argmuent when you create your job struct using GetComponentDataFromEntity

#

in your OnUpdate method

warped trail
#

so this is not working ?๐Ÿค” cs [ReadOnly]public ComponentDataFromEntity<PlayerMovement> playerGroup; [ReadOnly]public ComponentDataFromEntity<PickupCollider> pickupGroup;

dark mauve
#

Nope :3

#

And Linq's idea didnt work either

#

This is so strange

#

Could it have something to do with me removing some entity cache earlier?

opaque escarp
#

Anyone know how to access a Collider within an Entites.Foreach system?

warped trail
#

PhysicsCollider.ColliderPtr

#

(SphereCollider*)collider.ColliderPtr as example

#

and then ->๐Ÿ˜…

dark mauve
#

I'm really confused at the ReadOnly thing. It has [ReadOnly(true)] and I use true as argument in getcomponentdatafromentity, yet it still gives the error

opaque escarp
#

how do I access the PhysicsCollider within the ForEach?

#

doesn't seem to work as an argument

#

@dark mauve make sure the ReadOnly you're using is Unity.Collections.ReadOnly

warped trail
#
.ForEach((ref PhysicsCollider collider)=>{})``` works fine๐Ÿค”
opaque escarp
#

naniii

dark mauve
#

@opaque escarp โค๏ธ

opaque escarp
#

op there we go

dark mauve
#

fixed it

opaque escarp
#

ayyyy

#

everyone's happy woo

#

thx drUiD

dark mauve
#

Is there an easy way to disable an object so it's no longer visible? (Like GameObject.SetActive())

#

I saw EntityManager.SetEnabled, but this doesn't hide the mesh

mint iron
#

mmm they introduced something like that specifically for not rendering something in the latest version.

#

there is also Disabled component which will prevent it from showing up in queries.

dark mauve
#

Disabled is nice, but it doesn't hide the object sadly

mint iron
#

ahh yep its DisableRendering in hybrid v2

dark mauve
#

That doesn't work for just Entities right? It didn't hide it for me

mint iron
#

what do you mean by hide it

#

from entity debugger? from queries? from rendering?

dark mauve
#

rendering

dull copper
#

are you even using hybrid rendering v2?

#

(and 2020.1 or 2020.2)

odd cipher
#

I'm trying to update to burst 1.3.0 preview.9 but I get this error when launching my game Error while executing command: C:\Users\adria\My Project\Library\PackageCache\com.unity.burst@1.3.0-preview.8\.Runtime\hostwin\lld -flavor link "@C:\Users\adria\AppData\Local\Temp\tmp361348d5.tmp"

#

and this ```Unexpected exception Burst.Compiler.IL.Aot.AotLinkerException: The native link step failed Error while executing command: C:\Users\adria\My Project\Library\PackageCache\com.unity.burst@1.3.0-preview.8.Runtime\hostwin\lld -flavor link "@C:\Users\adria\AppData\Local\Temp\tmp361348d5.tmp". Check previous exception in the log - linker command line : "C:\Users\adria\My Project\Library\PackageCache\com.unity.burst@1.3.0-preview.8.Runtime\hostwin\lld -flavor link "@C:\Users\adria\AppData\Local\Temp\tmp361348d5.tmp""

dull copper
#

have you restarted the editor?

warped trail
#

i can't use burst higher than 1.3.0 preview.7๐Ÿ˜…

dull copper
#

1.3.0p9 works here

warped trail
#

i get crash

odd cipher
#

oh! restarting the editor worked, thanks

dull copper
#

I did get really weird crash on somewhat empty project on IL2CPP build

#

wonder if it was related

#

it literally crashed the built player immediately but only with IL2CPP

mint iron
#

preview9 crashes like mad for me too.

warped trail
#

i got crash when i enter playmode

#

and when running some tests with ecs related stuff

odd cipher
#

preview9 works fine for me

#

no crashes in playmode

loud matrix
#

Is it not possible to properly use ScriptableObjcts with DOTs jobs? I'm trying to use ScriptableObjects to store data that is loaded into a Component so I can easily change models and variables. This all works fine Provided I run it on the main thread and nowhere else. If I try and schedule it I get the error PlayerControlSystem.cs(23,9): error DC0023: Entities.ForEach uses managed IComponentData Ship&. This is only supported when using .WithoutBurst() and .Run() when trying to access the data. If I don't try to access it it all works just fine.

#

I assume this is due to Scriptable objects being able to have functions and that likely causing issues. But from what I know that leaves the only sane method to store data to be either doing it all in code, or making everything from a game object and converting it. both kind of defeating the point of going with Pure ECS.

sour ravine
#

has nothing to do with functions and everthing to do with the dread Reference Typesโ„ข

#

you are hard SOL with the ScriptableObject approach, but look at the BlobAsset family for DOTS-compatible alternatives

loud matrix
#

SOL?

sour ravine
#

abbreviation for an expression meaning 'out of luck'

loud matrix
#

... ah, that abbreviation

sour ravine
#

๐Ÿ˜‰

loud matrix
#

Well FML, I spent 2 days learning about, testing and integrating a nice complex ScriprableObject database for nothing then. I wonder if Odin takes refunds XD

sour ravine
#

more technically, reference types can alias (meaning two variables can potentially reference the same memory) and potentially trigger a garbage collection pass

#

two things that Burst really, really doesn't like

loud matrix
#

I thought the Burst compiler only handled compilation, not runtime, so shouldn;t it work once compiled?

sour ravine
#

Burst is a compiler, but it's a compiler that works under specific assumptions

#

and ignores certain problems by design

loud matrix
#

I'm starting to wish unity just kept ECS and DOTs to themselves for 5 more years till they were finished with it :p Could have probably finished the entire prototype by now

sour ravine
#

you forego that with the WithoutBurst() and likewise allow the job data to be blittable by removing object references-- thus allowing it to be used with the Job system

#

first thing that happens is a copy to native memory and making things invisible to the GC

#

can't patch your object references, etc.

#

concurrency is a thorny problem in general

loud matrix
#

I'm afraid you've gone over my head at this point. I'm far too used to runtime programming languages and too new at c# to grasp the issue. but I'm looking into BlobAssets now, thanks ๐Ÿ™‚

naive parrot
#
  1. queue "destroy entity' in ECB
  2. queue "set/add component" on same entity in ECB from same system after 1.
    is this an issue ? does ECBS auto reorders the commands for validity prior to playback ?
low tangle
#

it does not reorder commands at all

naive parrot
#

so that means order of commands can lead to crashes

low tangle
#

not crashes, exceptions

naive parrot
#

leading to crashes.

low tangle
#

although they changed a few commands to always succeed

#

they used to require you to add a component first before set

#

now the set does a add if it isn't

naive parrot
#

adding component add/remove/set commands after destroying the target entity seems like obvious problem though

low tangle
#

yes but thats on you to not directly add to something you just deleted

naive parrot
#

in same systems it can be prevented. but for more complex implementations with multiple systems , order can be critical due to nature of this

#

am adding commands against same entity for eg from different systems , that may not be ordered relative to each other explicitly

#

this pretty much makes me define explicit system order on all systems if they are using ECB

low tangle
#

just before / after the ecb system

naive parrot
#

dont get it. obviously system will be either before or after another system (ecbs too )

#

you mean have to define order relative to ECBS only for system using ECB ?

low tangle
#

once you relax the mindset that everything needs to happen all in the same frame, your ordering becomes a lot easier
it really boils down to centering everything before and after a primary ecbsystem where you do all your changes
most transformations only take one or two mutations

#

all of my non networked systems update in simulation, before endsimulationentitycommandbuffersystem

#

so you can just assume that the current state is valid and not run into race conditions where x deletes y which z might be reading from y etc

naive parrot
#

my implementation are confined to simulation group and hence to end/begin ecbs of that group but this still is problematic in places. being aware of it does help now though.

#

good point regarding centering around single ecbs

#

simplifies a decent amount of ordering issue\

low tangle
#

for my networking tick groups, I needed to have a bit more done per tick (because of server latency)

#

I was able to name the groups to work within a lot closer to how they were being used

craggy orbit
#

is it bad practice to use extensions methods (called inside jobs) with DOTS? it seems to work but is there a downside to it?

#

i know that math is using static methods (probably?) but is there a difference for extension methods?

naive parrot
#

๏ปฟmath ๏ปฟuses ๏ปฟstatic ๏ปฟmethods wit๏ปฟh aggressive inlining๏ปฟ.

#

you can check math.cs in packages folder

covert raven
#

Anyone running into Unity.Entities.EntityQuery.GetFirstArchetypeIndexWithEntity when upgrading to 0.9.1? I think it was worst in 0.9.0 but for me the issue boils down to me accessing a different world's simulation system and retrieving the singleton.
Something like this: var mainCamera = defaultWorld.GetExistingSystem<SimulationSystemGroup>().GetSingleton<MainCamera>();

dark mauve
opaque ledge
#

afaik, RenderMesh is shared component, so you should use GetSharedComponentData

dark mauve
#

Wouldnt that change the material for all objects though?

opaque ledge
#

do you want to change on the instance ?

dark mauve
#

Yes

#

I'm trying SpriteRenderer as well

#

lmao that just worked

opaque ledge
#

You have to use Hybrid Renderer v2, RenderMesh system doesnt support instancing, i know there is a 'hack' for Render Mesh about it in forums but it was a while ago

dark mauve
#
renderer.sprite = pickup.m_ItemType.m_Texture;```
#

Only this already worked

#

I didn't try that at first cause I read somewhere all renderers get converted to mesh renderers in entities

#

Guess not

opaque ledge
#

@mint iron

NullReferenceException: Object reference not set to an instance of an object
Vella.Events.EntityEventSystemLoader.AddToGroup[T] (T group) (at Library/PackageCache/com.vella.events@5322dcf5ba/Runtime/EntityEventSystemLoader.cs:43)
Vella.Events.EntityEventSystemLoader.OnCreate () (at Library/PackageCache/com.vella.events@5322dcf5ba/Runtime/EntityEventSystemLoader.cs:35)
Unity.Entities.ComponentSystemBase.CreateInstance (Unity.Entities.World world) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities/ComponentSystemBase.cs:124)
Unity.Entities.World.AddSystem_OnCreate_Internal (Unity.Entities.ComponentSystemBase system) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities/World.cs:295)
Unity.Entities.World.GetOrCreateSystemsAndLogException (System.Type[] types) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities/World.cs:481)
UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities/Stubs/Unity/Debug.cs:19)
Unity.Entities.World:GetOrCreateSystemsAndLogException(Type[]) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities/World.cs:485)
Unity.Entities.DefaultWorldInitialization:AddSystemsToRootLevelSystemGroups(World, Type[]) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:127)
Unity.Entities.DefaultWorldInitialization:Initialize(String, Boolean) (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities.Hybrid/Injection/DefaultWorldInitialization.cs:106)
Unity.Entities.AutomaticWorldBootstrap:Initialize() (at Library/PackageCache/com.unity.entities@0.9.1-preview.15/Unity.Entities.Hybrid/Injection/AutomaticWorldBootstrap.cs:15)
#

I wanted to try your event system but i am getting this error

mint iron
#

@opaque ledge are you on latest Entities, i haven't checked in the fixes for 0.9 yet

opaque ledge
#

yeah, 0.9.1

mint iron
#

aight, ill fix it

opaque ledge
#

Thanks ๐Ÿ˜„

#

your events is specialized for ECS to MB right ?

#

anyway, i think it is ๐Ÿ˜„ i need it for ECS to 3rd party assets, will come in quite handy i hope^^

mint iron
#

it can do that, but was originally designed for normal ECS use. Easy MB firing/listening to events came about afterwards when i actually tried to make an example project with sound/effects/scenes/UI-interactions

opaque ledge
#

oh i see, well i am glad you did that ๐Ÿ˜„

mint iron
#

what version of burst are you using

opaque ledge
#

1.3.0-preview 9

#

which is latest

mint iron
#

everything works fine except for burst preview7->preview9 upgrade ๐Ÿ˜ฆ shakes fist. They broke something.

opaque ledge
#

๐Ÿ˜ฆ

mint iron
#

interesting, burst preview10 just showed up

#

doesn't have fancy formatting like @dull copper ๐Ÿ˜ฆ

opaque ledge
#

they heard you and immideatily released a new package ๐Ÿ‘€

#

tho i cant see it

mint iron
#

looks like its packed with good shit

#

If burst detects a package update, it now prompts a restart of Unity (via dialog). The restart was always required, but could be missed/forgotten we were complaining about this the other day

warped trail
#

just hope it won't crash ๐Ÿคž

opaque ledge
#

"Add support for Debug.Log(object) " ๐Ÿ‘€

amber flicker
#

haha yea I just read that and was like ahhhhhh ๐Ÿฅณ

bright sentinel
#

Strings ๐Ÿ˜

stiff skiff
#

Is there a new place to follow package releases? As bintray is no longer updating most of the packages ๐Ÿ˜ฆ

safe lintel
loud matrix
#

Is there anyway to handle BlobAssets with the editor interface?
I'm trying to work with Pure ECS but need to store my data somehow and ScriptableObjects were perfect for that but they don't work with Jobs so I'm trying to move to Blob, but I can only find ways of making the assets programatically. I'm trying to avoid having to create json files to store my data as linking to assets is just a pain compared to drag and drop into a scriptableobject

worn stag
#

zero errors in console. What am i doing wrong

safe lintel
#

if you take out Component from the name does it work?

torn kestrel
#

Could be another script not compiling

worn stag
#

No, still doesnt work

#

i have clear console, all scripts are compiled

loud matrix
#

What happens if you remove it and try to re add the component to the GO?

mint iron
#

@loud matrix there isn't a nice way no with Blobs no.

torn kestrel
#

can you enter play mode without any errors popping up?

#

without that game objet

worn stag
#

Tried but no changes. This script is also dont appear in Add Component dropdown so i can only drag n drop him

mint iron
#

one thing that does work though for SOs, is to create a MB container, attach that in a subscene and write a ConversionSystem to process the MB, add it as a Hybrid component. Then it will be in ECS (although managed), but you could grab it from EntityManager (maybe even GetSingleton dunno, otherwise Entities.ForEach(delegate(ManangedType){}) in setup and store as a field). Now you can access the SO from its container's public field. If you store a serializable struct in that SO for the actual data, you could use the SO data in burst jobs. Although probably a smarter option is to use CreateAdditionalEntity in the conversion to just put the IComponentData from SOs directly into ECS.

bright sentinel
#

@worn stag What's the name of the file that the component is in?

torn kestrel
#

I've been dabbling with ECS and have been using scriptable objects and the addressables package to load in component data

#

works very well

loud matrix
#

MB?

torn kestrel
#

monobehaviour

loud matrix
#

ah

torn kestrel
#

this has a great example of using SO and addressables to load in data

worn stag
#

@bright sentinel name of file and struct is the same. Its "CameraRotation"

warped trail
#

editor is crashing the moment i use some esc stuff with 1.3.0-preview 10๐Ÿ˜ญ

torn kestrel
#

try using the preview 7 of burst instead?

worn stag
#

Maybe i need different name for struct?

torn kestrel
#

filename is CameraRotation.cs and the struct is CameraRotationComponent ?

worn stag
#

no, CameraRotation.cs and struct CameraRotation

torn kestrel
#

your screenshot is different though

#

it says CameraRotationComponent

worn stag
#

i changed name after

torn kestrel
#

program runs fine otherwise?

worn stag
#

yea

torn kestrel
#

can you add the component to an entity manually in a script?

worn stag
#

its almost empty project with character controller and few scripts

#

i will try

#

also wanna delete library folder and see maybe something will change

loud matrix
#

@mint iron Why put it in a subscene? could it not be converted directly to a entity?

dull copper
#
## [Burst 1.3.0-preview.10] - 2020-04-21

### Fixed
- Fix negation of integer types smaller than 32 bits
- Fixed a bug where optimizer generated calls to `ldexp` would be incorrectly deduced when deterministic floating-point was enabled.
- Swapped private linkage for internal linkage on functions, this fixes duplicate symbol issues on some targets.
- variable scopes should now encompass the whole scope.
- variables in parent scopes should now be present in locals windows.
- Native plugin location for windows has changed in 2019.3.9f1. If you are on an older version of 2019.3 you will need to upgrade for burst to work in windows standalone players.
- Added an error if `Assert.AreEqual` or `Assert.AreNotEqual` were called with different typed arguments.
- Fixed a bug where doing an explicit cast to a `Unity.Mathematics` vector type where the source was a scalar would fail to compile.
- Fix issue when converting large unsigned integer values to double or float.
- Fix an invalid value returned from a conditional where one type is an int32 and the other type would be a byte extended to an int32.
- Button layout of disassembly toolbar tweaked.
- Copy to clipboard now copies exactly what is shown in the inspector window (including enhancements and colours if shown)
- AVX2 now generates the correct AVX2 256-bit wide SLEEF functions instead of the FMA-optimized 128-bit variants.
#
### Added
- Anonymous types are now named in debug information
- XCode/LLDB debugging of burst compiled code is now possible on macOS.
- Added some extra documentation about how to enable `AVX`/`AVX2` in AOT builds, and how we gate some functionality on multiple instruction sets to reduce the combinations exposed underneath.
- Optimized external functions (like `UnsafeUtility.Malloc`) such that if they are called multiple times the function-pointer address is cached.
- Add support for string interpolation (e.g `$"This is a string with an {arg1} and {arg2}"`)
- Add support for Debug.Log(object) (e.g `Debug.Log("Hello Log!");`)
- Add support for string assignment to Unity.Collections.FixedString (e.g `"FixedString128 test = "Hello FixedString!"`)
- If burst detects a package update, it now prompts a restart of Unity (via dialog). The restart was always required, but could be missed/forgotten.
- Better error message for unsupported static readonly arrays.
- Link to native debugging video to Presentations section of docs.
- Fixes a bug where `in` parameters of interfaces could sometimes confuse the Burst inspector.
#
### Changed
- iOS builds for latest xcode versions will now use LLVM version 9.
- Burst AOT Settings now lets you specify the exact targets you want to compile for - so you could create a player with SSE2, AVX, and AVX2 (EG. _without_ SSE4 support if you choose to).
- Improve speed of opening Burst Inspector by up to 2x
- Provided a better error message when structs with static readonly fields were a mix of managed/unmanaged which Burst doesn't support.
- Tidied up the known issues section in the docs a little.
- Enhanced disassembly option has been expanded to allow better control of what is shown, and allow a reduction in the amount of debug metadata shown.
- Load Burst Inspector asynchronously to avoid locking-up Editor
- Documented restrictions on argument and return types for DllImport, internal calls, and function pointers
#

I do dig that they added AVX and AVX2 properly now

#

there were bunch of improvements on p8 for AVX already

mint iron
#

@loud matrix converted directly to a entity? it does get converted directly to entities with subscenes. and there's a few reasons to use it 1) runtime conversion is not going to be supported which leaves only SubScenes 2) subscenes would let you use LiveLink to change the config data during play 3) if all your data is pre-compiled in subscenes it gets loaded in a block into ECS world so in theory if you have a lot of data or significant processing on it, it could be faster.

loud matrix
#

Seems I need to go look more into subscenes, I've only ever seen them used as well.. sub scenes, for loading big worlds in chunks.

worn stag
dull copper
#

this is nice: Add support for Debug.Log(object) (e.g `Debug.Log("Hello Log!");`)

#

would love burst support for debug draws as well (at least I don't think it yet supports them?)

warped trail
#

just use debugstream๐Ÿ‘

loud matrix
#
public class Database : MonoBehaviour, IConvertGameObjectToEntity
{
    public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
    {
        Debug.Log("conversion Running");
        dstManager.SetName(entity, "Database");
    }
}

I have this in a subscene, any idea why this would not work?

#

Name doesn't change and no debug log.

fallow mason
#

name doesn't survive conversion

#

has something to do with how scenes are constructed. apparently they would like this to work eventually.

loud matrix
#

Well that's a horrible feature, what about the debug?

#

do debugs not show in subscenes?

#

It's weird as when i open the subscene i get a JobTempAlloc has allocations that are more than 4 frames old - this is not allowed and likely a leak error, and all i have is an empty with that script inside.

fallow mason
#

don't know about the debug :\

loud matrix
#

Well from what I can see in my 10 mins working with subscenes is they are suicidal as it's generating the same error when just a empty is inside, no scripts just an empty.

mint iron
#

instead of an IConvertGameObjectToEntity in MBs you can make a new conversion system to process all instances of type. All the new default converters look like this: (and SetName worked for me in this context when i tried the other day, but after a few changes LiveLink might rename it back to EntityX :(

public class SpriteRendererConversionSystem : GameObjectConversionSystem
{
    protected override void OnUpdate()
    {
        base.Entities.ForEach(delegate(SpriteRenderer sprite)
        {
            AddHybridComponent(sprite);
        });
    }
}
loud matrix
#

I think I might have to do this with BlobAssets, I just can't seem to wrap my head around this

coarse turtle
#

The general idea for the conversion system for blob assets would likely be read the component, grab the scriptable object or fields you need, construct the blob asset, attach the blob asset to a component

#

of i think there are some caveats especially if you wanted to store some managed components ๐Ÿค”

loud matrix
#

My issue is the interconnectedness of my data, I can go down one level but as soon as i need to reference somethign else I can;t grasp it in my head anymore

coarse turtle
#

ah got an example?

loud matrix
#

Even something simple like a SO for items, and a SO for recipes where recipes contain items.

#

Currently I have items, recipes, a list of recipes all as SOs and the list it attached to a Game Object (To instantiate it as a singleton)

coarse turtle
#

o ok

loud matrix
#

So i have my database entity, but if i just make a component for the SO lists and attach those, im still storing SOs so jobs won't work

coarse turtle
#

so im making this card game - and i have something similar where my authoring is in this scriptable object.

So what I did was -> a primary scriptable object which contains common information for each card

  • id
  • name
  • card description
  • image
  • card type

and separate scriptable objects which contain information like damage, additional effects etc - but they're all linked via id

so this gets converted into a collection of blob assets where if I enter from the primary scriptable object - I can jump around to different blob assets and grab any associative data to some card and run some systems based on the card

mystic mountain
#

For non references in data, I have my SO field of IComponentData which gets added as a singleton entity. For list of other SO in SO, I would make a blobasset of it all. If the referenced SOs can be referenced other place maybe just rethink the design?

loud matrix
#

So are you referencing everything by id in your SOs the instead of making a ScriptableObject data type field you can drag and drop into

coarse turtle
#

to store images - what i did was - in a conversion system - I'd loop through the primary scriptable object's entries, declared the image as an entity and attach an image component to the declared entity and with its associated id

#

pretty much

#

it's just all linked by some id / mask

loud matrix
#

That's one thing I'm trying hard to avoid, failing, but trying

coarse turtle
#

i would say initially the workflow was a bit annoying until you write some custom editor

#

to kind of help visualize it ๐Ÿค”

loud matrix
#

I setup odin to search for assets of X type to populate the list in the SOs which is great but the issue is, its just a reference to a SO so i can't picture in my head how to unwrap the data into a entity based one

#

I haven't gotten to the complicated data structures yet where items have recipes bu recipes also have items and items aren;t always items but also weapons etc

#

Why can't all programming languages just let you break stuff and have it still work but run like arse like PHP and JS. I'd get far fewer stress headaches

coarse turtle
#

so the structure is:
Scriptable Object (has a collection) -> references to another Scriptable Object? ๐Ÿค”

mint iron
#

what about passing the conversion system through to each SO in the hierarchy using a shared interface, then at each level they can add whatever they need to the destination world. Could probably even abuse GetPrimaryEntity to avoid having your own reference lookup.

loud matrix
#

Reipe List SO (Has a list of type Recipes) -> Recipe SO (Has a list of ingredient SOs<Item> and result SOs<Item>) -> Item SO contains the names values etc

#

When you say conversion system do you mean GameObjectConversionSystem or the abstract concept of the conversion system

coarse turtle
#

hmm - without blob assets - I imagine you can just construct entities and have a DynamicBuffer<RecipeEntity> and a RecipeEntity might have a DynamicBuffer<Ingredient> attached to it ๐Ÿค”

loud matrix
#

googles DynamicBuffer

#

How, how in the holy hells has Unity made an environment where me storing data is the hardest part of a game that involves literal gods damned rocket science!?

mint iron
#

its funny because its true

loud matrix
#

I've not had a stress headache like this in years, so it's nice to relive my school years again somewhat

#

Coming from mainly stuff like JS, PHP, little Java, I understand abstracts, structs, interfaces etc, but the mental gymnastics to jump through when trying to work through this is maddening ๐Ÿ˜›

fallow mason
#

graduated 8 years ago and just had another recurring nightmare that I'm two weeks into a college class having done nothing for it

#

All this talk about scrobs makes me remember how much I like to use them. But I have no experience with blobs...Gotta blob some scrobs.

loud matrix
#

I'm really tempted to jut scrap my entire project and spend my time making a unity plugin for easy BlobAsset database creation

fallow mason
#

(going to make the new lingo stick) ๐Ÿ˜›

#

do it

loud matrix
#

Over my dead body... Please... Please end this suffering

#

But before you do please murder the people who told me no no, forget Game Objects, just make any new projects with ECS

#

They also like the normal lingo :p

fallow mason
#

ECS is the Futureโ„ข

loud matrix
#

Oh definatly, just like how jetpacks, flying cars and personal planes were the future in the 1800s

gusty comet
#

Hola

#

Does anyone know if something happened to IConvertGameObjectToEntity?

#

I'm trying to use it, in a project that uses a lot of ECS stuff, and I'm getting "The type or namespace name 'IConvertGameObjectToEntity' could not be found "

#

My assembly definition is using Unity.Entities

warped trail
#

maybe you have to include Unity.Entities.Hybrid to your assembly?๐Ÿค”

gusty comet
#

omg, yes that was it!

#

thanks!

safe lintel
warped trail
#

i see a lot of names in their entities view๐Ÿค”

#

no names in subscenes, does that mean that i will have to keep subscenes open to see this๐Ÿค”

safe lintel
#

hopefully another update brings names to subscene entities(but also hopefully not a regression to the parent system ๐Ÿ˜€ )

warped trail
#

and i don't want to see relationships between entity and authoring data at runtime๐Ÿ˜…

mint iron
#

its nice to see them making progress, trying to improve it and get feedback

safe lintel
#

imo animation needs one of these types of posts, like a mini roadmap

#

forum might also need a cleanup with so many stickied things, wheres that friendly neighborhood hippocoder when you need him ๐Ÿฆ›

loud matrix
#

Yup, so new plan, delete 4 days worth of research and work and just hardcode everything into BlobAssets, this is just way above my level to work out.

mint iron
#

im actually after something similar right now :S

loud matrix
#

Oh god now I'm suddenly able to find very few resources on BlobAssets

mint iron
#

i tried to use BlobAssets once, once.

loud matrix
#

Which one of you works at google and is strategically deleting things from search results

#

They seem useful, but accessing the data not by index seems like a pain

coarse turtle
#

Uhh - I think what I did was look at the blobifications test file in the entities package and based how to structure it from there ๐Ÿค”

#

ppl have referenced this video for blob assets

opaque escarp
#

funny thing, I've been using ECS/DOTS for around 8 months now, watched every vid I could on youtube, and went through all the docs etc. Didn't even hear the phrase "blob asset" until a few days ago

warped trail
#

ecs samples has some blobasset examples

loud matrix
#

Too bad I've managed to burn out my brain i just sat staring at a simple getItemById function for like 5 mins going "why can't I return null?"

safe lintel
#

anyone know how you can destroy all entities in a scene? i know theres a way but cant remember

#

ah EntityManager.UniversalQuery

opaque ledge
#

yeah, for null values have default values in your fields represent the null

#

if you have int id for example, if id is 0 that means its null etc.

#

you can also have a static null property or frield that is the default constructor

#

thats how i do ๐Ÿง

loud matrix
#

I just added a hasItemId method as well and had it return a empty item;

#

There, all the ScriptableObjects converted to BlobAssets. It's not too bad to understand, Though I really need to get this setup with a generic type and a Json loader or something.

#

Here is where i load this in my Jobs and find it breaks for some new unforeseen reason ๐Ÿ™‚

mint iron
#

i have a solution i think, now that you've done all that good work

#

i have two recipe SOs, that each reference 1-4 ingredients with some overlap.

#

they get converted into 6 entities, and each recipe has a buffer linked to the ingredient entities they use

loud matrix
#

Couldn't even wait till my inevitable glorious failure?

mint iron
#

sorry ๐Ÿ˜ฆ

loud matrix
#

Come on then, show us all how clever you are ๐Ÿ™‚

mint iron
loud matrix
#

Looks interesting, I see a lot of lovely unsafe flags ๐Ÿ˜› I'll have to load up a new project as I don;t have a version that supports DeclareAssetDependency

mint iron
#

i dont think there's anything unsafe in there actually, just habit to put the tag in

loud matrix
#

Hmm, for some reason unity never wants to let me download the 0.9.1 Entities package. Think its still in 0.9.0 though so I'll give that a try

#

What would the MonoBehaviour data parameter take in, the items, recipes or both?

mint iron
#

i put recipes there

#

it might work with either, havent tested it lol

#

the MB has to go into a subscene

#

and if you turn on DOTS>Link link in Edit mode, they show up in EntityDebugger while in edit mode which is cool

loud matrix
#

ah yes i forgot to subscene it, silly me

#

Weird, Once in the subscene it doesn't recognise the ingredients or recipes as ScriptableObjects to be put into the Data paramater

#

Select them and it just Nones them

mint iron
#

mmm, are the Scriptable objects in their own files

loud matrix
#

Yup

mint iron
#

if you click on the scriptable object does it have the .cs file listed under script, or none

loud matrix
#

huh, making new ones works after moving it into a subscene but the old ones dont

mint iron
#

i had pretty much the same issue when i had them all in one .cs file, id already made some SOs but they were corrupted ๐Ÿ˜ฆ

loud matrix
#

Yeah that sees to be a common problem with SOs

#

Still not quite grasped when i need to just delete them all and start again

#

But yeah, that doesn seem to work, Though why the Enums for IDs?

#

From what i see they don't do anything

mint iron
#

the enums are not necessary, they're just so they can be identified in the EntityDebugger when LiveLink changes the names. It uses Guid for the id.

loud matrix
#

Ahhh, I was wondering how you did that, I couldn;t see where that was coming from

#

I'll have to have a play with it, see how easy I can make it to access data etc ๐Ÿ™‚ Still not 100% no querying subscene contents and the like ๐Ÿ˜›

mint iron
#

is it working though, showing up in EntityDebugger?

loud matrix
#

Yeah it looks like it works fine, and it does work with eigther ingredients, recipes or both

#

with no duplication from what I an see

mint iron
#

you can use either style ScriptableObjectDataProvider or ScriptableObjectDataProvider<T> just depends if the data you need to add can fit nicely in a struct or if it needs custom processing.

#

but yeah, you're right, getting them into ECS is only half the story, now how can they be indexed and nicely accessed from systems and burst.

loud matrix
#

Unity dev team seem to be making a awful lot of systems that can do some similar things, it just needs one that's easy to use for non OMG how performant use cases.

covert raven
#

Asked this yesterday, but has anyone ran into GetSingleton null reference exception in 0.9.1 of entities? I know it had a lot of that in 0.9.0, but I'm still getting some of it when doing cross world singletons:

var sGroup = defaultWorld.GetExistingSystem<SimulationSystemGroup>();
if (!sGroup.HasSingleton<MainCamera>()) return;
var mainCamera = sGroup.GetSingleton<MainCamera>(); <--- throws NullReferenceException
mint iron
#

also why don't we have simple component property drawers like guid, or FixedString

loud matrix
#

They're too busy making tech demos with 10 million game objects on screen at once to show off.

#

Just wait till they make the unity 2020 dev talk on how they implemented ray tracing and each individual ray is it's own entity that you can if need be control the memory usage of.

#

@covert raven Does it work if you get the MainCamera with a entity query?

covert raven
#

@loud matrix yeah if I use defaultWorld.EntityManager.CreateEntityQuery to retrieve, it works fine.

analog horizon
#

Is this still the most elegant solution for integrating FixedUpdate into JobComponentSystems?

lusty otter
#

My iOS build crashes here but Android works fine, any idea why?

warped trail
#

@analog horizon no, they added function callback in system groups, with them you can control group's update๐Ÿค”

stone osprey
#

Is there a alternative to entityManger.GetComponentData<T>(entity) which returns a reference instead of a copy ? Like Entities.ForEach(in T) ?

opaque ledge
#

i think that doesnt return a reference, it returns a copy

stone osprey
#

Yep, but is there a way to get the ref instead without using Entities.ForEach ? ^^

opaque ledge
#

ah you are asking for a method that returns the reference to it ๐Ÿ˜„ sorry, you can just do SetComponentData(entity, data)

#

you can also create entity query and do ToComponentDataArray to get native array of components which means they are "references"

stone osprey
#

Alright thanks... sooo no other "easy" way to acess the ref of a component ? Hoped for a method like "GetComponentDataRef<T>(entity)"... xD

warped trail
#

@opaque ledge ToComponentDataArray returns copy of components, so they are not references๐Ÿ˜…

opaque ledge
#

doesnt that returns native array ? so when you change one you will change the 'real' as well ? ๐Ÿค”

warped trail
#

no, you get native array of copies

opaque ledge
#

hmm never knew that ๐Ÿง

stone osprey
#

Any clue what this exception means ? .endCommand. You must call JobHandle.Complete() on the job MovementSystem:<>c__DisplayClass_OnUpdate_LambdaJob1, before you can write to the NativeArray safely.

#

Im using a buffer for instantiating entities inside a schedule... that endsystem is used to destroy entities...

#

If i run that instantiate system on the main it works fine

opaque ledge
#

can you post your code ? are you doing something after ForEach ?

stone osprey
#

On my way :=

#

Those are running in two different systems

cosmic sentinel
#

Using hybrid renderer 0.4.2 and unity 2019.3.10f1

opaque ledge
#

Thats not how you schedule jobs

#

@stone osprey

#

you should do something like this

#

Dependency = Entities.ForEach().Schedule(Dependency)

#

or simply Entities.ForEach().Schedule() which is exactly what above code does

dull copper
#

@cosmic sentinel hybrid renderer is bit dead on the water when using Unity 2019

warped trail
#

and you create new entity for every entity๐Ÿค”

dull copper
#

they'll not update hybrid v2 for it and v1 is lacking on many fronts

cosmic sentinel
#

ok thanks, might try to delete it

stone osprey
#

@opaque ledge The problem here is... that if i schedule that job i still get that message that the endCommandBuffer tries to modify the nativearray

#

So this does not work either

warped trail
#

not new JobHandle

#

pass to it Dependency

cosmic sentinel
#

depen will never complete?

#

just leave Schedule() empty unless you need to handle dependency

warped trail
#

do you really need jobhandle from your foreach?

cosmic sentinel
#
            var entity = beginCommand.CreateEntity();
            beginCommand.AddComponent(entity, new EventComponent{message = message, Entity = triggeredBy});              
 }).Schedule()```
#

or do ScheduleParallel if that's all you do since it can be done in parallel

#

also don't pass in entity and create another variable called entity

#

it will complain

stone osprey
#

Thanks... i adjusted my code but i still get the exception that endCommandBuffer modifies a nativearray while the job is not completed

warped trail
#

why do you need jobhandle from foreach?

cosmic sentinel
#

why do you pass in an entity and then create a new entity?

#

for every entity

stone osprey
#

Oh sorry... forget that "var job = ..."... forgot to remove it

#

Glass thats the entity which triggered the event

warped trail
#

that means that your foreach will run for every entity that exists ๐Ÿ˜… Entities.ForEach((Entity entity)

opaque ledge
#

instead of doing the way you did (for end Command) do

Entities
.WithAll<EventComponent >()
.ForEach((Entity entity)=>{
  eventConfiguration.endCommand.DestroyEntity(entity);
}).Schedule()
#

if you are trying to create an event system, you probably dont want to or need to store references to any command buffers, they should be created on every frame, you shouldnt re-use them (it is not allowed anyway i believe)

warped trail
#

what the point of this foreach if you can just pass query to command buffer?๐Ÿค”

opaque ledge
#

idk, thats how i do it and it works ๐Ÿ˜„

#

plus i dont want to run anything on main thread outside of ForEach, they seem dangerous thing to do

stone osprey
#

Gonna try that real quick ^^ one moment

opaque ledge
#

Also another thing, you need to tell your command buffer systems that this job is producing/creating entities (which means structral change) so you have to

commandBufferSystem.AddJobHandlerForProducer(Dependency) after your ForEach

#

commandBufferSystem here is the command buffer system that you are using, like EndSimulationCommandBufferSystem, BeginSimulationCommandBufferSystem etc.

stone osprey
#

Even if my foreach loop is only "Schedule()" instead of Parallel ?

opaque ledge
#

Yes, they are both schedules jobs^^

stone osprey
#

Now im gonna try it with that producer

warped trail
#

if there is a possibility that job with ecb will not finish before this ecb will be played back, you have to make sure that ecbsystem will call complete() on your job

#

you can do this by AddJobHandlerForProducer(yourJobHandle)

#

and you can use different commandBufferSystem for AddJobHandlerForProducer, until this commandBufferSystem is running before one you used to create ecb๐Ÿค”

cosmic sentinel
#

@dull copper tried the code in 2020.1.0b5 and I no longer get the spikes. I guess I just wait for 2020 to come out ๐Ÿ™‚

stone osprey
#

@warped trail Thanks ! So im just trying that... the problem is im using a Systembase... so i have no dependency i can put into .schedule(deps);... what could i do ? :/

opaque ledge
#

SystemBase has "Dependency" property which is a jobhandler

cosmic sentinel
#

@stone osprey this.Dependecy

vivid copper
#

Hi guys.
Is there a way to pause in dots, as it was for MB with timescale = 0 ?

stone osprey
#

@cosmic sentinel Thanks ๐Ÿ™‚ @opaque ledge

#

soooo

#

Thats how it looks now... and... still getting this error, but this time it does not target my endCommand for destroying events

#

LambdaJob1 reads from the NativeArray <>c__DisplayClass_OnUpdate_LambdaJob1.safety. You must call JobHandle.Complete() on the job MovementSystem:<>c__DisplayClass_OnUpdate_LambdaJob1, before you can deallocate the NativeArray safely.

cosmic sentinel
#

can you rename one of your entity variables. you pass in ref Entity entity and then next line you make var entity

stone osprey
cosmic sentinel
#

If you want to use an ECB from a parallel job (e.g. in an Entities.ForEach), you must ensure that you convert it to a concurrent ECB first by calling ToConcurrent on it.

stone osprey
#

Parallel Job... but uhm... i just use "Schedule()" and not "ScheduledParallel", so its not parallel

cosmic sentinel
#

according to your error message you're running at least two jobs in your system

#

since it says LambdaJob1 and not 0

#

so you must be doing something else

stone osprey
#

But those arent parallel right, because of the missing "Parallel" from schedule... atleast some people told me yesterday that you only need to use ToConcurrent when you use "ScheduleParallel"

#

Thats my updated version... probably the error happens due to the reading ( exception : Previous scheduled job reads from other job" )

#

At some point i loop over all events for reading them

cosmic sentinel
#

yeah you're probably ok without concurrent

stone osprey
#

So i think that might cause that issue, when i actually read those... but how could i prevent that issue ?

cosmic sentinel
#

is beginCommand created from eventSystem.endBuffer.CreateCommandBuffer?

stone osprey
#

No, those are two different CommandBuffers from two different CommandBufferSystems :/

cosmic sentinel
#

why do you do eventSystem.endBuffer.AddJobHandleForProducer(job); then?

stone osprey
#

You mean after my foreach loop which spawns the events ?

cosmic sentinel
#

yeah

stone osprey
#

Good question... changed it to eventSystem.beginBufer.Add... which results in three errors in total :/

cosmic sentinel
#

When you write to a command buffer from a Job, you must add the of that Job to the buffer system's dependency list with AddJobHandleForProducer(JobHandle).

#

so the AddJobHandleForProducer should be to the beginCommand's buffersystem

stone osprey
#

That basically gives me those two errors...

#

"LambdaJob1 writes to the NativeArray <>c__DisplayClass_OnUpdate_LambdaJob1.JobData._lambdaParameterValueProviders.forParameter_lc._type. You must call JobHandle.Complete() on the job MovementSystem:<>c__DisplayClass_OnUpdate_LambdaJob1, before you can deallocate the NativeArray safely."

#

And this here

#

"LambdaJob1 writes to the NativeArray <>c__DisplayClass_OnUpdate_LambdaJob1.JobData._lambdaParameterValueProviders.forParameter_lc._type. You must call JobHandle.Complete() on the job MovementSystem:<>c__DisplayClass_OnUpdate_LambdaJob1, before you can deallocate the NativeArray safely."

#

The first is getting called every frame, the second only once :/

#

Damn i really hope they improve their exceptions at some point

cosmic sentinel
#

the examples you've posted never writes to any native arrays

#

you can add WithoutBurst and it should be able to tell you which line

#

at least in my experience

stone osprey
#

The exception isnt that clear either

#

It targets the CommandBuffer