#archived-dots

1 messages ยท Page 210 of 1

gusty comet
#

I think I can have 90% of the data for the characters in a corresponding entity but have the actual character you see in the world be a gameobject so I dont have to deal with ECS animation, ECS character controllers, ECS camera....and all the other ECS stuff that has been jurry rigged together and not really thought out well.

I'm a little worried about when ECS updates vs when gameobjects update but I guess we'll see what happens

ocean tundra
#

yea probably a good idea

#

animation looks too rough for me

gusty comet
#

I'm 100% for ECS but if they want to go back to the stone ages with code based animation systems...no thanks

ocean tundra
#

i actully would prefer code based animation

#

but simple

#

like i always wanted to be able todo animationClip.Play(gameobject) in old MB world

gusty comet
#

I think animation is one of the things I greatly prefer in UE4

#

Their interface is so easy to use

ocean tundra
#

if they can make a way to add a component (so 1 component = 1 animation clip) i would love that

gusty comet
#

I don't like dealing with code when you have to pull in a bunch of assets

#

But thats just my personal preference

ocean tundra
#

That can be solved with code gen :p

gusty comet
#

Like the input system does

ocean tundra
#

Yup

#

Like configure your animations in a window/scriptable object, click generate, boom. Code

#

The worst part is code gen usually makes mods harder

#

But with dots being basically open source I'm sure there would be ways to extend for mods

gusty comet
#

There is but some of the code is terrible. If you look at their character controller for instance it's written to be all-or-nothing. With gameobject character controller, you put it in and just use the .move function and don't worry about anything else. In the ECS version, it's all integrated in with gravity and other stuff that generally the user would implement themself

#

They really need to focus on making the open source code more modular and manageable.

#

The good news is my code works ๐Ÿ™‚

sturdy rune
#

digression from your topic: do you use a lot of custom conversion logic, or are the out-of-box conversion pretty acceptable? finally getting around to implementing some things

#

back on the topic: are you sying there are ECS character controllers out of the box?? I am on my first attempt at DOTS implementation so just learning tools.

ocean tundra
#

@sturdy rune so ive started building more conversion stuff

gusty comet
#

I think it feels more proper to make your own authoring code rather than relying on the default convertoentity script unless it's something very simple like a static object

ocean tundra
#

unity has confirmed that the conversion workflow is here to stay, and i want to build some tools/assets so makes sence to support it

#

i started with using subscenes and IConvertToEntity

#

but have recently moved to custom ConversionSystems as i needed more control

gusty comet
sturdy rune
#

I still don't totally understand subscenes (sorry I am just getting to the gameplay documentation on unity site)

ocean tundra
#

ummm so think of subscenes as Scenes for ECS ๐Ÿ˜›

#

but with none of the old scene limitations

#

and all the data within a subscene is already converted and optmized

#

so its FAST

gusty comet
#

Subscenes are really simple - everything inside the subscene is converted to an entity and you can load and unload them from the world to create large open worlds or procedurally generated areas.

It's the single biggest reason to use DOTS - unity, for some reason, was basically incapable of being used for open world or procedurally generated games without you implementing all that functionality yourself (through gimmicky ways)

#

Subscenes aren't ECS scenes, they're INSIDE a scene.

#

They dont replace scenes

sturdy rune
#

I will finish reading this doc before I ask too many questions - the concept is simple but I haven't used one or delved into it yet, I just was reading about them in the auithoring section last night

#

so it sounds like a scene within a scene but I have no reference for that

ocean tundra
sturdy rune
#

I am so simple ๐Ÿ˜ฆ haha

ocean tundra
#

DOTS is alot ๐Ÿ˜›

#

way easier now

#

but still

sturdy rune
#

actually I really get the concepts and philosphy of DOTS/ECS

#

it makes complete sense from engineering level

#

I am struggling to implement my first projects

ocean tundra
#

yea that happened to me too

sturdy rune
#

where to start, how to implement even something simple. I am spinning my tires on practical side

ocean tundra
#

writing the first jobs was tough

#

then came foreach and i was like WOW

gusty comet
#

Subscenes are pretty basic - basically this short clip I made is what they're for. You can imagine streaming them in for open worlds or loading them in/out for procedural generation.

https://streamable.com/guhf1u

#

I have had some issues with them and my lighting system but that seems to be a glitch and just me

ocean tundra
#

yea full support for them thoughout the unity systems is still missing

#

like most of dots tho

#

๐Ÿ˜›

#

but its getting better

gusty comet
#

I have had horrible issues with them in the past. Objects would flicker randomly in and out of existence with HDRP and now it seems (i just noticed) i have an issue with some objects being blacked out like they're not getting lighting they would normally get if they werent in subscene

ocean tundra
#

yup

#

all that sounds very similar to my initial expenerences with them

#

this latest update feels like they are better tho

#

that lighting issue might be the hybrid renderer instead of subscenes

gusty comet
#

I'm on 2020.3.1f1 I might have to go back to the betas....

#

My last issue only occured on HDRP - I would assume this is the same thing

#

Same but different

zenith wyvern
#

I would not bother with subscenes if you're still learning. Just stick to IConvertGameObjectToEntity scripts until they have better support

gusty comet
#

For open world content you don't really have a choice

zenith wyvern
#

How so?

gusty comet
#

Other than implementing a gimmicky workaround

ocean tundra
#

yea was about to say depends on the game

#

for open world they will give you like alot out of the box

#

but for a 0.1 prototype yea you dont need them

sturdy rune
gusty comet
#

Subscenes should have already been a thing before DOTS and should not be DOTS exclusive. The simple utility of using them for procedural loading/unloading should have already been integrated with basic Unity

ocean tundra
#

it wasnt that hard to make scenes work like subscenes

sturdy rune
#

I am not building an MMO astraight away but I want to start simple and build up to a multiplayer space shooter

zenith wyvern
#

I didn't even think they had good/any support for runtime loading/unloading

sturdy rune
#

I am patient but also slow ๐Ÿ™‚

ocean tundra
#

back in old unity, ie load additive and unload

#

worst was the lightmapping

zenith wyvern
#

They were originally created for loading and unloading entity scenes in the editor specifically

gusty comet
#

I think they were basically required to get megacity off the ground

#

@sturdy rune Not all open worlds are complicated. You can make indie open worlds with less effort than some 2D games - depends on the game

zenith wyvern
#

You shouldn't need subscenes for a game like that for sure either

sturdy rune
#

good point - I will learn as I go @gusty comet. It's an exercise to build something one system at a time.

ocean tundra
#

@sturdy rune yea just pick a project you wanna make and start building it

#

1 bit at a time

gusty comet
#

You need some form of level streaming.

sturdy rune
#

once I finish this documentation passover, my project is starting with this goal: character controller for a space ship in a dotsnet project.

ocean tundra
#

Ooo i did that

#

tho without dotsnet

#

i did it before physics too, was a PAIN to get the bullets to hit things

sturdy rune
#

haha

gusty comet
#

Character Controllers are fun...

ocean tundra
#

mine was more of a rts controller

#

was pretty fun tho

#

and thats where version 0.1 of my networking tech got built

#

honestly supprized it worked

#

that whole project was like using gule to build a house

#

no clue what i was doing

#

but it worked

#

had like 10k bullets flying around at the end of it

gusty comet
#

RTS like FF/Pokemon or like Starcraft?

ocean tundra
#

more like starcraft

#

but "1" unit

#

one really really big space ship

#

the idea being you customize the ship, different guns, update insides ect

gusty comet
#

Ah - I assume you did research on how networking is done in those kind of games? I know its totally different, something like all the inputs are replicated across the server and the server runs the game instead of each client running the game and replicating data to one another across the server

ocean tundra
#

yup

#

lockstep

#

and decided its not worth it

#

๐Ÿ˜›

gusty comet
ocean tundra
#

yea read that

#

i went with curve networking

gusty comet
#

Oh same blog- neat

ocean tundra
#

haha

#

didnt notice that

sturdy rune
gusty comet
#

Final Fantasy lol

#

Probably bad example considering they have like 10 different game archetypes

sturdy rune
#

lol

#

my idea is more like.. squad + dreadnaught + star wars squadrons

ocean tundra
#

i dont think ill be smart enough to implement determisitic + lock step

#

yea thats much more "twich" focused

gusty comet
#

I've been working on character controllers for the last 6mo so

ocean tundra
#

so netcode or dotsnet would probably be a better fit

sturdy rune
#

yea I like the idea of a dotsnet for now where there's support and other transport options

ocean tundra
#

it looks pretty good

sturdy rune
#

but that is why I decided to learn eCS because it comes a system and could theoretically be decoupled

#

yea I liked the looks of it and very active developer

ocean tundra
#

im using Unity.Transport as my underlying transport

#

yea if you build it right changing transport layer is pretty easy

sturdy rune
#

I am sure for me it won't matter for a long enough time that, byt he time it does, I will know exactly what I am doing with it haha

ocean tundra
#

i think for a steam game is probably the only case where you may want a different transport

#

i cant think of any other usecases to support many transport layers

sturdy rune
#

I think some transports are more perfromant for different scenarios

#

but that's putting the cart before the horse for me

#

am a network/computer engineer but don't know enough about these specific transports ๐Ÿ˜›

ocean tundra
#

yea neither

#

i just wanted a reliable UDP transport

#

used ENet for a bit

#

bit now with Unity.Transport having tight support with burst+jobs seems like a easy win

#

so much speed being able to use those

sturdy rune
#

yea I think at this point it is most important part

#

soemthing that utilizes jobs + burst will be way more performant than anythign I have used so far

#

I have used mirror for a couple other projects and liked it so went with dotsnet as it was same author

