#archived-dots
1 messages ยท Page 282 of 1
did the dotween port not work out?
nah, Polymorph components break on generic types
and I couldn't fix it quickly enough, before I burn out
yeah
damn
i'm sure a pure dots tween engine wil be possible
maybe someone will invest the time
it is possible
I already know how to make it
but I am not doing it without either fixed codegen in polymorph
or some other fancy way to achieve struct conversion
the whole point is to be in unmanaged land as long as possible ^^. I just spawn a gameobject for an entity from a prefab and do all my managed stuff on there. its not really that hard and you still get to use pure dots for everything else
maybe just avoid polymorphism completely as it's kinda the opposite of dod right
I knoooow, but for this kind of project it takes 100 times more efforts then managed
meanwhile it's not even used in it's capabilities
since amount of entities is always small
report back when you handled all the destroy logic and setup you need for your own hybrid workflow. sounds again like a framework to me ^^
welp, since I create/destroy same objects often I decided to just pool them
Instead of destroying I'll send object to pool, and add disabled tag to entity
yah go for it. just dont say stuff like you like the hybrid workflow. cause u aint using it ๐
Yup, I'm a moron, I already had a user interface gameobject doing just that, and I can slap her on that. I been so long in the tech depths I forgot my brain exists.
wait what
someone is using Unity not for games, but for utility application
๐ค
considering possibilities of such fast calculations with burst seems understandable
also you have any sort of UI framework to work with
also ability to easily port it to literally any platform
ofc. i wrote a GIT projectmanagement graph tool in unity. even without dots it was used for applications
GameEngines are also commonly used by now for filmmaking, motiontracking etc
yeah, filmmaking is totally understandable
Especially considering Unity is officially supporting it
but desktop utility app, oh man
smth not very obvious
architecture, car industry, digital twins, serious games, ... the list goes on and on
our mobile app is 99.9% a 2d tool app and in unity. why make something native, in react, xamarin or the other trash when you have unity? ๐
we had long discussions about it and the worst fears were projected on this decision. we had 0 problems
i'm at a point where i'd do pretty much anything, client side in unity
just ui but i've recently added some particles:)
welp, you assured me
yeah i mean why not. especially on desktop. even on mobile battery usage isnt much of a problem. sure if anyone uses it for like 3 hours a native app would win but who does that?
how do you guys spawn a staticoptimizedprefab at runtime? all children end up in 0,0,0 for me because ofc they are not moving with the virtual parententity i can set the transloation of....
Is the static tag even used anywhere in the transform systems (cant find it)? or is it just a tag for debug purposes? spawn the prefeb without it beeing static and then remove Translation,Rot,Scale from it?
Stuck on compiling a standalone again
The hell that is compiling a standalone with UNITYs experimental packages never ends... I just wish they didn't depreciate packages that did work.
I don't want to update my steam page telling the reason I can't get the promised update is due to Unity having tons of bugs.
But it's been 100 hours of this nonsense and its looking like no choice.
I just don't get... why if addressables worked in last standalone compile and nothing changed except an extra rebuild... why would they not work again?
don't you have a repo with a working state?
Its the same one as what I have here.
I literally didn't change addressables at all, but they won't work anymore.
and unity and entities has the same version?
I distinctly remember addressables not working on a new build of addressables(just misclicked the build button and let it cycle through) back in the version it worked in.
Its like sometimes addressables just doesn't work. I saw the issue online. Someone said it takes 20 to 50 tries for a standalone to work.
try clearing all caches and start a clean build
I did that like 30x
Wait
I can clean liberary too
I think maybe what I did was... I manually copied a directory of data from my Editor to my live and it worked last time
But I'll delete library and restartit
good first step
ty
I didn't go into work today, I promised my users a patch.
some pitfalls in addressables, the build target is not correct, like win32 != win64. the addressable cache got corrupted or the addressable cache still has editor loaded so win64 isn't loading. best to test on a pc that never had the unity editor running.
I think maybe my build target is not correct.
I just use out of the box build targets, but I compile to D:/starfighter
I tried targetting D:/starfighter and it seemed like I got more errors
are you loading the addressables with cache? it's just a buildIndex that is set
I'm not sure what this means. I assumed the default script handled everything.
Addressables is not advanced technology, it was in FlashPlayer and earlier techs... Loading on the fly shouldn't be crazy hard to pull off as it'd been done for decades... On top of this, I never saw an IDE which promised to build standalones that couldn't.... I'm a teeny bit frustrated, but I love Unity and I'll roll with it.
I rephrase that, do you load them from a server?
no
I just want gameobjects that load on the fly as the game plays
It saves my game loading time from 8 minutes seconds to 3 seconds.
All my files are local
There's a guy from 2 years ago with the same problem as me. It's a bug that hasn't been fixed for 2 years: https://www.reddit.com/r/Unity3D/comments/h9oom1/having_trouble_with_unity_addressables/ It should be the very first use case tested, out of the box default compile for Windows.exe standalone.
The worst part is I simply used the resources folder and everything was awesome, but that solid functionality got depreciated to not work in a few ways before the "experimental" package was fully functional. I'll be fine, I'll roll with this especially if someone can help me consistently compile a standalone without grief... It's just been a long 100 hours the past 3 weeks wrestling with these Unity Bugs.
have you checked all addressable assets that they have valid scripts on them? also, as stated here, you can do it manually Addressables needs some files at runtime to know how and what to load. Those files are generated when you build Addressables data, and wind up in the StreamingAssets folder. This is a special folder in Unity that causes all files in that folder to be included in the build. When you build content, we do not immediately put files into this folder. Instead they are staged in the Library. When you build the player, we copy the requried files over, do the build, then delete them. This is done so that a user can build data for multiple platforms, but only get the relevant data included in their build.
check if the library folder has all files and are correct
and yeah, I agree, addressables can be quite finicky. resources folder was more straight forward. less "magic" that can break
Once they depreciate solid required functionality and force you to use an experimental package, that package is no longer experimental/alpha/beta, it's live retail.
but they are stable, otherwise you'd see a LOT more problems with it. there's also https://discord.com/channels/489222168727519232/844715993213173780 who can give better advice I think
resources folder is not deprecated?
No one ever goes there or replies. You gave me solid advice. I think I have to copy the streaming assets.
I was doing fancy things with the resources folder, and I was told the reason my fancy things no longer compiles was because what I was using was depreciated... I may have gotten bad advice tho, so maybe it wasn't.
the last time I've used addresables was a non-dots game. maybe the new build mode screws things up or smth?
I think I have to find out where streaming assets compiles to my main project and manually copy it by hand to the build folder, but I'm not sure why Unity doesn't have that as default behavior.
not sure what you were doing but resources folder works still the same
I actually got the same kinda errors
Like the resource folder data wasn't being copied to my standalone directory
In the past year, I spent about 500 hours just trying to get standalones now that I think of it since this isn't my first 100 hour rodeo.
hm, that's weird. i instantiate and convert a prefab from the resources folder. works fine
Did you build to standalone and convert to entity?
I can do all that stuff in the editor as well
It only breaks on standalone
also for builds
Then I get the error messages of not being able to find the data, because Unity didn't bring it with the .exe
Here. I'll do a sub 1 minute video, you'll see what I mean. (can't make video til my library rebuilds, normally takes a half hour or more)
so adressables AND resources folder aren't working? i can reall only think of a broken prefab
some deleted script or smth
the addressable build process shoukd tell you that though ๐ค
The addressables build works fine
I think what is happening is: Unity is not copying over the data files it built for addressables to my location of my build.
I remember if I copy/pasta it from my unityProject directory to my unityRelease directory (d:/starfighter), it may work
I need to find out what to copy, but a Unity user should not have to do this ever
Enzi, thank you so much for trying to help. If I make MMORPG bank, let me know you remembered and I'll help you out.
My paths look odd
Why are you using custom paths
And is there a reason you're loading via remote path not local?
Do you upload your bundles to a server?
Then why is it setup to be loaded via a server
Still ain't working, I'm just exasperated
The player.log says AssetBundle.Unload was called while the asset bundle had an async load operation in progress. The main thread will wait for the async load operation to complete.
And I never called that
what are your new paths?
Thats my player.logs, too big for paste.bin
Localbuildpath and localloadpath
Localbuildpath: [UnityEngine.AddressableAssets.Addressables.BuildPath]/[BuildTarget]
Localloadpath: {UnityEngine.AddressableAssets.Addressables.RuntimePath}/[BuildTarget]
Its probably my paths.
If programming is like reading a clock and telling time, some children might think it difficult, but it isn't when you get to know how to do it. What is difficult is interfacing with some random engineer's API. That's when it becomes mind reading. Imagine buying a new Toyota truck, you get a clock, its off an hour, but how do you set the clock? Is there a set button, press the radio buttons, maybe windshield wiper, pump the break in a rhythm or play a zelda ocarina of time tune on your stick shift. There really is no way to know how to change the clock despite knowing how to tell the time, you're at the mercy of guessing what a Japanese engineer was thinking.
I coded all day today, literally since I woke til now, well it ain't coding, but trying to get this a standalone... This is what the last 100 hours of my life has been like: https://youtu.be/MvDZjxp9dSA Now I must sleep for I am exhausted trying this, it wears a man thin. I don't want to have to give my user base on Steam the truth: Unity engine bugs are holding me back.
Love API, hate that you can't compile to a windows standalone easy anymore.
You are putting me off with this blame game tbh. Own up for the mistakes and/or inexperience. It'll be okay in the end.
Wise words
hm, I made a nice comment in code that I should confirm this. I remove keys from a NativeParallelMultiHashMap in parallel. I checked the code and it should be threadsafe. Am I in the clear?
oh nothing special, like mapCombatEffectsSpellIds.Remove(element.hash); the keys are unique.
hm, then I have to schedule this part? ParallelWriter has no remove
{
// First find the slot based on the hash
int* buckets = (int*)data->buckets;
int* nextPtrs = (int*)data->next;
int bucket = it.key.GetHashCode() & data->bucketCapacityMask;
int entryIdx = buckets[bucket];
if (entryIdx == it.EntryIndex)
{
buckets[bucket] = nextPtrs[entryIdx];
}
else
{
while (entryIdx >= 0 && nextPtrs[entryIdx] != it.EntryIndex)
{
entryIdx = nextPtrs[entryIdx];
}
if (entryIdx < 0)
{
ThrowInvalidIterator();
}
nextPtrs[entryIdx] = nextPtrs[it.EntryIndex];
}
// And free the index
nextPtrs[it.EntryIndex] = data->firstFreeTLS[0];
data->firstFreeTLS[0] = it.EntryIndex;
}```
looks threadsafe to me except the last part. hm
Nah I was mentally exhausted and needed sleep from all day dev. Unity Dev team agreed with me, one of the issues I faced compiling a standalone was indeed a bug.
Not being able to compile a windows.exe is Unity's fault and not mine, it's been like this for many on the scriptable build pipeline.
Addressables should work out of the box, it does not. This too is a bug of unity. It ain't a blame game, just fix Unity, plz.
I'm doing my absolute best to say nice things about Unity to this point. You guys have been greatly helpful, but Unity is the only IDE I saw since 1980 which will not compile a standalone when it claims it should.
what about that looks thread safe? pretty much every line is not thread safe!
{
entryIdx = nextPtrs[entryIdx];
}```
you have a loop, if a value in the loop changes it can easily lead to an infinite loop (trust me run into that on hashmap before >_>)
// Someone writes to data->firstFreeTLS[0]
data->firstFreeTLS[0] = it.EntryIndex;```
as no same keys are removed the index access should be unique have no race conditions. the last part is problematic though. yeah I dunno, do you have an idea to remove keys in parallel?
but something could add a new key with the same hash
it'd still share the same bucket
and rewrite the chain
that you are in the middle of iterating
no adding is happening at this stage.
correct
yet I wonder if this is an oversight or smth. removing should be supported in a ParallelWriter, right?
hmm not sure i agree
me neither ๐คฃ
but removing doesn't seem that much out of the ordinary in parallel. there must be a reason though that it's not supported
even if they'd support it. I'd probably just complain that it's slow ... haha
oh man, //todo InvalidOperationException: HashMap is full that 100% has to do with the firstFreeTLS being overwritten because I was wondering why the hashmap is full yet the capacity is correct. well ... shit. gonna need to think of something else then. I'm building hashmaps with pointers to effects. now I'll be damned if I need to use a DB for that!
yeah the one big difference between the native map and say my dynamic hashmap
is i removed the tls array
(basically what gives native hash map parallel support)
hm there's ```internal static unsafe void FreeEntry(UnsafeParallelHashMapData* data, int idx, int threadIndex)
{
int* nextPtrs = (int*)data->next;
int next = -1;
do
{
next = data->firstFreeTLS[threadIndex * UnsafeParallelHashMapData.IntsPerCacheLine];
nextPtrs[idx] = next;
}
while (Interlocked.CompareExchange(
ref data->firstFreeTLS[threadIndex * UnsafeParallelHashMapData.IntsPerCacheLine]
, idx
, next
) != next
);
}```
if (TryGetFirstValueAtomic(data, key, out tempItem, out tempIt))
{
// Put back the entry in the free list if someone else added it while trying to add
FreeEntry(data, idx, threadIndex);
return false;
}``` maybe I can use that
cool found a thread that explained the problem: https://forum.unity.com/threads/nativehashmap-concurrent-replace.532420/
I had to send this to my Steam users instead of giving em a patch: https://www.starfightergeneral.com/2022/06/unitys-scriptable-build-pipeline-is-a-failure/ I'm not anti-Unity, I'm just honest, you need to fix your scriptable build pipeline to be able to make windows.exe, this is a terrible terrible failure and those who made it should be embarassed it isn't just one check box: Compile to windows.
Its like making a yacht that you cannot take out of port. I'm not the only one with this issue. I see lots of people with this problem dating back two years when the scriptable build pipeline was made. So why not just fix it?
Heck just hire me for a few weeks and I'll fix it for you.
Actually, I just realized the pressure is off me now, my users don't expect frequent patches now, so I can focus on code and improving my game. Then when Unity gets around to doing basic .exe windows compiles again, I'll have a game ready. Thank God. I hate tech nightmares. I'd rather just make elaborate software architecture.
My code is immaculate. ๐
You say you can't compile. Isn't your game technically just crashing?
Unity & addressables builds fine - thousands of companies use it (mine included). I would not expect any changes that fix your problem.
You're not going to solve the issue until you take responsibility for it...
Also you should be making a build every week bare minimum
I'm one of the absolute best UI guys on Earth, only knowing a couple better than myself. I have helped Google identify their Google ads website is bad, and still bad after their rework. I'm helping ebay in their redesign. I knew 98 websites were bad in 98 pointing to the future of menu based websites that came later. I knew more than the top guys at Carnegie Mellon when they pioneered a course of UI as they just were trying to figure stuff out. I love you for all the help you've given me in the past. You're knowledgable, helpful and a good guy. You are wrong here. If addressables does not compile for everyone right out of the box, it's trash tier design. I'll say it again: If you make a new technology and the default settings do not give the desired behavior everyone expects, it is trash tier design. Unity is not trash. Unity is a great software, but the addressables compile and scriptable build pipeline is trash that could be fixed easier than denying it is bugged for public relations/brand awareness falsehoods.
My game works fine in editor, but Unity cannot get it working in standalone.
it does compile out of the box, literally go make a new project, add addressables, use default settings and add an asset to addressables and make a build
it will work
I like the cut of your jib. Though I think export my entire 14.5 GB MMO to an asset, and reimporting it might tax Unity in other ways.
Where we go tho, is isolate exactly where the bug is and reduce it to the bare minimum so that Unity could fix it. I believe I have your attention like I showed the IBufferElementData bug yesterday with authoring.
IBufferElementData with Entity is a well known bug in 0.51
This actually brings up a great point: Why is there no 'reset to default settings' with addressables.
Yes, but it was a bug that cost me 20 hours of my time. I'm glad you guys helped, but it is one of a few Unity bugs I encountered in the past 100 hours.
Look, in no way shape or form do I want to trash Unity. I think Unity is awesome.
i'd be shocked if a preview package didn't have a bug
that's the risk you take using a preview package...
there are a lot more bugs than just that in entities 0.51
but that has nothing to do with addressables?
I'm fine with bugs happening, but the very first test every Unity dev should take is see if it compiles to windows standalone. You don't need remote assets building from websites. You don't need servers compiling for you. You don't need to reinvent version control for builds. Before you go fancy, just make sure windows compiles to windows.
Its like attaching nitrous to a car before you put on tires or put in an engine.
Much love to all you guys especially tertle and Enzi. I hope you don't get tribally opposed to me.
I just see a problem and I fix it, but if the problem is something I can't fix, I get exasperated. I see the UI as a problem, should be compile and go for everyone. Tertle brought up a great point for me to isolate the problem to the bare minimum, which might take another 100 hours on my end, so I'm just taking a breather.
look, we wouldn't tell you this stuff if we wouldn't know you can fix the problem locally. unity can't/won't help you much here unless you have enterprise or whatever plan you need to get actual tech support. under normal circumstances addressables work out of the box. i would bet top dollar it's just a setting that breaks stuff.
you said addressables build fine. the exe builds fine but the game crashes while loading addressables. so ...
In the editor it works
It is not the user that should figure out why the editor cannot be mimiced to standalone
i know, the editor doesn't use addressables
acutally, it's a setting. default it loads them in a different way
that's why it works in editor and doesn't in build
it does not. it uses asset database simulation
you have to build addressables then manually tell it to use your bundle instead
and anytime you make a file change, you have to rebuild addressables
this is why it does not use addressables - otherwise it's a 10min+ build between changes
I'm loading addressables in code. As a user, all I should have to do is pick what addressables I am using. Then it should be able to do a standalone. As I said before, this is a UI bug.
It's worked once before, but not again. Some people say they get it working 1 in 20 or 1 in 50.
Optimally: I load in code, then use the ui already there to pick what ones I want packaged (since I don't expect a code skimmer written), and you have that already.
the pseucode looks like this
if (editor)
AssetDatabase.LoadAsset<T>()
else
Addressasbles.LoadAsset<T>();```
unless you select
Use Existing Build
you are not using addressables in editor
I have many loadassetasync
The way I use Addressables is to load things on the fly.
that doesn't mean it's using addressables look at my above code
in the editor, the mode it uses, is determined by the play mode script option
Addressables.LoadAssetAsync<AudioClip>("Assets/Standard Assets/music/_sorted/CombatSpaceEasy1.wav").Completed += OnLoadDoneCombatEasy;
Thats a sample line of my code
yes
Addressables does work in my standalone
thats not using addressables in editor
I got it working once
Well in the editor when I'm playing the game
It works.
I think our vocabulary is mixed
no you are not listening to what tertle says ๐
let me repeat, **__That is not using addressables in the editor __**unless you change your option
I'm 100% super confused. My live build is using addressables in standalone. I know it works in the live play version in Unity too now, stuff loads on the fly.
I know it works in the live play version in Unity too now, stuff loads on the fly.
it works because you're not using it
I just can't get it working standalone again. I think I copied a directory from my Unity Project into my standalone directory.... I just forget what I did, and I'm wondering why I have to.
I'm 100% using Addressables.
If I load without addressables, it takes 8 minutes to start my game instead of 5 sec
I changed it around constantly the last 10 hours as I tried to get it to work by changing random things.
I can use any of the three, and it plays in editor.
Nothing I choose plays in standalone.
this settings do not affect standalone
My standalone plays, but the stuff that loads on the fly 'addressables' does not.
I can give you a few videos to demonstrate or make one up for you.
I'm still convinced you have a problem in your paths
based on last error he posted
pretty sure he's doing something like Resources.UnloadUnusedAssets
To get it to work last time, I think had to copy pasta a directory from my UnityProjectfile to my Standalone directory.
if you have to copy/paste the directory you're build won't work because it hasn't included the link.xml when compiling
so it's stripped out all the resource loading stuff
something in the path is not correct, that confuses unity and it's not copying the addressables to the StreamingAssets folder automatically
The only place I saw that was in NGUI, so I commented out even their code, that's how deep I go. yes I literally am editing 3d party APIs now, that desperate. (Resources.UnloadUnusedAssets)
Enzi, those are my paths again. I believe they're wrong. I want to set them to default, but there is no option. Tertle gave me a great idea to open a new project to copy from theirs.
There's no reset to defaults in this UI panel.
#archived-dots message what about these custom paths?
This has the best odds of solving things in a short period of time.
I have 3
these are defaults
since you're not using remote paths they're identical
your paths are fine
Thank you tertle, mine are vastly off as Enzi suspected.
Oh remote doesn't matter?
remote is only for if you're downloading from server
which you are not doing
you've told it only to use local
which of these should I pick: Use Asset Database, Simulate groups or Use Existing Build?
simulate is a bit meh - i never use it
you should use asset database for development
and only use existing build when you are testing addressable loading
Use Existing Build sounds like it tests it
to make sure you have set it up right
Makes mucho sense
you have to build a fresh addressables for it though so it's bad for development
what version of addressables are you using?
you are missing so many settings from the assetsettings compared to what i see
But for me, not being able to make a standalone, its like an iterim step and could be valuable
1.19.19
the latest
ok so it's because i'm out of date
(not surprising we don't update packages often at work
wait no
im on 1.19.19 as well
ah
It may be just some components aren't arrow keyed out focused
i need to sleep ๐ good luck you two
Thank you!
God bless your sleep! I know it ain't why you help, but if I do well, I want to help you guys back someday.
oh before i forget tertle, var multiplicative = mores[index] * lesss[index]; are you already having the product of all more stats in the mores[index] saved?
yes
though i've since used Manarz suggestion and merged the 2 more/less arrays
{
var statValueBuffer = statValueBuffers[entityIndex].AsNativeArray();
if (statValueBuffer.Length == 0)
{
continue;
}
this.statModifiers.Reset();
for (var index = 0; index < statValueBuffer.Length; index++)
{
this.statModifiers.Add(*statValueBuffer[index].Effect);
}
var stats = statBuffers[entityIndex].AsNativeArray().Reinterpret<float>();
StatCalc.FromModifiers(this.StatSchemas, this.statModifiers, stats);
}```
basically what my loop looks like
this.statModifiers.Add(*statValueBuffer[index].Effect);
is looping the buffer and populating each of the arrays
public void Add(in StatEffect stat)
{
switch (stat.ModifyType)
{
case StatModifyType.Added:
this.AddAdded(stat.Type, stat.Value.Short);
break;
case StatModifyType.Increased:
this.AddIncreased(stat.Type, stat.Value.Half);
break;
case StatModifyType.Reduced:
this.AddReduced(stat.Type, stat.Value.Half);
break;
case StatModifyType.More:
this.AddMore(stat.Type, stat.Value.Half);
break;
case StatModifyType.Less:
this.AddLess(stat.Type, stat.Value.Half);
break;
}
}```
thanks, gonna take a more detailed look at it tomorrow
its interesting how nestedprefabs work together with declarereferencedprefabs. it seems like using the same nested prefab in multiple different bigger prefabs will lead to multiple conversions of the nested prefab. those bigger prefabs cannot share the nested entity prefab.
kinda makes sense for loading speed i guess but it does bloat the converted entity scene quite a bit.
each subscene gets its own set of prefabs as well
is this design chosen deliberately for better streaming or would you expect changes in the future?
my artist made a dirty randomgeneration like this :
each of those houses again have such generate on point scripts which chose random objects (like doors etc)
so now i have 6x the same roof prefab converted per scene ^^^
it basically does the same thing as addressables
each bundle in addressables brings its own dependencies in
if 2 addressable bundles reference the same texture, 2 copies of this texture exist
this is actually really useful for memory management
however, addressables does let you explicitly add the dependencies to a bundle and ensure only 1 copy
oh i thought its automatically like that. good to know
an asset bundle won't unload from memory until every asset is released
so if you load, texture A and then load texture B
if you release texture B, texture B won't be released from memory
until texture A is also released from memory
this is why isolation of assets is really important in addressables
i see. and the same principle is used for subscenes?
pretty much
when you close a subscene all the subscene memory is unloaded
sometimes though, as you say, it would be nice to have option of sharing memory
maybe you never unload a subscene etc
or this asset is always in memory regardless, why make duplicates
thanks. this means i need to think about i actually want to split my world in multiple subscenes (or even split at all)
i should point out though that i have not studied how memory management works that closely in subscenes
and it was pre-0.17 so things could have changed
ye i still expect alot of changes comming in regards to subscenes
i've seen people use addressables and put every asset in just 1 bundle
means none of their memory will ever unload
quite bad
whole reasons we moved away from resources
because resources was effectively just 1 asset bundle!
so as an example should an npc be its own assetbundle? or group multiple npcs together?
depends on your game
more asset bundles slower it takes to load
but overall probably better runtime memory
but also much larger file size
there is an option to split every asset in a single bundle into its own bundle when building
so you dont actually have to manage 342134 bundles
oof that got complicated quickly ๐
at work we have around 40 bundles
game is procedurally generated
so its hard to manage memory
so i wrote a script to auto generate the like world templates into bundles where they could spawn
forest
desert
forest-desert
etc
we still have memory issues on old consoles though
no one really ever thought about memory management in early development (way before i joined) and especially not on restricted platforms like consoles
and it's a tough problem to fix
hmm im glad im doing 2D. we also wanna do random worldgen but i probably wont have to optimize too much
the subnautica devs did a good blog on this
oh perfect primer. thx alot
@rotund token i had another quick question for you. i need to make EntityHierarchies that i spawn in at runtime static. Do i need to do more than just remove Translation,Rotation,Scale and mark it as static? I cannot find the actual code where this is done with StaticOptimizeEntity to copy it
not sure sorry never tried
i actually have very few hierarchies
i hate dealing with them
i can show you teh code though
yep huge PITA but artists ๐
that would help alot
TransformConversion is where it adds the components
static is added in GameObjectConversionMappingSystem
and the flag is set also in GameObjectConversionMappingSystem
(static entities have no hierarchy)
thats exactly what i was looking for. thx! pretty hidden
yes and i fear i have to break the hierarchy up myself. calculating each l2w from l2p and stuff
but probably its easier
id like to have the possibility to have transform parents but without the child beeing localtoparent. that would be useful
but doesnt seem possible atm (atleast not without too much hassle)
Why exactly? If something doesn't have a parent matrix then is it really parented from a transform perspective?
not from a transform perspective. but it would be nice to have the hierarchy (which is based on parents) and still have the option to have an entity without any transform or completely decoupled from parenttransform as a child. just for organizing the scene a bit better.
i am just now getting around to looking at the DOTS authoring Talk GDC2022. i dont like this api:
i hope this doesnt make the cut ๐
curious how would you propose they implement code gen in a struct based system?
seemed like a reasonable way to get around c# limitations
well i wouldnt have a solution for that. i dont know the reasons for this API. i just wouldnt like to write it this way
that example is implementing Entities.ForEach in struct based ISystem
structs can't inherit from a base struct so that can't just have a stub in the base class
what is idea behind struct based?
yes i see. still doesnt mean i have to like the looks of it ^^ i hope they find other workarounds. Not that it matters much though. ill stick with writing jobs anyways
sitting outside of heap even more?
you can burst compile the entire system
there are 3 main benefits for this
- faster query lookup
- faster job scheduling
- faster job dependency combining
the limitation of most application is the main thread and if you can utilize it ISystem plays a pretty important roll in significantly increasing the number of systems you can run
I'm way more interested in Paralleling managed code
for smth that is 100% safe in parallel
just let us do parallel Run/Schedule
that doesn't even make sense
parallel run/schedule is parallelschedule
if you do WithoutBurst().Run()
that would run whole job on main thread, right?
yeah, what I'd want
is to make it stealable
while it runs on main thread
or make it schedulable
but I don't know any logic behind it
so
you mean
WithoutBurst().ScheduleParallel()?
yeah
because you can do that
wait, really?
what's stopping you
It always errored
and said
"You can only do Withoutburst().Run()"
because code is managed
so you can't pass managed code to jobs
but you can use managed code in parallel jobs
if you acquire it from within the job
can be made parallel?
why not just use Tasks
that's really pog
there is no safety system for managed code
would be great if you could just schedule literally whole game code
nothing stopping you from using them when in parallel
good news they did this and released a package
i believe it's called entities ๐
I know, but sometimes it's 100% thread safe
I meant with managed code
At least
I didn't know it was possible
until now
spawning hierarchies is really annoying me. the only easy solution i got now that should work with all of unitys systems is to spawn a hierarchy let unity do all its parenting and transform logic in first frame and then in second frame reduce the hierarchy to ashes (by simply removing the parent component). id wish i could remove it in first frame already but then transforms are all bugged.
I made a code that restored parenting hierarchy
because I needed it upon instantiation
but it requires EntityManager
you mean you build the child buffer yourself?
yes i wont do it for now. maybe in later stages when i really need to optimize. for now i go for flexibility
LinkedEntityGroup yeah
Friends I have a couple of questions about unity, could you answer them if you know something.
-
When will dots andย Entities ? Next year?
-
When will weta digital tools be released?
-
What innovations await enlight GI? HDRP? What new unity will bring us with the arrival of dots in terms of graphics?
-
Expect the appearance of an analogue of nanite or innovation in lods
-
When will there be a New state machine for animation?
-
When will the animation graph from the roadmap be released? With the arrival of dots?
-
When will motion matching that was in the plans in the roadmap be ready?
-
Will the IK be updated?
i think it means more, if the device doesn't support Vulkan it won't render at all
Hello. Your question would be better suited in #๐ปโunity-talk
For question 1 though we can answer: https://forum.unity.com/threads/dots-development-status-and-next-milestones-june-2022.1291766
Anyone else constantly get this error?
System.IO.IOException: Cannot create '...\Temp\GeneratedCode\Schnozzle.Actors' because a file or directory with the same name already exists.
not personally but I made a script to delete that temp folder from other issues(tertle mentioned theres someone made another that does it with a hotkey on the forums somewhere)
I do
but this is warning
so I ignore it
It won't let me go into play mode
Is reading data from blobs heavy? I have some readonly data (mostly definitions like i.e. statistics of units etc.) and I put them into a blob. Is it efficient or should I consider putting it into another component?
Maybe chunk component?
blobs are like references
actual data is somewhere else
Can't say for sure: but I assume it just depends on amount of data.
If it'll be too big to load - it might ruin cpu cache.
But take it with a huge grain of salt. I don't know how it actually might work internally.
should be very fast? physics uses them for colliders
even if I pass reference to the job and get data there?
it'll be just random access data, no?
same as accessing ComponentDataArray through entity
I think the only way you will get a clear answer for it is to profile it
are you actually encountering a problem or just theorizing one?
i'm rewriting few of my systems and wondering if I've done things right
there should be nothing wrong if you use native dots instruments
and you're probably right - between data and reference there wouldn't be much difference as both are random access
I read some info about how CPU cache works internally
you might want too, if you're interested in cache optimizations
so maybe should I gather data per entity before and then process it in two different jobs?
so it would be still random access but calculation part should be faster this way?
They can be quite heavy in terms of memory access but that's how it goes. There's not really a better solution.
They are faster than CDFE. Just one pointer access.
there's actually little reason for this because data access will be like 90% of the time. if you are into heavy arithmetics like matrices and so on it could be worth it
When can I use variables that Entities.ForEach modifies?
OnUpdate()
{
int count = 0;
Entities.ForEach((in Component c) => count++).Schedule();
UnityEngine.Debug.Log(count);
}
In this code, will count accurately reflect the amount of entities that has Component, or will the job finish sometime after Debug.Log?
if you can, merge jobs. scheduling is quite expensive and its on mainthread. i prefer having a little slower job but faster mainthread in most cases
Schedule() is async operation which only schedules job for execution until something executes it
Log runs right after schedule, but before job is run
except for if you use .Run()
if you do Run() it'll run right now and only then Log will
seems reasonable
thanks you all!
Did 0.50/0.51 add additional restrictions to using containers in the "incorrect" way? I can't schedule a job in parallel that uses a native container even if I add NativeDisableParallelForRestriction
https://forum.unity.com/threads/dots-development-status-and-next-milestones-june-2022.1291766/#post-8241375 There's a livestream about how V-Rising leveraged DOTS in production happening in a few minutes.
what does the error say
InvalidOperationException: ChunkPathfindingJob.JobData.ClosedSet.m_Data is not declared [ReadOnly] in a IJobParallelFor job. The container does not support parallel writing. Please use a more suitable container type. Unity.Jobs.LowLevel.Unsafe.JobsUtility.ScheduleParallelFor
[NativeDisableContainerSafetyRestriction, NativeDisableParallelForRestriction]
private NativeParallelHashSet<int2> ClosedSet;
hmm wasnt aware that you cant turn off all restrictions. but im the wrong one to solve this. i always try to stay in the safe world even if i lose out on some performance. id only remove restrictions if i absolutly need that performance. often feels like im quite alone with that approach when reading forum and discord ๐
I'm creating a pretty large native collection inside the job and would like it to be re-used from chunk to chunk for each thread
are you writing into the hashset across multiple threads?
hm thats weird then. since you are not writing in parallel to it from multiple threads. each thread has its own copy and writes in order. so not sure why safety kicks in
Well the safety doesn't actually check the writing afaik, it only checks on scheduling
wait are you allocating outside?
my guess is b/c NativeParallelHashSet is just a wrapper for NativeParallelHashMap ๐ค so the [NativeDisableContainerSafetyRestriction] would also need to be existent on m_Data
Are you sure it wasn't on a Schedule and not a ScheduleParallel?
yes its in a parallel job

I think you are right
I guess the alternative is just to use an UnsafeParallelHashSet
btw for my usecase sharing the hashmap was slower than allocating one per entity. you might wanna profile that
How can that be?
i had the choice between 1 big defensive shared hashmap and many small perfectly sized ones. the big one was much slower
even when i made the shared one small it eventually grew through automatic resizing so much that it got slow again.
for my case it was a factor of 2x (with auto resize)
Ah, that probably won't matter in my use-case. It's just reusing containers used for pathfinding, they are cleared between every run anyways
mine where cleared too
Yeah but I don't have the option to use "smaller" containers
They will grow to whatever size they need to
yes but say you have a lot of entities that would need a very small hashset and one entity that needs a really big one. and now that one big one allocates at the start. every other entity uses a much bigger hashset than necassary now. this was what cost me performance
if its pathfinding you might find some heuristic of how big that Hashmap needs to be before allocating (like just pure distance).
Makes sense, but I think they will be equally in size. The pathfinding is divided into three steps, with the first one being very fast, and the second one only going from step to step of the one above it, so the distances should be roughly the same each time
I'm still having some trouble optimizing this since it's pretty slow at the moment, so I'm just trying stuff out. Currently it uses HashMaps to store node data, and a potential performacne for memory tradeoff would be to use a very large native array instead, that's why I asked about the caching, since that array would be the same size each time
well in that case yes sharing should be more performant. and nativearrays can be shared like you wanted to. no idea whats up with NativeHashSet
It works if I use UnsafeParallelHashSet ๐คท
Doesn't change the fact that I may have written the world's slowest pathfinding algorithm...
It's gotta count for something though right? 
1 lol, it's slow as hell. There's a few things I could do to make it potentially faster, but I think switching to mesh based pathfinding would be much faster
oh snap, yeah that's slow
I'm rasterizing my world anyways, so creating a mesh at that point would probably be pretty easy
This is the path it was searching, I think just using the underlying voronoi cells for the mesh shouldn't be too hard to do
I'd still like to know why it's so slow though
post code ๐
otherwise, use some ProfilerMarkers to get the hot paths
VS profiling can also be useful (if it works)
Yeah I'm in the process of putting profilermarkers everywhere
don't overdo it. I'm guilty of this. ๐ profilemarkers don't profile themself so you can get pretty garbage results
and because I didn't know you can use using(new ProfilerMarker("path1").Auto()) { you code }
Yeah, that's what I'm doing
ah great, I created them in system and used as a parameter. such a pain ...
how does the timeline look?
It's only a single thread
Hmm, I feel it's pretty difficult to compare profiled runs vs non profiler runs if the profiling is so slow
cant you just use unitys navmeshbuilder api?
yes and its incremental.
so its actually pretty fast to expand around the player for example
What function is used to build the data during runtime, NavMeshBuilder.BuildNavMeshData?
yes
Can you handle pathfinding requests inside jobs?
And can you have multiple nav meshes that you can then tell actors to selectively use?
yes and yes
but inside jobs i havent done myself.
i think its experimental api
you need to write your own navmeshagent for ecs. using hybrid agent is just an insane PITA
Sounds pretty promising, but I guess I'll have to read into it. Basically each agent in my project only has a small area around it that that has spawned objects, and if it moves away again those objects despawn
So I guess I would have to generate the mavmesh each time a piece of the world is created, and remove it again if it is destroyed
so its not created deterministicly?
yes but then you can keep the navmesh around and share it between actors
just incrementally build it
How would I use it in any jobs though? All of the code seems to use managed objects
there are some experimental APIs in some obscure package i think. as i said i havent looked into it much. i just use the managed version atm in systems running on mainthread. its fast and easy enough for me RN. 100 units take around 0.3ms mainthread
ofc they dont all pathfind each frame
I think at least for my world pathfinding that would be pretty useful. I have a lower resolution version of the world cached, and currently I path find on that first and then pathfind multiple times until the actual destination is found
So I'm guessing the flow is use NavMeshBuilder to create a NavMeshData, then add that using NavMesh.AddNavMeshData?
and then NavMesh.CalculatePath
yes. a very easy to understand implementation of it is in the navmeshcomponents package
just look at the navmeshsurface 2D. actually all you would have to do is call NavMeshSurface2D.BuildNavmesh at runtime
or UpdateNavmesh()
I can't see anything with 2D in it's name? Unless I'm missing something
oh damn look at the normal NavmeshSurface component. i got another package for 2D
and since pathfinding is multithreaded anyways i didnt bother looking at the new NavmeshApis that would allow me to write jobs
you still see the profiler markers
and you wouldn't compare profiled vs non-profiled. just watch out for markers that are quite large in the timeline
https://forum.unity.com/threads/navagent-and-pathfinding-in-ecs.923183/#post-6042680
here is sth about jobs and navmesh
tertle said he uses bursted navmesh to query paths
he did roll his own thing though
he wrote about it in a forum post
thats what i linked i think
yeah later on
both are based on recast though. might use the unity one. pretty sure his one is faster ๐
but not maintained ๐
though that doesnt mean much. Navmeshagents are unusable as is despite beeing "maintained"
Thanks for all the tips @solemn hollow , I'll definitely check it out
if you look at that API for jobs id appreciate if you tell me how it went. if its easy to do id probably spend the time implementing it
Just ATM there are bigger fish to convert
bbbruuuuh
I decided to switch into Unity conversion workflow
aaaaand, it converts components I don't want -_-
is there a way to exclude Transform components from conversion?
thats basically what i asked about yesterday.
for me it was the physics components
you can destroy the converted transform components at the end of conversion.
I hope at some point they do add writegroups to conversionsystems
but why do you even convert an entity that should not have a transform in the first place?
I convert without removing game objects
yah dont do that. convert and inject is the worst you can do
I mean
it said in a thread it wont be supported in the future too
I have managed world anyway
well, if in future there will be option for animations, then I'll gladly get rid of it xD
the most annoying part: there are authoring components added in conversion
well i do use the animator. i just dont use Inject
idk why
It is the preferred way according to Unity: https://docs.unity3d.com/Packages/com.unity.entities@0.51/manual/conversion.html
This process is the preferred way of authoring ECS data
they are not really added. they are the same components that are on your gameobject
I know
thats so you can query them in systems and still effect the gameobject.
basically its what you did yesterday by hand
it's about convert and destroy
rly cant help you with your problems if you decide to use outdated workflows or workarounds ^^
not about convert and inject
its about subscenes. just use them
I cannot convert fully
I rely on transform
since I need DoTween
convert your gameobjects to pure entities and then let every entity spawn a gameobject from a prefab of what you need to be on a monobehaviour. basically like a companionobject but you have full control over it
the odd part
is that this workflow is not even supported, meanwhile inject one is xD
why would it not be supported?
hmm, will Subscene even keep reference to prefab game object?
why shouldnt an entity spawn a gameobject? IMO this is the only really solid Hybrid way. Entities always control the logic. gameobjects are just there to be rendered until the missing features are there for entities
then i can just delete those gameobjects and everything still works
yes. how else could i use it?^^
i've literally gone through every other workflow. and this is the easiest one to maintain. syncing in 2 directions gets really stupid really fast.
hmm
Now how would I create game object and then grab all classic components from it as components for entities?
๐ค
inject does it for me somehow
and what's more curious
it does without warnings
about addings MonoBehavior as component
i just have a managed component on the Entity which has a reference to the spawned gameobject and all the components i might need from it
Well yeah, but in my case the whole point of entity - keep references to components
and since Unity can do it natively
I do wonder how I can too
{
public GameObject artPrefab;
public GameObject artInstance;
public Animator animator;
}```
this is one way
but there's the one where Unity already references all components somehow
so either such components are declared already
or you can attach existing mono as component somehow
you dont want to do it though. since those components will get lost when serializing to subscene since the gameobjects actually having those components are destroyed
like this
but I mostly care just about having references
on new objects
which will be created by entity
so whats wrong with that snippet i posted?
I'll have to declare components for every mono
not much, but seems like just doing smth wrong, since there's a native way
there is a native hacky unsupported way yes.
why? you can fill the componentreferences in a single (runtime)conversion system
whats stopping you from adding an audiosource here?
you have 1 managed component containing all references to that gameobject you wanna steer
the V Rising stream is actually pretty interesting, definitely goes into more DOTS detail in the second half
They have an interesting approach to physics, i think they rebuilt the build physics world system.. my basic understanding is all their moving colliders ( for say characters that roam the world ) are actually static colliders, but they do move them, and use physics casts to manually check for collisions
oh its going on. damn
nearly finished i think
worth a listen though, just to hear some of the details of what they've done.. some nice bits
can u link again?
thx
i noticed their transform system group looked stripped down/different from whats builtin so mustve done changes there too, didnt get a chance to listen to it yet
they talk with the V Rising guys that's really cool
yeah maybe just stripping away all of the Translation Rotation etc and doing their own writes to LocalToWorld
not sure why they would have done that. it didnt seem like much is moving in their scenes. no reason to otimize this bit. maybe they had some problems with their networking solution and transform system
yeah i'm not sure but i think there could be optimization benefits by basically removing all of that stuff and not running those systems and just focusing on updating ltw exactly when needed
the transform system does feel like a bit of a rats nest, maybe easier to just strip it away
cant imagine working like that ๐ incrementally building up the transform changes over multiple systems is really convenient
well i'm kinda thinking you could basically still do that, but without having Translation, Rotation, LocalToParent, LocalToWorld, Composite Scale, etc etc.. which i think are basically just helper components.. Just have LTW
That's my basic understanding though
yes but then youd always have to do the costly matrix operations.
well say for example most transform related systems u probs need pos/rot - so you can do ltw.Position and ltw.Rotation
but again, that's just my basic understanding, there might be more to it than that
getting position from the 4x4 is just the last row for example
yes but thats still slower than pulling in exactly the data you need and having that in an array already without the need to pull it out of anywhere
yeah that's true
kinda like why you split up big authoring components in multiple sub components too. each system can get the perfect subset of data
yep
i think my issue with transforms is just knowing exactly what is what
i remember having issues a while back with getting the right data from the right components, things not updating, not knowing what was local or parent relative and what was world/global etc
so i'm kinda like, could this not be simpler
developing and babys. my attention span is down to a pigeon or smth ๐
gotta bring that up with my gf
Do you know which networking solution they used?
yes bit confusing with hierarchies
they rolled their own
ah alright
i shortly tuned into the vrising stream and they were showing of hot reload. damn. some tools are awesome
Yeh I was wondering about that, they do have a runtime conversion system and a scripting api they've created so its maybe that
they didn't answer antthing about it. pretty sure it's custom
still very awesome. they just put a debug log in a server script spawn method and voila
They're converting mono to ecs on the fly in runtime I think
huh,. i remember they specifically said that part isnt burst but they convert data into esc streams. looked like most is built on graph's
Ah yeah possibly
this is comming in 1.0
man i am really afraid of all that breaking changes that might be comming
rewrite of conversion (baking)
new transform system
aspects
im ready for improvements everywhere
they were pretty adamant that 0.17 -> .50 would be breaking changes but the upgrade process was fairly reasonable for me
so I'm assuming there will be a reasonable amount of api updaters for anything thats truly breaking
I think when you are using job structs you are on the safer side
lambda jobs could be a total pain. changes look substantial
but maybe old api will still be supported for a few versions
hey, i have a simple use case. i want a job to only run when a certain input is made. so a change filter on UserInput or smth. problem here, the naive ways of updating input is with a system that writes to it so every version gets bumped. I can think of the job (that is updating the input) really only running on an input but are there any better solutions?
apparently theyre gonna be renaming hybrid renderer into entities graphics, should help clear up misunderstandings ๐
good hybrid renderer always was a bad name for it
im doing polling right now so i too need a better solution. but if i had to implement it again id would do it with spawning entities for inputevents. so i would not have any changefilter checks in frames i dont have input. spawning an entity in endinitializatoncommandbuffer
when disable enable comes around that should be the way to go for input
tertle wrote into a seperate array and did a memcmp, then acquired a write handle and memcopied the data.
there must be some more reasonabke solutions. i had many bools to check changes. but meh
disable enable wouldnt be reasonable?
sure but that's far off ๐
i mean you also could subscribe systems to inputevents and set a bool to run or not
and I'm the guy who REALLY wanted enable/disable but now I'm planning to never use them ๐
haha same xD
true on the input, I just took it as example. I have tons of applications for it if I have a good solution
there's also the roundabout way of manually bumping the chunk version.
ah so you search for the famous event solution
you could call them events ๐ isn't everything that is happening some kind of event?
well if you define it as an update event sure
for me there is no clear cut solution in sight. every problem needs a diffrent approach. enable, disable / tag / NativeStreams / entity spawn / bruteforce poll / changefilter
that is something very different. i'm currently just focusing on DidChange
btw a nice pattern i found is using a basically empty component + changefilter on it to trigger systemupdates
very easy to avoid an accidental write on the component this way
because you guys said DidChange works on a component level and I thought it just works on chunk level. so I want to rethink how I can implement some
it is only written to when an "event" should fire
that gets around the biggest issue i have with changefilters. alot of systems just have to declare write access to a component which destroys changefiltering
having such a proxy component solves that
hm, true dat. sounds reasonable
so changefilter even works for a comp that has no data? interesting didn't know or expected that
no it does not work for tag components. you need a little bit of data in there
ah ok
might as well use it for useful debugging stuff
i think this gets pretty close to enable / disable feature anyways
might even be better for single events tbh
usability wise
how would you manage this comp though? you can't acquire a write handle for it all the time so the handle has to be acquired on some condition
alternative would be to access it with a CDFE
no you can get a write handle without triggering changeversion bump
i showed you this before i think. GetNativeArray triggers the bump
or you manually bump it
i was too lazy to search for how that works lol
probably much more performant ๐
wait, that's my point. getting the array bumps the version, so I can only get it on some condition
i could get RO pointers and manually bump
yes so in the case you want sth to happen in another system you get this array
in my case i only get this array for a certain number of chunks so that all my AI Systems only run for those chunks
but inside that job you could also just check for any condition and get the array to trigger the "event" for the whole chunk
i hate this internal stuff so much ... ahhh. can't get a Chunk* and its SetChangeVersion method because it's internal.
huh. pretty sure there was a way
:S
yeah ๐ sucks though to do that very time. and the last time I did it I realized I can't use Chunk* in my code context
it's just annoying. I mean, I get that not everything should be public for noobs but some compiler directive would be nice
anyway, tertle, didn't you mention you are bumping your archetypeChunks manually? Did you just write an internal method in your library for it?
hmmm
So will it be possible?
I want to have a game object. During conversion it will be converted and one authoring component supposed to create a prefab out of that game object minus all authoring components.
And then instantiate that same game object again.
Meanwhile everything kind of supposed to be saved in subscene
creating a prefab during conversion does not sound like a good idea. why not just create a prefab you actually wanna spawn and have an authoring gameobject that just holds the reference to the prefab.
because that would mean I'll have 2 prefabs
not sure why that is a problem. might even be better for loadingtimes of scenes if you have a smaller authoring GameObject and a bigger Prefab with all the heavy assets and stuff
for my project its pretty good cause we dont have the full bonehierarchy of our characters loaded while authoring
well in my case, there are almost none unmanaged components
so authoring process will look more like doubling prefabs minus authoring comps
and considering huge amount of prefabs I have to work with, this does not sound fun at all
im a little lost now. you either need the MonoBehaviours for authoring or for runtime right?. so you can split them up and should not have any copies.
every authoring logic you would run would never be needed at runtime and vice versa
that's the point - I might even have them as monos
that was my first workflow
I might go back to it, tbh
I just don't see how I can avoid it, to make authoring easier
just currently bumping it with the typehandle
honestly i cant help you more. told you how it works perfectly fine for me and how you could implement all your requirements you gave. it doesnt make it easy if you wanna support running everything everywhere...
oh, so just calling GetNativeArray or GetComponentDataPtrRW?
you either want dots or GO architecture. you said you want to do dots for your gamelogic cause its nicer to write. so skip GOs
just GetNativeArray
no need to be fancy
this is indeed very not entities friendly project
yeah, I've overcomplicated this with wanting to call SetChangeVersion :/ thanks man
i pretty much only use lambda's what sort of changes to those are you thinking
there was a slide in the last presentation and it had some syntax changes
i'm pretty sure they can code-gen these changes though
i really need to check wtf ISystem actually is
just a struct based Systembase
instead of using systembase as a class?
ahh
ohhh
interesting
so where is ISystem called from ๐
is it turtles all the way down?
oh true, didn't realize! then the Entities.ForEach is probably staying as it is
public struct MySystem : ISystem{}
just like SystemBase
this is what I was referring to
yep talked with tertle about it some hours ago.
yeah my understanding was this was just the api for ISystem
but maybe they'll make it consistent, who knows
I hope so, reads much better tbh
haha Manarz hates it
aren't APIs funny like that
my concern is it reads ok atm
but how does it read when you have a bunch of WithReadOnly, WithNone, WithAll and other properties on that query
i dislike everything that resembles LINQ so don't take me too seriously ๐
i mainly dont like that type and name of the variables are split
so the query is an actual query as part of the for each
yeah i don't like that it's split either
true, that can be confusing and a pitfall for dumb mistakes
as tertle says not sure how WithAll etc would work
but then again, it should be obvious as we're dealing with strongly typed structs
linq seems so confusing to me, i see on stackoverflow its like why not use this handy dandy linq expression and its just a bunch of gibberish
that's 90% of why I don't like it
linq is great ๐
as I started web-deving in C# around 2008 and this guy LOVED LINQ so I had to write everything in it. then it turned out the queries it created where total garbage and I had to manually look at every LINQ query and optimize. total pain. just writing the SQL statement would've been so much easier ... that said, I think LINQ for sql is much better now
i find things like
.SelectMany(s => s.GetTypes())
.Where(t => t != type)
.Where(t => t.IsClass && !t.IsInterface && !t.IsAbstract)
.Where(t => !t.ContainsGenericParameters)
.Where(t => type.IsAssignableFrom(t));```
quite clean and easy to read
so are ISystems just picked up automatically and run, similar to SystemBase, without requiring to be instantiated or called anywhere
using the builtin bootstrap and they are @devout prairie
linq has its place for exactly that stuff tertle. i would also not erite it any other way ๐
didnt somebody write some burstable linq for ecs?^^
definitely an elegant example
how many arrays does linq actually allocate in that example? hopefully not 1 for every .Where
who cares! i'm iterating every single type in every assembly. performance is hardly a priority here.
i created a short gif, illustrating why i think the transform system is a touch more complex than it needs to be:
https://gyazo.com/68c34aa31285ab07cd863e6f295b1e54
that whole article is like an enormous recursive nested if statement with a thousand branches
i mean there's some useful bits of information in there
but did you need to read all of that to be able to reliably set local/global pos/rot/scale in any other context
idk did u?
you get the idea pretty quickly i guess ^^
maybe they just datamined that doc
lol
yeah it's too much that they have to explain if this then this over and over etc
i get there's a need for some of it, and a parenting system ( debatable )
but say a noob is coming in to this and they have one system writing to Translation, another writing to LocalToParent, and another writing to LocalToWorld, etc etc
it's all a bit silly
imo
dont be a noob?
i mean they clearly tell you in the first lines of the doc that you are supposed to write to Transform,Rot,Scale
yeahhhhhhh
that sequencer graph in the v-rising talk ๐คค
guys did they deprecate OnDrawGizmo or sth?
public class GizmosRunner : MonoBehaviour
{
void OnDrawGizmos()
{
foreach (var world in Unity.Entities.World.All)
{
foreach (var system in world.Systems)
{
if (system is IGizmoDrawing gizmoDrawingSystem)
{
gizmoDrawingSystem.OnDrawGizmos();
}
}
}
}
}```
that was my way to run gizmos from systems
its not updating anymore
wtf
dont think its datamined, anyway its not overly complex so much as it goes into and repeats a lot of depth that when youre starting out you dont necessarily need to know right away
I actually wish it went into a little more depth on some of the more esoteric combinations ๐
just looking at RigidTransform, seems to have some useful methods
i hate how physics is split from the transform system
I changed my mind ๐
that required a second job and I /think/ it should be safe to set the change version in parallel =S
probably bite me really hard though
are gizmos running for any of you in 2021.3f5?
im aware that its slow. i just dont know what else to use ^^
probably entities ๐
you can find some line drawing library
its an old tool though which i need to get running. and somehow gizmos dont update at all anymore
i have my own draw library but i always recommend aline if you don't want to roll your own
oh nice it even works from bursted jobs
yes
having a burstable draw library is a requirement imo
drawing makes debugging so much easier
especially if you can output text to the screen
(which aline supports)
oh man thats great
apart from that's it's like 100x faster than gizmos
guess ill get it ^^ how much provision you get? ๐
i really need to get myself an affiliate link ๐
so, SetChangeVersion?
where T : struct, IBufferElementData
{
var typeIndexInArchetype = ChunkDataUtility.GetIndexInTypeArray(chunk.m_Chunk->Archetype, handle.m_TypeIndex);
if (typeIndexInArchetype == -1)
{
return;
}
// This should (=S) be thread safe int writes are atomic in c#
chunk.m_Chunk->SetChangeVersion(typeIndexInArchetype, handle.GlobalSystemVersion);
}```
yeah just wrote a tiny little utility for myself in my internal library
alright, that was my plan ๐
is GetNativeArray that much slower?
no but i can't do it in parallel
it fails safety checks
i dont quite understand why it shouldnt be safe? does it circumvent the dependency management of the systems?
what if you did GetNativeArray in the same archetypechunk in different threads
then wrote to it
normally archetypechunk are split per thread
but for what i'm doing multiple different threads can update the change filter
so actually accessing the data for writing is unsafe
ah so i shouldnt run in this issue
here's mine for IComp which uses the lookupcache ```public static void SetChangeFilter<T>(this ArchetypeChunk chunk, ComponentTypeHandle<T> handle)
where T : struct, IComponentData
{
ChunkDataUtility.GetIndexInTypeArray(chunk.m_Chunk->Archetype, handle.m_TypeIndex, ref handle.m_LookupCache);
if (handle.m_LookupCache == -1)
return;
chunk.m_Chunk->SetChangeVersion(handle.m_LookupCache, handle.GlobalSystemVersion);
}```
a gist or resource for how globalSystemVersion works? I use it but I don't know where it actually increments? on every frame start?
GlobalSystemVersion should be the same so even on race conditions, the correct value should be applied. I don't know too much about the atomic implications of int but I just trust you on this one ๐
it increments in every system in BeforeOnUpdate
makes sense, thanks
now that I dug in the code, yeah every type has its own version. not sure how I missed that
how could i get which system is selected in the systems window for an editor tool? is there an easy way to access this?
sth like EntitySelection.selectedEntity just for systems
how i solved it until now was having proxy objects either in a graphview or in the hierarchy representing the systems. so i could mark one of those objects and draw debug data into the scene.
i just now wondered if i can skip this proxy object but it seems like i cant
Even Unity is solving their EntitySelection by wrapping it in a Scriptable Object
wait a second. with the upgrade to 2021 Unity now supports default interface methods of c#8 !!!!
just got around to looking at this
seems like it's SystemTreeView.SelectedSystem
though SystemTreeView is internal unfortunately
yes thats where i stopped digging yesterday.
I should be able to make this work.
well that SelectedSystem variable turned out to always be default due to this.
Time for reflection
shit i got it to work. but lets not talk about UX
so turns out everything is set correctly if you NOT select a system in the systems window but instead get it to be selected by selecting a relationship or sth
@gusty comet if youd use subscenes all your objects would already be converted when the scene loads. I didnt get your second problem sry. conversion should write from authoring monobehaviours to Icomponentdatas in the Conversion Step. This usually happens before OnCreate.
Is there a good guide on using subscenes at runtime (in code) for loading assets? I haven't been able to find one.
Unity.Physics.Math has some useful helper methods, but ToEulerAngles is marked as internal because apparently they intend to move it to Unity.Mathematics..
So basically if you're looking for dots versions of some of the old methods like SignedAngle, FromToRotaion, etc etc, have a look in Physics.Math
Unfortunately have to copy the code out of the package until they're public
they're all internal so you can just use asmref trick to access them
but yeah they have a lot of replicated behaviour from UnityEngine
which is great for converting existing code
what's the asmref trick? set up an asmdef and add as a reference?
i wonder how they decide which methods to aggressively inline and which not, for example ToEuler is but Angle isn't, in the above clip
maybe just arbitrary depending on usage while they've been building the library
from what I see: some things can be inlined and make whole code vectorized.
Smth else will be vice versa: you have bad code all around, but this piece, which is not inlined is vectorized.
But I haven't really played around burst debugger to see how it actually will turn out, so I suggest to just test if you are curious
Yeah i haven't either tbh, would definitely like to start looking at it, will have to be later though!
I don't really know why someone would tweak around that, unless they are building library or tool or their game is already finished and they are actually optmizing it
however com.unity.platforms.windows results in errors with 0.51 entities
these platforms are all deprecated and no longer work
add components with the search function and a bit of luck, you dont need the platform thingies, they are included with dots by default, to change settings and stuff, im pretty sure they can be found in the component menu, which is a bit broken, but use the search function to your advantage, the top one should be what you typed
Any idea what is going on here?
(0,0): Burst error BC1045: Struct `Unity.Entities.JobEntityBatchExtensions/JobEntityBatchWrapper`1<Schnozzle.InterestManagement.Systems.InterestManagementSystem/PlayerOverlapViewInterest_Job>&` with auto layout is not supported
It's just a normal Entities.ForEach job
yup it works great if used weirdly, let me explain, basically use the search function
general settings i think, also something else i dont remember, check the samples on the dots github, sorry for not knowing lol
i gtg to bed now, but i wish you luck in getting your build working!
Hi everyone, I'm currently creating a world manually. There is only on problem. When I exit playmode the world doesn't seem to be destroyed automagically.
What is a good way to do this?
i just have one mono on scene which have OnDestroy in which i dispose the world. Same mono creates this world
also you can Application.onQuitting += but in editor you should reload this delegate on every entering to playmode