#archived-dots

1 messages ยท Page 244 of 1

coarse turtle
#

Did you try other sorting algorithms?

frosty siren
#

yes, i've implemented few before i've realised that NativeArray.Sort in single job is best, But when you have nested sprites all algorithms can't handle your new rules, because when element is a child, then we can't compare it with other elements, only with other children. This is because child should goes with parent and be sorted only with other children.

coarse turtle
#

oh right I didn't think about children entities

#

yea probably limiting your sort space might be a good idea? It also sounds like your order value could be a key for radix sort, but I'm not really sure about the children entities rule ๐Ÿค”

frosty siren
#

i'm thinking about
0. sort by nesting level

  1. find where in array nesting level changes (depth groups)
  2. sort slice with 0 depth group
  3. starting from last depth group to 1 depth group -> sort by parent + position -> find all parents in previous depth group -> insert

2 and 3 can go in parallel until depth group 1 wants to be inserted to 0 group

but this algorithm sounds wild and still has all of this SORTINGS, still looks better then O(n^2) though

frosty siren
rustic rain
#

are those same sprites?

frosty siren
rustic rain
#

I just wonder whether you actually need that sorting at all, what is the end goal you are trying to accomplish with it? So whatever entity is appears closer to camera?

frosty siren
#

in my system i have "RenderArchetype" with is Shader + Textures. I'm using GPU Instancing and after sorting find batch groups of spirtes which can be rendered together

frosty siren
rustic rain
#

greater X?
Is that 2D or?

frosty siren
#

yes, it is 2D

#

when we talking about 3D we have depth and can enable ZWrite On, then pixels with tested depth will be overdrawed afaik, so you just render your 3D objects in batches and that's all. But there is no depth in 2D, so we faced that kind of problems. If i'm totally wrong about those things, pls point me, because i'm new to all this stuff ๐Ÿ™‚

rustic rain
#

I worked with 2D, but it was actually in 3D, where X and Z were used for position, and Y to render queue

#

I accomplished rendering a lot of textures (about 40k) with indirect gpu instancing

#

but those textures were transparent, so I never really had problem with render order

#

they just kind of multiplied with each other

frosty siren
#

So you write render queue to Y depending on your X and Z value and then use it like depth?

rustic rain
#

Not really.
it was smth like this:
0 - terrain
0.01 - buildings
0.02 - items
0.03 - pawns
0.04 - gas
0.05 - weather
And etc...

#

layers were predetermined, everything else is figured by engine draw calls

frosty siren
#

ok, how you handle 100 items on screen, what item being rendered first?

rustic rain
#

that's actually impossible mechanically in that game xD
It can only happen for transparent objects basically

frosty siren
#

ok, imagine 100 characters which are moving up down left right on screen, how would you sort them?

rustic rain
#

depending on context, tbh
Is rendering has any gameplay value?

#

or you just want things to look good?

frosty siren
#

what you mean gameplay value?

rustic rain
#

well, is it relevant for gameplay? Or it's as important as background?

frosty siren
#

it is important for gameplay i guess

rustic rain
#

for gameplay I mean, if it's smth you must shoot, then it does have value

#

what happens rn tho? Without sorting, how does it look?

frosty siren
#

oh, ok, my game is something like tycoon games, so all player see have gameplay value

frosty siren
rustic rain
#

oh

#

so, are characters 1 sprite alltogether? or combination of several?

frosty siren
#

combination, that is why i need sorting groups

rustic rain
#

you can do this

#

wait

frosty siren
#

look and this example i've found in google, here is zombies with proper order rendering + they consist of parts of body

#

and here we see issues

rustic rain
#

are your character entities are groupped in any way?

#

if you can assign them to one Y altitude

#

all entities of character

#

it will stop mess

#

at least

frosty siren
rustic rain
#

ooooh, if your body parts have any sort of "Parent" entity component
You can pretty much just use EntityID as Y axis

#

and it'll be cut down to just one query through all body parts

frosty siren
rustic rain
#

you don't have same parentIDs tho

#

just multiply that ID by some very small value

frosty siren
#

i'm sorry, can't figure out an idea

rustic rain
#

so, if you use GameObject prefab

#

then every child entity knows it's parent entity

#

they have this component

#

so you just query through all objects with that entity

#

and adjust their Y axis (or whatever render order you use) by for example:
EntityID*0.001;

frosty siren
#

ok, imagine two characters stays on same position float3.zero
each character has body, legs, arms and head
we want make legs/arms/head to be children of a body
then we adjust it's Y values to some small value
now they a little bit greater then parent, yes. But how they can be sorted between each other?
also there are legs/arms/head of the second character and they have the same Y adjusted values.
now we will have this picture: bodies of both characters being rendered first, then all other body parts of both characters. It is like with zombies case.

rustic rain
#

you adjust all children by same value of parentid

#

if you want to also adjust children between each other

#

you can create more queries

#

so it then goes through all legs

#

all bodies

#

all hands and etc

frosty siren
#

parentID is Entity.Index of parent it is random value in rendering context

rustic rain
#

yeah, it's a bit random

#

but what is important - it's unique

frosty siren
#

yes, but randomness leads to mess, there will no proper order

rustic rain
#

and by what order you want them to be sorted?

frosty siren
#

we want body1 -> legs1 -> arms1 -> head1 -> body2 -> legs2 -> arms2 -> head2

rustic rain
#

if you want order between children - it's simple and precise

frosty siren
#

depending on bodies positions between each other

rustic rain
#

order between characters is not

frosty siren
rustic rain
#

but how do you want them to be sorted?

#

by what rule?

frosty siren
#

by position on a screen

rustic rain
#

??? whoever closer to left side of screen is rendered first?

frosty siren
#

like on that screen

rustic rain
#

ah, well

#

then when you query through children

#

you need to know their parent's position

#

not sure if you can make such query in dots tho

#

it seems like it beats the idea

#

if you try to access parent's position

#

while working with children's position

#

maybe someone else knows a way tho

frosty siren
#

accessing to parent's position gives us nothing because we still need to sort them all together. we even can calculate parent's positions without access to his LTW, because we can just extract local position from world position

rustic rain
#

sorting is simple tho

#

if you know parent's position while accessing child

#

you once again, add some value based of X axis of position

#

in this case you don't even need entitiyID

#

it's just was ez way to access some unique per character data

deft stump
#

I see some Burst changes in 2022.1.0b3

Burst: Added: Added support for DOTS Runtime running / loading .Net Core assemblies.

Burst: Added: Added support for System.Span and System.ReadOnlySpan within Bursted code. These types are not allowed as entry-point arguments.

Burst: Added: BurstAuthorizedExternalMethodAttribute is now used to mark external functions that are safe to call potentially multiple times from static constructors (pure functions, with no side effects).
frosty siren
#

but how to solve problem with characters with stays on same positions? all children will get the same parent's postition

rustic rain
deft stump
#

Ooooh so DOTS 1.0 is really on the horizon.
URP: Added: Added minimal picking support for DOTS 1.0 (on parity with Hybrid Renderer V2).

frosty siren
rustic rain
#

like, biggest value of Y axis comes from X and Z math

#

while also adding some super small value from entityID

#

so in case

#

X and Z of other entity are exact same, your draw order is secured by entityID

frosty siren
#

yeap, but how to calculate this small value

rustic rain
#

just keep it very small

frosty siren
#

i mean 0.00001 * Entity.Index will grow with index

rustic rain
#

it's not really relevant