ocean tundra
#

yea hes a pretty smart guy

tight blade
#

is Tiny the only thing in dots that has a Text module? Im trying to do, like UI text with entities

#

but all I ever hear about Tiny is frustration about how nothing in the ecosystem is compatible with it

ocean tundra
#

yea theres no general DOTS ui

#

just Tiny UI

#

which is like exream DOTS

#

i would just use hybrid

#

get your ui data entities setup, pump your data into those and setup some sort of change detection (not sure if built in will be enough)

#

then use a nice system + querys to get the data

#

also when there is a dots UI, you can just add it to your ui data entities

tight blade
#

blugh, I dont have much experience with hybrid, so I really dont... wannnnaaa

ocean tundra
#

need to learn it sometime

#

so many bits still missing from dots

tight blade
#

yeah, true. Its just that in this case what I was thinking of was a whole micro framework of text tooling, to create a little API for making animated text from a custom markup language that specified animation type/timing/effects, etc

ocean tundra
#

that sounds like alot

tight blade
#

wouldn't actually be that hard to prototype with an entities based thing, its just, like, a component that specifies shader values

#

but in this case I'd be writing more code to make it work with hybrid than the entire footprint of the prototype would have entailed

#

so, I think Im just gonna wait till theres native dots ui

ocean tundra
#

im thinking its still ages away

#

been like no info about UI for dots

#

and they have just spent ages rebuilding UI for like the 3rd time

#

so i expect if they do make something it will be build on UIToolkit

tight blade
#

UIToolkit?

ocean tundra
#

UI elements?

#

they keep renaming it

#

not sure what it is now

#

basicly HTML + CSS

tight blade
#

oh, right

ocean tundra
#

but with different names

tight blade
#

that sounds so fun

ocean tundra
#

๐Ÿ˜›

#

it wasnt that bad

#

and that was during like super early beta

tight blade
#

I love learning someone elses DSL for an already impossibly convoluted DSL

ocean tundra
#

they stuck with most of css which is good

#

easy to reuse that

#

but the html (XAML) was different

tight blade
#

huh. well, I guess as long as I can figure out what a <div> translates to, it will replicate the entirety of my business as usual usage of html

#

well. and attributes

#

so yeah, thanks; much appreciated. I guess I'll just play the long game on that project

ocean tundra
#

yea thats what i usually do

tight blade
#

brb check back with you in 3 years

ocean tundra
#

๐Ÿ˜›

ocean tundra
#

Has anyone been able to store a list of Subscenes in a MB?

#

I'm using subscenes as 'maps' and would like to be able to pass a list into my UI for a game lobby

#

so the player can pick a map

karmic basin
#

Store a list of SceneGUID ?

#
  • metadata like name and such for display
stone osprey
#

Ok soooo... Lets say we have some objets and some structs casted to objects in a List<object>. We want to Set/Add those all to an entity of our choice. How do we do that ? ( I actually found a way using reflection, but that one produces like 40 Bytes of garbage EACH call... so im looking for smarter ways )

#

Glad for any help and inspiration... this drives me crazy

zenith wyvern
stone osprey
#

Well of course. But thats not the problem here. Theres no other way i could deserialize my packet. At some point i need to store either a list of objects or a list of pointers. Well and i want to add those to an entity. Thats the main problem here

#

Because theres either a "SetComponent<KNOWNTYPE>(Entity entity, KNOWNTYPE T)" but none without those damn generics

#

The generics are the huge problem here

#

Well and a missing way to just insert a object or ptr to add/set a component

karmic pilot
#

you cannot add without knowing the exact type. So while/after reading your packet, you need to store the actual types and then depending on the actual type, call the corresponding SetComponent<TYPE>(...) . If you have a List of objects, you would have to iterate, unbox, get their real type and then add... this is cumbersome and will allocate memory

#

And there are always possible alternatives. But without more information and actual data/structure of packets, we cannot really do anything except guessing

zenith wyvern
#

This is a common C# concept and is only related to dots insofar as burst can't work with reference types.

karmic pilot
#

another important question: is your packet design/structure fixed and out of your control ?

stone osprey
#

Yep it is... thats why i needed to write my own deserializer for it which... returns a List<object>. And i know why they use generics, but.... look at that beauty here. They actually JUST use it for getting the type index. And well, i bet they could actually do the same by calling TypeManager.GetType();. This way they could provide either the generics variant. Or just a variant for lazy people which dont wanna write a huge switch case or automatic generate code

karmic pilot
#

you can do that yourself actually. unbox your value to its real struct and pass it as argument. you can also save your data instead of in a list as a dictionary/tuple of type + object and use that information to unbox and use the generic versions

north bay
#

Isn't the main problem here that you do not have access to the internal SetComponent method that just asks for a type index and the raw memory?

stone osprey
#

@karmic pilot But that would require a huge switch case... Or automatic code generation. And i actually wanna avoid both of them :/ But i think im just gonna try another way. Creating delegates n stuff to acess "EntityComponentStore" and similar other variables to "hack" myself into the EntityManager and CommandBuffer

#

@north bay Yep, but that asmref stuff still dont like me. So thats no option for me. I also updated unity. Nothing :c

north bay
#

Oh damn ๐Ÿ˜ฆ

#

I mean you can copy the actual package code into your project ๐Ÿคทโ€โ™‚๏ธ

#

Everytime you update entities you would have to change the internal method to public

stone osprey
#

Yeah... i also thought about that. But thats actually more work than writing some reflection code/delegate code ^^ But if my next attempt doesnt work... then i will really edit that damn package

coarse turtle
#

oh what happens with the asmrefs @stone osprey ?

stone osprey
#

@coarse turtle Rider just messes everything up. It just throws a bunch of errors ^^ For example, a partial classes didnt merged and it just used my partial class... but didnt merged with unities one. Or it tells me that some structs/classes are suddenly missing for whatever reason. Its very, very strange

coarse turtle
#

Hmm - I had something similar, I just regenerated the solution and csproj files, you might need to tick one of these arguments in your prefs

#

well if that doesn't work - then yeah probably just copying the package locally to your project would work

stone osprey
#

Wait... Thats interesstinf, you could probably saved my life. Im gonna try that out ! But where those arguments ? Player prefs ? ^^

coarse turtle
#

Edit -> Preferences -> External Tools

#

