#archived-dots
1 messages Β· Page 27 of 1
Quick question: you can make a source generator inside unity, right? I don't need to make it outside of unity anymore?
With the exception to that being ecb playback crashes
I believe so though I couldn't tell you how
this is where the singleton is setup
That seems pretty straight forward
@viral sonnet sometimes what I do is delete all the compiled files to force a recompile if I'm having issues
hmm, im wondering does some sort of native list exist? as i need to pass in and out of a job an array of unknown length of ints (usually lists would be used for this in situations without jobs)
Yes it's called native list
order seems also correct. broadphase runs way after the picker system
yeah, no idea. as i said, i don't even think it's a physics issue. there are a bunch of errors beforehand that maybe break the loading sequence
and those are all related to errors for internal unity comps that have no constructor - but they do π
I recommend you look at this, it helps give an overview: https://docs.unity3d.com/Packages/com.unity.collections@2.1/manual/collection-types.html
thanks, that shall be useful!
Errors are cumulative to the point of failure. Just because it fails at that point, doesn't mean it's actually "failing" at that point
you never answered if you have a working build
This is the longest I've ever waited for a build (6 mins)
90% of it has been URP shit
idk why it's taking so long, last build I did that wasn't ECS took 20s and was far more complex (and used URP)
it always takes so long on a fresh projects/new unity version. urp/hdrp takes ages to compile. but only once
even then, I do a clean build every now-and-then and it takes less-than a minute
cant be on il2cpp
no console plans then i take it
pure windows atm
This is just a test project for various ECS-based mechanics
10 mins in

il2cpp build is coffee break time. π
if it's mono something gone wrong
have you noticed it is much faster in 21/22 than 20
at least
i could incremental build in like a minute or two in 21
you know i've only made a mono build. i'll try an il2cpp now
Why would I be in here if this was a mono build 
I didn't even make it past to the splash screen on il2cpp
The bar went down...
what did your dmp say - i was curious if it was the same issue i had

The il2cpp dump?
Yeah I know, but I was looking at the mono dump earlier
I wasn't sure which one you meant
Ah forgot which build was il2cpp π¬
Does it say anywhere in the logs?
iirc it does
probably
Ill check
hm, .net standard 2.1 is okay, right?
what you should be using
Do I need to load the UnityPlayer.dll from an il2cpp build or is a mono build fine?
same line in the il2cpp build
You made it to the splash screen?
yes but not any further π
I didn't even get that far π¦
ah not sure about unityplayer that shouldnt matter
but you'd need to match your exe/dll/pdbs to the actual build
I have a working build
can you post your player.log?
where would I find that?
AppData\LocalLow\companyName\gameName
Asset has disappeared while building player to 'globalgamemanagers.assets' - path '', instancedID '-2564288' UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&) please kill me
hey does .Add() work with native lists? (im pretty sure it doesnt, but making certain)
It works normally, like a normal C# list
hmm, odd
You need to be careful when copying the struct around though, since the Length property may only change on the copy
heh that's only for unsafe list
Oh, right. My bad
oh, im trying to do a foreach loop on the nativelist outside of the job
There's nothing of interest
Too much putting unsafe collections in components π¬
But now I can replace them all!
i cant remember the last time i didnt use an unsafe void lol
just some index out of range exceptions caused by my shitty graph script, and some attribute warnings that they will be ignored
but anyway, back to the native lists, i cant seem to get them to change, they seem determined to stay the same
Can you show some code?
i can try, but cause it is quite long ill just cut out the unimportant stuff around it
no ArgumentException: Unity.Entities.PostLoadCommandBuffer is a class based IComponentData. Class based IComponentData must implement a default constructor.?
nope
runs perfectly fine, other than what I mentioned above
I think they're tricking us @viral sonnet
π
This also likes to happen now:
It's just stuck on begin sometimes
I need to kill unity and try again

on build or code recompile?
yeah that's just unity
build
it'll begin ... any minute now ... π
wait till it's on recompile and you got changes to save π©
i killed unity 3 times on recompiles. was just stuck
oh - are there any docs about builds with entities now? I think I remember reading somewhere in this chat, build configuration assets weren't needed (I might be wrong)
just build like normal. Make sure the build settings checkbox is ticked
preferences > entities > Builtin Builds Enabled
any idea what this is on build? 'GlobalCooldown' is missing the class attribute 'ExtensionOfNativeClass'! it's just public struct GlobalCooldown : IComponentData { public uint gcdStarted; public uint gcdEnding; }
oh we see this in 2020.3 with entities 0.50
nothing to worry about, right?
weve never had an issue just annoying warnings
odd, i have so many comps and for 2 the build complains
if you want to hide warning you can literally make an attribute of that name and attachit
yeah we have 2 i think as well
and they juts seem random
warning? i have them as error
is the poor soul looking forward to writing bakers?
yeah, error is thrown but build isn't cancelled.
probably it has nothing to do with the build. it's thrown from here UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
eh, whatever π never had this before though
clean build?
Yeah, and my computer was basically unusable while it was going
I had other shit running too so yeahhh....
did you get a build with physics working?
ahh
I did, works fine
goals
ahh
I'm guessing the crash is the same on I had on mono, same one as @viral sonnet
What do you mean?
ah sorry getting my terminology mixed up i think
i thought you meant it was not an il2cpp build
Physics crashes on both il2cpp and mono for me and @viral sonnet
Doesn't seem that way
i wonder why it's ok for Extevious and not for you guys
Yeah that is odd
I have the exact same errors as enzi, and the same exact crash position in the stacktrace
i guess it could be tricky to track down from our side
could be something like a bug with unique colliders, or using two worlds, or any possible variety of thing
never fear tertle is here π
crashes is what i spend half my life debugging -_-
i've always thought that about myself
you're special, just in a bad way