#

you can add additional math of keeping it always small

#

smth like

#

if (Index > 10000) index / 1000;

frosty siren
#

my brain gets heated. It is still requires sorting children between each other, so i need pack theirs local positions to that small adjustments

rustic rain
#

no it doesn't

#

just query through additional tags

#

which also will have some weight

#

eg:
leg 1
body 2
head 4
hands 3

#

it's basically a matter of keeping values intact

#

as you need to have this offset below 0.01

#

or maybe 0.05

#

to avoid any visible changes

#

for camera

frosty siren
rustic rain
#

Component without values

frosty siren
#

oh, ok. So one tag for one kind of child?

rustic rain
#

yeah, every leg will have some LegTagComponent

#

or smth like that

frosty siren
#

it will stretch rendering system code to infinity

rustic rain
#

why? it can be done in one system

#

with just 3 queries

frosty siren
#

because different cases assumes different children set

rustic rain
#

1 query for tags (actually each query for each tag)

#

1 query for position based offset

frosty siren
#

characters wants body parts, dress, etc. Building wants parts

rustic rain
#

1 query for entityID query

deft stump
#

question is how deep can you go without the rendering system go to infinity

rustic rain
#

well, you'll have tags for all your entities you want to draw

#

it's not like those tags can't be used for anything else

#

you can later use them for some kind of game logic

frosty siren
rustic rain
#

I don't see why my solution is no perfect xD

#

fast and efficient

deft stump
#

1 tag for each child

rustic rain
#

each kind of child

#

basically, body part

deft stump
#

you can have infinity body parts

frosty siren
#

it doesn't scale

rustic rain
#

why not

#

you can limit it to 1 tag

deft stump
#

so you'll be making infinity tag for infinity body parts

rustic rain
#

and call it

#

internal offset

#

and query through this one tag

#

using internal value

frosty siren
#

i mean for my own project, yes, i can predefine all kinds of children, but for other project ๐Ÿ™‚

rustic rain
#

that is assigned whenever you initialise this entity

#

idk why I didn't think of just offset comp in the first place

deft stump
#

over engineering lmao

rustic rain
#

can't help myself being less close minded kek

frosty siren
#

basically idea of calculation universal sort value depending on position/parent position/parent id is good, but i still try to figure out how to avoid all issues

rustic rain
#

eventually some things are eyes opening anyway

#

hm

#

biggest work here would be figuring out numbers

#

imo

#

will require tests I guess

#

while the only issue I can see

#

is when both entities in same position

#

and their IDs overlap

#

smth like ID 1000 and ID 10000

#

but how often that would happen?

frosty siren
#

small adjustment leads to different entities on same world positions is not same more, and adjustment values is deterministic because of entity.index
children can calculate parent's positions and make own additional adjustment to goes after parent, but how to figure out proper adjustment to child be sorted with other children

#

and also be before next parent

rustic rain
#

offset tag

frosty siren
#

component with offset value?

rustic rain
#

Predefined value that differs between objects

#

yeah

frosty siren
#

but they can move

rustic rain
#

let's say, it's float from 0 to 1

devout prairie
#

any idea is there a way to duplicate what ConvertAndInjectGameObject does, but inside a custom IConvertGameObjectToEntity class?

rustic rain
#

all your body parts already know their "priority" for drawing

#

before game starts

#

you can always add more

#

and etc

#

mix them in any way between

#

in the end it'll be just 1 query that makes a small adjustment to Y axis

devout prairie
frosty siren
devout prairie
frosty siren
rustic rain
#

why not?

#

just change this value from 0 to 1

#

like sine

#

foreach entity.WithAll<floatingOrbTag>(ref ChildDrawOffsetComponent offset).Run()

#

smth like this

#

I guess

frosty siren
rustic rain
#

actually, you aren't even limited to 0 or 1

#

it's up to you what values to use

#

idea is same

frosty siren
#

ok thank you for ideas, i'll try to compile it in some solution ๐Ÿ‘

rustic rain
#

I actually wonder if you can acess parent's comp in children

#

and how it'll affect perfomance

frosty siren
#

with 1 depth level it is simple as LocalToWorld.Position - LocalToObject.Position

rustic rain
#

not really in this case

#

but overall

#

accessing some other entities component

coarse turtle
#

btw, has anyone had an issue where Entities calling IsEmptyIgnoreFilter result into a null reference exception?

FAULTING_SOURCE_LINE:  ..\Unity\cartediem\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Unity.Entities5.cpp

FAULTING_SOURCE_FILE:  ..\Unity\cartediem\Library\Bee\artifacts\WinPlayerBuildProgram\il2cppOutput\cpp\Unity.Entities5.cpp

FAULTING_SOURCE_LINE_NUMBER:  10675

SYMBOL_NAME:  GameAssembly!EntityQueryImpl_get_IsEmptyIgnoreFilter_mC61848E0EE4543DE37D44F14346CC26454719F78+54

I'm looking at a dmp file in windbg to see if I can figure out which query is causing this in an IL2CPP build ๐Ÿค”

digital kestrel
#

how do you create / enable a system you marked a with [DisableAutoCreation]

#

using World.GetOrCreateSystem() doesnt seem to create it

rustic rain
#

Any idea what is wrong? I simply loaded new scene aaaaand all materials are black (they should be white and red instead).
Even though in component it's visible as red

#

by loaded new scene I mean this


        this.Q("button-newgame")?.RegisterCallback<ClickEvent>(StartNewGame);



    private void StartNewGame(ClickEvent evt)
    {
        SceneManager.LoadScene(1);
    }
#

Meanwhile if I load scene directly, not during runtime - it's all works as intended

remote crater
#

Anyway to "FUSE" a gameobject into all its children so you can turn it into an Entity?

#

Another general and fun question: Lets say I have Entities with "Attractor Logic" Aka, if you're within X range, pick it up.

#

In Gameobject terms, I just did an update and searched for nearby objects every few frames.

#

I wonder if there is a better way of doing this using ECS/DOTS.

#

Ie, you're pacmanning dots

#

And if you're within X of the dot, it collects.

#

The way I'm thinking of doing this is making an Attractor SystemBase .foreach parallel

#

the IcomponentData will be AttractorData

#

prolly won't have much in it, more of a tag, but maybe could have a modifier to be collected further, say its a magnet itself

#

In the systembase I am thinking of looping through all entities, and each entity will need a counter

#

Cuz one of the best things you can do in ECS/DOTS is to not do mass AI calculations every frame

#

So in AttractorData I'll have an int called: CycleInt

#

on the .foreach it will add +1;

#

then if Cycleint> 7, then look for a collection

#

and set cycleint=0;

#

Also...

#

It will be good to randomize

#

Every cycle int

#

well only if spawned

#

I'm thinking I want the jobs to cycle evenly, not spike every 7 frames, but thats minor

#

I'll need to find a function or something to find entities nearby.

#

Typically this involves a 3d array of stuff nearby...

#

I wonder if Unity supplies such functionality for DOTS/ECS

#

I think that's my big question.

#

Can you find stuff close by in your sector on a fast scale, or do I have to roll my own 3d grid buffer system to know stuff in the general zone nearby?

remote crater
rustic rain
#

just highlighted

#

spheres are fully white originally (standard material)

#

here how it looks when I load scene directly

remote crater
#

Oh great the unity example is in the boids example

#

I get a chance to recompile it

#

My youtube video doing 2.5 million boids got thousands of views...

#