You might need to clear Rider's cache also, usually I just delete the .idea/ directory - there's probably a function in Rider to do that (it's been a while since I looked at rider)

stone osprey
#

Hmmm...

#

Mine is a bit... short

#

Two options... i now ticked the first one, excited if it works this time

stone osprey
#

oh damn... i think this didnt worked :/

#

And suddenly the whole project forgot what Unity.Entities is

sturdy rune
#

I have had that - vscode/vsce just forgot about being linked to unity

#

does it give errors in unity

#

I actually had to create a new project and copy things into it

#

it was very annoying

stone osprey
#

The first time i tried this asmref stuff it did not... currently, it looks like unity really doesnt know that namespace anymore. Atleast theres a debug error inside unitys console

sturdy rune
#

tried deleting all .meta and .csproj, but the .soln file I think is what needed fixing

stone osprey
#

Hmmm... alright. Could this break the project ? xD

sturdy rune
#

yea if ther'es an error in unity during compile it won't work until you're able to recpmile

#

no

#

csproj files are regenerated, meta files done by unity, and soln file is done during compile afaik

stone osprey
#

Soo i guess i try that next. I just restarted and cleared riders cache. It still doesnt know all of that unity entities stuff

#

Now i dont even get such a little popup like in the last pic above

#

"Reference assembly Unity.Entities 0.0.0.0"

#

And thats in the console

coarse turtle
stone osprey
#

Thanks ! I will add those ^^

#

.meta, .csproj and .soln file...

#

So like those ?

coarse turtle
#

yeah - I don't typically delete meta files since that's what unity uses to cross reference assets, usually I will just delete the *.csproj and *.sln files

stone osprey
#

Hmmm... well that didnt worked :/

#

It still cant find that namespace

#

Now im gonna add that visible stuff

#

Hmm... adding InternalsVisibleTo didnt helped either. Still none of my scripts is able to find Unity.Entities or any of its structs, classes, methods

#

Kinda sad that theres no real tutorial for it

coarse turtle
#

hmm yeah sorry - copying the package locally might just be a better option for you

stone osprey
#

Oh well

#

I think i broke my project

#

Or rider, depends

north bay
#

Those are the settings I use with which asmrefs work for me

stone osprey
#

Thats interessting. I dont have those... I only have two ๐Ÿ˜ฎ

remote crater
#

I have an entity with icomponentdata public Entity me; How do I get that me to a static Monobehavior public Entity variable?

#

I tried this code: https://www.crystalfighter.com/code/code3.txt Apparently you can't set a singleton public variable from Systembase. You'd think they'd have a before and after batch processing of multithreaded that communicated with monobehavior so I figure this code would work, but it didn't. I'm stuck just being able to access my entity by monobehavior which is required to give it input.

remote crater
#

figured it out

#

โœ… Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=XomlTHitAug
Let's mix normal Game Objects with DOTS in order to benefit from massive performance!

Pathfinding in Unity DOTS / ECS!
https://www.youtube.com/playlist?list=PLzDRvYVwl53v55lu_TjC21Iu4CuFGQXVn

Pathfinding in Unity ECS!
https://www.youtube.com/watch?v=ub...

โ–ถ Play video
urban summit
ocean tundra
#

@stone osprey Did you get asmrefs going?

#

still rereading it all

safe lintel
#

how many kb is a chunk?

ocean tundra
#

16 from memory

#

yea 16kb

safe lintel
#

chunks are stored on the stack right? do you know what is supposed to happen when you run out of chunk space? it just uses heap memory or stuff crashes?

ocean tundra
#

sooo i wouldnt quite say they are stored on the stack

#

not exactly sure where they are, but Unity manages them

#

when you fill a chunk you just get a new chunk

#

i dont know if theres a TOTAL chunk space limit

safe lintel
#

ok so chunks are stored on the heap but icd stuff is stack then?

ocean tundra
#

i think its all manually managed by unity, not really sure if that is Stack or Heap

#

theres pointers and crazyness inside dots

safe lintel
#

i only just started to notice talk about chunk fragmentation or unoptimal chunk useage and it being ideal to "plan out your archetype usage" from the dots best practises thread

ocean tundra
#

yea ive seen some of that too

safe lintel
#

and i havent really done any planning ๐Ÿ˜ฉ

ocean tundra
#

like instead of having 1 huge player entity with all your components break it up into many

safe lintel
#

just been throwing crap together and its been working so far but wondering if its gonna collapse at some point because of my poor planning

ocean tundra
#

(player was a poor example as there likely wont be many of those

#

yea i do that too

#

tho ive nicely split out my networking stuff this time

#

what type of game are you making?

safe lintel
#

making a retro fps

ocean tundra
#

hmm

#

ok so i would say your Player can probably be left however it is, no point it worring about chunks for something you only have 1ish of

#

what do you have a TON of in your game? thats probably where you want to look into chunks

#

npcs?

safe lintel
#

tbh i doubt it will be a problem, but im a bit concerned about this sudden recent talk of optimizing and planning ahead of your project given i doubt thats how 90% of unity users approach things, and I wouldve expected dots to be able to handle things better than current unity for free flowing game design

ocean tundra
#

i think its more about another optimisation path for those who want/need that extra fps

#

i still think DOTS will handel 99% of stuff

#

but for something like Voxels for example

#

got todo extra thinking around those

safe lintel
#

yeah im terrible at math so I stay away from stuff like voxels ๐Ÿ™‚

ocean tundra
#

haha yup

#

also VERY easy to full a chunk with a single entity if you dont think ahead

#

but how many games will have that much data

karmic pilot
#

the separation components <-> systems just helps a lot with faster, linear access through data on the heap, as the CPU can prefetch more predictable into cache

ocean tundra
karmic pilot
#

almost everything important is directly controlled

ocean tundra
#

Yes makes sense

safe lintel
#

oh ok this does make more sense i think

karmic pilot
#

you can actually look at the source code doing all of this ๐Ÿ™‚ except for the direct c++ calls into the engine at some points all the entities package content can be viewed directly

safe lintel
#

i wouldnt have understood these concepts just from viewing source code ๐Ÿ˜‰

ocean tundra
#

yea i read alot of source code for my job, and Unitys DOTS packages are the most complicated i've seen

#

๐Ÿ˜›

#

mainly all the unsafe stuff

safe lintel
#

i have no idea how the devs pack this stuff into their brain, but maybe thats why its all taking so long? ๐Ÿ˜€

ocean tundra
#

yea its definitely next level c#

karmic pilot
#

mostly it is actually "normal" c++ stuff in C#. It's a lot easier to read than equivalents in C++ ๐Ÿ™‚ Especially Unity.Collections.Memory and all the memory management

ocean tundra
#

i've never learnt c++

#

just never any time

#

and C# has been pretty much the only language ive needed for a while now

#

especially now, .net 5 runs everywhere on everything

karmic pilot
#

using c++ efficiently forces you to learn about performance and modern processor architecture, as you are completely responsible for data access patterns

ocean tundra
#

yea i get it can make me a better programmer

#

but time

#

๐Ÿ˜›

sturdy rune
ocean tundra
#

ooo

#

but thats not Unity is it

#

some other company

sturdy rune
#

no it isn't, it's a third party site I have been using tutorials from

#

there was a character controller on there, a pretty good dots/ecs one but it's a bit out of date now

#

if I should remove that's fine I got an email thought it might be of interest - no offense taken

ocean tundra
#

yea thats the worst part about dots articles, all out of date in one update

sturdy rune
#

lol

karmic pilot
#

I don't rely on the official dots articles, only on changelogs in the repository... has the most up to date information you can get

ocean tundra
#

yea same

#

tho the offical docs are getting better

#

they are still missing bits tho

karmic pilot
#

it is still a LOT of work for technical writers to produce high quality content on such a different topic... even most devs can't wrap their heads around, and they have to explain it in an understandable and practical way

#

so I don't expect them to get everything done anytime soon ๐Ÿ˜ฆ

ocean tundra
#

yea im planning out docs for my networking packages

#

and it sucks ๐Ÿ˜›

sturdy rune
#

but I am brand new

#

... to everything

ocean tundra
#

yea thats the right place to start

karmic pilot
#

this is also helpful for other packages, to see what changed

#

especially for those packages where documentation is even more sparse than for the entities one

stone osprey
#

Uhmmm... Any ideas why it doesnt find DefaultGameObjectInjectionWorld ?

#

No i havent got asmrefs working :/

#

Currently splitting up my code into asmdefs

ocean tundra
#

do you have any asmdefs?

stone osprey
#

Now ^^

ocean tundra
#

you might be missing a reference

stone osprey
#

Well... that ASMdef references com.unity.entities already

ocean tundra
#

thats all you need i think

stone osprey
#

Oh a restart did the trick

safe lintel
#

generally shouldnt need to restart for asmdefs, but it does introduce a lot of headaches if you havent included them

snow iron
#

did you see the best practice guide? https://learn.unity.com/course/dots-best-practices

Unity Learn

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

north bay
#

At least in my experience

snow iron
sturdy rune
#

I have - I am going through unity docs again but went through best practices previously, before I knew what things were :)

snow iron
#

ha

#

just keep in mind that DOTS is considered experimental so you're in some pretty untested waters, unless you want to just use Burst and Jobs

safe lintel
#

@snow iron any chance of making that project public?

snow iron
safe lintel
#

i thought it said it was an internal project

snow iron
#

sigh - let me double check with Victor, lol - I've been up for a while and not fully conscious

safe lintel
#

I might have misunderstood the phrase Unity project to be internal/unity technologies authored rather than just implying it was an external customers unity project but I appreciate asking ๐Ÿ™‚

snow iron
#

I've sent him the ask

safe lintel
#

thanks!

sturdy rune
#

I'm reading page after page of docs and have taken a couple dots/ecs courses so I think I get the concepts, just trying to get through the basics before I start

sturdy rune
snow iron
stone osprey
#

Sooo im trying to hook into Unity.Entities via asmrefs. This time i nearly got it. But its showing me "Missing MaterialOverride" errors... any ideas why ?

#

Once i remove the asmref to Unity.Entities that issue is gone

#

This probably is causing the issue

#

Hmmm... i think i just delete the hybrid render stuff. I dont even use it in my project

#

OMG praise the lord

#

it finally works

#

Thanks to the one who recommended to update the rider package

karmic pilot
#

yeah keeping the rider/vs packages up to date has become important since packages have been introduced, as you might miss some project file generation otherwise

stone osprey
#

Yeah ^^ but now finally... i could write a SetComponent for an ECB without having generics :

        public static void SetComponent(this EntityCommandBuffer ecb, Entity entity, object obj) {
            
            ecb.EnforceSingleThreadOwnership();
            ecb.AssertDidNotPlayback();
            ecb.m_Data->m_MainThreadChain.m_CanBurstPlayback = false;
            AddEntityComponentCommandFromMainThread(ecb.m_Data, ecb.MainThreadSortKey, ECBCommand.SetManagedComponentData, entity, obj);
        }

So... now im gonna test if its able to set a boxed struct as an component to an entity. Taking bets... either it works or it crashes

hollow sorrel
#

why do you not wanna use generics?

#

or is that not possible here

stone osprey
#

I cant use the generics because all of my structs are boxed when i deserialize them as a packet... and i dont know their type. So im trying to find a way without using generics ^^

#

So im basically trying to write a "SetComponent(Entity en, object boxedStruct)" method which is able to add them to an entity. The way above didnt worked... unity told me that the last method is only for managed classes.

#

So i basically just need to find a way to rewrite this here... to copy the object instead of a struct to that adress

hollow sorrel
#

they already are boxed when you deserialize? ๐Ÿ˜ฑ

stone osprey
#

Yep... because... actually i never saw an Serializer/Deserializer which does not use boxing at some point ^^ I could just return pointers but that wouldnt make it any better... atleast for the entity command buffer

#

Some boxing is acceptable. Network packets are not being received every frame and it produces not that garbage

hollow sorrel
#

it's possible if you use codegen, but yea idk if you're using that

stone osprey
#

No i dont use code generation ^^ Meanwhile... its possible to copy an "object" to an ptr location... or ?

hollow sorrel
#

yea should be able to pin it

#
fixed (byte* b = someObject)
{
  // do stuff
}
stone osprey
#

Thanks ^^ Well this way i can pin it... but how do i copy the pinned objects to another pointer location ? :/

viral sonnet
#

hey o/ When dealing with subscenes, gameobjects and its children are converted. Does anyone know how I can get the converted child entity or call from the children when only the parent has a component for it?

#

what I really want to do is convert a gameobject to a proper entity prefab in a subscene. sadly GOs in subscenes are not handled like that, they are missing a prefab comp for the parent and children and LinkedEntityGroup which is what I want to add now but it's seems complicated ๐Ÿ˜ฆ

hollow sorrel
#

not 100% sure if this works but if you can be sure it's a struct then maybe

fixed (byte* b = someObject)
{
  Buffer.MemoryCopy(b, dest, destSize, lengthOfStruct);
}

where lengthOfStruct = usually sizeof(T), dunno how you'd get that with object

safe lintel
#

TryGetPrimaryEntity should yield thr child entity from the child gameobject

stone osprey
#

@hollow sorrel Thanks, im gonna try that ! ^^

#

In typemanager/unsafeutility ... theres an method to get the length of a component by its pure type without generics

stone osprey
#

@hollow sorrel So fixing is not possible... because its a object and we cant fix objects :/ But... we cant pin the adress via GCHandles.

#
            byte* data = (byte*)(cmd + 1);
            
            var objHandle = GCHandle.Alloc(component, GCHandleType.Pinned);
            var adress = objHandle.AddrOfPinnedObject();
            Buffer.MemoryCopy((void*)adress, data, sizeNeeded, sizeNeeded);
            
#

So i hope this works

hollow sorrel
#

lmao

#

oh btw

#

@stone osprey if you don't care about boxing, can't you just pass in IComponentData?

stone osprey
#

@hollow sorrel It works ^^ Atleast i get no errors with my internal written method... IComponentData does not work as far as i know :/ Because... its just an interface.

#
        public static void SetComponent(this EntityCommandBuffer ecb, Entity entity, object obj) {

            if (!obj.GetType().IsValueType) {
                
                ecb.EnforceSingleThreadOwnership();
                ecb.AssertDidNotPlayback();
                ecb.m_Data->m_MainThreadChain.m_CanBurstPlayback = false;
                AddEntityComponentCommandFromMainThread(ecb.m_Data, ecb.MainThreadSortKey, ECBCommand.SetManagedComponentData, entity, obj);
            }
            else {
                ecb.EnforceSingleThreadOwnership();
                ecb.AssertDidNotPlayback();
                ecb.m_Data->AddEntityComponentCommand(&ecb.m_Data->m_MainThreadChain, ecb.MainThreadSortKey, ECBCommand.SetComponent, entity, obj);
            }
        }
#

Pretty cool ๐Ÿ˜ฎ acessing internal stuff is great

hollow sorrel
#

nice ๐Ÿ‘

stone osprey
#

Hmmm... or probably it does not work as intended

#

I get no errors... but i get the feeling that it doesnt set the components right

karmic pilot
#

got tests for that?

stone osprey
#

What do you mean ?

#

A unit test ?

karmic pilot
#

either that or one step higher, integrating your deserialization to the component add

stone osprey
#

Not yet, i just played around with it a bit and i saw that my game isnt working as intended anymore... the component values are not being set. So probably im still doing something wrong in there

karmic pilot
#

since you know the data, arranging these tests is pretty straightforward and you can run them after each change to see if it still works as intended

stone osprey
#

So yeah... well... i think my own internal method does not work

#

The components neither get setted or added

#

But there no errors ๐Ÿ˜ฎ

#

Not exceptions

#

nothing

#

Anyone here knows what this code block does normally ? Or whats a "Entity fix up" is ?

snow iron
# safe lintel thanks!

sorry - it was a collaboration with a customer so we're unable to share the full project

stone osprey
#

Anyone here with an idea why this throws no error... but the component does neither get added or set on the entity ?

       internal static void AddEntityComponentCommand(this EntityCommandBufferData ecbd, EntityCommandBufferChain* chain, int sortKey, ECBCommand op, Entity e, object component){
            
            var ctype = ComponentType.ReadWrite(component.GetType());
            if (ctype.IsZeroSized) {
                ecbd.AddEntityComponentTypeCommand(chain, sortKey, op, e, ctype);
                return;
            }

            var typeSize = UnsafeUtility.SizeOf(component.GetType());
            var sizeNeeded = EntityCommandBufferData.Align(sizeof(EntityComponentCommand) + typeSize, 8);

            ecbd.ResetCommandBatching(chain);
            var cmd = (EntityComponentCommand*)ecbd.Reserve(chain, sortKey, sizeNeeded);

            cmd->Header.Header.CommandType = (int)op;
            cmd->Header.Header.TotalSize = sizeNeeded;
            cmd->Header.Header.SortKey = chain->m_LastSortKey;
            cmd->Header.Entity = e;
            cmd->ComponentTypeIndex = ctype.TypeIndex;
            cmd->ComponentSize = typeSize;

            byte* data = (byte*)(cmd + 1);

            var objHandle = GCHandle.Alloc(component, GCHandleType.Pinned);
            var adress = objHandle.AddrOfPinnedObject();
            var ptr = adress.ToPointer();
            Buffer.MemoryCopy(ptr, data, typeSize, typeSize);
            objHandle.Free();
            
            if (ecbd.RequiresEntityFixUp(data, ctype.TypeIndex))
            {
                if (op == ECBCommand.AddComponent)
                    cmd->Header.Header.CommandType = (int)ECBCommand.AddComponentWithEntityFixUp;
                else if (op == ECBCommand.SetComponent)
                    cmd->Header.Header.CommandType = (int)ECBCommand.SetComponentWithEntityFixUp;
            }
        }
#

So i can call it without any problems... no exceptions or warnings. But it simply does not set/add the passed "object component".

#

And the part where i copy the object into the ECB buffer... works fine *(MyStruct*)data shows the that the object was copied sucessfully

#

Glad for any help here

stone osprey
#

Anyone ?

safe lintel
#

@snow iron thanks for the clarification

stone osprey
#

Uhmm... i heard that its not possible to "copy" managed objects into unmanaged memory. Is this true ? Cant find anything online about it

#

This would explain why my stuff above does not work as intended

coarse turtle
cobalt dagger
#

So I would like to have mesh based pathfinding in Project Tiny. Anyone know what my best option would be? Are there any that do not require monobehaviours that you know of? Or should I roll my own..?

#

I don't need fancy avoidance or anything like that just agents finding a path in a mesh...

safe lintel
#

theres a few user made solutions, out there, but Im not sure if any specifically targeted tiny

stone osprey
#

It doesnt copy the boxed object... it copies the struct itself into allocated memory

#

So my self written method for adding/setting components by its boxed value should work

#

But it does not... atleast i dont see my components being added/set... their values do not change

#
        internal static void AddEntityComponentCommand(this EntityCommandBufferData ecbd, EntityCommandBufferChain* chain, int sortKey, ECBCommand op, Entity e, object component){
            
            var ctype = ComponentType.ReadWrite(component.GetType());
            if (ctype.IsZeroSized) {
                ecbd.AddEntityComponentTypeCommand(chain, sortKey, op, e, ctype);
                return;
            }

            var typeSize = UnsafeUtility.SizeOf(component.GetType());
            var sizeNeeded = EntityCommandBufferData.Align(sizeof(EntityComponentCommand) + typeSize, 8);

            ecbd.ResetCommandBatching(chain);
            var cmd = (EntityComponentCommand*)ecbd.Reserve(chain, sortKey, sizeNeeded);

            cmd->Header.Header.CommandType = (int)op;
            cmd->Header.Header.TotalSize = sizeNeeded;
            cmd->Header.Header.SortKey = chain->m_LastSortKey;
            cmd->Header.Entity = e;
            cmd->ComponentTypeIndex = ctype.TypeIndex;
            cmd->ComponentSize = typeSize;

            byte* data = (byte*)(cmd + 1);
            Marshal.StructureToPtr(component, new IntPtr(data), false);
            
            if (ecbd.RequiresEntityFixUp(data, ctype.TypeIndex))
            {
                if (op == ECBCommand.AddComponent)
                    cmd->Header.Header.CommandType = (int)ECBCommand.AddComponentWithEntityFixUp;
                else if (op == ECBCommand.SetComponent)
                    cmd->Header.Header.CommandType = (int)ECBCommand.SetComponentWithEntityFixUp;
            }
        }

This is my modified version, which now uses StructorToPtr

#

And the ecb still does not add/set my components using that method. No errors... debugging also looks right. It just wont... do it

coarse turtle
#

Hmm what about setcompenentdataraw?

stone osprey
#

@coarse turtle Well i guess the copy of that object into the ecb works now. But do you have any idea why the component wont get add/set ? The copy process looks valid... even when debugging...

#

Is this available for ECB ?

coarse turtle
#

Oh, through ecb. No it's an Entity manager thing

ocean tundra
#

what does component.GetType() return

coarse turtle
#

Guess technically you can write your own kind of CommandBuffer which uses that EntityManager.SetComponentDataRaw(...) When you do a playback.

ocean tundra
#

the right type? or object?

#

cause its all boxed and stuff

stone osprey
#

Componen.GetType() returns the struct type :/ which is boxed of course... but the struct type is the right one

#

The right type

#

I also debugged that code

#

And when i dereference data it shows the the copied raw struct

#

But it seems like that the ECB ignores my call

#

But it gets weirder :

#
ecb.SetComponent<Velocity(entity, velo);
ecb.SetComponentOnMyOwn(entity, boxedStruct);

Works !! But only when i call that generic method before
only
ecb.SetComponentOnMyOwn(entity, boxedStruct);
Does not work :c
ocean tundra
#

does it work with 0 sized components?

#

tags

stone osprey
#

My own variant ? Never tested it... but wait... im gonna create a tag component real fast

#

@ocean tundra No it does not... when i just use my own method on its own ecb.SetComponentMyOwn(entity, new Tagg()); it wont get set or added... when i use one of unitys generics ecb methods to set a component before, then call mine afterwards... it works ecb.SetComponent<Velo>(entity, new Velo()); ecb.SetComponentMyOwn(entity, new Tagg());

ocean tundra
#

well that points to the first line right?

#

that get type must be wrong

#

hmm wait your saying its a order depened thing?

stone osprey
#

Im gonna debug this... but it should be right. Yes it is... thats totally weird. My methods alone do not work. But if i use unitys generic before mine... mine do work

#

Its like... i dont know. Its just strange

#

I have never seen such a behaviour

ocean tundra
#

god no clue

#

that code is way over my head ๐Ÿ˜›

stone osprey
#

Thats the debug from .GetType(); and the ComponentType

ocean tundra
#

is it somehow different when calling unitys code first?

stone osprey
#

@ocean tundra Thats the same debug point... but this time unitys ecb method was called before mine

#

I see no difference here

ocean tundra
#

sorry man

#

no clues

#

any of the other opperation parameters?

#

(chain, sortKey, op, e, ctype);

#

theres not really alot that can be different

#

whats that chain thing?

stone osprey
#

Is it possible because i do not pass my objects via "IcomponentData" ? I have no clue what that interface is for... but probably it has an internal meaning

#

Im gonna check that chain thing

coarse turtle
stone osprey
#

@coarse turtle Oh great question... it will blow your mind... one moment

#

            // First unitys method, then the second SetComponent ( which uses the method posted above ) is mine... then mine ( The second one ) does work !
            var random = Random.value*100;
            var testCMP = (object)new TestCMP{test = (long)random};
            cmd.SetComponent<Location>(test, new Location{pos = new Vector2d(20,20)});
            cmd.SetComponent(test, testCMP);

            // Only mine.... without unitys one before... does NOT work
            var random = Random.value*100;
            var testCMP = (object)new TestCMP{test = (long)random};
            cmd.SetComponent(test, testCMP);  
#

@coarse turtle Mine selfmade method for the ECB does ONLY work... if Unitys ECB method is used before

coarse turtle
#

oh

#

interesting

stone osprey
#

And i have never... ever... seen such a behaviour

ocean tundra
#

can it be that SetComponent is not capturing stuff right

#

did you touch that?

stone osprey
#

Capturing ?

coarse turtle
#

something I'm curious about is whether or not the TypeManager is returning a valid index for your type

ocean tundra
#

like SetComponent needs to record a bunch of stuff so playback will work

#

@coarse turtle yea I thought the same thing

#

but looks right

stone osprey
#

Im gonna compare both typemanager calls... the generic and the type based one... one moment

#

@ocean tundra Shouldnt be the case ๐Ÿ˜ฎ but wait... let me change the order of the calls

ocean tundra
#

Ooo interesting, good idea

#

that will help point if its the capture to command buffer or playback

stone osprey
#

Oh boy... its getting better.

#

When i first call my method... then the unity one. It does not work at all

#

So 1. Mine, 2. Unitys = Does not work

#
  1. Unitys, 2. Mine = Works
coarse turtle
#

that's interesting lol

ocean tundra
#

does unitys work if yours is first?

#

PS make sure your building Tests for this

#

๐Ÿ˜›

stone osprey
#

@ocean tundra See above ๐Ÿ˜„ it does not work when mine is first... but if unity is first it does work

ocean tundra
#

yea i mean the Location component

stone osprey
#

Oh and TypeManager.TypeIndexOf<TestCMP>() and .TypeIndexOf(testcmp.getType()) is the same

ocean tundra
#

not your boxed component

stone osprey
#

@ocean tundra What exactly do you mean ? ^^ I think thats what i meant by "Unitys first, then mine"... or do you mean i should try to set the location via mine method ?

ocean tundra
#

            cmd.SetComponent(test, testCMP);
 cmd.SetComponent<Location>(test, new Location{pos = new Vector2d(20,20)});```
Does location still get added?
stone osprey
#

Ahhh... wait...

#

It does not ๐Ÿ˜ฎ

ocean tundra
#

ok...

#

so what does that mean ๐Ÿ˜›

stone osprey
#

So somehow the order matters... and when mine gets called at first... it somehow breaks the ecb

ocean tundra
#

the whole SetComponet capture broke? not playback?

#

have you modified SetComponent?

stone osprey
#

Yeah... somehow it breaks the capture mecasim. Of course ^^ wait... time for a pastebin

ocean tundra
#

haha

coarse turtle
#

would be interesting to see what happens to the EntityCommandBufferChain if it's broken - maybe an iteration broke and it's not linked properly

stone osprey
ocean tundra
#

how does that chain thing work? points to the next command?

stone osprey
#

I provide my own SetComponent methods... and unity ones.

#

Mine are first

coarse turtle
#

Yeah it's pretty much a linked list of commands

stone osprey
#

You should see that its actually some sort of direct copy

coarse turtle
#

EntityCommandBufferChain* m_Next; would just store the next recorded command

#

each element in the node contains an integer flag which tells the ECB which operation was recorded

turbid sundial
#

In a standard chunk/points/voxels style terrain generation - if I iterate through chunks using Entities.ForEach but also want to parallelize the block generation as well - is that possible? Job within ForEach? Or are there other ways to do something like this

stone osprey
#

@coarse turtle Thats interessting to know ๐Ÿ˜ฎ But i havent changed anything regarding the chains... so i think those arent a problem. I get the feeling that one of the generic calls probably... activated something which its type based counterpart is not able to activate

#

Would be great if anyone could take a look at those methods in the pastebin ^^

coarse turtle
#
byte* data = (byte*)(cmd + 1);
Marshal.StructureToPtr(component, new IntPtr(data), false); // For this here, data must be reserved to equal the size of your component when you use Marshal.StructureToPtr
ocean tundra
#

any changes in AddEntityComponentCommandFromMainThread?

#

hmmm but your code shouldnt go down that branch...

stone osprey
#

@ocean tundra Yeah... but you can ignore that ^^ Its not getting called because the boxed struct is a value type

ocean tundra
#

100% sure?? ๐Ÿ˜›

stone osprey
#

@coarse turtle Well it should... some command before that call should reserve enough space

coarse turtle
#

Ah right didn't see that.

stone osprey
#

@ocean tundra Very, very, very sure ๐Ÿ˜„ It never goes down that branch

ocean tundra
#

cool

#

๐Ÿ˜›

#

just trying to rule everything out

stone osprey
#

I just tested it again... the debug point does not get called ^^ so that branch is fine

#

Im now gonna test the generic methods and their type based counterparts... probably theres something wrong in there

ocean tundra
#

can you confirm the size of your component?

#

UnsafeUtility.SizeOf(component.GetType());

#

the typesize

stone osprey
#

SizeOf is a lil different... the generic variant uses "sizeof" and the type based some external dll

#

๐Ÿ˜„ hehe wait

#

@ocean tundra Nope :c

#

Would be too easy

#

Annnddd thats all... T is actually used two times in unitys method

#

For size... and for type

#

And both are the same with their type based counterpart

coarse turtle
#

hmm and the data stored in the data ptr is correct too right ๐Ÿค”

stone osprey
#

Im gonna check that again ^^

#

A bit difficult... because those are two different assemblys... so i need to have a exact copy of the TestCMP inside my internal stuff

ocean tundra
#

and can you capture sort key for the different orders?

stone osprey
#

@coarse turtle I check it... it looks right :

#

@ocean tundra On my way ^^

#

My method first : 2147483647 for my set cmp

#

And unity method first : 2147483647 for my set cmp, after unitys

coarse turtle
#

hmm what if you debug the playback - if it looks like the data is all correct

ocean tundra
#

yea digging around that looks right

coarse turtle
#

then playback might seem like a good culprit ๐Ÿค”

ocean tundra
#

yea time to check out the playback methods

stone osprey
#

Hmmm... i opened the playback method and it looks... awfull xD Where the hell is the part where the entity receives its cmps ?

ocean tundra
#

lol

#

im reading it too

stone osprey
#

Damn... so ugly xD

ocean tundra
#

oh is burst on or off?

stone osprey
#

Good question

ocean tundra
#

maybe just make sure its globaly off for now

stone osprey
#

I assume its off

#

I never understood that window anyways

ocean tundra
#

yea i think so

stone osprey
#

So i found this part here... but then it gets worse

ocean tundra
#

yea its crazyness

#

can you find AddComponentWithValidation

#

and breakpoint on that

stone osprey
#

Damn... the poor person maintaining this... Wait, im gonna take a quick look at that

coarse turtle
#

I'd look at PlayBackChain(...)

ocean tundra
#

maybe the playback is trying to play, but the validation is failing

stone osprey
#

I think i found it

ocean tundra
#

yup

#

wait thats for add component sorry

#

your doing set right?

stone osprey
#

Yep ^^

ocean tundra
#

oh it still calls that method first

#

๐Ÿ˜›

stone osprey
#

Woww... the naming is great

#

@coarse turtle Im gonna do that next ^^

ocean tundra
#

honestly the playback looks ok to me

#

go to EntityCommandBuffer.cs line 2203

#

i think that needs the breakpoint

stone osprey
#

Uhmmm

ocean tundra
#

and confirm that the cmd has your data

stone osprey
#

That method... AddComponentWithValidation never gets called

#

The breakpoint does not get invoked

#

@ocean tundra Could you write whats in that line ? ^^ My line just returns a true in there

ocean tundra
#

Try ECB,cs line 2039

#
            UnsafeList* managedReferenceIndexRemovalCount,
            ref EntityComponentStore.ArchetypeChanges archetypeChanges,
            ref ECBSharedPlaybackState playbackState,
            ECBChainPlaybackState* chainStates,
            int currentChain,
            int nextChain,
            bool isFirstPlayback,
            PlaybackPolicy playbackPolicy)```
#

thats looks like the non bursted playback

#

except rider tells me it is bursted....

stone osprey
#

Lines arent working here i guess... that method is somewhere else ๐Ÿ˜ฎ

ocean tundra
#

what

#

so weird

#

dam this code is full on insane

stone osprey
#

Im inspecting that method _PlaybackChunk

#

But i dont see data anywhere xD

ocean tundra
#

this call

#

PlaybackUnmanagedCommandInternal

#

takes the chain data

stone osprey
#

Ahh the chain data... thought the ptr data of the component ^^ thats what i looked for

ocean tundra
#

the command contains the ptr data somewhere

stone osprey
#

Guess what

ocean tundra
#

never called?

stone osprey
#

It never runs into that breakpoint

ocean tundra
#

wtf

#

must be taking the other branch

stone osprey
#

Dude... i bet this could get qualified as an olympic sport

ocean tundra
#

oh no

#

it disappears into some magic unity code

stone osprey
#

Where ? ๐Ÿ˜ฎ

ocean tundra
#

try this

#
            EntityDataAccess* mgr,
            UnsafeList* managedReferenceIndexRemovalCount,
            ref EntityComponentStore.ArchetypeChanges archetypeChanges,
            ref ECBSharedPlaybackState playbackState,
            ECBChainPlaybackState* chainStates,
            int currentChain,
            int nextChain,
            bool isFirstPlayback,
            PlaybackPolicy playbackPolicy)```
#

find that and breakpoint that

#

it switchs based on bustable

#

the bursted branch looks.... confusing

#

can you force CanBurstPlayback OFF?

stone osprey
#

It doesnt even run into that method at all

ocean tundra
#

wtf

stone osprey
#

And yes... i have the rider debugger attached xD

#

But wait...

#

Im still calling my own method to set the component before i call unitys one

#

So i assume that my own one is breaking that code before it even reaches that point

ocean tundra
#

hmmm

#

yea i would agree

stone osprey
#

Im gonna switch those real quick

ocean tundra
#

so back to void PlaybackInternal(EntityDataAccess* mgr)

#

and step though that chain state crazness ๐Ÿ˜›

#
            // Only chains with non-null Head pointers will be included.```