i seem to very quickly hit the limits of what things weren't designed to do.. it's a talent
Does the MaterialProperty attribute still work for components?
they changed something about it
For some reason MaterialPropertyFormat doesn't seem to exist anymore
but i haven't looked at rendering yet
yeah i think that was what it was, not needed anymore
it's determined by the struct
/// <summary> /// Constructs a material property attribute. /// </summary> /// <param name="materialPropertyName">The name of the material property.</param> /// <param name="overrideSizeGPU">An optional size of the property on the GPU.</param> public MaterialPropertyAttribute(string materialPropertyName, short overrideSizeGPU = -1) { Name = materialPropertyName; OverrideSizeGPU = overrideSizeGPU; }
Ok so to elaborate on what my project is like: It's a basic plane with mesh collider, some non-uniform cubes in the scene, and a convex hull for a vehicle that I drive around in
@viral sonnet how complex is your scene that causes it to crash/errors?
have you tried stripping out anything that is related to the errors?
Yes, the MaterialProperty attribute no longer has a format enum, Entities Graphics just uses the size of the type. That enum only had meaning for HRv1, and has in practice has been unused for a long time.
No, nowadays you only have to type
[MaterialProperty("NAME")]
. The second integer is used for actually overriding the size to be something else, but I don't think that parameter is really useful, that feature is only used internally for optimizing transform matrix size on the GPU.
https://forum.unity.com/threads/hybrid-rendering-package-becomes-entities-graphics.1323792/
Well i need some sleep.. i'll leave you guys to solve all of the transition to 1.0 problems and come back in three weeks to search all the answers π
That sounds like a great deal π
I will say thanks, it's the least i could do
The dots channel is like the raptor cage in jurassic park, we're all sneaking around testing for weak points to break out
yeah but the entire enclosure is held together by ductape
radios back to base "Damnit they've spotted the ductape"
After rebuilding with il2cpp I can get to the splash screen now for some reason, I have no idea why. It now crashes on the OnCreate in the broadphase system
Sadly I couldn't recover the other build that crashed immediately π¦
the physics sample also runs fine.
blah i'm still blocked by aliasing bug i reported
the workaround we thought of didn't seem to work
I swear you guys are coming across some weird-ass bugs
not even one error or warning in the player.log
restart PC?
oh i already reported this to unity and they tracked down the issue
maybe it's a conflict with your system somehow
The issue is that IL2CPP is getting mixed up when dealing with unions of fields and incorrectly applies 1 byte padding to the outer type. This makes BlobAssetReferences appear to be 8 bytes in size but an alignment requirement of 1. This is a problem since mono sees your component
{
public BlobAssetReference<MetaData> Value;
internal bool IsSetup;
}```
> as 16 bytes and il2cpp sees it as 9 leading to deserialization issues/corruption
this component breaks il2cpp
oof yeah that's a big issue
so yeah if you're using BlobAssetReference be careful
also @rotund token you were questioning how the new aspect types would do compared to IJobEntityBatch
i was?
yeah, a while back
(if anything i think i was probably questioning how they would work with IJobEntityBatch?)
yeah how they will work with ijobentitybatch
i was mostly concerned at that time that aspects would be tied to code gen and require one of the code gen jobs to function
Just curious what your take was on it now that we have access to them
ah alright
once that is done it's time to modernize my api and look at features
my ECS libs are really simple, nothing crazy atm
I want to netcode a game, but I'm still waiting for more support
i find netcode works well
just poorly documented
ok well i can't build il2cpp for the aliasing issues
but i add physics and built a mono no problem
still on b8
same
yeah very simply physics test worked as well
cube falling onto plane
so yeah not sure, physics builds fine for me
In the editor does it fall through the ground for you when clicking on it?
Build testing infrastructure has indeed been not up to snuff relative to other things, and it clearly shows. Fortunately we are pushing hard on that right now in master and itβs improving (and finding bugs)
makes me wonder when AI will be commonly used in testing programs for bugs/glitches and providing a potential fix for them
not 100 but no
MOAR
rookie numbers...
THEY SAID MOAR!
tf
Wow, adam driver is not allowed
but how many cubes per second are you running at
unity physics or havok?
ugh
The editor support requires using Unity.Graphics I assume?
that's a plane right?
yes
e.g. clicking a thing
the only thing i can think of is i enabled live conversion
let me show my settings
you have to enable internal mode
for the option to appear
if you enabled it in earlier entities it might already be on (im not sure, mine wasn't)
sorry "Live baking"
Not me I haven't attempted a build.. Enzi and Schnozzle
how do I enable that? I dont see Live Baking
What the hell kind of black magic is this??
there's nothing in about
wait what
????
yeah literally just type internal
tf why
nah turning it off changes nothing
why does this exist
oh it's just a mistake by unity
this option shouldn't have been marked internal
but conveniently there's an easy way for us to just access it
What does typing internal do in that window?
oh typing internal into about allows access to internal settings?
WAS I JUST HACKED?
and a few other feautres
(annoying circles)
they seem to be indicators for selection
also Live Baking was already on
i believe a dev said it shows when the OnGUI ticks
I love that show
Is this documented anywhere?
no

so how did you find it?
i just searched through source code and noticed an editorpref that i could set to enable this internal mode
mentioned it and a unity dev said you could just type internal instead
oh lmao
That's not a circle @misty wedge
Your wheel didn't fit the scheme
figured as much π
Hehe might have been me π
#archived-dots message
physics samples also run fine. the error must be way deeper. i'd be interested in a project that also uses SystemBase
Did you manage to create a small reproduction repo?
there should be a debugging setting called "enable internal mode" or something
I think the konami code method is much cooler
i wouldn't know where to start π
can have both π
I was just wondering π
That takes all of the pizazz out of it though
I think tertle had to call a premium rate number to get that code
Agreed, feels like you're typing in the code to a secret base 
ok... type internal to enable the toggle "internal"
exactly, hackerman
first thing to figure out. why does this happen: ArgumentException: Unity.Entities.PostLoadCommandBuffer is a class based IComponentData. Class based IComponentData must implement a default constructor. at Unity.Entities.TypeManager.ThrowOnDisallowedManagedComponentData (System.Type type, System.Type baseType, System.String baseTypeDesc) [0x0001e] in <7d1df35eee734686aa0e124eb644d3f7>:0 at Unity.Entities.TypeManager.CheckIsAllowedAsManagedComponentData (System.Type type, System.String baseTypeDesc, System.Collections.Generic.HashSet`1[T] nestedContainerCache) [0x0001a] in <7d1df35eee734686aa0e124eb644d3f7>:0 at Unity.Entities.TypeManager.BuildComponentType (System.Type type, Unity.Entities.TypeIndex[] writeGroups, System.Collections.Generic.Dictionary`2[TKey,TValue] hashCache, System.Collections.Generic.HashSet`1[T] nestedContainerCache) [0x00112] in <7d1df35eee734686aa0e124eb644d3f7>:0 at Unity.Entities.TypeManager.BuildComponentType (System.Type type, System.Collections.Generic.Dictionary`2[TKey,TValue] hashCache, System.Collections.Generic.HashSet`1[T] nestedContainerCache) [0x00000] in <7d1df35eee734686aa0e124eb644d3f7>:0 at Unity.Entities.TypeManager.AddAllComponentTypes (System.Type[] componentTypes, System.Int32 startTypeIndex, System.Collections.Generic.Dictionary`2[TKey,TValue] writeGroupByType, System.Collections.Generic.Dictionary`2[TKey,TValue] descendantCountByType) [0x00072] in <7d1df35eee734686aa0e124eb644d3f7>:0
Can you post the ones you get? We can check if we get the exact same ones
have you deleted the compiled files like I said?
I reimported like 50 times today and got it every time
yeah, physics samples log is also totally clean. have tried in b8 and b9 now.
reimport isn't the same thing tho
i can't delete anything on the first build π
It deleted all temporary folders, deleted library, and pulled completely new from git
damn that's wack
I figured it was just for packages
can you screenshot what packaged you have added?
Did you switch it off and back on again?
yes and the mainframe is up to date as well
ok posting fragments is stupid. here's the player.log
Reinitialize the quantum stability transgressor?
lots of "Missing default ctor" after the error
that and I checked every vacuum tube twice
Not sure what else it could be tbh
can you compile an empty scene?
@viral sonnet what strip level is selected
strip level is low
yeah i have none of that in my log
set it to none
I don't think you can on il2cpp
hes building mono isn't he
yes in il2cpp low is min, but in mono you can select none
Ah, I thought he was building il2cpp
i built both but i'm trying mono now. if mono works, il2cpp will work too
not likely the case
(i wouldn't go that far, known il2cpp specific crashes at 3 now)
(@rotund token can tell you all about the conflict between mono and il2cpp)
empty scene also doesn't work π
This crash is a known issue. It has already been fixed, but sadly it did not make it before the cutoff. Should be fixed in 2022.2.0b10.
graphics crash from forum
what one?
specifically about serialization. blobAssetRefs get corrupted
oh nothing much more than i posted above
My systems don't match yours, but that's probably because you use Unity.Graphics, and I don't, and I use Unity.NetCode, and you don't
i reported a crash to unity with a small repo day 1 of entities 1.0
Between two runs the order is the same for me though
2 days later they got back to me after tracking it down and posted that explanation
i can repo this if i turn on stripping to low
so ah
turn off stripping to fix?
i repo everything
ArgumentException: Unity.Entities.PostLoadCommandBuffer is a class based IComponentData. Class based IComponentData must implement a default constructor.
i was about to write. empty scene loaded now with stripping disabled
Missing default ctor on Unity.Physics.Authoring.BeginColliderConversionSystem (or if you don't want this to be auto-creatable, tag it with [DisableAutoCreation])
etc
let's see about the rest
the crash in entityquery
You get the same crash with stripping?
yes
eugh
lame
boo
I'm guessing any call to GetSingletonChunk crashes it then and BroadphaseSystem is just the first one
success! π game works again
now onto il2cpp
hm, that was already on minimal. not good π
but stripping is required for il2cpp? 
Yeah
seems that way
why
i was getting the same errors/results
oh i get you
nah the stripping level was probably on low before
its shared between mono/il2cpp
ok, testing right now
it just removes the none option when you switch to il2cpp
When did they add a Minimal stripping level? I swear that wasn't always there
what's the default stripping level? i can't remember ever changing that
you are correct
It only strips GetSingletonChunk, nothing else 
I think the default was Low but I'm not sure
It could've also been Medium or High
Minimal doesn't remove any user code, that's cool
According to the docs the default stripping level is now Minimal, I think it was Low before
yeah that is what mine was on by default
well, at least it crashes somewhere else now π how can i figure out what this is IL2CPP_EXTERN_C IL2CPP_METHOD_ATTR void SystemBase_Update_m795994EE60C054DFA78C313A60ED025B2668C9B4 (SystemBase_tF1D148F181415A7A0A38555F7FAD20D5D33C0F0D* __this, const RuntimeMethod* method) does the pdb help?
What's the editor version?
2022.2.0b9
he old
haha right π
its a typo
I know, I was joking π
imagine if he was using 2020 lmao
I'm actually on 5.6 atm...
simpler times
I remember using the first "multiplayer" system, that was nuts
Do you have a callstack or player.log?
i just got mono to run. now a crash in il2cpp. probably related to something i'm doing wrong π
I thought il2cpp failed because of stripping?
lowering the stripping level fixed the physics crash
down to Minimal?
yes
Interesting
It's possible you're being affected by an unrelated il2cpp bug which is what we're checking.
thanks, very appreciated!
Damn there's a cats discord server, time to join

Drats looks like you too are hitting the IL2CPP crash due to the bug found recently. IL2CPP miscalculates the size of components when they contain a BlobAssetReference in them by miscalculating the alignment of BlobAssetReference to be 1 instead of 8 bytes
Does this affect everyone using a stripping level of Low or higher and using Unity.Physics?
that's the same bug @rotund token was talking about earlier
alright, thanks. i've read about it from tertle but didn't get around in checking if i'm affected
thanks for the heads up
You can work around the issue by forcing your BlobAssetReference component type size to be a multiple of 8.
The IL2CPP bug has been fixed internally so the fix is en route to the world as fast as it can.
all good, i'll wait for the fix. should be in b10, right?
Why does it crash in Unity.Physics.BroadphaseSystem?
Oh, you are referring to the runtime issue from @viral sonnet , my bad
Let me check, but I think it may have missed the release window for b10
can you also take a note about this (#archived-dots message) - this errors appears in mono builds with a stripping level higher than "Disabled"
So yeah I was just testing this from what we discussed and was still having issues
I also tried setting struct size manually with struct layout to 16 and no ball
Was about to test splitting component into 2 (for this specific case it should be anyway, I just tacked it on due to laziness)
Any idea how this can happen?
NullReferenceException: Object reference not set to an instance of an object
at Unity.Entities.EntityQueryImpl.GetSingleton[T] () [0x00053] in C:\Users\Linus\Repositories\DireSpark\Library\PackageCache\com.unity.entities@1.0.0-exp.8\Unity.Entities\Iterators\EntityQuery.cs:1524
at Unity.Entities.EntityQuery.GetSingleton[T] () [0x00000] in C:\Users\Linus\Repositories\DireSpark\Library\PackageCache\com.unity.entities@1.0.0-exp.8\Unity.Entities\Iterators\EntityQuery.cs:2752
hm, seems like the singleton you want to query doesn't exist? is that also coming from physics?
I have no urgency on a viable il2cpp build so as long as a fix is on the way I might just leave it for now
It throws a nullreferenceexception if the singleton doesn't exist?
I'm not involved with the release process but it does look like b10 should contain the fix -- but no firm promise.
I've noted the stripping issues. We'll take a look at it as it seems like a bug on our end with some dynamic lookups and some unnecessary restrictions for managed component instantiation
99% sure it does. have to check with HasSingleton
It's weird because it works in the editor, this is an error I only get in a build
debug.log to make sure it exists.
Tomorrow, it's time to sleep now. I thank everyone for participating in this journey, and bid thee farewell
have a good night
thanks to the unity devs that spare their time for us on the weekend! π
how can i get the system entity? am i missing an implicit conversion of systemHandle? the entity in there is internal.
oh, most methods have a SystemHandle parameter now. ok then π
There will be a doc about it but essentially most of the important methods have SystemHandle alternatives :3
related design question, i noticed entity command buffer systems don't use the system entity and instead create a new entity for the singleton you access
what's the reasoning behind this and when should i use the existing entity vs creating a new one
Sounds like a question for Kevin if he's still here, since tmk it's more historical than for efficiencies, as when ecbsystems became a singleton System entities were not there yet :3
ok was kind of what i was thinking just wanted to be sure
it currently does something like
ref var s = ref system.GetSingletonRW<T>().ValueRW;```
and I could just change it to something like this for my own uses
```world.EntityManager.AddComponent(system.SystemHandle, ComponentType.ReadWrite<T>());
ref var s = ref system.GetSingletonRW<T>().ValueRW;```
yup, and would likely be more efficient as well, since it causes one less structural change ish.
my 2 cents on this is that they implemented a struct with helper methods which makes for a very nice usage with var ecbSingleton = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>(); var ecb = ecbSingleton.CreateCommandBuffer(state.WorldUnmanaged); not only that, it's also strongly typed. otherwise we would need the SystemHandle first
it doesn't change the implementation of how you access it - it's still a singleton component
The type would still be there, it's simply an internal implementation detail of where the Singleton is stored :3
good good, after i finish these last updates my objective is to switch a few things to work similar to this for a consistent experience
playing around with right now and wanted to move out a static id from the archetype because it's just used for saving. wrote this: ```public partial struct AvatarIDLookupSystem : ISystem
{
public struct Singleton : IComponentData
{
public NativeHashMap<Entity, int> avatarIdLookup;
}
public void OnCreate(ref SystemState state)
{
if (!state.EntityManager.AddComponent(state.SystemHandle, typeof(Singleton)))
{
Debug.Log($"Error creating AvatarIDLookupSystem singleton!");
return;
}
ref var comp = ref SystemAPI.GetSingletonRW<Singleton>().ValueRW;
comp = new Singleton()
{
avatarIdLookup = new NativeHashMap<Entity, int>(0, Allocator.Persistent)
};
}
}``` seems pretty nice to just call AvatarIDLookupSystem.Singleton from anywhere and get the lookup hashmap
(i assume you have a dispose routine in this system as well)
sure thing π
i'm starting to like singletons a lot. have already rewritten a bunch of very weird dependencies around systems and init timings of runtime data. now that NativeContainers can fit in a struct IComp it's even better
pre-1.0 i was pretty anti allocated memory on containers
but this api makes it a very viable option
huh? can you rephrase?
yeah got you. it was a bit weird to handle
im probably still against it on non-singleton entities but we'll see
yeah i also haven't opened up to the idea to use nativeContainers inside IComps/on more than 1 entity. i rather handle this another way
nasty random access. inlined DBs are better for this
What's the purpose of singletons? (I know what they are, im specifically referring to entities use-case)
think entity command buffers systems now
but i have other usages i'm going to be setup
my navmeshworld will exist on a singleton
so any system can safely query the mesh
i have a draw library etc that will utilize it
my navmeshbworld already exists on an IComponentData - I just want to make some tweaks to be more consistent with the new API
there are a lot of use cases. previously they were mostly just used to trigger updates on systems. set something up, then the system knows it can run safely. but now it's also very viable to move any data out of a system and we don't need to get system references. all a bit more streamlined
hope the excessive usage of queries is not a problem π
so singletons are just ECB, but for systems?
hoping ISystem handles it well enough
Oh and pro tip: GetSingleton does no syncing since the core usecase is containers/cross system com, as a result many jobs can read from a singleton at the same time :3
(GetSingletonRW does though right?)
Yup, obvoiusly can't be sure when you set values, but hopefully you don't set values often on singletons, since they do sync jobs from systems using the type π
i'd probably just GetSingletonEntity and write it in the job to avoid that but good to check
a singleton is an IComp that exists once. that's about it. ECB just uses the design principle now which enabled us to use ECBS in ISystem
I try to avoid the singleton paradigm, mostly because it's a terrible pattern to implement
so im trying to figure out the use case in ECS
i think these singletons are quite a bit less problematic than oop singleton
at least until we all start abusing them π
we get an error when 2 singleton comps exist so, all good in terms of safety
they're singleton per world which is already a huge advantage so you can have more than 1 in an app
it doesn't just break down when you are like testing thin clients and stuff
oh right, that's also nice
Haha, well, the ecs singleton in entities can essentially be thought of as a Single query. It ensure there's just one result. and the one thing singletons in ecs land does extra is that .GetSingleton does no syncing. (But they bare next to no resemblance to original patterned singletons present in OOP books)
i guess that's what you'd be doing anyway when writing to a singleton comp in a job.
a classic case of singletons with gameobjects falling apart is you create a single player game and you decide to make it multiplayer - now your client/server both depend on the same singleton. then you want to stress test multiple clients...
off to bed now. have a good night or day o/
Shouldn't they be named something else then? When I first was looking into singletons in ECS they didn't match the design pattern as you would expect (per world, compared to typically per program instance)
This is why I was confused, because the singleton in other applications/mono is different then ECS.
I mean, I would rename a lot of the API's naming convention if I had my way hehe π
would you rather call them SinglePerWorldton?
SystemAPI.GetSingleUniqueComponentPerWorld<T>()
That's been an internal discussion for a WHILE, singletons are defintly one of the api's we likely want to give an overhaul of (and now that we're nearing 1.0) that will instead come with the slow out phasing path so everyone can depent on our stuff without being scared of deprecations :3 (for instance it was discussed to just rename them singles but like EntitiesForEach we chose to keep them to not break users further)
break us, break us until there is nothing left
punish us like the filth we are
I think small API changes are fine. And when I mean "small" I'm talking readability, rational name changes to methods, etc.
I would have named methods like GetComponentLoopup<T>() as simply GetComponent<T>(). Yes it conflicts with GameObject.GetComponent but that's kind of the point, to be similar.
Also, GetComponent would return a Component<T> type. getting and setting could be literally just someComponent.Get(someEntity), someComponent.Set(value), someComponent.TryGet(someEntity), etc.
GetComponentLoopup<T>() as simply GetComponent<T>()
it conflicts with GetComponent
that already exists
hmmmmmmmmm
are all unmanaged shared components negative index and all managed shared components positive index? or is this just a small sample size from me
yeah but its only possible within a MonoBehaviour, which let's face it, your systems and jobs should not be in
im saying that SystemBase/EntityManager already have a GetComponent method
what i'm trying to do here is basically update my TryGetSharedComponentInFilter method
where T : struct, ISharedComponentData
{
var impl = query._GetImpl();
AssertRange(index, impl->_Filter.Shared.Count);
var scdIndex = impl->_Filter.Shared.SharedComponentIndex[index];
var scd = entityManager.GetSharedComponentDataNonDefaultBoxed(scdIndex);
if (scd is T component)
{
sharedComponent = component;
return true;
}
sharedComponent = default;
return false;
}
which is getting a shared component from an entity query (for validation)
but my var scdIndex = impl->_Filter.Shared.SharedComponentIndex[index]; now returns negatives because well components can be unmanaged
so I need to determine if the shared component index is managed or unmanaged
this is purely used to verify someone hasn't screwed up the entityquery
Assert.IsTrue(query.TryGetSharedComponentInFilter<SceneSection>(this.System.EntityManager, 0, out _), "A SceneSection SharedComponentFilter has been overridden incorrectly.");
basically i just need to verify element 0 in a entityquery is SceneSection
i think what i need to use now is EntityComponentStore.GetSharedComponentData_Unmanaged
hmm no that requires TypeIndex
basically, need to turn sharedComponentIndex into a typeindex
well that's what i was doing
but i'm getting negative scd indices for unmanaged types
{
Assert.AreNotEqual(0, index);
return m_SharedComponentData[index];
}```
hence it's failing
anyway i've simplified this a lot
Huh
I guess they are stored in different arrays?
And negative should just be brought to abs
To the other array?
No idea if that's true, but that's how Id do it
i dont know if they're always negative
hence i was asking
my sample size is 1
where T : struct, ISharedComponentData
{
var filters = query.GetSharedFilters();
var requiredType = TypeManager.GetTypeIndex<T>();
for (var i = 0; i < filters.Count; i++)
{
var indexInEntityQuery = filters.IndexInEntityQuery[i];
var component = query.__impl->_QueryData->RequiredComponents[indexInEntityQuery].TypeIndex;
if (component == requiredType)
{
scdIndex = filters.SharedComponentIndex[i];
return true;
}
}
scdIndex = -1;
return false;
}
anyway i just simplified it to grab the typeindex from the query
i feel like im doing something very stupidly, but im not quite certain what, so basically im trying to create a native array of ParticleSystem.Particle, then i want to set the positions of indices 0 and 1 to be something, but of course they aint variables, but if i try create local copies of them i dont really know how to set the original native array to have those changes, guessing im missing something lol
can't particle system just return this for you?
there's a ParticleSystem.GetParticles(NativeArray<ParticleSystem.Particle>) method
you can get the particles
manipulate it
then write it back with SetParticles
public partial class SavableConversionSystem : GameObjectConversionSystem
classic
debugging why my code isn't working
left my updating of conversion systems half done yesterday when i logged off....
unfortunately i cant really do that, im trying to avoid some consequences of using dots to manipulate the particle system, and getting the particles is not really required, infact it makes it slower, plus it still doesnt solve my problem of needing to set the first 2 indices to have a specific position
i actually set all the positions later on, using the specific intended dots way of touching the particles system, unfortunately this breaks the bounds, and causes rendering to mess up, hence why i need to set the position now, in a weird way so i can trick the rendering system into working correctly
it sounds stupid and is stupid
im not really sure what this has to do with dots though
native arrays are dots right?
i mean sure
but if you're not using a job
why use a native array
return it as a normal array
normal arrays cant be manually disposed of as far as im aware
the garbage collecter struggles with incremental destruction of 70 thousand length arrays
does it?
native arrays are an experiment im trying now, to see if manual disposal might help avoid these huge spikes
then pool and reuse them
im not very familiar with pools, how exactly would this work with an array?
just means to re-use the array each time you need to get it
but ok use native arrays
unfortunately the array changes size every time the particle system gets updated
i'm still struggling to understand your problem
so am i lol
(there are ways around this but that's a bit advanced)
im doing fluid physics, the amount of particles is controlled by nvidia flex
the way i set particles is stupid slow
and there is in theory a faster way
but i cant work out how for the life of me
the cursed garbage collecter is determined to collect the arrays
it would be nice to create one array the size of the max number of particles, and then just grab chunks of that array without copying it and use that, but this appears impossible
Why not?
Just make array bigger if for some reason it doesn't fit your bounds
what do you mean, what knowledge do you know, as i cant work out how to do that?
Simply create new array on demand if it gets bigger
ok i can work that part out, but how do i grab a chunk of it?
he was complaining about GC spikes every 5 seconds because of doing this
so say i have an array of 1000 length, and i need to set 500 particles, then logically assuming black magic of chunk grabbing, it would be really nice to just say use half the array, or something like that, so gc only needs to clear the array on ending play mode
this appears impossible though
anyway, this is nolonger becoming a dots question too much though, so imma try move this question over to the particle system channel, thanks for all the help yall
there's an overload for this
wait really?
int GetParticles(ParticleSystem.Particle[] particles, int size, int offset);
unfortunately i dont need to get particles
there's an overload for this
void SetParticles(ParticleSystem.Particle[] particles, int size, int offset);
ooh
void SetParticles(particles, int size) => this.SetParticles(particles, size, 0);
not quite certain what that means, but i think i have an idea of how to use it, ill quickly try it out!
I'm trying to upgrade my project to Entities 1.0 and for some reason I can't get Rider to import LocalToWorldTransform . Other structs from the same package (for example UniformScaleTransform ) import fine. Did anyone encounter an issue like this?
I already double checked that the package import went fine and even did a reimport all so that shouldn't be the problem.
Fyi: I upgraded by changing the version numbers for entities, phyics and graphics in the manifest.json.
UniformScaleTransform won't exist if you have physics or netcode package installed
they don't support new transform system yet so forces V1 for now
Okay then I guess I will have to enable V1 again for now
shoudl already be enabled
Don't I have to add the scripting symbol ENABLE_TRANSFORM_V1
yeah it doesn't matter
i am super confused what's going on here, i have a bunch of subscenes marked NOT auto load scene
but starting game, half of them get loaded anyway...
Bruuuuuh
even with ICustomBootstrap
I can't start my game
Hierarchy windows is just broken
why does that stop you starting your game?
there's smth wrong with my game code and I can't debug it without hierarchy
because it relies on entities
π
ArgumentException: A component with type:Unity.Scenes.SubScene has not been added to the entity. Entities Journaling may be able to help determine more information. Please enable Entities Journaling for a more helpful error message.
oh
i can probably tell you the problem
you are creating entities during conversion from a baking system
no
my baking systems only add components
hmm π€·ββοΈ
i have a similar issue atm and it was from creating entities in baking systems
oh wait that was subscene section
on an entity
hmm this is subscene?
sounds like a subscene isn't converting properly
it does convert
it shows well outside of PlayMode
but as soon as I press it - ded
no play mode
play mode
don't mind convert to entity system
It doesn't work without it either
stars seems the problem?
I searched through the history to see if this has been discussed, but I didn't see it addressed here, so I hope I am not retreading old ground on this, but I have a question about 1.0. What does 1.0 mean to Unity? I know what it means to me, but I am not sure if it means the same to Unity.
To me it should mean that the core architecture of the system is defined and won't make major shifts away from what is available in 1.0 until there is a 2.0. Is that what it means from Unity's perspective
1.0 = production ready
Well okay, π
but I mean in more real low level technical terms
Have the said "here are the locked features/paradigms" or does production ready mean something less specific?
I ask because I have kind of been treating 1.0 as the green flag to start the race if you know what I mean, and I just want to know that I won't get rug pulled π
Anyone know how to remove components in a Baker?
add special tag with temporary attribute
to entity
and remove all components you want on entities that have this tag
Good solution thanks
Is there's any define to activate old conversation instead of baker at dots 1.0 preview? Currently I would like to see my project upgrade working properly first before fully migrate to baker
Thanks. So technically experimental still.
GO coexisting with entities in the hierarchy view, this is cool
if only it worked π΄
(not dots related but i'm going crazy)
when unity imports assets, e.g. an image, they create a .meta file for the asset, this .meta file can contain a lot of extra properties.
i am writing a custom importer and would like to add some to the .meta file too. does anyone know how to do that? i've found absolutely nothing
Looks like an oversight to me, we can take a look.
re UnmanagedSharedComponents, yes UnmanagedSharedComponent indices are currently always negative -- this isn't a formalized detail to rely on. But it's not something we are likely to change before 1.0
I believe the mechanism is the userData field for your importer. https://docs.unity3d.com/ScriptReference/AssetImporters.ScriptedImporter.html
Not sure if .meta is arbitrarily extendable for ScriptedImporters
I feel that this or the next preview should really error on any old conversion stuff, make it clear that conversion is dead in favour of baking
well, at first i thought this would be the thing, but it being string threw me off immensely.
but no. turs out, what you actually want to store data in .meta is: save the data as serializable data in fields inside your custom importer class. damn. that is important information that is just missing from the docs. (i guess, you could make the assumption that this happens if you've previously inspected some game-object's .meta, but even then i'd say it's kinda a stretch to assume this maps approximately to custom importers and editor only things too.)
many thanks for your help though. even if it wasn't actually the solution i was looking for
Thanks for the feedback ,I can pass it along to the importer team to see if they can clarify the docs (or point me to where it is documented) π
π
Has anyone ran into an issue where the TransformSystemGroup (v2) isn't being added? I end up getting these logs in a mono build:
A system Unity.Transforms.TransformToMatrixSystem could not be added to group Unity.Transforms.TransformSystemGroup, because the group was not created. Fix these errors before continuing. The system will not be added to any group and thus not update.
Hey everyone! I have a question about the blob assets. Let's imagine that I have an entity with a component containing BlobAssetReference. Do I have to dispose it manually or can I just destroy the entity itself and it will manage the disposal of the BlobAssetReference automatically?
Blob asset memory is handle for you as long as you set it up during conversion in a subscene
@viral sonnet I remember you were having trouble with trying to disable an IEnableableComponent in baker/baking system. Were you able to get it working in a baking system? Also, did any unity dev say whether or not the lack of a Baker<>.SetComponentEnabled() was an oversight or not?
So, I have to use SubScene in order for it to work, right?
I don't remember getting an answer on this. No, it doesn't work in a baking system. You have to set it at runtime after instantiating the entity.
Thanks for the reply. So the reason it doesn't work is because we can't disable components on prefabs?
UnityEngine.StackTraceUtility:ExtractStackTrace () (at C:/buildslave/unity/build/Runtime/Export/Scripting/StackTrace.cs:37)
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
UnityEngine.Logger:Log (UnityEngine.LogType,object)
UnityEngine.Debug:LogWarning (object)```
ooh just saw this my logs when constructing a custom world π
try setting the strip level to disabled
yeah, the prefab always defaults to true for the enabled comp
I have quite a few components that I use to trigger things. These are components with a single bool field that is false by default. When set true, it triggers some behavior. I was hoping to use IEnableableComponent for this, but having to disable them after instantiating a prefab will be very annoying. And I'd rather not have to invert all of my components to make a disabled component trigger the behavior
SetComponentEnabled: <remarks> Behavior at Playback: Will throw an error if this entity is destroyed before playback, if this entity is still deferred, if the entity has the <see cref="Prefab"/> tag, or if the entity doesn't have the component type.</remarks> so no prefab support
i hope it's an oversight. something like that should not be a constraint. and yeah, inverting logic is annoying
Do you get the same error when you disable directly with an EntityManager instead of an ECB?
my preliminary notes on entities 1.0 ```baker:
- no removeComponent
- can't set IEnableComponent to default false
- no direct way of removing LinkedEntityGroup (needs internal access and YABS - yet another baking system)
- generic bakers throws errors after recompile (still works 100%)
- no easy generic bakers, needs base class
- holding down CTRL+D on a GO with baker component creates chunks for every new gameobject (needs open/close or reimport of the subscene)
codegen:
- namespaces are missing in 2nd partial struct
- SystemAPI can't query MBs
dots hierarchy:
- GameObjectChangeTracker stalls when instantiating gameobjects (in my case 3 every 2 frames)
builds:
- misaligned bytes with BlobAssetReference (fix in Unity 2022.2.0b10 or b11)```
only tried with ecb. there is no error π
Wait so it doesn't throw an error despite saying it will in the comments? It just silently fails?
The comments for EntityManager.SetComponentEnabled() don't say anything about this limitation:
/// <summary>
/// Enable or disable a <see cref="ComponentType"/> on the specified <see cref="Entity"/>.
/// </summary>
/// <remarks>
/// This operation does not cause a structural change, and does not affect the current value of the component.
///
/// An entity with a disabled component will not match an <see cref="EntityQuery"/> that requires that component,
/// and will match a query that excludes that component.
///
/// To enable/disable components from a job, use <see cref="ComponentLookup{T}.SetComponentEnabled(Entity,bool)"/>.
/// To enable/disable an entire <see cref="Entity"/>, use <see cref="SetEnabled(Entity,bool)"/> (which, unlike this function,
/// does involve a structural change).
/// </remarks>
/// <exception cref="ArgumentException">The <see cref="Entity"/> does not exist.</exception>
/// <typeparam name="T">The component type to enable or disable. This type must implement the
/// <see cref="IEnableableComponent"/> interface.</typeparam>
/// <param name="entity">The entity whose component should be enabled or disabled.</param>
/// <param name="value">True if the specified component should be enabled, or false if it should be disabled.</param>
/// <seealso cref="IsComponentEnabled{T}(Entity)"/>
/// <seealso cref="ComponentLookup{T}.SetComponentEnabled(Entity,bool)"/>
I'll have to test this later today
thanks - that was my issue π
π i hate this, why they so much love to make stuff internal? by what reason? Companion link, many default systems, and now even LEG is internal, omg
that's a good thing
internal stuff keeps you away from complex stuff
but if you want it anyway
you get it very simply
yeah, just use assembly with unsafe mode
and yes, i agree with you about keeping clients away from details they can break and get unexpected hard-to-understand result. But IMHO that is applicable when we deal with black box solutions, which we have near to zero need to get under the hood. But with unity's ECS we often need to use such components with custom constructed entities.
For example i want to make custom procedurally constructed set of linked entities so i can instantiate/destroy them cascadly. In 0.17 you just simply use LEG (yes you should not forget about adding entity itself to LEG as element, which is breakable part) and voila. Now for each separate asmdef which wants to make this trick i need to enable unsafe code to access internal stuff
Regarding IEnableableComponent and Baker, I was hoping for there to be some way so that disabling a MonoBehaviour on a game object would disable the IEnableableComponent on the baked entity. Looks like the baker already has support for taking a dependency on the enabled state of the MonoBehaviour (Baker<>.IsActiveAndEnabled()) so we just need a Baker.SetComponentEnabled() to make this work.
just use asmref trick and get all internal stuff you want
LEG is not internal but LinkedEntityGroupBakingData is which is used in baking and for subsequent LEG setup
still, you need internal access to prevent LEG on prefabs
oh, ok, sorry for my misunderstanding π
np, don't expect everyone to understand my notes π
that's honestly a great idea for IEnableComponents - I don't see an obvious downside
that way unity can set this up and we don't need additional code
Yeah automatic would be cool, but there are some use cases where a single mono turns into multiple components on an entity. In those cases, automatic disabling of all the added IEnableableComponents might not be the best option.
There wouldn't be too much code required to do this manually, and I think the flexibility is worth it:
public override void Bake(MyAuthoring authoring)
{
AddComponent<MyEnableableComponent>();
SetComponentEnabled<MyEnableableComponent>(IsActiveAndEnabled());
}
Nobody has any idea what this is right? It's driving me absolutely nuts
Asset has disappeared while building player to 'globalgamemanagers.assets' - path '', instancedID '-3602' UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
At least I'm not the only one... https://forum.unity.com/threads/2022-02-0b9-asset-has-disappeared-while-building-player-to-globalgamemanagers-assets.1343288/
true, too much edge cases. just setting it is clean and simple
@raw mica is it alright if I post the message to the bug report I sent you?
(for others to understand what is the cause, and the best solution for the time being)
Sure thing!
I submitted a bug report and this is what @raw mica replied with (edited for readability/emphasis):
Thanks! Looks like the
TypeManageinUnity.Entities.dllis not halting the build when invalid components are found. This is leading to their use even though the are not setup correctly and due to the nature of how some methods can be Burst compiled, this can lead to crashes. e.g. In this case there are some components that are not default constructible that need to be fixedArgumentException: Development.ECS.Components.FollowerTarget is a class based IComponentData. Class based IComponentData must implement a default constructor.Weβll fix this in our next release ofcom.unity.entities. In the meanwhile looking in your Editor.Log for ArgumentExceptions before the crash should highlight the invalid components to fix your build locally. Hope this helps! Kev
I have a mono build that crashes immediately even though unity reported a successful build, should I submit something like this?
I don't think it has to do anything with the project itself, since sometimes it will build correctly, but sometimes this happens and it crashes immediately
I think the incremental build pipeline might break or something
Anyone know any doc to read about ISystem? i'm trying to touch this thing, but can't figure out how to work with this like with normal SystemBase
What are you having trouble with?
getting instance from world
Like a system insance?
yes
You can't, those are managed
You can only get a SystemHandle or SystemState
I guess in theory they could could return a ref to the system struct, but I don't think you can currently do that (and it's probably not recommended as a design)
do you need a property from the managed system?
What an incredibly weird callstack for a crash
This is the callstack for when it crashes before even reaching the splash screen, incredibly strange
Yep
Yes please, crashing while drawing the splash screen is a bit surprising, especially if it's not always consistent
The completed build always crashes before the splash screen, but when building the same project, sometimes it will fail completely, giving me this:
Asset has disappeared while building player to 'globalgamemanagers.assets' - path '', instancedID '-3602' UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&). This happens about 90% of the time, you can imagine how frustrating that is. Sometimes if I'm lucky, after deleting the library and global cache, and the reimport loads, if I immediately build, there's a 50/50 chance I either get a build that crashes before the splash screen, or a build that works normally.
Is there anyway to debug leaks within baking?
[Worker5] Internal: There are remaining Allocations on the JobTempAlloc. This is a leak, and will impact performance
Getting a random leak but higher leak detection doesn't seem to provide any info
The thing is, I also have 0 usages of TempJob which is making this even harder to figure out
You can enable tempjob leak tracking in the editor diagnostics menu from Preferences
(you'll need to restart the editor after)
Will give that a shot thanks
haha well that's fun
0x00007ff657676371 (Unity) BatchRendererGroup::~BatchRendererGroup
0x00007ff6576789df (Unity) BatchRendererGroup::Destroy
0x00007ff656d03d08 (Unity) BatchRendererGroup_CUSTOM_Destroy
0x0000028631545d61 (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Rendering.BatchRendererGroup:Destroy (intptr)
0x0000028631545bdb (Mono JIT Code) UnityEngine.Rendering.BatchRendererGroup:Dispose ()
0x0000028631543ebb (Mono JIT Code) [EntitiesGraphicsSystem.cs:1186] Unity.Rendering.EntitiesGraphicsSystem:Dispose ()
0x0000028631543aab (Mono JIT Code) [EntitiesGraphicsSystem.cs:963] Unity.Rendering.EntitiesGraphicsSystem:OnDestroy ()
0x0000028631524d60 (Mono JIT Code) [ComponentSystemBase.cs:281] Unity.Entities.ComponentSystemBase:OnDestroy_Internal ()
0x0000028631523803 (Mono JIT Code) [World.cs:1001] Unity.Entities.World:DestroyAllSystemsAndLogException ()
0x0000028631520c43 (Mono JIT Code) [World.cs:303] Unity.Entities.World:Dispose ()
0x000002863151fb33 (Mono JIT Code) [World.cs:329] Unity.Entities.World:DisposeAllWorlds ()
0x000002863151d7c3 (Mono JIT Code) [DefaultWorldInitialization.cs:101] Unity.Entities.DefaultWorldInitialization:DomainUnloadOrPlayModeChangeShutdown () ```
a) it stopped leaking on the unity restart after turning on the debugging
b) entering play mode just crashed from cleanup of editor world
yeah 100% repo on this crash of editor
with these 3 enabled
TempMemoryLeakValidation: True
JobTempMemoryLeakValidation: True
ForceDebugAllocator: True
just going to turn them off to make sure it was this cause and not just a coincidence
Does the crash keep happening if burst is off? There is a vaguely listed known issue on the release post about burst compilation when entering playmode causing crashes
turning all 3 off, restarting, no longer crashes
let me turn them back on, and turn burst off
I know we have some fixes for the Batch renderer coming in the next release of Unity as well
i think they said it missed b10 on the forums
Ah drats
at least, 1 fix
i dont know how many are coming
oh wait no i read it wrong, missed b9 coming b10
but stack is different
burst was already off it seems ^_^'
Thanks for checking. When I'm back at my desk I can try those settings to see if I can repro
What do I need to do to make a client and server build on netcode? For some reason I can't get it to not exclude either
This worked before 1.0.0, even manually adding the defines doesn't work, I'm guessing something is modifying them
It either strips the initialization code for the client or server
I'm also missing the Server Build build option for some reason
This also just seems false:
When you build a standalone game, NetCode uses the Server Build property in the Build Settings window to decide what to build. If the property is enabled, NetCode sets the UNITY_SERVER define and you get a server-only build. If the property is disabled you get a combined client and server build. You can use a combined client and server build to decide if a game should be client, server or both at runtime.
I don't even have that property and it is stripping server code
i threw up a thread here: https://forum.unity.com/threads/crash-with-memory-debugging-enabled.1343747/
graphics guys are pretty good at reading stuff
Testing further and disabling ForceDebugAllocator stops it crashing
hmm this doesn't seem to have helped
I have these
TempMemoryLeakValidation: True
JobTempMemoryLeakValidation: True
and all I get still is
[Worker0] Internal: There are remaining Allocations on the JobTempAlloc. This is a leak, and will impact performance
Is there a setting I'm missing
No that should be it. I'll reach out to the memory folks. I know they regressed tracking recently but I wouldn't have thought that went into 2022.2 but it's possible.
I only have 2 bakers, 1 bakingsystem in this library
it shouldn't be hard for me to track down what i'm doing wrong but i'm only using 4 Temp allocations as far as i can tell
oh well, time for the classic disable 1 thing at a time
Gah looks like it was indeed broken in 2022.2. But looks like it should be fixed in b11
I really hope b10 or b11 fix my build issues, it's driving me mad
@misty wedge does your Editor.log mention any other errors regarding globalgamemanagers.assets?
I'll post the log, give me a second. It's completely useless for tracking down the issue though
I seem to have re-opened the editor too many times since the last build, I'll post it when I reproduce it again (which shouldn't take long)
The build itself doesn't seem to really get "further" than this step
It will stay on Building Resources Folder for a long time and then throw the error π€·
Which platform is the player build for?
(error DC0065: Only value type 'ISystem' types are allowed.
i'm so happy this was added, saving me from myself)
Windows, it happens on both il2cpp and mono
https://hastebin.com/vuretiwapa.makefile
There's a forum thread with the same issue on the same unity version here: https://forum.unity.com/threads/2022-02-0b9-asset-has-disappeared-while-building-player-to-globalgamemanagers-assets.1343288/
And a 4 month old reddit post that seems to have the exact same (or at least a very similar) issue: https://www.reddit.com/r/Unity3D/comments/uudiud/asset_has_dissapeared_while_building_player/
It's also weird because it says Error building Player: 2 errors but I don't see a second error. Unless it's referring to the default Build completed with a result of 'Failed' in 389 seconds (389478 ms) as that is also logged as an error...
this is triggering me more than it should
Editor
Playmode
why does my hierarchy reorder itself
Hello, i have implemented several system that are not part of the game, and serve only as tools for debugging other systems, i wish to have them disabled until they are needed. What is the best workflow for this use-case?
Is it possible to list all system's and enable/disable with a checkbox in a custom editor window?
you can enable/disable systems from within the System window
and simply in your OnCreate do something like Enable = false to start them disabled
then just enable them in your system window as required
you can always write more tooling on top for yourself if you want, remember state from last play instead of always setting disabled on start etc
UNITY_EDITOR directives should help with this. use it for DisableAutoCreation attribute or Enabled state of a system
i actually like my debug systems in development build
my draw debugging UI basically went from an editor window
into an in game toolbar so i could control it in development builds
that's much cooler
oh right, i wanted to ask you about a screen you posted where you showed a list of subscenes. how did you do that?
what screen?
this one: #archived-dots message
oh just select them all in the hierarchy
the custom inspector draws them together like that
ohh π
it will be a great day once we can go pure dots π
so many systems i can't rewrite yet to ISystem ... π¦
orly? what's stopping you
the obvious ones, animations and hybrid gameobjects π
the core systems were for the most part ISystem already just non-burst compiled OnCreate because of entityQuery or ECBS
that's like, 2 systems for me
but yeah a lot of my oncreates aren't burst compiled
but that doesn't bother me too much
one time setup, usually behind a small load screen
500ms reduction in load screen isn't going to make/break game
though i will go through and enable what i can
Wow, that's an excellent idea for draw debug system's.
However, there are occasions when I wish to test a system in isolation or switch between two distinct gameplay systems.
Disabling system's that spawn entities in the system toolbar will not work since by the time I reach the window, all of the entities have already spawned.
hm, i'm actually rethinking my hybrid entity spawn. i'm using standard ECBS for instantiating but i'm questioning the value of it now. i could instantiate a batch with the entityManager and that would probably be faster than the ECB that runs at the end in EndSimulation. they are both mainthread anyway, correct?
should be fine, just manually add them to a SystemGroup (simulation, your own debugging etc etc), call sort and it should start ticking fine
I am going to adopt your approach and create a similar toolbar window in a prior load scene that allows me to enable/disable all system's, something akin to a mod manager
So far, I've avoided all of these issues by creating a 2D top-down game that doesn't require animations.
ECS is a great tool for making games heavily depend on system's like dwarf fortress or rimworld.
Characters in these games are tiny enough on screen that you can create the illusion of motion by just switching the skeletal pose on a 2d layered character.
Or implement a relatively simple 2D animation system yourself. Sprite animations usually aren't terribly complex
Hi guys
How does one query entities that Have disabled Components? Basically, Entity.WithAll<myComponent>... disabled ... in the loop I can reenable all of the disabled entities... or is there a cooler way to do that? Entities 1.0 beta
You add a tag component common to entities with your enablable component and query on that, either WithAll or WithNone for hte enablable component
Nice... alright
Also, Is there a way in a Baker to add a disabled Component?
True, however character sprite animations limit your ability to replace specific character pieces
I don't think you can currently, but it's requested feature by some here already
What do you mean?
Like replacing hands or something?
you can add them like a normal IComp. but you can't set it to default false
Yes, layered characters and sprite animations are incompatible.
Unless you employ sprite animation sparingly on individual body parts, you'll have to create animations for each each body part set, which is a nightmare for a small dev team.
That's why I said simple sprite animations. You can relatively easily write your own system that just swaps out sprites and doesn't use unity's animations
But it is more complex than not doing it of course, and rimworld does just fine with only layered animations
Hell, dwarf fortress is just text
Although I doubt that ever helped it in gaining popularity...
Can't set IEnableComponent to default false? So can't disable component at baker?
unfortunately at this stage it does not seem possible (enzi's investigation, i have not verified this myself)
o-O there's a 'NetCoreRuntime' folder with .net 6.0.4 shipping with the current unity 2022.2
i know it was said it'll still take a while, but that's still a good sign
anyone familiar with the Mesh.MeshData api? I'm trying to remove faces that don't point in the proper direction but GetVertexData returns an array
well yeah, it get's you all the vertex data
so is there a way to convert a NativeArray into a NativeList then back into a NativeArray?
.ToList() doesn't seem to work
not entirely sure why you would need a list in the first place for your use case
i need to remove faces which normals don't point towards a center
i'm merging a bunch of meshes and after that I need to remove their faces and do a bunch of stuff that change the size of the collection
to remove the faces you need the GetIndexData()
i hope this works out. my plan is now to provide a package to fix the hybrid question and entity <-> gameobject linking once and for all π
this is used to run separate processes like il2cpp, unitylinker, etc, not to do with any main unity runtime running
ah shucks
lol, took me a few days now to realize this conversion circle. pretty useful
you must have watched the gdc talk about this
was one of the highlights!
but yeah this is why i was trying to find the live baking option the other day (that defaulted off for me)
because it doesn't work without that on
i have watched it aaaand forgot about it π
i've streamlined the hybrid process pretty good now and i support a few cases mostly covering the directions and spawn options for:
- subscene entity spawns prefab go
- scene go spawns entity prefab
trying to convert a GameObject prefab into an Entity prefab with a few components.
each GO prefab has a NetworkIdentityAuthoring + Baker.
however, the baker never seems to create the Entity in DOTS world.
- is there any extra step needed to run the baker?
- is there any way to bake not just into DefaultWorld, but into my custom worlds too?
looks ok. do you have the go in a subscene?
in fact, are there any Entities 1.0 demos where we can see how this stuf works?
it is a Prefab in the project area, it's not in any scene. does it need to be?
well, how do you expect the entity to show up? there's no runtime conversion
put something like this in a subscene and reference your prefab: ```public class PrefabReference : MonoBehaviour
{
public GameObject prefab;
public class PrefabReference_Baker : Baker<PrefabReference>
{
public override void Bake(PrefabReference authoring)
{
GetEntity(authoring.prefab);
}
}
}```
that makes sure that the entity will be created. you can use any kind of method to do this
I have a PrefabSystem which references the list of all prefabs.
so I need to call GetEntity for all of them?
thanks for help btw @viral sonnet , I have seen your name quite a few times now π
np π yes, that's the gist
that enzi guy is alright
thanks, will try.
does anyone know if it's possible to target a specific (or all) worlds via baking?
seems to always bake to the standard world, with no 'world' setting being exposed anywhere
no idea. wondered that myself when you asked that question. i've seen no way or mention of it.
i don't really get the question
do you mean more, where a subscene loads into?
by default subscenes deserialize into World.DefaultGameObjectInjectionWorld
it's fine, I'll get back to it later as soon as the prefabs thing works anyway π
oh actually no i lied
thats not true
Subscenes that are marked AutoLoad deserialize into all worlds that have SceneSystem during OnEnable
I have this on my PrefabSystem in GameObject world now.
Bake() is never called it seems. breakpoint doesn't hit either.
do I need to flag the GameObject in any way for Bake() to happen?
ahh, great thanks
but you can load a subscene into any world you want
(as long as you add the subscene systems)
SceneSystem.LoadSceneAsync(World, SubScene, Params)
huh, so it doesn't really matter where it was baked. makes sense
interestingly the IBaker has a method for the NetCode package /// <summary> /// Checks if the the authoring component is baked in the Client World /// </summary> /// <returns>True if the NetCode package present and the authoring component is baked in the Client World</returns> public bool IsClient() { return (_State.World.Flags&WorldFlags.GameClient) == WorldFlags.GameClient; }
yeah they added general client/server flags into root entities package
yea noticed that too. wanted to inspect the source but netcode package seems to be gone from package manager atm
i think they want to be able to bake specific data to client/server world in future
so servers dont need presentation and stuff and clients don't need server components etc
i'm not certain this is setup yet though
(but i haven't got around to testing netcode yet since the update)
is it? 1.0exp is out
add it via git url: com.unity.netcode
so yeah i expect the above stuff to change at some point
subscenes might end up holding multiple bakes
1 for client/server/other etc
something like this? who knows
yah maybe need to add manually, it's not shown in UI
btw seems the entities samples were updated to 1.0:
https://github.com/Unity-Technologies/EntityComponentSystemSamples
these packages don't appear in the package manager
you have to add them manually
add by name
com.unity.netcode
guess it's best to look at what netcode does. seems there's already a way ... or not. anyway, the netcode package should answer how's the state of it π
Anyone has an example on how to setup custom world?
Doing things in default world works, but I have no clue on how to get set of systems running in custom ones
was talked about here: #archived-dots message
Just found an issue, and wanted to give you guys the headsup, that currently a line like this won't work:
public void OnDestroy(ref SystemState state) => SystemAPI.GetComponent<Singleton>(state.SystemHandle).Dispose();
As SystemAPI currently doesn't support being inside an Expression body syntax (the => arrow).. The worst bit, it will throw an SGICE instead of giving a proper error!..
Just wanted to give you guys the headsup, found it during a game jam this weekend π
To fix, type it like this instead:
public void OnDestroy(ref SystemState state)
{
GetComponent<Singleton>(state.SystemHandle).Dispose();
}
Here's my custom world boot with systems being created only after certain crucial resources are loaded (and also after GO scene is loaded)
public class CustomWorldInit : ICustomBootstrap
{
private World _world;
private BootExtensionManager _bootExtensionManager;
public bool Initialize(string defaultWorldName)
{
SceneManager.sceneLoaded += SceneManagerOnSceneLoaded;
Debug.Log("Creating world");
_world = new World(defaultWorldName);
World.DefaultGameObjectInjectionWorld = _world;
_bootExtensionManager = new BootExtensionManager(_world);
return true;
}
private async void SceneManagerOnSceneLoaded(Scene arg0, LoadSceneMode arg1)
{
Debug.Log("Creating systems");
SceneManager.sceneLoaded -= SceneManagerOnSceneLoaded;
var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
var bootSystems = systems.Where(x => typeof(IBootSystem).IsAssignableFrom(x)).ToList();
var otherSystems = systems.Except(bootSystems).ToList();
_bootExtensionManager.CreateBootExtensions();
DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(_world, bootSystems);
foreach (var system in _world.Systems)
{
if (system is IBootSystem bootSystem)
{
await bootSystem.Ready();
}
}
DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(_world, otherSystems);
_bootExtensionManager.PostBootExtensionCall();
#if !UNITY_DOTSRUNTIME
ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop(_world);
#endif
}
}
Just wanted to give you guys the headsup, found it during a game jam this weekend
every 10 seconds?
(also thanks for heads up)
Nope, tho I did look at it, was actually at a physical game jam here in DK, called Green Game Jam :3
I guess state.EntityManager.CreateEntityQuery(ComponentType.ReadOnly<xxxComponent>()) still can't put [BurstCompile] attritbute at ISystem OnCreate then wat's the replacement API ?
new EntityQueryBuilder() afaik
but tbh, I don't see how it's crucial for OnCreate to be burst compiled
π Just afraid old API will be deprecated soon.
Hey guys, I modified com.unity.physics 0.51 32 to use soft floats for cross-platform determinism and in my testing box colliders are acting a bit strange.
It seems like the front collider vertices work fine but the vertices at the back tend to droop into the floor.
Is this normal? I'm running the physics simulation every 66ms.
Any ideas what could be causing this problem or how to improve the situation?
Because I'm no longer using normal floats I can't use authoring components for now, so I'm setting up the colliders manually.
Code for the ground:
||```
EntityManager.AddComponentData(
ground,
new PhysicsCollider
{
Value = BoxCollider.Create(
new BoxGeometry
{
Center = float3.zero,
Size = new float3((sfloat)100f, (sfloat)10f, (sfloat)100f),
Orientation = new quaternion(float4x4.identity),
}
)
}
);
EntityManager.AddSharedComponentData(ground, new PhysicsWorldIndex {Value = 0});
EntityManager.AddComponent<PhysicsVelocity>(ground);
EntityManager.AddComponentData(
ground,
PhysicsMass.CreateKinematic(MassProperties.UnitSphere)
);
EntityManager.AddComponentData(
ground,
new PhysicsDamping
{
Linear = (sfloat) 0.01f,
Angular = (sfloat) 0.05f
}
);
EntityManager.AddComponentData(ground, new PhysicsGravityFactor {Value = (sfloat) 1f});
Code for the dynamic box colliders:
||```
EntityManager.AddComponentData(
unit,
new PhysicsCollider
{
Value = BoxCollider.Create(
new BoxGeometry
{
BevelRadius = sfloat.Zero,
Center = new float3((sfloat)0f, (sfloat)0.45f, (sfloat)(-0.27f)),
Size = new float3((sfloat)5.6f, (sfloat)1.2f, (sfloat)8f),
Orientation = new quaternion(float4x4.identity),
}
)
}
);
EntityManager.AddSharedComponentData(unit, new PhysicsWorldIndex {Value = 0});
EntityManager.AddComponent<PhysicsVelocity>(unit);
EntityManager.AddComponentData(
unit,
PhysicsMass.CreateDynamic(MassProperties.UnitSphere, (sfloat) 1000.0f)
);
EntityManager.AddComponentData(
unit,
new PhysicsDamping
{
Linear = (sfloat) 0.01f,
Angular = (sfloat) 0.05f
}
);
EntityManager.AddComponentData(unit, new PhysicsGravityFactor {Value = (sfloat) 1f});
PhysicsStep configuration:
||```
var entity = EntityManager.CreateEntity();
EntityManager.AddComponentData(entity, new PhysicsStep
{
SimulationType = SimulationType.UnityPhysics,
Gravity = new float3(sfloat.Zero, sfloat.FromRaw(0xc11cf5c3), sfloat.Zero),
SolverIterationCount = 4,
SolverStabilizationHeuristicSettings = Solver.StabilizationHeuristicSettings.Default,
MultiThreaded = 1,
SynchronizeCollisionWorld = 0
});
does not look normal
you try maybe upping iterations in case it's just missing the collisions?
( at least just to confirm/diagnose )
i noticed the mass is 1000 i have noticed that mass seems to have an impact on how well collisions are performed..
for example i had a catapult setup, which i was testing out launching a simple sphere - when the mass of the sphere was high, the throwing-arm of the catapult would just pass straight through it
was just looking at CreateDynamic not sure if that accepts an inverse mass value or just straight mass number, maybe worth double checking
Is there a utility somewhere to convert IComponentData to NativeArray<byte>?
you mean like a byte reinterpretation of it?
var ptr = &component;
UnsafeNativeArrayUtility.ConvertExistingDataToArray<byte>(ptr, Allocator.None)
(names are wrong but you should find it)
Yeah exactly, I went through UnsafeUtility.. good to know there's also a NativeArrayUnsafeUtility π
Hmm, since my component is a field in a ScriptableObject it seems that method doesn't work. I thought I could just GC-Pin the object and use it, but the returned array is always effectively null
why not just copy value and convert to bytes?
Could I? I store components in a List<IComponentData> so I don't really know the type. My original idea was to pin the component, do a NativeArray<byte>.Copy and then pass in the new copy to my job to manipulate data
oh, it's boxed
I guess what you could do
is get type of it
convert to ComponentType
through TypeManager
get size
and do MemCpy to NativeArray<byte>
Why do you store it like that, may I ask? π
Working on a setup that allows us to store configuration data in a ScriptableObject, if the stored data is a IComponenData I mark it with an attribute. Then whenever that data changes it should be forwarded to the ECS world and overwrite any existing components with the new data. Think OnValidate but in a generic way for ECS data. This is specifically only for the editor
This works just fine, thanks! π
It accepts mass number, not inverse mass
I tried setting mass to 0.01f and it didn't seem to make any difference π€·ββοΈ
maybe try like 1 mass and up the iterations to like 6?
there didn't look to be anything fundamentally wrong that i could see
Upping iterations by a small amount doesn't make a big difference.
Here is the scene with 12 iterations:
hmmm
yeh i mean realistically i think max 6 iterations, i think i'm currently using 2 π
but yeah just to diagnose if that's actually the issue
fwiw maybe test with a plane for ground instead of cube?
yeah maybe test it with a plane for the ground
Do you mean terrain collider? I don't see a plane collider
when I make the collider for the ground very thin, the dynamic colliders fall through the ground.
mm i think there's a plane, haha maybe i should double check that
there is a Plane in physics shape authoring
my ground was previously a box tbh and it was ok
i think what i've observed with physics is when it propagates multiple collisions it does seem to struggle at times
i've had to do a lot of work to work around issues like that
in your clip, the second object goes through the first when it lands on it, so really that shouldn't be happening
only other thing i can think is enable contact stablization, tbh that might fix it:
the default in your code will be false i think
It seems to create boxgeometry from plane so I assume it also creates a box collider somehow π€
I'll give it a try, I'm afraid it could break determinism but I'll have to try and see
yeahhh
other option might be increase the collider radius, i couldn't quite fathom the description of this in the docs but in theory i think it should push out the faces by a margin.. thing is when you see the debug colliders after doing this it appears to actually shrink the size of the colliders :S
I don't think it's possible for colliders to change at runtime. They should always be the same size.
They move into each other, which makes them look like they are shrinking sometimes.
I just tested it and it didn't help much. Oh well, it's good enough for now. I'll try to figure out the weird collision behaviours at a later time ^^
Thanks for your help @devout prairie !
i meant the BevelRadius on your BoxGeometry
Yeah no problem good luck! If you figure it out, let me know π
Thanks, will do π
bevel radius is set to 0. Do you think this could be a problem?
i'm still a bit unsure exactly what bevel radius is doing and what it achieves, besides the obvious, but it's worth maybe just testing with a small value ( i think default is 0.05 but will depend on the size of your object )
I noticed that the author of the outdated deterministic soft float physics likes to use arrow getters, even when the returned value should always be the same.
Why would you write
public static MassProperties UnitSphere => new MassProperties
...
``` instead of
public static readonly MassProperties UnitSphere = new MassProperties
...
I have another question. Is it okay to always pass MassProperties.UnitSphere as the first argument to PhysicsMass.CreateDynamic?
I don't really get what this Volume field is needed for. is it for buoyancy?
https://docs.unity3d.com/Packages/com.unity.physics@0.0/api/Unity.Physics.MassProperties.html
This is what happens if I set bevel radius to 0.05. (Yes, I think my physics are a bit bugged)
Hmm, I think you'll maybe need to ask on the forum on this one, pretty stumped π
those physics problem look like a hard case. maybe it's best to setup the same scene with normal physics and then go from there. you can yhen debug the vales per frame. output them to a log. find the differences, etc...
physics has weird behaviour on its own so first get something stable
I noticed that the author of the
unrelatedly did everybody see that the samples got updated https://github.com/Unity-Technologies/EntityComponentSystemSamples
[BurstCompile]
public void OnDestroy(ref SystemState state)
{
}
```π€
is that a good thing?
feels like it makes Burst call invocation for nothing. Also making library size larger
i don't know if burst call overhead is worse than normal call overhead tbh. it might be? probably depends
that said, i'm not sure i've seen ondestroy show up in profiles ever either way
Good idea, it's something I've thought about doing once I absolutely need to fix these issues. Sounds like a lot of work but probably necessary :/
oof
// The ChunkEntityEnumerator helps us loop over
// the entities of the chunk, but only those that
// match the query (accounting for disabled components).
var enumerator = new ChunkEntityEnumerator(
useEnableMask,
chunkEnabledMask,
chunk.ChunkEntityCount);
Wouldn't that break vectorization?
not necessarily; sometimes llvm can do the mask lanes thing like a shader. gotta look at the asm if you're worried
(in general, if i ever find myself stressed about whether something is going to be vectorized, i'm probably just going to go straight for intrinsics rather than trying to trick llvm into doing it. maybe i've just been poisoned by https://pharr.org/matt/blog/2018/04/30/ispc-all , not sure. llvm vectorizing is great, but if it's mission-critical i'm probably going to take the wheel)
Collected together all for your convenience.