But I never standaloned it for 10x as much processing...

rotund token
digital kestrel
#

how do you add it to the playerloop?

rotund token
digital kestrel
molten flame
#

Trying to understand the order that the conversion system runs compared to the regular player loop.
Specifically I'm looking to initialize regular GO components in a script and ensure that they get converted.
Normally this works fine, but with prefabs it falls down.

rustic rain
#

take a look at this tutorial

#

high quality explanation

molten flame
#

Thanks @rustic rain, moetsi tutorials are great.
I think I gave a shit explanation of my problem.
I essentially want to know what people do for the equivalent of the Awake function in DOTS.

Sometimes I will have a mono that will add components via script dynamically instead of statically.
This means the added components do not have any data assigned from the inspector, the data would all just be sitting in the mono fields so would need to be assigned, normally I do this in OnValidate, then I would then call that OnValidadate func again in Awake so it works for prefabs too.
In DOTS, you don't get Awake afaict, or at least it's unreliable.
Thinking it through, I think Awake essentially becomes the Convert function, does that sound right?

#

However, this is what gets me, I dont think you can add components during Convert

rustic rain
#

Can you explain what you want to achieve gameplay wise?

remote crater
#

You can addcomponents and data after you make em

molten flame
#

It's not a gameplay thing, its purely an authoring workflow.

In this example I want to set the material to my mesh renderer before the prefab is spawned.

Material _material;
MeshRenderer _meshRenderer;

OnValidate()
{
  _meshRenderer = AddComponent<MeshRenderer>();
  _meshRenderer.hideFlags = HideFlags.HideInInspector;
  Setup();
}

Setup()
{
  _meshRenderer.material = _material;
}

Convert(Entity ent, EntityManager em, GOConversionSystem cs)
{
  Setup();
}
remote crater
#

The conversion process is fickle

#

Either it works before or after, get anything working

#

I have mine to slap on diff mesh and materials but I forget how

#

The thing with dots now, is it ain't always pretty

#

get it functional, get it optimized

rustic rain
remote crater
#

Listen to issue

coarse turtle
remote crater
#

Sometimes you cant even add components and stuff before conversion

molten flame
#

GO Components

#

obvs you can add DOTS components

coarse turtle
#

Ah gameobject components

remote crater
#

You want to convert once, and keep an entity around to clone

#

like object pool

#

If you messing around with game objects live en mass, you doing something horribly wrong

rustic rain
#

I don't really get what you want to achieve

#

Entities don't run code

#

Only systems do

remote crater
#

He wants to slap gamedatacomponents on gameobjects before convert

#

I ran into th eissue too

#

its a mess, but thats fine, you shouldn't be doing that anyway

molten flame
#

Thanks for the help guys ๐Ÿ™‚ I do really appreciate it

remote crater
#

I keep all my "objectpool" entities in memory

#

with a disabled and disablerendering tag on them

#

They don't slow the system down, but make the entity debugger a bit crowded

#

Then when you entity e=instantiate it, then you can add to e.addcomponent

#

or ecb.addcomponent

#

either entity directly or entity command buffer if needed

#

I just realized, my game is almost ready to launch.

#

Tomorrow I'll launch and do the tutorial video

#

I wonder if my Unity Asset store application vetted

rustic rain
remote crater
#

I will make this sooooooooo Easy for everyone, even people with mature gameObject games

#

Issue, if you keep disabled and disable rendering on a zillion stuff spawned from your resources folder

#

you can immediately isntantiate off them like they're object pooled

#

its easy pz, and no GUI editor work.

rustic rain
#

Uugh

#

I still don't follow

remote crater
#

Can you wait a day?

#

I have a million small tricks that all add up to a Smooth Design Patterns Architecture for DOTS

#

Well

#

Ok I'll walk you through this part

#

You know the resources folder is a special folder?

rustic rain
#

Let's assume I do xD

remote crater
#

Its the one folder that allows you to load game objects from disk on the fly

#

so you don't need to drag em in a scene or something

rustic rain
#

Ah, I did it once

remote crater
#

Unity says not to do it

#

Because they think people are morons

#

But no coder is a moron

molten flame
#

Ha

remote crater
#

People who make GUI IDES think no one should code stuff they can drag and drop

#

Anyway, you load up your gameobjects, then slap em in a buffer pool

#

Then you can use em anywhere

#

I need to cool down, get some sunlight before close

#

I'll do this tutorial, I told people for a year I'd do

#

I finally have a core, everything works

#

And everyone needs this.

#

I'll be back in an hour after cleaning shed, and then I'll do my absolute professional youtube + clean up code for this one.

#

I have people like Turbo Makes Games amazed at what I came up with.,

#

oops

#

If you understand this video, you do not need to make new games from scratch. You can simply use your gameobject games and entityfy new levels with em. I apologize for this video being extremely rambling on, but I was also doing some dev and I plan on getting you a great video soon, but to some, this will be a God send Holy Grail of Dots ECS ...

โ–ถ Play video
#

Not a lot of you will understand this, but this is how ANY GameObject video game can get DOTS ECS update levels.

#

Its rambly, bad production. I promise you guys, in an hour, I'll get it making sense, with tons of other big time methodology not being used, but should be industry standard.

#

In short, I'm going to make DOTS/ECS easy, but give me 8 hours to produce it.

#

People say you can't even make GameObject games into DOTS/ECS, you have to start from scratch. That is not true.

rustic rain
#

It's a deal

#

See you in 8 hours then kek

remote crater
#

HUK

#

I want to make the chobo gosu

#

well discord bots killing my Korean whale face

#

\

#

\ ( ^ ________ ^ ) /

#

sposed to have more underlines

#

\ ( ^ _____ ______ _______ __ ___ ^ ) /

#

what the lol, those are all _

#

Discord made it into a creepy hockey veteran Korean whale

molten flame
#

Thats a cursed whale

remote crater
#

hhahaahh

rotund token
remote crater
#

Nah, you can load/unload em at will.

#

Initialization of gameobject can happen over and over.

#

This system is literally perfect.

#

Well for all my use cases and I am quite demanding.

#

My software architecture always demands the ability to build upon.

#

I think you'll be impressed my tertle bro, remember, you helped bring this to fruition.

rotund token
#

You don't seem to understand how memory management works with asset bundles (resource folder is considered a single asset bundle)

#

Just destroying the asset from a resource folder is very unlikely to free any memory

remote crater
#

I was under the impression, the resource folder was a disk hit.

rotund token
#

This is the reason Unity tells you to avoid the Resource folder

remote crater
#

Where's the one to load from disk then?

rotund token
#

You can avoid that by not using the Resources folder, which makes detailed and controlled memory usage quite hard to achieve. It will be build into a single AssetBundle and then fully load the index into Memory. Assets loaded from it may remain in memory longer as needed in the scene and you have less control over when they get loaded in, as e.g. loading an object that references them will load them into memory. Instead, you can get more control by placing these assets in separate asset bundles.

rotund token
# remote crater Where's the one to load from disk then?

The quick explanation of how asset bundles work.

  • Lets say an asset bundle has 2 assets, A, B, C
  • You load asset A, B
  • You unload asset A. Both asset A, B will still be in memory
  • You load asset C. A, B, C now in memory.
  • You unload asset A, B. A, B, C now in memory.
  • You unload asset C. All memory freed
remote crater
#

I know of alternate ways of loading assets, but I always thought Unity was convoluted in not allowing us just to load from disk.

rotund token
#