stone osprey
#

So... meanwhile i switched the lines. First unity, then mine and now it does run into that PlaybackChain method you posted above

ocean tundra
#

non null head pointers....

stone osprey
#

And it takes the... burst way ?

ocean tundra
#

ok in your setcomponent

#

theres some branch setting canbustplayback

#

copy that to the other one

#

force it the other way for now

stone osprey
#

You mean this here ?

ocean tundra
#

yea

stone osprey
#

But it gets never executed ๐Ÿ˜ฎ

ocean tundra
#

copy that for the other branch

stone osprey
#

Ahh copy

#

and set it to true ?

ocean tundra
#

no keep it false

#

sorry need some food

#

try that

#

and then look at the chain state crazyness

#

๐Ÿ˜›

stone osprey
#

Sooo that didnt worked either xD thanks... go and get some food ^^ Im gonna step now the internal playback

#

So... i think i have something here

#

Something which could solve the issue

#

Im debugging that chain hell in playback/playback_internal

#

And well...

#

When i first call my method... it seems like it... never playbacks ANYTHING

#

Why ?

#

Let me show you

#

This... is the block where we start executing the chains. Great ๐Ÿ™‚ But... when i use my method before unitys... then recorded chain count is... zero

#

So it... jumps to the end of the playback and exits it