TLDR; all assets in a bundle need to be unloaded before memory is freed for the bundle

remote crater
#

I definitely keep one copy of every asset in memory.

rotund token
#

yeah so if you have 20GB of assets you now permanently have 20GB of memory used...

#

now imagine AAA games with 100GB+ assets

remote crater
#

But you're saying like if I have a resources folder of 64gb, that even if I don't load anything, it will take up 64gb

rotund token
#

The one exception is for the Resource folder which has this function
Resources.UnloadUnusedAssets
Which will force unload assets from memory that are not used

#

The problem is, it causes huge frame spike

#

so can only really be used during a load screen

remote crater
#

Of course it should

#

Loading/unloading from disk is uge

#

But should be used sometimes

#

That's all very valuable information. I have many ways of loading things, not just resources.

#

Just resources is the fastest way to type it out. Keystrokes are faster than mouse drags.

rotund token
#

(I'm very bitter about memory management atm. I've spent around 3 of the last 6 months optimizing asset loading and memory manage for old gen consoles...)

remote crater
#

Imagine 40,000 mesh game objects drag and dropped

#

ahhaahahah

#

Your wisdom is well spent my man.

#

For if you ever see me flush with cash, from games, just hit me up

#

Rather just type out 40,000 or index loop em than drag and drop 40,000... especially if you need to shift, I think we're good to go.

#

I'm just glad you added to knowledge.

safe lintel
#

i always found assetbundles hard to understand ๐Ÿ™‚

remote crater
#

The demo I wanted to post has weird compile errors

still pewter
#

I need some help with structuring my code. I'm a bit of a newbie, but I'm stuck on the following problem.

My goal is to have an inventory with 5 slots, and when you would select, let's say slot 1, it shows a preview mesh at your cursor, and when you click, it builds that entity. In my case a turret for a tower defense game.

So I need to convert and declare these GameObject prefabs through a GameObjectConversionSystem, simple enough. But then I need to store these in an inventory that I can reference to when I select a slot, I guess a BlobAssetReference?

In Standard Unity, I would have an inventory manager with an array of 5 scriptableObjects containing the GameObject turretPrefab, the Mesh previewMesh, the int buildCost, and Sprite iconUI.
But how would I convert a ScriptableObject that contains a GameObject prefab?

rotund token
#

@still pewter while maybe not an inventory, conceptually are you trying to do something like this? i.e. preview + place
If so I can kind of detail at least part of how I'm handling this so far (it's a work in progress)

remote crater
#

I was making the standalone template and ran into this error: IndexOutOfRangeException: Index 0 is out of range of '0' Length.
Unity.Collections.NativeArray1[T].FailOutOfRangeError (System.Int32 index) (at <d3b66f0ad4e34a55b6ef91ab84878193>:0) Unity.Collections.NativeArray1[T].CheckElementReadAccess (System.Int32 index) (at <d3b66f0ad4e34a55b6ef91ab84878193>:0)
Unity.Collections.NativeArray1[T].get_Item (System.Int32 index) (at <d3b66f0ad4e34a55b6ef91ab84878193>:0) Unity.Physics.Broadphase+DynamicVsDynamicFindOverlappingPairsJob.Execute (System.Int32 index) (at Library/PackageCache/com.unity.physics@0.6.0-preview.3/Unity.Physics/Collision/World/Broadphase.cs:1052) Unity.Jobs.IJobParallelForDeferExtensions+JobParallelForDeferProducer1[T].Execute (T& jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.jobs@0.8.0-preview.23/Unity.Jobs/IJobParallelForDefer.cs:62)

rotund token
#

probably forgot to add a handle to the physics world

#

Also just a heads up to developers , Unity 2020.3.26 and 2021.2.8 appear to have broken DeferredJobArrays or something related to it (and therefore Netcode). I believe it's likely this change
Kernel: Fixed an issue where low bit set in NativeArray buffer pointer assumes NativeArray is created by NativeList.AsDeferredJobArray which is not always the case. In some cases NativeArray can be created by NativeArray.GetSubArray, where pointer would have lowest bit set for odd byte aligned offset. (1294627)

still pewter
#

And I assume that you can press 1 or 2 to change your object? Because that's also what I'm trying to do

rotund token
#

i've split the prefabs into 2, I have the 'preview' and the 'ghost' (i'm built this using netcode, so by ghost i just mean the actual placed structure)

#

these are just prefab instances for maintainability. the ghost is basically just the preview with physics collider added and a couple of other scripts etc

rustic rain
#

is there any up to date example of character controller?

#

Mostly interested in collision with environment

#

and how it's done

karmic basin
#

The sample from Unity is not so great

#

you can find better implementations on blogs (and maybe the forum ? not sure)

#

Worth mentioning Rival asset too

rustic rain
#

Rival is not open source project I assume

#

hm

#

is doing public float3 CurrentDirection { get; set; } such properties ok for structs?

#

components I mean

#

what's the difference between just using field of float3

#

as value

#

Do you guys know, is IJobChunk smth obsolete?

still pewter
verbal pewter
#

Question: how are we meant to check equality of components? In one case I'm using Equals which is throwing the following Burst error: Burst error BC1001: Unable to access the managed method object.Equals(object) from type RockMine.C4.Generation.City.Networks.NetworkNodeArchetypeData.

worn valley
#

Two components may have all the same values but not be associated with each other.

#

And since components are structs they are passed around as values and aren't really objects to be equaled with each other.

hot basin
#

do I need dots physics to make selection in pure DOTS?

#

I mean, normally I just make a raycast but it needs a collider on the object part so can I do it without somehow?

#

I have no use for physics in my game so using it this way seems to be an overkill

left oak
#

^ There's ways to spatially partition stuff and query for selection other than resorting to raycasts with the physics package, but you'll have to do a lot of it yourself, so that's a tradeoff

rustic rain
#

in case you go with dots physics, it's pretty lightweight when it has no objects to work on

#

literally 0.01ms on 0 objects

#

entities*

hot basin
#

what do you mean? I will need colliders on everything selectable

#

like rigidbody equivalent?

rustic rain
#

I mean is that if they will be kinematic, they won't cause anything to process

hot basin
#

๐Ÿ‘Œ

#

then I'll try

rustic rain
#

I'm currently trying to understand unity samples of physics

#

and ngl

#

my head hurts

#

even after bull sized sugar doses kek

hot basin
#

AFAIK it will produce pair collision event that you need to handle and that's everything

rustic rain
#

if you just want to select on mouseover

#

then we are actually studying same thing rn

#

I'm looking through "Mouse pick" system

hot basin
#

for every collision it's the same

rustic rain
#

that lets you drag objects

#

in short, this is how it looks

#

I don't really get the magic behind CollisionWOrld.CastRay tho

#

but it seems like it's ready to use code for getting entity on mouseover

#

with precision of exact point of body you click

hot basin
#

nice, thanks! that will definitely help me

rustic rain
#

here whole code

#

btw

#

do you have any idea about

#

IJob interface

#

IJobChunk

#

and etc

#

are those about to be deprecated?

#

Those are pretty old samples

#

and I haven't yet seen those interfaces in any new tutorials

#

so I kind of fear

#

if I should learn more about them or not

hot basin
#

I know only that IJobChunk will be replaced by IJobEntityBatch or something similar

#

but never used them

#

IJob is just a simplest job type

rustic rain
#

I only worked with Entities.ForEach or Job.WithCode

#

haven't touched any interfaced job structs

hot basin
#