#

m_Data->RecordedChainCount is... simply 0 when i use my method first

#

So i still have no clue... how i could fix this... but hey. Atleast we know why it happens

coarse turtle
#

Look at the Reserve call @stone osprey in your SetComponent, check if its incremented there.

stone osprey
#

@coarse turtle On my way ^^ It actually looks like it gets incremented :

#

But wait

#

Interesting

#

The second call... which uses the same ECB... starts at zero again

#

In this case, the unity method call is zero at that point... after it was incremented by my method

coarse turtle
#

for the same ecb or a new one? ๐Ÿค”

stone osprey
#

Its the same i guess

coarse turtle
#

seems odd that it would start again at zero

stone osprey
#

Yeah ๐Ÿ˜ฎ

#

theres only one place where it gets resetted

coarse turtle
#

so m_RecordedChainCount starts again zero when you call SetComponent again in the EntityCommandBufferData?

stone osprey
#

Yep. It seems like this

#

This is where it gets reset

ocean tundra
#

Ooo nice progress

coarse turtle
#

hmm

stone osprey
#

Thats the constructor i assume

coarse turtle
#

yeah

stone osprey
#

Which doesnt make sense either

coarse turtle
#

yeah i dont think that's the case here ๐Ÿค”

stone osprey
#

Im gonna debug that xD

ocean tundra
#

ok dumb question

stone osprey
#

Yeah ?

ocean tundra
#

is var cmd = (EntityComponentCommand*)ecbd.Reserve(chain, sortKey, sizeNeeded);

DIFFERENT to

var cmd = (EntityComponentCommand*)Reserve(chain, sortKey, sizeNeeded);

stone osprey
#

Thats actually a good question

#

But i think not

#

I checked the namespace... theres one internal

#

:/

#

And it makes sense

#

Because i have my debug points in that one method... and my own method and unitys are entering it ^^

ocean tundra
#

i only see a internal one

stone osprey
#

This one here ^^

#

But i dont see another one

#

So i assume its the only one called Reserve

ocean tundra
#

how are you calling a internal method?

#

you got asmrefs working?

stone osprey
#

Yes finally xD

ocean tundra
#

oh nice

stone osprey
#

Long story... but i just needed to update the rider package ^^ In external tools and it worked

ocean tundra
#

nice ill keep that in mind

stone osprey
#

๐Ÿ˜„

#

So besides that... that record count...

#

Its definitive the same damn ECB

#

I checked the constructor and this one is only called ONCE

#

So where the heck does that value reset ?

ocean tundra
#

in reserve it gets incremented

stone osprey
#

And it does... My method comes first, increments it... and it stays incremented. Then unitys method comes and boom

#

its zero

ocean tundra
#

ok so...

#

dumb question 2

#

internal static void AddEntityComponentCommand(this EntityCommandBufferData ecbd, EntityCommandBufferChain* chain, int sortKey, ECBCommand op, Entity e, object component)

#

this is a extention method?

coarse turtle
#

only methods I find where it assigns m_RecordedChainCount

#

yea @ocean tundra

ocean tundra
#

what happens to structs and extention methods?

#

specifically EntityCommandBufferData?

coarse turtle
#

this EntityCommandBufferData believe it is a copy

#

so if you want by reference

ocean tundra
#

does it copy?

coarse turtle
#

you should do

#

this ref EntityCommandBufferData

#

i do this often for custom extension methods

ocean tundra
#

Oooo

stone osprey
#

Wait...

coarse turtle
#

so if that's the case then

#

the copy is being passed and set

stone osprey
#

this REF ENTITYCOMMANDBUFFER DATA ?

#

If this works... im gonna kill myself

coarse turtle
#

but the recorded ECBData

#

is just a copy.

ocean tundra
#

๐Ÿคž

coarse turtle
#

yeah change it to this ref

stone osprey
#

...

#

@coarse turtle I love you

#

It works xD

ocean tundra
#

WOOO

stone osprey
#

Such a stupid mistake

#

im gonna cry

#

I hate structs

coarse turtle
#

honestly i wouldn't have noticed unless @ocean tundra mentioned it was an extension method

stone osprey
#

๐Ÿ˜„

ocean tundra
#

teamwork!!!

stone osprey
#

Oh damn... thanks a lot... both of you โค๏ธ Otherwhise i might have spend the whole night on that damn mistake

ocean tundra
#

all good

stone osprey
#

If this should ever generate some cash... im gonna pay you xD

ocean tundra
#

was a interesting problem ๐Ÿ˜›

#

sweet ill be here

#

๐Ÿ˜›

stone osprey
#

๐Ÿ˜„ So... finally... i can rest in peace...

ocean tundra
#

the best feeling

stone osprey
#

Im gonna go and take a nap ๐Ÿ˜„ thanks a lot again... you guys are the best

ocean tundra
#

sigh

#

how do we get hybrid renderer working again?

coarse turtle
#

not sure ๐Ÿ‘€ I haven't touched it yet lol

ocean tundra
#

๐Ÿ˜›

#

my fault

#

have it disabled from the default world

remote crater
#

I'm at a loss. I tried for hours on this. How do I capture an entity into a monobehavior variable: public Entity myEntity; ?

#

day3 lol

odd ridge
#

how does someone queries for entities by the value of a shared component?

remote crater
#

If I have a single entity in a scene. How do I get a reference to that entity?

#

I want to change it's acceleration by monobehavior script. I have the entityManager, but no reference to the entity.

#

I am stuck. Gonna go to bed I guess. I hope someone helps me. Maybe day 4 I'll be able to access an Entity to change it's acceleration.

odd ridge
#

that should work public Entity myEntity;

#

you assign myEntity by fetching the actual entity from the entity manager

#

then you do what you want with myEntity

remote crater
#

I have the entityManager, but how do I fetch?

#

Is there a find, an indexing or ?

odd ridge
#

you would use a Query . I suppose you are using a ConvertToEntity script on your game object?

remote crater
#

Yes. Just digging through autocomplete, I found: Unity.Collections.NativeArray<Entity> aaa;
aaa=GameBoardModel.entityManager.GetAllEntities();

#

It seems like every entity has an index. This is a good system. How do I find the index of the Entity I have in my scene? Can I search by name like GameObjects? I only knew two ways to access a gameobject and that is through linking em in scene(unavailable so far), and doing GameObject.Find();

#

I was able to find 5 entities in my scene, but no way to tell between them.

odd ridge
#

I'm not sure if there's a better way, but the first thing that comes to mind is putting a tag component on your entity, then you can get this entity by the tag