then just try it ๐Ÿ˜„ they are simple

#

sadly in my company we don't use ECS so I'm constrained to jobs in MB

rustic rain
#

I do get general idea, just wondering

#

if I should get used to them

hot basin
#

they are pretty same as Entities.ForEach, just couple more lines like .Complete()

rustic rain
#

is there any reason to use them tho?

#

I assume whatever code is done with them

#

can be done with ForEach and etc

hot basin
#

i.e. I have "attack component" with target and value
in my system I do 2 jobs, first sort components by target and second one apply dmg to the target

#

It would be difficult to do this in .ForEach manner

rustic rain
#

well, you can do such loops several times

#

in one OnUpdate

#

tho

hot basin
#

yes you can, but after my first loop/job I have NativeHashMap so

karmic basin
#

If you guys are working on selection with DOTS, TurboMakesGames just released a video on that this week if I'm not mistaken

#

ECS*

rustic rain
#

I'm just learning stuff I don't know by looking through 2 yo examples xD

hot basin
rustic rain
#

it's easy to say xD

#

even with those comments, my head just goes pffff

hot basin
#

learning about stuff gives you more options to use in the future

rustic rain
#

My current goal is actually to make a character controller

hot basin
#

if you want to learn jobs look into basic DOTS samles

rustic rain
#

similiar to GO one

#

that is responsive and not really attached to physics

#

besides collisions

hot basin
#

not phisics or any other package specific

#

I remembered now, there are different samples for jobs only

#

like not even in ECS

rustic rain
#

I don't find jobs hard

#

I find physics hard kek

#

these examples seem to assume that you know what all that means already, just showing how it's done in dots...

#

but I'm learning this stuff from ground zero (besides irl physics knowledge, which doesn't help a lot tbh)

hot basin
#

and they should be as they are "physics samples" not "job samples"

#

it's your mistake to start in the middle ๐Ÿ˜„

rustic rain
#

yeah, that's I was asking whether

#

those job struct interfaces are deprecated or smth

#

cause they appeared only in old samples

hot basin
#

so the answer is: no, they don't. ForEach it's just a wrapper to reduce boilerplate, it's all jobs under the hood

#

sometimes you want more control that ForEach gives

#

and you can make your own custom made job types for whatever reason

#

the only reason I found is to iterate other collection than array in the IJobFor

#

probably your own custom native collection

left oak
#

IJobChunk will, I believe, eventually be superseded by IJobEntityBatch & IJobEntityBatchWithIndex, though, it's unclear if that will happen in version 0.5

hot basin
#

I tend to make ForEach in systems that operates on single entity, and Jobs in systems that communicate between enities and need 2 or more entity queries

#

as an example for uses of jobs

left oak
#

You can do things when you operate on entire chunks that's not as efficient when just using entities.foreach

pliant pike
#

I don't suppose anyone knows if when using a CommandBuffer in a job to create an entity there's a way to ensure that it only creates one of those entity's?

hot basin
#

single bool value?

dense crypt
left oak
#

i mean definitely don't put the spawning logic in a parallel job then

pliant pike
#

I have a weird job loop that's running over multiple entity's and can run multiple times for a single entity

dense crypt
#

Yeah doing it in parallel will be problematic. If you run it in parallel and create multiple you'd need some cleanup job to run later and clean up all but 1 of the entities.

pliant pike
#

I want to create like a singleton event entity that will cause another job to run

dense crypt
pliant pike
#

hmm yeah maybe the job to clean up the excessive entity's run after the AddJobHandforProducer would be the only way then ๐Ÿค”

left oak
#

like peppej said, if it's just an event flag, it doesn't matter if there are duplicates

pliant pike
#

but [RequireSingletonforUpdate] requires a single one

left oak
#

just use a regular query

#

but don't iterate for each entity in query

dense crypt
#

The way I would do this is have an entity that always exist and flip a bool value on it. Always run the job and if the value is false just early return.

left oak
#

and RequireForUpdate

dense crypt
#

Depending on how often your "event" entity is spawned/destroyed it's probably faster the just flip a bool value

#

To prevent err

left oak
#

yeah, your systems will still run, so you might need to modify your OnUpdate code

pliant pike
left oak
#

actually, your dependent jobs will all still run

dense crypt
#

~~wtf I can't remember what its called. ~~Structural changes is expensive if you have to allocate a new chunk.

left oak
#

cause the changefilter will always return true

#

it's a tradeoff of structural changes vs scheduling jobs that don't do anything/early-out

pliant pike
#

ok boolean it is then, thanks everyone ๐Ÿ‘

hot basin
#

๐Ÿ‘Œ

left oak
#

there's an old forum thread that compares bools vs tags at scale for performance, and there's definitely a tipping point somewhere, but not sure it matters for individual tags, unless it means the difference between having/not having any structural changes on a given frame

misty wedge
#

Is StepPhysicsWorld very slow for anyone else?

#

I have 32 physics entities, which seems like a paltry amount, and the system takes ~3-4 ms...

rotund token
rustic rain
#

sooo. I'm looking into collision filters. And I found this funny example:
Object belongs to nothing collides with static env

#

and then I have static env, that collides with everything

#

and they don't collide

#

any explanation why?

unkempt silo
#

How to put I componentdata onto an entity? Was trying to use ECS visual scripting to wrap my head around ECS

#

However for certain code to work on a certain archetyoe of entity I need to make sure those entities have certain data

rustic rain
#

SetComponentData

unkempt silo
#

How do I attach it to an entity in the hierarchy for testing

rustic rain
#

a bit more details? Do you convert GO or create entity in runtime or?

unkempt silo
#

Well the thing I'm confused about setting entity at runtime

#

How do I set the correct entity's at runtime

#

Eg I have cows and pigs

rustic rain
#

you create new entity either by archetype or you manually add components

unkempt silo
#

If they both start as the same archetype how do I set an individual to have a certain component

rustic rain
unkempt silo
#

Is there a way to set an archetype in the editor

rustic rain
#

here how authoring components usually look like

rustic rain
#

you usually just make authoring components

#

and put them on your GO

unkempt silo
#

Ok so you would add this script to the prefab

rustic rain
#

so they get converted upon start

#

this script is mono

#

create->ECS->Authoring

#

you'll get your template

#

with detailed comments

unkempt silo
#

Ok interesting

#

Thank you I will try to go on that

rustic rain
#

I really recommend this site for tutorials

unkempt silo
#

Oh excellent

rustic rain
#

up to date tutorials on dots

#

actually a gem for newbies like you and me

#

kek

unkempt silo
#

Awesome. Yeh Im not even sure how to wrap my head around ECS especially since it's apparently always changing

rustic rain
#

ECS is not changing

#

dots does

#

but it's irrelevant

#

it's mostly about learning this new way of thinking anyway

unkempt silo
#

Honestly I wasn't that good at the old way of thinking so maybe I have a head start there haheha

rustic rain
#

I barely just learnt of OOP and already diving deep into DOD kek

#

It is really fun

unkempt silo
#

But there seems to be a lot of seasoned developers saying "oh I'm not touching ECS properly until they sort it out"

rustic rain
#

I kind of already was using sort of ecs system while doing tile based gas

#

where gas was literally an index of array kek

rustic rain
#

or you can start now

#

and then just catch up on changes

#

can be compared to watching series on season's releases or watch whole thing in one sitting xD

tawdry iron
#

hello, I've been messing around with quaternions in order to fix a problem with my prefabs being spawned sideways, yet for some reason it's also changing the size and shape??