remote crater
#

That's not terrible for a temporary solution. How do I do that? I know how to set a tag, how do I reference it?

odd ridge
#

I asked on the forum if there's a better solution. I'll tell you if there's a better way

remote crater
#

Thanks bro, we look like we're both trying to make heads or tails about this

#

I have this really realy really super awesome game

#

And I already spend 5000 hours on it

#

But I just need to be able to change velocity/acceleration etc of the Player's Entity and I'll have a new mode in one week or so.

#

This is exciting, but I'm just standing staring at a brick wall

#

Maybe I should put on some Pink Floyd, lol.

odd ridge
#

did you say 5000

#

๐Ÿ˜ฎ

remote crater
#

yes, if I talk about it tho, people help me less because they tell me it isn't posisble

#

I'll whisper you a key

odd ridge
#

cool

odd ridge
#

thanks Sark

zenith wyvern
remote crater
#

Yah I have that, it rocks.

#

But it does not answer how to assign an entity to a monobehavior singleton.

#

Here's a video I showed the other day because I was impressed with it, to show you how long I've been stuck on this: https://www.youtube.com/watch?v=Ws-7rqluv6w

ECS DOTS lets you have 10-1000x as many poly on screen by unlocking cores. So as more and more people play these games, they'll buy CPUs with more and more cores. Maybe in 6 years we have 1024 cores and stuff, so then we are able to render 1000x-100,000 more objects.

Download ECS examples that you can import right into your UNITY hub, from th...

โ–ถ Play video
#

Guess I've been stuck on this for well over 8 days now. I just wish someone could help me with syntax because it is so so hard to find documentation online that isn't outdated. I'm just trying to assign a reference to a DOTS/ECS entity to a monobehavior singleton: public static Entity playerEntity;

zenith wyvern
#

I guess you want something like that?

remote crater
#

Maybe... Let me try,

#

Thanks for trying also! God bless ya Sark.

#

I used to have a matchbox car that looked like a Tron Shark. I called it the Sark car.

#

Do I put that in a monobehavior attached to the gameobject that will convert to Entity? Also, what goes in whatever?

zenith wyvern
#

Put it wherever you want, it's querying for an entity so it's not limited to any scope. All that matters is that the entity exists before you query for it. I'm assuming conversion would happen before GameObject Start but I'm not sure

remote crater
#

Well if it doesn't exist at first, I can do it during update...

zenith wyvern
#

That's an ancient version of the manual - note the "0.0". There should be a blue button at the top to "view latest version" if you're on desktop.

remote crater
#

oooh

#

ty, see where this rabbit hole goes

#

Small note: Start and update in that monobehavior cannot run because when attached to a gameobject that gets converted to an entity, the entity no longer can run monobehavior scripts attached. I'm not stuck yet tho. From: #archived-dots message

#

I got it working! Ooooh! Navy Seals!

#

So uh i'll post code.

#

It has to be done when converting from gameobject to Entity

odd ridge
#

wait a minute

odd ridge
#

I mean, have you tested it?

ocean tundra
#

@remote crater Yea that code is about converting GOs into Entities

#

not sure that use is a good idea

#

instead put that code into Start of a MB somewhere

#

or even better put it into your game loading code somewhere so you have exact control over when it runs

#

I'm using the event entities pattern, i often create, process and destory the entity within a frame or 2, BUT it makes my entity inspector useless,
Is this just a bad pattern?

odd ridge
ocean tundra
#

oh yea... the inspector

#

if i used streams or queues or something wouldnt be able to inspect

#

Anyone know what the rules are around self promotion and team finding/collaboration on this Discord?
I've got a few more items TODO on my networking tech then would like to try find a alpha user to work with to add it into their game

turbid sundial
#

Hey, having an issue with some DOTS generated terrain and hybrid renderer V2. UVs are set, but looks like everything is one big silhouette. What obvious step am I missing here?

karmic basin
#

Otherwise you can try other discords. Guess I cant promote here.

acoustic spire
#

Speaking of Burst optimizations, is it correct to suppose that structures are zero overhead abstractions?
I.e. I can wrap an integer into 5 nested structures and the performance would be the same as if I used the integer directly. Or mb it's built-in optimization for any .net platform, not aware of it

torn hollow
#

A while ago I talked about optimizing my boids program on here and someone suggested keeping GPU Instancing for gameobjects and jobifying the rules of each boid. I am stuck on how i make JOBs and gameobjects talk to each other in a way i can use .transform.
So far I have eliminated:

  • IJOBParallelForTransform โ†’ get unboxing problems
  • IJobParallelFor โ†’ cannot use .transform
  • NativeArray<GameObject> โ†’ not allowed since NativeArray cannot contain non nullable types
  • Coroutines โ†’ run from main thread

Based on this link: https://www.reddit.com/r/Unity3D/comments/8i91dl/using_new_job_system_to_perform_actions_on/

my next plan would be to write a dictionary that contains refrences to the gameobjects.

Anyone have any ideas on this?

Note: I am working in a team and the project is OOP based, so I would like to keep the gameobjects as they are.

hollow sorrel
#

@acoustic spire should be yeah
i think part of the reason burst only supports value types like structs is it's a 1:1 representation in memory

#

and struct with 1 int should be identical to just 1 int in memory

amber flicker
#

Note that you can read transforms in parallel and set them on a single thread that's off main

#

Another note: <= 100 transforms, manipulating regular Unity .transform on the main thread is quite a bit quicker than just the job scheduling overhead in my testing - though ymmv

sharp flax
torn hollow
#

thank you all for the feedback :) will work on it tonight

ocean tundra
odd ridge
acoustic spire
odd ridge
#

gotcha

robust scaffold
#

Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 5)
Hrm. Surprisingly caused by lack of vsync on game window.

calm edge
#

So apparently I'm supposed to be using build configurations if I'm using DOTS? Is there any info on how to set it up properly? I'm getting a crash at startup in GameAssembly.dll!GameObjectSceneUtility_AddGameObjectSceneReferences_mCA24ACDDBE1FB3CE50403880BFA3FC7D85564C27 currently

turbid sundial
#

Trying to apply a material with RenderMeshDescription in an Entities.ForEach - this loop happens to be one of the biggest slowdowns in my procgen code. Unfortunately it requires a Material as an argument, but materials are not reference types so I get the Entities.ForEach Lambda expression captures a non-value type 'baseMaterial'. This is only allowed with .WithoutBurst() and .Run() - is non-burstable the only way to go here?

lusty otter
#

How's AllocateWritableMeshData comparing to the good old managed API like SetVertexBufferData in terms of performance?

#

I have recently upgraded from 2019 LTS to 2020 LTS, wondering if I should switch.

#

The thing I've noticed is that to apply mesh data you must use ApplyAndDisposeWritableMeshData which also disposes the data

#

I need to do mesh generation every frame, which means I need to do AllocateWritableMeshData call every frame, and in docs it says:

Creating a MeshDataArray has some overhead for memory tracking and safety reasons, so it is more efficient to make a single call to Mesh.AllocateWritableMeshData and request multiple MeshData structs in the same MeshDataArray than it is to make multiple calls to Mesh.AllocateWritableMeshData.

#

Does that mean I should just stick with the old API instead?

sharp flax
lusty otter
#

That's my guess as well, but then I also don't know how SetVertexBufferData works internally. For example, although SetVertexBufferData can take NativeArray, but if it still internally has to copy it to managed memory, then it's no different from just calling AllocateWritableMeshData every frame to allocate new memory.

#

I don't know why ApplyAndDisposeWritableMeshData forces you to dispose it, I'd like to modify the mesh data that's already built (or even at the very least, reuse the same memory so I don't have to allocate again) for better performance.

#

In comparison I can simply have _vertices = new NativeList<VertexBufferData>(...), operate it however I like including using it in bursted jobs, have it persist across multiple frames and no need to reallocate unless list size exceeds previous capacity (if you have a good estimate on how many vertices you have then it will never happen), and whenever I need to apply to mesh I can do _mesh.SetVertexBufferData(_vertices.AsArray(), ...)

#

It just seems better in every way possible, except the applying to mesh step which I have some question marks about, and there seems to be no information online comparing the two.

sharp flax
#

I'd let the profiler speak, try both, compare results ๐Ÿ™‚

#

But yeah if its doing what we think it'd be nice to have a way to prevent disposing

frosty siren
#

When A's component refers B's component then after conversion i have null ref on A's component. Is there a way to avoid such results?

pulsar jay
sharp flax
#

Are FixedLists allocated on the stack?

#

Also, intrigued about if there's some technical reason for the missing pow2 gaps

frosty siren
pulsar jay
hollow sorrel
#

dunno why they have missing gaps tho, maybe they didn't wanna clog up the namespace with more than necessary

calm edge
hollow sorrel
#

also it seems fixedlists don't support resizing thonking seems weird to call it fixedlist instead of fixedarray then

sharp flax
#

docs say its "resizable list", there's add and addnoresize, why have both if its not resizable? maybe it is actually resizable ?

north bay
#

It keeps track of it's current length, the capacity is fixed

karmic basin
#

There's a LiveLink one which is promising, but I removed it as my machine struggles a bit when I try.

#

ANd I'm sure I miss cool ones

hollow sorrel
#

Add just calls a set:

#

and set is just a writearrayelement without resizing:

sharp flax
#

Maybe its placeholder for the future? I was testing it, nice to see that it is actually the same lol

hollow sorrel
#

yeah that could be the case

zenith wyvern
#

AddNoResize is only there because it implements the "INativeList" interface

#

It's "Fixed" because the list always takes up the same amount of memory regardless of how many elements it has, there's no actual resizing

stone osprey
#