hot basin
#

seem you don't know how the quaternion works, it's not just a x,y,z rotation as it was before, I think you should just google it as I will not be able to properly teach you how it works by few messages on discord

#

changing scale is probably due to wrong quaternion values as it lands in local to world matrix

rustic rain
# tawdry iron

you don't change quaternions yourself (I doubt there's a sane person who can actually edit it manually)

#

instead you generate them from Euler angles

hot basin
#

ideally you just use quaternions

tawdry iron
#

this is crazy, cus it was my own lecturer who told me to do this

rotund token
#

if you don't want rotation use quaterion.identity

tawdry iron
rotund token
#

so will cause all sorts of issues

tawdry iron
#

I just want them to face upwards tbh, instead of sideways

tawdry iron
rustic rain
rotund token
#

I think you should avoid both Quaterion and Vector3 if you're using entities

tawdry iron
rustic rain
tawdry iron
#

I'm ridiculously new to this

rustic rain
rotund token
#

quaternion.Euler(math.up()) would be the math library equiv

rustic rain
#

you can easily switch between two

#

but when cpu works with it, it doesn't do that. It works purely with quaternions, which avoid all bugs related to glitched rotations, that happen with euler angles

tawdry iron
rustic rain
#

in short: quaternions is just different way to describe rotation of object.
The reason it's used: it's bug free. But unreadable for human.

#

actually, it is readable, just not for sane ppl xD

tawdry iron
#

while, I'm here, as you can see I'm making a beehive. What would be a good video for ai pathfinding that I could use

rustic rain
#

I spent about 10 hours trying to understand them, but I gave up

#

I literally watched through math course just to try and understand them xD

rustic rain
#

no, I mean how do you just go and define certain angle

#

for example Vector Up

#

in quaternion

hot basin
#

so value * quaternion.RotateY(90) is rotating something by 90 in Y

#

or instead of degrees it take radians, don't remember now

rotund token
#

there are many ways to represent stuff depending on what you need, another example is quaterion.LookRotation(float3 forward, float3 up)

rotund token
hot basin
#

radians = angle/360 * PI

rustic rain
#

what is Euler alternative for it?

rotund token
#

or quaternion.AxisAngle(float3 axis, float angle)

rotund token
#

if you're standing up, you're forward 0,0,1 and up 0,1,0
if you're lying down you're forward is now 0,1,0 and forward is probably 0,0,-1

hot basin
rustic rain
#

kinda, that's what I meant:
You can transform quaternions, it's pretty simple.
But not just define it, without using euler angles.

#

so initial rotation will always come from euler -> quaternion transformation

rotund token
#

i'm just saying you can define it in direction vectors instead of euler angles

#

and if anything it makes more sense

rustic rain
#

where can I read more about this btw?

#

This kind of subject is of my interest rn

hot basin
rustic rain
#

well, multiplying matrices is not fun math tbh

#

I'd let machines do that stuff kek

rotund token
#

just think about real life. you don't think 'my tv is rotated 90* in the Y direction'. You think 'my tv is facing forward'

#

it's interesting we choose to think differently when developing games

#

just food for thought

tawdry iron
hot basin
#

EulerAngles

rustic rain
#

no, it's for extracting

#

you sure you use Quaternion, not quaternion?

#

I don't remember alternative of Euler in quaternion

tawdry iron
#

nah, it's quaternion

#

lowercase

rustic rain
#

it doesn't have Euler method then

#

maybe it's just called differently

#

idk tbh

rotund token
tawdry iron
#

for some reason

rustic rain
#

EulerXYZ

#

try this one

tawdry iron
rustic rain
#

Just

hot basin
#

strange, but quaternion is ok?

tawdry iron
rustic rain
#

press ctrl and click on quaternion

#

and look what it has inside yourself

hot basin
#

do you use assembly definition files?

rustic rain
#

oh wait, you actually might want ZXY

#

looks like this is what Unity editor uses with GO

hot basin
tawdry iron
tawdry iron
#

but it's NOT accepting it?????????

rustic rain
#

and how exactly you are trying to call it?

tawdry iron
#

as a new rotation

rustic rain
#

just show

tawdry iron
rustic rain
#

welp

hot basin
#

do you even have quaternion.Euler here?

rustic rain
#

I guess you need to learn C# syntax a bit more

#

instead of new, just put

#

quaternion.Euler(whateverEulerAnglesYouwant)

tawdry iron
tawdry iron
hot basin
#

show us how you actually use it

#

you probably have a mistake so unity don't accept it

tawdry iron
#

I don't use it, that's the problem ๐Ÿ˜ข , this the first time I'm trying to touch rotation at all

#

but oh well

hot basin
#

Value = quaternion.Euler(new float3(0f,0f,1f))

#

use this in rotation

tawdry iron
#

it worked

#

kinda

#

but I can work with this

#

thank you very much!

hot basin
#

np

tawdry iron
#

if I have any other questions, I'll be sure to come back

#

thanks fr man

#

I'll mess around with rotations

hot basin
#

I think it's radians as Tertle said so if you want to use degrees:

#

radians = angleInDegrees/360 * math.PI

rotund token
#

there's just

#

math.radians(degrees)

hot basin
tawdry iron
#

oh yeah

#

I asked if there was any good videos on pathfinding that anyone has seen?

hot basin
#

CodingMonkey channel has one I think

#

but it's 2D

rustic rain
#

DynamicBufferTriggerEventAuthoring
Can anyone explain this a bit?
So I read through code of this system about 5 times

#

But it's just feels like reading unknown language xD

#

Am I correct to assume that whichever entity has this component will collect all collision events in it's component buffer?

#

Or maybe just explain in short how you're supposed to use it? I generally get the code behind it, but I just don't get how to work with it

rotund token
#

doesn't this basically just add support for stateful trigger events "TriggerEnter" "TriggerStay" "TriggerExit"

rustic rain
#

yeah, it converts simple trigger events into stateful events

#

as far as I understand

#

and looks like it gets it from some Unity Physics system

rustic rain
#

omfg, they created a humanoid ragdoll

#

in 500 lines

#

I'm extremely confused

dense crypt
#

chunk.GetSharedComponentIndex() seems to return an index of 2 but the array populated by GetAllUniqueSharedComponentData only has index 0 and 1. Why is it returning an out of bounds value?

haughty rampart
#

it might return the length (how many shared component date) instead of the index?

karmic basin
dense crypt
remote crater
#

Sorry for the delay on that DOTS/ECS Ez mode tutorial, my old code that worked last year got hosed with a UNITY editor update.
Gonna do a modified version with only code snippets instead of a full project.

#

I rabbit holed like 7 hours trying to just get old code working for tutorial purposes. Did not succeed.

#

Once I finalize a few things on my game, I'll be able to do the DOTS/ECS ez mode tutorial, but I can't give a full project, just classes and stuff to assemble.

pliant pike
# tawdry iron I asked if there was any good videos on pathfinding that anyone has seen?

๐Ÿ“Œ Download the project files from this video: https://tmg.dev/DOTSFlowField ๐Ÿ“Œ
๐Ÿ“บ Learn how a flow field works: https://youtu.be/zr6ObNVgytk ๐Ÿ“บ
๐Ÿ’ฌ Join the conversation: https://tmg.dev/discord ๐Ÿ’ฌ

๐ŸŽฅ Flow Field Tutorial Unity MonoBehaviour: https://youtu.be/tSe6ZqDKB0Y
๐ŸŽฅ