When i call "system.CreateCommandBuffer();" does this allocate memory ? Like 32B ? I get the feeling that it does :/ Does anyone know more about this ?

zenith wyvern
#

It shouldn't. Show the code

hollow sorrel
#

ye but then why is it called fixedlist and not fixedarray

zenith wyvern
stone osprey
#

@zenith wyvern Well... it does call some allocs under the hood when you take a look at the .Create method... but im not sure about it because i dont understand it that good. Never the less... this is the method that generates 32B of garbage. Deep profiling just tells me that this method generates 32 B of "Gc alloc" but it doesnt show me what exactly it causes.

 public Entity Process<T>(ref EcsCommand<T> command) where T : struct, IComponentData {
            
            var opcode = command.Opcode;
            var entity = command.Entity;
            var data = command.Data;
            var type = data.GetType();

            // Create buffer and filter possible layers
            ref var commandBuffer = ref CreateCommandBuffer();
            var operationProcessor = OperationProcessor[opcode];
            var manualProcessor = ManualProcessors.ContainsKey(type) ? ManualProcessors[type] : null;
            var exists = entity != Entity.Null && Manager.HasComponent(entity, type);

            // Prevent a null entity from add/update/remove operations
            if (entity == Entity.Null && opcode != Operation.CREATE) return Entity.Null;

            var operation = new ECSOperation<T> {
                command = command,
                entityManager = Manager,
                ecb = commandBuffer,
                ecsManualProcessor = manualProcessor,
                type = type,
                exists = exists
            };
            return operationProcessor.Process(ref operation);
        }
#

Probably a bit difficult... but actually everything is a struct

zenith wyvern
#

Basically it's not an array because you can treat it like a list - you can add elements or clear the "list". That works how you would expect it to work even though it's not technically a list

stone osprey
#

Besides operation & manual processor

north bay
#

ECSOperatoin is a class?

stone osprey
#

A struct... my own one

#

Like ECSCommand

#

Thats why i dont know what exactly produces garbage here... im just using a bunch of structs and i dont box anything

#

So i assume its the CreateCommandBuffer call which creates or reuses a command buffer

#

thats why i asked

#
    /// <summary>
    /// An ECS command getting applied to the ecs. 
    /// </summary>
    public struct EcsCommand<T> where T : struct, IComponentData {

        public Operation Opcode{ get; set; }
        public Entity Entity { get; set; }
        public string TypeID { get; set; }
        public T Data { get; set; }
    }
    /// <summary>
    /// A struct which describes a ECS operation. <see cref="IOperationProcessor"/> do take of those to execute the described operation on an entity
    /// </summary>
    public struct ECSOperation<T> where T : struct, IComponentData{

        public EcsCommand<T> command;
        public EntityManager entityManager;
        public EntityCommandBuffer ecb;
        public IECSManualProcessor ecsManualProcessor;
        public Type type;
        public bool exists;
    }

If someone wants to know how those are looking

zenith wyvern
#

I've used commands buffers a lot and never had an issue with it generating garbage

#

So I would assume it's something else

stone osprey
#

Hmmm... but what ? :/ The deep profiler doesnt help either... it justs lists it as "Gc alloc" in that method shown above.

zenith wyvern
#

I have no idea, you have too much going on there. Reduce your problem

stone osprey
#

Ok besides that. What does it mean when theres something listed as "GC alloc" in the deep profiler ? I would assume that its either a direct alloc call... or a boxing operation... or am i wrong ?

zenith wyvern
#

It could be anything that's allocating on the heap

stone osprey
#

Hmmm... but doesnt an EntityCommandBuffer allocate memory on the heap ?

zenith wyvern
#

No. It's a native container.

mint iron
#

mmm, i thought if a struct contains a class it gets allocated on the heap

stone osprey
#

@mint iron I never heard of that... but im gonna look into it. Probably thats the case here ๐Ÿ˜ฎ but it would be weird

mint iron
#

i remember it from many years ago on a StackOverflow answer but i can't remember the details, i could be wrong, or maybe it doesn't apply to Unity.

hollow sorrel
#

does it actually contain a class?

zenith wyvern
#

string

#

That would only allocate if you were doing typical string operations that do allocate, like concatenation

hollow sorrel
#

oh it's his own struct

zenith wyvern
#

Also "Type"

hollow sorrel
#

in that case yea

stone osprey
#

Hmm... im already searching, but i think thats not the case. A struct should not allocate memory when you pass a already allocated class into it

#

And .GetType(); returns the same object every time... its cached

#

Oh damn

#

Well ok... according to this article... it does

#

Or wait... it does not... damn im confused

zenith wyvern
#

ref CreateCommandBuffer() what is this function doing?

stone osprey
#

@zenith wyvern Oh ^^ Its a little method which looks like this...

        public ref EntityCommandBuffer CreateCommandBuffer() {

            if (!entityCommandBuffer.IsCreated || !StartCommandBufferSystem.ActiveEntityCommandBuffer(ref entityCommandBuffer)) {
                entityCommandBuffer = StartCommandBufferSystem.CreateCommandBuffer();
                return ref entityCommandBuffer;
            }
            return ref entityCommandBuffer;
        }

It only creates a new entity command buffer when a new one is required. .ActiveEntityCommandBuffer checks if the command buffer is still "pending" and valid.
This one does not create garbage... so i think the command buffer in total does not create garbage. Otherwhise the deep profiler would list CreateCommandBuffer

zenith wyvern
#

Well I have no idea if it would be generating garbage but you shouldn't be caching command buffers between frames

stone osprey
#

It does not ^^

#

I just cache it FOR the frame... difficult to explain. My layer just receives ECS operations and executes them. But it doesnt know when a new frame is starting and when its ending. Thats why i designed it that way. Its just some sort of utility

#

So i receive a ECS Command... which creates a new ECB and once the next one comes it checks if the ECB is still valid and reuses it. When i receive a ECS Command in the next frame, the previous cached ECB is out of order and it generates a new one

zenith wyvern
#

It could be ManualProcessors[type]

#

I've had issue with dictionary key access generating allocations if I don't pass in a custom comparer

stone osprey
#

Thanks, im gonna look into this ! ^^ This could probably be the case... because i didnt gave my enum an equals or comparator.

stone osprey
#

Besides that... can we use one ECB for multiple operations ? Like having one that adds a few components, then sets a few afterwards ?

cerulean forge
#

Is there anything like a 'reactive system' in the Unity ecs? Which triggers when components are added/removed

night venture
#

Hi.

Trying to understand pure ECS and avoid using monobehaviour/gameobjects.
I'm able to move an object on my scene, using a gameobject with DOTS create entity component attached...but i'll like to create entities 100% from code.

So far, this is what I got:

    protected override void OnStartRunning() {
        Debug.Log("OnStartRunning...");
        Entity car= CarSystem.manager.CreateEntity(CarSystem.archetype);
        manager.AddComponentData(car, new Translation {
            Value = new float3(-10f, 0.5f, 0f)
        });
        manager.AddSharedComponentData(car, new RenderMesh {
            mesh = this.mesh,                                   //<------------------------------THIS IS WANT I WANT TO CHANGE
            material = new Material(Shader.Find("Standard"));
        });
    }

Similar to Material...is there a way to easily attach a Cube mesh or something similar to make my "hello world"?

karmic basin
#

So if you're looking for an already set callback, I don't think so, but you can easily add your own system to react when a specific component is present.

cerulean forge
#

I don't want to react when a component is active, I want to react the frame it is added (or perhaps changed). The component might persist for many frames after that.

night venture
#

"...In cases where you only want to process an entity component when another entity of that component has changed since the last time the current SystemBase instance has run..."

#

perhaps that could help you

cerulean forge
#

Ah, that's exactly what I am looking for

night venture
#

๐Ÿ™‚

cerulean forge
#

I thought I remembered that it existed, but couldn't find it anymore

#

thanks ๐Ÿ™‚

night venture
#

perhaps you could help me in return ๐Ÿ˜‡ ๐Ÿฅด ?

karmic basin
#

@night venture RenderMesh.Mesh is a UnityEngine.Mesh, so you can create one from code like usual

#

dots physics package also added some BoxGeometry thing, could be even easier. But I never tried, only saw them use it in their unit tests

night venture
#

let me try that render thing...

karmic basin
#

unless there's some conversion involved, hope I'm not mistaken

#

I assume you do it for learning purposes ? Otherwise it's really recommended to go hybrid, and ignore pure ECS at the moment

night venture
#

is RenderMesh.Mesh correct?

karmic basin
#

.mesh

night venture
#

yes, pure ecs for learning

#

RenderMesh does not have those properties/methods

karmic basin
#

It's like you wrote, in your RenderMesh struct

night venture
#

perhaps MeshRenderer?

karmic basin
#

this.mesh should be ok to be a UnityEngine.Mesh if I'm not mistaken

night venture
#

but how i create that mesh?...that the question...if you look following line, material is created by a static method Find.

#

is there any way to create a "cube" mesh from code?

karmic basin
#

yep, but nothing to do with dots

#

like the usual way

night venture
#

i mean...are "visible objects" gameobjects and everything else is dots?

light mason
#

Question for the group, anyone used Dots in VR project for oculus quest 2

night venture
#

I'll try asking other way: DOTS paradigm is built around Entities (collection of components) and Systems (handle components)...but object show on screen are "gameobjects"?

light mason
#

That depends I guess

zenith wyvern
night venture
#

probably my questions are clear enough to get a clear answer...my fault.

#

does unity provide something similar to Mesh m=new Mesh("Cube"); to get a 3D cube mesh ?

zenith wyvern
#

For a cube gameobject, yes, for a cube mesh, no