๐Ÿ‘จโ€๐Ÿ’ป GitHub repo for this project: http://bit.ly/DOTSFlowFieldGit ๐Ÿ‘จโ€๐Ÿ’ป
๐Ÿ’ป My Game...

โ–ถ Play video
tawdry iron
pliant pike
#

it wouldn't bee that hard to make it work in a 3D space or however you want

rustic rain
#

unless you have some sort of space game ofc

tawdry iron
tawdry iron
rustic rain
#

do you really need pathfinding for that?

pliant pike
#

I mean yeah it wouldn't be hard to add an extra z dimension if you really needed to but it doesn't sound like pathfinding is needed for this problem at all

tawdry iron
haughty rampart
#

randomized how?

pliant pike
#

I don't suppose anyone knows how I change a singleton inside a job you can't seem to manipulate the value gotten from Getsingleton and SetSingleton doesn't work?

rustic rain
#

why it doesn't work?

#

SetSingleton is exactly what you need

pliant pike
#

it says its only allowed to be withoutburst() and Run()

#

I know I don't get it what's even the point of singletons then ๐Ÿ˜•

rustic rain
#

it's just special entity that can be only unique

#

one and only

pliant pike
#

yeah and which you cannot change inside a job

rustic rain
#

but you can

#

what's the problem to run job without burst?

pliant pike
#

because the whole point is to run a job with Burst that's how you get the best out of dots

rustic rain
#

hmm

#

I wonder if you can use command buffer

#

to change singletons

worn valley
#

@pliant pike What are you trying to run?

rustic rain
#

I really wonder tho, what kind of job on singleton you want to do, so you need burst for it

pliant pike
#

I'm just trying to set a boolean Singleton inside a Schedule() singlthread bursted job

worn valley
#

What type of Singleton? An component singleton?

pliant pike
#

yeah what other types are there?

worn valley
#

Singleton means there is just one type of that thing in the program. So singletons can be classes and other stuff

pliant pike
#

no yeah just a single componentdata

worn valley
#

So you have a component attached to a entity and you want to modify that component?

pliant pike
#

I mean I guess I could just use an EntityQuery and that would work but then what is even the point of GetSingleton SetSingleton etc

rustic rain
#

to get and set unique data?

worn valley
#

There are a lot of non burstable stuff that makes it easier to do certain things. But yeah, doing a query would work. SetSingleton is definitely a regular write.

#

There may be some methods to write a to a singleton. A lot of the ECS code has regular non burst stuff in it just to get it to run. Then they loop back to make it burstable and job ready later

tawdry iron
# haughty rampart randomized how?

I want the bee to leave the hive then run around the hive and return through the same hole. But I want to make it so that the bee always uses a different path when it leves the beehive every time

karmic basin
pliant pike
#

it turns out the ecb does work to set a singleton ๐Ÿคท

worn valley
#

huzzah

rustic rain
#

kind of weird tho

#

don't you want your single ton to be instantly changed?

rustic rain
#

instead it's just gonna be only on next frame

haughty rampart
#

that should be plenty fine though

#

the singleton value will not be used in other jobs anyway in this frame

pliant pike
#

yeah its not super time sensitive

rustic rain
#

idk, most things I can imagine with singletons are just global settings

haughty rampart
#

sure. but then next frame is perfectly fine

rustic rain
#

and what if it's time sensitive global setting tho

#

it might create some glitches

haughty rampart
#

it will rather create glitches if it's instant

safe lintel
#

thought this was mildly interesting

haughty rampart
#

in what way?

safe lintel
#

hes the lead on the hybrid renderer

pliant pike
#

cool I didn't think it would be that quick before other engines would emulate nanite leahWTF

haughty rampart
#

eeeehh, i mean i am looking extremely forward to a nanite equivalent but i wouldn't give anything about a speculative twitter comment

pliant pike
#

nanite with dots would be insane leahS

safe lintel
#

i figured they wouldnt even bother attempting an equivalent tbh

haughty rampart
#

true. though the benefit would even be without dots

haughty rampart
karmic basin
pliant pike
#

I thought as soon as Unreal announced it every other engine would be trying it

safe lintel
#

nah thats when we'll see 1.0 @karmic basin ๐Ÿ˜…

haughty rampart
karmic basin
#

Haha yeah

haughty rampart
#

i hope we get mesh shaders before nanite equiv though

tawdry iron
haughty rampart
robust scaffold
rustic rain
#

research 9 times, write code once

#

hmm

#

I wonder if there's a way to create some sort of abstraction for job system

#

I want to create some sort of system that will process whatever Job component entitiy has, where that Job component is AI state for doing something rather complex

#

Let's call it work:
so that work can be either going from one point to another, or doing some action on certain position

#

Thing is, amount of such jobs can be thousands

#

and you don't want to define each as system

#

anyone knows anything about this sort of stuff?

#

in OOP that would be just abstract Work class and whoever needs that AI, would just tick over some virtual method

#

I want to know how you can implement smth similiar with dots

karmic basin
# tawdry iron How would I even go about starting to do that <:SweatyPepe:800360098131869706>

Yeah that's not really a DOTS question at this point. When lost you can start by deconstructing the problem in lighter tasks. Here it could be

  1. learn how to generate a 3D spline
  2. learn more about path following. For example, Craig Reynolds' "Boids" implement a simple path following solution https://www.red3d.com/cwr/steer/gdc99/ (actually all of the Boids concepts would be useful for a beehive, depending how far you want to push your scene)
haughty rampart
remote crater
rustic rain
#

Any idea how it can be done alongside DOD?

haughty rampart
rustic rain
#

hm, static methods

#

that's sounds like a plan

tulip robin
#

Hello guys, I have a big question.
I wanted to know if it was possible to use "Graphics" command buffers in a base system running a ComputeShader in parallel with burst?

At the moment I have this working but I think it's not optimized and I'm missing some features to know.

so if you have the best way "the most optimized" for this kind of features, with pleasure!?

haughty rampart
# tulip robin

Command buffer will be executed on main thread only btw. Also compute shader works on GPU, not CPU, and I don't think you can dispatch them from a different thread cause that wouldn't make a difference anyway

tulip robin
#

So for this you are sure i can't do it ?

#

so why i can fill command buffer in SystemBase ?

#

and i have async btw

haughty rampart
tulip robin
#

aie ๐Ÿ˜ข

haughty rampart
#

Also, the command buffer in dots and in graphics are not the same

tulip robin
#

i know x)

#

that's why i try to make fusion

#

because i don't want to wait end of my compute shader

#

need to find solution to get handle or async c shader

haughty rampart
#

At least how you propose it it's most definitely not possible

tulip robin
#

humm CPU is use only to write data in GPU for compute shader ?

haughty rampart
tulip robin
#

ah

tulip robin
#

"GPU has to finish all tasks anyway before drawing anything" this is important thing

#

sad

#

so i can't dispatch end wait an handle to make "async"

haughty rampart
#

I'm 80% certain that doesn't exist

rustic rain
#

wdym

#

you can dispatch async

tulip robin
#

like this


class A {
bool chocolat;

void thread() {
  chocolat = true;
}
void update() {
  if (chocolat)
    doSomething();
}

}
#

@rustic rain its you, you said me i don't need to use async dispatch

#

btw

tulip robin
#

And how you know when it's finish ?

haughty rampart
tulip robin
#

i think ^^

rustic rain
#

I haven't actually worked with async, but I saw a lot of mentions that it's supported

#

here another link I found

tulip robin
#

yes look my pictures here so i m thinking how to make it properly, finally that's why i made this question because i have too less experience with CShader and ECS

#

possible to play with that

#

ok ok i see better now but not ultime mind x)

#

btw sorry for my english ^^

rustic rain
tulip robin
#

?

rustic rain
#

It's my own problem:
I don't get what is wrong
SceneManager.LoadScene("SampleScene", LoadSceneMode.Single);

#

I literally try to load other scene

#

and it won't go flawless

tulip robin
#

you added ?

rustic rain
#

yeah

#

I tried loading by index

#

same deal

tulip robin
#

LoadScene"Sync" deprecated for me

rustic rain
#

now it's doubled xD

#

here exactly what I do

#

World method is irrelevant (it's just resetting DefaultWorld of entities)

tulip robin
#

Ok and what is "please use ..." you have plugin ?

rustic rain
#

what plugin?

#

It says "Please use SceneManager.LoadScene()"

#

xD

#

btw

#

I checked

#

LoadScene is also using LoadAsync

#

inside

tulip robin
#

xD

#

ahaahah

rustic rain
#

I'll try to build and see if it'll be same

tulip robin
#

strange

#

i m going to try c buffer async with read callback

rustic rain
#

ah yes, Build exceptions

#

my favorite

#

hmm, input system doesn't work in build for some reason

#

I use new input system

tulip robin
#

same i try to make all from scratch (hand build) ^^

haughty rampart
# rustic rain

you cant unload the current scene before having switched to a new scene

rustic rain
#

and broken materials

haughty rampart
rustic rain
#

same deal

rotund token
#

How are you waiting for your scene to load before unloading

#

Because it looks like you're unloading before loading a new scene

rustic rain
#

Unloading is part of loading new scene

#

it's just a trigger event

#

of clicking button

rotund token
#

Hmm It's not the same scene you're in is it?

rustic rain
#

no

rotund token
#

Oh wait you're using the entities scene manager not the unity engine one?

rustic rain
#

I do?

rotund token
#

Just based off your stack

#

I guess it's listening to an event

rustic rain
#

I basically copied a sample of unity official repo

rotund token
#

Except they use load scene

#

Not load scene async

#

Which is what the warning is telling you to do

rustic rain
#

Uugh?

#

I use LoadScene

rotund token
#

Ok I'm tired and on my phone

#

Clearly I can not read

#

Got no idea then mate sorry

#

I have been no help but I don't use scenes so no experience sorry

rustic rain
#

Any idea about new input system not working properly in builds? COmpared to Editor

rotund token
#

What's the error

rustic rain
#

No errors, it's just not working

rotund token
#

We use input system at work in a released title no issue

#

How are you setting it up?

rustic rain
#

in a system

rotund token
#

Via the c# code generation then just new() +?

#

Hmm you've got your enable

rustic rain
#

so, basically after loading scene - no logs are registered

#

not even before loading scene

rotund token
#

Is your asset being included, wonder if that matters for c# anyway

rustic rain
#

well, it works in editor

#

perfectly fine

#

just not in build

rotund token
#

Just wondering if the asset isn't referenced its being excluded or something

#

I honestly don't know if it's needed or not

rustic rain
#

It's referenced in System

#

and system only

rotund token
#

You're referencing the code generated not the actual asset

#

Anyway I don't think it matters

#

Mono build?

rustic rain
#

how do I check?

rotund token
#

Project settings

rustic rain
rotund token
#

If you haven't changed it to il2cpp it'll be mono

#

What version you on?

rustic rain
#

2021.2.7f1

rotund token
#

Of input system

#

1.0.2 or later?

rustic rain
#

1.2.0

rotund token
#

Hmm not sure then sorry. I know there were a few issues in 1.0.x that I thought we fixed in 1.2

#

This is certainly not an uncommon issue though

#

Anyway I must sleep gl with it

graceful mason
haughty rampart
#

anyone know how i can run a simple job x amount of times?

rustic rain
haughty rampart
karmic basin
rustic rain
#

I have a feeling build configuration inspector is broken

#

no matter what you press at this point

#

this window is static

#

ok, so appears it's partially broken. Even tho component list is invisible, I can still click them in correct order.
Any tip in what category can I find Pipeline component?

#

So I can fix it

graceful mason
rustic rain
#

yeah

#

that's what I mean

#

after clicking one of categories

#

I still only see categories

#

yet I can blindly pick actual components

#

So I just added all of them

graceful mason
#

then you did a "Classic Build Configuration" asset for each platform (via the "Assets > Create > Build" menu). The properties of that asset will contain a "Scene List", which is the only way of adding subscenes to a standalone project. Make sure you add at least one scene or that the "Build Current Scene" checkbox is toggled on.

rustic rain
#

oooh

#

man

#

now I found how to create not empty kek

rustic rain
graceful mason
#

not sure soz

#

you need to make sure you add all your scenes otherwise your next levels wont load ๐Ÿ˜„

#

I know that much

rustic rain
#

any tip how to choose where to build using this?

#

cause after click:
Add Component -> Global
I see this:

karmic basin
#

Looking for this one I guess ?

rustic rain
#

yeah

karmic basin
#

Inside Unity.Build.Common

rustic rain
#

what order?

karmic basin
#

the third one for me

rustic rain
#

halleluya

#

looks like build works ok

#

it loads, it's not broken

#

even textures are ok

karmic basin
#

So you're saying the build config component is glitched ? In 2021 ?

rustic rain
#

yeah

karmic basin
#

ok good to know

rustic rain
#

Once it's open it's static picture, you only see category folders

#

if you click one - nothing changes, besides

#

clicking on first - will actually add whatever component is there

karmic basin
#

frustrating

rustic rain
#

ngl, all those annoying things make me want to go back to OOP for a while. At least until we see dots beta

haughty rampart
#

i've got this struct here:

    private struct ReturnValues
    {
        internal long _seed;
        internal NativeArray<Materials> _lc;
        internal long _lcProbability;
        internal NativeArray<Materials> _ap;
        internal long _apProbability;
    }

why can i not use that in a NativeList?

coarse turtle
karmic basin
#

Can't use a safe container inside another one

coarse turtle
#

Could always alias another struct to the native array's pointer ๐Ÿ‘€

haughty rampart
#

How would I go about this then?

coarse turtle
#

Something like this can work

unsafe struct UnsafeArrayWrapper<T> where T : unmanaged {
  [NativeDisableUnsafePtrRestriction]
  public void* Ptr;
  public ushort Capacity;

  // Add your get/set if you want read/write bracket accessors
  public this T[int i] => ((T*)Ptr)[i];

  public UnsafeArrayWrapper(NativeArray<T> values) {
    Ptr = values.GetUnsafePtr();
    Capacity = (ushort)values.Length;
  }
}
haughty rampart
#

Ok, nice to know. Thx

last swan
#

I have a global Status I want to check - when this is not the required Status the System should not run at all.
In the System I have much code and a Entities.ForEach loop, so I don't know if I could use anything for Update Requirements? This is how I do it currently (with the system running constantly)

    protected override void OnUpdate()
    {
      if (currentStatus != Status.RequiredStatus)
      {
        return;
      }

      // some other code
      // and a Entities.WithAll<ManyComponents>().ForEach().ScheduleParallel();
    }
dense crypt
#

But we usually used a query with CalculateChunkCount()