#archived-dots
1 messages ยท Page 25 of 1
One of my bakers adds a buffer to the entity but it isn't showing up for some reason. Another component on it with a baker works fine ๐คท
should still be there for NativeMultiHashMap
true
anyone know if you can have multiple bakers for a specific authoring class?
sort of knee deep in fixing errors so will be some time before I can actually test if this works or is a dumb idea
why not?
are there errors if you make one?
at very least can just make empty one
without implementation
the today released unity 2023 version compatible?
well i cant even run the baking system with all the other errors currently so it will be a while before I can actually test it
how do you access ISystem struct these days?
i wouldnt put any bets on 2023 being compatible given a large part of the 2022 beta is the dots preview
looks like UnmanagedWorld is safe to be passed without ref now
similiar to Native containers
hey DOTS team.
.net 7 now has abstract static interface members. since we talked about how burst only does static's and how it does some magic for IJob etc, do you think that will be game changing for DOTS once unity coreclr is available?
i'm not really a .net expert, so i don't really know, but let me re-emphasize that coreclr is probably over a year away for the player, and much longer for the editor, and even longer than that to become enough of a default that we can rely on specific features in it.
how conversion should happen in 0.51 if i need conversionSystem.AddHybridComponent? For now i see no alternative for AddHybridComponent.
HybridComponents were removed back in 0.50
they are simply managed components now
same as CompanionLink
but how then prevent gameobject destruction?
yeah that is the whole point of hybrid components ๐
not sure about now
same in 1.0 ?
well probably not
or bakers works fine in hybrid way?
since there aren't gocs anymore
bakers only work with subscenes
that could be done in subscenes too
hybrid components will be stored somehow
and reinstantiated on demand
hm. ok then. i guess time will tell.
what roslyn version is shipped with 2022.2 though?
3.8.0 iirc, why?
hmmmm
internal unsafe partial struct WorldUnmanagedImpl
I wonder if it's safe to add fields to it
i mean, maybe, but also what are you trying to do
My game relies on Ticks heavily
I want to store it in a similiar to Time fashion
cause i wanted to write an IIncrementalGenerator to test if i can do something equivalent to [GenerateAuthoringComponent]
unfortunately not possible with 3.8.0
weeelll
i think we provide some later roslyn libraries for source generators to use, up to 4.2.0 maybe?
and if your source generator references those it'll load them or something. it was confusing. but i did see the later versions in the editor install
hm, i'll try then. see what's possible.
you know. some R&D myself. imma also share the results for unity. if you wanna take a look at it, feel free to ๐คท
well, Entities is, but Collections is not. so no for now
4.2.0 should be supported yeah, and you should be able to use this documentation:
https://docs.unity3d.com/2022.2/Documentation/Manual/roslyn-analyzers.html (tho those docs are slightly outdated it still esentially comes down to you just making a 4.2.0 generator and then typing -RoslynAnalyzer in your somebuildgenerator.dll.meta file)
you have to edit the dll.meta ? can you not just add the tag in editor anymore?
Maybe you can, I never did it that way, i let Unity generate the meta file and then I edit in the flag 
last time it worked :)
God the latest discord alpha is buggy
Never really had issues, but the current one doesn't sent half of my messages. Do not recommend
I wonder if there will be any tutorial on how to implement your own SystemAPI
well it is an alpha

well this is new:
wow, so soon
Likely not, depends on what you wanna do, and what you mean by implementing your own, but I can be easily persuaded ๐
I mean, I want to have
CustomSystemAPI.Tick
for example
which will add line to codegen
of smth like
this.World.Unmanaged.m_impl.Tick
I kind of wish unity named their package "ECS" instead of "Entities" because you can do this with the namespaces:
Unity.ECS.Entities
Unity.ECS.Components
Unity.ECS.Systems
๐
eh, really not needed. once global namespace support arrives, you'll hide all the relevant namespaces anyway
Inspector<T> hmmm
what was it replaced with?
tertle mentioned PropertyInspector<T>
but my IDE can't find it either
does 1.0 need a build script to build? or do i use the regular build window
regular from now on
awesome ๐
any chance Rival character controller works out of the box? or not a chance - need to wait for update
guess i'll TIAS...
hm
not a chance
โน๏ธ i see...
previously i saved an entity 'prefab' with runtime conversion in a system itself. how can i do this now with the bakers?
if i use a regular GameObject-based character controller, am I losing all the benefits of ECS Graphics/renderer?
if yes - how can I make a minimal controllable fly-around camera just to try and test some ECS scenes
if not - is it only ECS Physics i'm losing out on, but not ECS graphics rendering?
@haughty rampart not really sure what you're asking, how to do runtime conversion now?
throw new InvalidOperationException($"Entity {entity} doesn't belong to the current authoring component.");
ahem
anyone knows what this exception means?
no. how can i get an entity serialized so that i can instantiate it from within a system without having the original 'prefab entity' present in the world when starting the game
you can still use GO-based things. but these things cannot interact with ecs physics
@haughty rampart can you not query for it like any other singleton entity?
i guess you are trying to access an entity that is not converted / added by the particular baker
ahem
ok so the GO-based player controller camera will still render with all benefits of ECS graphics, just it will fall through the floors of any physics within subscenes, so i'll need to make some GO-based platforms for the GO-based controller to stand on - does this sound correct?
and how am I supposed to access Entity that is not converted
no. if it's a GO it will not use the hybrid renderer. only entities will use the hybrid renderer
ah, so i need a camera component object inside the subscene?
then you will need to write the controlling logic ecs style though. and then you can use all ecs things. because then it's an entity.
you can only access the entity that the particular baker is currently running on as well as any entities you create through that particular baker
๐ค
it says that in the docs
that sucks
https://philsa.github.io/rival-doc/Images/tutorial_camera_setup.png this seems to show using a camera outside of the ECS subscene? does that mean that Rival controller is not making use of ECS rendering? or is there some way that a camera outside of subscene can still render with ECS graphics rendering?
has nothing todo with where the camera is located. if you're looking at a GameObject it will render with the normal renderer. if you are looking at an Entity it will render using the HybridRenderer
ahh
ok so for now i'll use GO-based character controller, and the whole graphics scene i'm testing will be in a subscene, so it will use ECS graphics renderer - just not physics at the moment i guess
yes
but for that it has to exist in the world
which it should not
were you storing it in a different world prior? because if not it existed then as well(prefabs arent automatically included in queries)
no. what i did was i had a field Entity prefab in a SystemBase and populated that field in OnCreate through GameObjectConversion.ConvertFromHeirarchy(<myGOPrefab>)
so the issue is that GameObjectConversion.ConvertFromHierarchy no longer exists(/slated for removal)? and what to do for its replacement?
pretty much. or how i can bake an entity through a subscene without putting it in the world, but rather saving it <somewhere else>
think of it like a bullet casing. you don't want a bullet casing to exist in the world already, but you want to spawn one each time you fire a shot from a weapon
ehhh if you can bake it in a subscene you wouldnt need that GameObjectConversion.ConvertFromHierarchy so if you mean outside of a subscene you need to just do all the conversion manually, ie figure out your own runtime conversion with a monobehaviour
if you dont want the bullet casings to "exist" as like "live" entities, you could store them as entity fields on another entity's componentdata, ensuring they get converted and hang around as prefab entities but not processed by gameplay/physics systems
yes exactly. but how do i store them, but without having a 'storage' entity
presumably you could add a prefab component on the baker and just be done with it as another route
still converting all my crap so cant test it out
Use a prefab and then use GetEntity in the baker and store it in a component
Same as with conversion before
but i do not want to have a 'storage' entity
prefab component?
Why not? You could have one entity with many prefabs on it
Prefab
yes, but i'd like not to because I would LIKE not to
yes. THANK YOU. seems that's exactly what i was looking for
unity is kinda moving against storing data in systems so I assume their ideal way is to have a singleton entity component store the prefab field for use in the system, whether its a system singleton or your own. however maybe just adding that Prefab component in your baking script would get you a prefab from the start https://docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Entities.Prefab.html
Okay... you do realize that the prefab will not be included by queries etc.? It has the prefab component
it's not supposed to be included in queries. that's the whole POINT
Yes, thats also what you get when you use a prefab in baker, the prefab gets converted to an entity with the prefab comp ๐
?
like i can add the Prefab as a component with the baker
but not sure what you're referring to
results in an baked entity with the prefab comp (same as conversion with IDeclarePrefabs)
yeah but that stores the entity in a component
which is still not something i want
I dont think you really have choice
Entities.ForEach uses ISharedComponentData type StarShared. This is only supported when using .WithoutBurst() and .Run().
Bruh
seriously
no
it's not
Unmanaged shared components are here
ForEach doesn't about it, it seems
you should migrate away from Entities.Foreach anyway
Yeah also don't think you have much choice here, you could try not saving it in a comp and then query for it using the query options for prefabs but...
only if it was .Run() before
yeah exactly what i'm gonna do
something aint right... tried creating a SubScene by adding a single Plane object (shaded water) to new sub scene - now it's been processing like this for too long...
can't really use Entities.Foreach OR Query or whatever for baking
first time i created a subscene it took quite long too. maybe normal right now
first time i created a subscene it took quite long too. maybe normal right now
......since you can ONLY access the entity the baker runs on AND entities the baker creates
this is why entity prefabs need to exist
BakerSystem
is SystemBase
i would say they do
stuffing a single prefab into a subscene doesn't make sense
judging by description
ok. idk then. no idea
Do they? Because I would love to have them too
add the Prefab component and put them in the subscene. ๐คท
using static Unity.Entities.SystemAPI;
Query<RefRW<MyComponent>, RefRO<MyROComponent>>()
Well only because it has a preab tag it isnt a prefab. A prefab is an asset. THis is just the runtime representation
Ah yes, RefRW
think that's the best way for now
13:30 min? ๐คทโโ๏ธ i'll wait if it's normal, just don't know at what point to consider maybe it isn't normal..
nah. was like 2 mins max.
dude no its not normal
better restart unity
lol ok killing..
@proud jackal i was sure you fixed that already, no? ^
maybe you have to make an aspect, i forget
omit the RefRW or RefRO if it's managed
shared components can be unmanaged now
I have unmanaged shared
and buffer
Example: Query<RefRW<LocalToWorld>, SomeManagedType>
I have a trouble with conversion though
are Terrains a thing in ECS yet?
not really. workin on it, big project
I have a GameObject reference in authoring component to other GameObject and during baking I need to add component to the references GO
Indeed we did, Query supports any type of IQueryTypeParameter, which includes IAspect, RefRO, RefRW, EnabledRefRO, EnabledRefRW, managed IComponentData and ISharedComponentData.
you guys have any plans to ship an analyzer for DOTS btw? cause if not, i'm def gonna write one and contribute it to the MicrosoftAnalyzersForUnity github since it ships natively with unity now. (since, like we saw yesterday, what to annotate with what and what not and, ..... can be a bit confusing sometimes)
So any tip how to keep entity cross references in Baking?
And DynamicBuffer<T>!
gah not even sure the regular character controller will work... ๐ฌ
i mean daniel here would be the expert, but i would think you'd rather we focused on making all our generators incremental first before we put even more crap in the IDE experience, right?
starter assets are outdated since years ago
oh... what would you recommend as a "go-to / default / basic" FPS character controller solution for testing around a project?
Rival, but it's not updated yet
i thought Unity official starter assets FPS controller would be the way to go...
right....
well yes, definitely. i mean i guess it would end up in the MicrosoftAnalyzersForUnity repo anyway, so i might as well do some prime work
i think the URP / HDRP sample scene templates you can create when you make a new project have a good character controller already
they will at least have a flying camera controller
ahh ok lemme try, i thought surely those controllers came from the unity starter assets...
nah
I've got a baking question. Can I have one baker that adds a DynamicBuffer and another baker that appends to it?
It would appear that the baker API doesn't let you do this since the buffer was added by another baker. Perhaps I need to come at this problem another way
everything prior to 1.0 will not work
you've captured your problem perfectly
they are not looking for an ECS controller right now
@errant hawk i went through this a bit earlier - from my understanding basically the character controller camera will still render ECS SubScene content using full advantage of the ECS graphics renderer, just the controller physics wont interact with the ECS physics.... or is this not accurate?
๐
BTW how does that actually work - does untiy player go through 2 rendering processes? does one render-to-texture on the other or something?
how does unity "merge" graphics from GO-world and ECS-world
the camera has nothing to do with rendering. it's simply your 'view' into the world
ah
the camera will render both entities and GameObjects if you have Entity Graphics added
There is no merging. GameObjects with mesh render/filter components are basically just references to the mesh/textures loaded on the GPU (same with entities)
it's all basically shipped to the same rendering pipeline you have in your project
just through different paths
except ECS graphics benefit from a bunch more awesome than GameObjects?
pretty much this. It's just the delivery method that is different
yeah
you cant see your entities without Entity Graphics otherwise
right, but also - there's ECS-specific optimizations and scene-graph-like calculations etc.?
My use case is this. I have a buffer type that represents the different control prompts when hovering the object in game. Various authoring components (Interactable, Pickupable, etc.) all have their own control prompt that they want to add to this buffer. For example, the PickupableBaker would, ideally, set some flag to mark the object as able to be picked up and also append to the control prompt buffer that is used by some UI system.
I'm using RequireComponent on the different authoring scripts to ensure that the ControlPromptAuthoring component is present, but I can't figure out how to ensure the PickupableBaker runs after the ControlPromptBaker. It also doesn't like me appending to a buffer that was added by another baker.
of course
I guess I could use a baking-only component like AddToControlPromptBuffer. Then in a baking system, find all of these and append them to the buffer. Seems kinda roundabout but I assume it would work.
just tried new URP sample scene project in the 2022 beta version required for ECS 1.0 ๐ ๐ค
you can use GetComponent I presume from inside a Baker
enter safe mode and what errors do you get?
ok trying now...
also, it's not required to be 2022.2 sample scene, since the controller code is not ecs. but should work nevertheless
Also, you can also just combined all scripts into one authoring/baker if you really need to
ye but i want to use ECS 1.0
You mean to do something like this? GetComponent<ControlPrompt>().Prompts.Add(MyNewPrompt);
How do I ensure that the control prompt baker happens after my other bakers?
Library\PackageCache\com.unity.render-pipelines.core@14.0.3\Editor\Debugging\DebugUIDrawer.Builtins.cs(228,55): error CS1061: 'DebugUI.FloatField' does not contain a definition for 'GetValue' and no accessible extension method 'GetValue' accepting a first argument of type 'DebugUI.FloatField' could be found (are you missing a using directive or an assembly reference?)
eh, ignore, and just copy the sample scripts into your own project
how please, which scripts exactly do i copy what from where
Yeah I used to do this but it requires keeping the two in sync. Also makes it hard to support mods for adding custom actions and control prompts to objects.
exit safe mode, let it load fully, and then in the assets folder and subfolders there should be a few scripts
ok trying..
Well, I don't really know if you actually can define the execution order of your bakers
sirs pls
Anyone solved how to get another GO's entity reference during Baking?
I am desperate
GetEntity()?
[Worker2] InvalidOperationException: Entity Entity(12:1) doesn't belong to the current authoring component.
if called in Baker
i'm here now, what am I looking for
scripts
ok i see just 1 file
Is this a prefab or another GO in the subscene?
the latter
yeah. that's the flying camera controller
What I would do is make an interface that has a method like GetEntityComponent. Add that interface to the GameObject scripts you want logic for. Have a singular Baker of that logic type go through all the GO components that have the interface
ah cool ok, i just copy that into my other working project? lemme see what i need to attach it to....
Hmm, well I'm still knee deep in my own baker errors so maybe that doesn't work? From what I read, that is how you're supposed to reference prefabs or other GO in the scene. I'd also like to know the right way to do this.
i think that's to reference other GO, not their converted entities
i only briefly glanced at it but could you add temp baking components in your baker and then use a baking system to homogenize the results? @whole gyro
I have direct reference to other GO
and I need it's Entity
So that I can add component with reference to that entity
Yeah, I mentioned that alternative above. I think it would work, although a bit complex. I guess if you need any kind of baking ordering you need to use baking systems
can't beleive smth so basic previously is now so unclear
That could work, but can you have a baker for an interface? Or maybe the baker is for some general component which looks for other components. That could work nicely. Thanks!
Which way are you doing the reference?
yeah i think you need a baking system: https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/baking.html#prefabs-in-bakers
all the way on the bottom
No.. the interface is for the GameObject's monobehaviour scripts. Inside the baker you use the authoring target as your entry point to enumerate over other MonoBehaviour scripts (optionally children GOs as well).
yeah... but working with runtime data
during baking
is uuugh
and in this case
I have no idea how to solve it
afaik there is no runtime conversion anymore
tbh
that's not the point
I'm just saying that if the only way to get entity reference in baking
@rustic rain I think the error you got is because you can only call AddComponent on the primary entity, not the referenced entity. So, I think you can call AddComponent(new ReferenceToOtherSceneEntity { Entity = GetEntity(SomeGameObject) });
yeah, that makes sense
you can call AddComponent on a referenced entity
๐ค wouldn't really say so
It's not runtime if its in a baking system. Those runtime systems just run during baking, but after the simple Bakers<T> run.
but that totally defeats the purpose of authoring being simple
so
At least, I think that's how baking systems work. They are just the new GameObjectConversionSystem.
instead of simply getting entity reference and adding component to it
Now I have to create new component type which
which will reference that other entity
yeah you are correct
and add to it in separate BakingSystem
think it's a good seperation of operations. and you can be sure that every possible entity is available when you run the combiner system
A lot of this could have been solved with an entity-only baking/construction/whatever UI
In the end it's all getting converted
Are you sure? It checks here that the entity is either the primary or one of the CreateAdditionalEntities
current one is better flow though
That's not what I see:
not until we get our previous options back
i'd rather not
That last one. CheckValidAdditionalEntity(entity)
that's what I meant
cause new approach forces me to have way more code
then I used to have
but it's way more robust code
Ah yeah, but this is all it's doing:
private unsafe void CheckValidAdditionalEntity (Entity entity) {
for (int i = 0; i < _State.BakerState->Entities.Length; i++) {
if (_State.BakerState->Entities[i] == entity) {
return;
}
}
throw new InvalidOperationException($"Entity {entity} doesn't belong to the current authoring component.");
}
So it makes me wonder why tf this is even a thing
So are you just missing GenerateAuthoringComponent? Or do you have more? n.n
those entities are only main entity and additionally created
Exactly. That was the error @rustic rain was getting. It checks that its one of the entities created by the baker
yeah I understand the error you're getting now. That is pretty lame
no, I am just trying to get entity reference during baking and attach component to it
no i think he's missing IConvertToEntity
public override void Bake(SpaceObjectAuthoring authoring)
{
AddComponent(new ShipComp()
{
movementSpeed = authoring.shipSpeed, rotationSpeed = authoring.maneuverability
});
var graphics = GetEntity(authoring.graphicsEntity);
AddComponent(graphics,
new Selectable() { type = authoring.selectableType, mainEntity = GetEntity(authoring) });
}
here's what I want
but that won't work, because I can't attach components to other entities
Random nitpik: I believe you can just call GetEntity() instead of GetEntity(authoring)
But yeah, I think you would need to inverse this so that the graphics GO has some authoring/baker with a reference to the space object and add it there
that's the point though
if code simplicity is what you're missing here, you can write a ExtensionMethodStub and a SourceGenerator that looks for it and generates such a simple BakerSystem for you
I think Bakers shouldn't be for just a specific entity(s), but more of a filter to what entity you want to modify
I can't have any authoring on graphics GO, otherwise it would be... so much pain to author
If you want to modify all entities, that's up to you
Yeah I don't understand your exact setup but I understand the frustration. My control prompt problem is kinda similar in that the suggested fix was a complicated baker system. But I assume that this restriction ensures better baking determinism and stuff
disagree. separation of concern - design guideline
screw the guidelines if they make you jump through 50 hoops to get something simple done
after all, they are guidelines
๐ fuck devs that give a fuck about robust guidelines
that's how bad code and spaghetty trash surfaces in a project
also read the message where I said they should act as a filter, but optionally be implemented to where you can modify all entities
you know what
I'll try some hack
_State.Ecb.AddComponent(graphics,
new Selectable() { type = authoring.selectableType, mainEntity = GetEntity() });
if you first treat every entity as it's own, and then merge the ones you need to, you have a way better logic structure
ah bypass the validity check
good idea
welp, now subscene doesn't even bake ๐
๐ .....and now people wonder why unity doesn't distribute best practices
Try this:
public void AddComponent<T> (Entity entity, in T component) where T : unmanaged, IComponentData {
if (_State.PrimaryEntity == entity) {
AddTrackingForComponent<T>();
}
AddDebugTrackingForComponent<T>(entity);
_State.Ecb.AddComponent(entity, component);
}
What did you change?
eh, whatever guys. get your spaghetty fresh from the tap if you want
just did what I sent
it does work
finished subscene entities references are valid
It wouldn't be spaghetti code if unity gave us the tools to do what it is we need
clearly not if @rustic rain is having a hard time finding a supported solution
that isnt a hack
guys, chill
They are having a hard time finding a quick solution
So as I understand it, Bakers are only for operating on the primary entity and any other entities the baker created, and only the components that were added by the baker (no appending to a buffer added by another baker). These restrictions allow all the bakers to run at the same time without stepping on each other, which helps with determinism. If you want to work around those restrictions, you create baking systems. With that comes the responsibility of ordering that system in the baking pipeline such that it works as expected and is deterministic. I guess I can get onboard with that even if it means more code for certain things.
๐
yes, and how much code does a quick solution take? 1-2 lines? Maybe a little more? Harder, longer solutions need specific implementations to work correctly
You then have to maintain that code, ensure it works, test it, debug it, etc
The current Baker system is fine, but I would like to see a dependent baking system as well where you can modify multiple entities loosely related to each other
I'm assuming the baking system only runs once, or when a value is changed in the inspector
There could also be subscene-specific bakers as well
only entities in that sub scene can be modified
I think adding a per-sub scene baker is the way to go, because the likelihood of needing an entity outside the scene is incredibly low
(ignoring prefabs)
manual could use some explanation over internal structure of baking system
that too
well you can't have cross-subscene references so the baking systems are basically per-subscene
Each subscene is converted in isolation, right? So it would spin up all the baking systems for each subscene separately
Yes but from what I understand you cant access entities from other GameObjects that are not a child or parent/root object
A baking system is just a system in the (baking) world so it can do whatever.
But a Baker<T> can only modify the primary or entities the baker created (this is different from entities in the game object's hierarchy).
I guess I'm not sure which you were talking about, but wanted to point out that when I was talking about a baking system, I mean a normal SystemBase or ISystem that is running in the baking group (there is some new attribute I forgot to specify this). Separately, there is the Baker<T> types that have the restrictions we were talking about above.
I'm specifically taking about the Baker<T>
Example of a baking system:
[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
partial class BakingOnlyEntityAuthoringBakingSystem : SystemBase
{
protected override void OnUpdate()
{
// โฆ Your code here โฆ
}
}
Yeah exactly, but it provides a per-subscene kind of baking thing you were looking for, no?
The syntax isn't quite as concise, but in terms of flexibility and features
I'm only expanding on the issue @rustic rain was having, and that's GameObjects in a subscene can't be referenced if they're not a child or parent object
using the Baker<T>
i mean you shouldnt be doing that because theres no way to guarentee what sort of outcome happens if you split them into different subscenes
ok, so
Here's what I assume is intended way
public class SpaceObjectBaker : Baker<SpaceObjectAuthoring>
{
public struct GraphicsReference : IComponentData
{
public Entity value;
public SelectableType type;
}
public override void Bake(SpaceObjectAuthoring authoring)
{
AddComponent(new ShipComp()
{
movementSpeed = authoring.shipSpeed, rotationSpeed = authoring.maneuverability
});
var graphics = GetEntity(authoring.graphicsEntity);
AddComponent(new GraphicsReference { value = graphics, type = authoring.selectableType });
}
}
[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
public partial class SpaceObjectBakerSystem : SystemBase
{
protected override void OnUpdate()
{
var em = EntityManager;
var buffer = new EntityCommandBuffer(Allocator.Temp, PlaybackPolicy.SinglePlayback);
Entities.WithAll<ShipComp>()
.ForEach((Entity e,
in SpaceObjectBaker.GraphicsReference graphics) =>
{
buffer.AddComponent(graphics.value, new Selectable { mainEntity = e, type = graphics.type });
})
.WithoutBurst()
.Run();
buffer.Playback(em);
buffer.Dispose();
}
}
I don't think the restriction is child/parent btw. Its entities created by the baker. So its actually more restrictive
That's pretty much what I expected you to do
given the current limitations
as the "safe" way
Yeah, its verbose but looks right to me
Wait, you can mark the GraphicsReference as baking only though
also @rustic rain I think you can remove the GraphicsReference during the Foreach
yeah
actually
That is handled automatically by some new attribute. That's what I meant
I just can't remember the name of it haha
Didn't know that
[TemporaryBakingType]
I don't do a whole lot of ECS rn so I don't do a whole lotta digging into features
I only know because someone mentioned it here yesterday
so judging by this intended way
they also want ECS during authoring
which is sadge tbh
yeah seems like what you want to add
I liked OOP design of conversion workflow
it was very convinient
to implement
but I guess
why is that sad? you have oop for bakers, and then can use the burst path for pure ecs(and could still use class data in the baking systems too)
the benefits of this ECSy approach
is that it would be easier to extend as project scales
Baker adds temporary tags/components
I'd still like an entity-only workflow tho... Just a little editor window to add/remove components, set fields, etc
BakingSystems work on it
Also, it might be a bit different with a "save" button since the conversion/baking system will still exist, it's just codegened for ease of use, and each time you add/remove a component, or change a value the codegen needs to update
Going to give this a quick whack..
Yeah, I was meaning to ask if this version was compatible. Not in a rush to update though so I'll wait for your report ๐
all right, I'm getting a hang of it
Even if I don't like it, might as well minimise damage ๐
Ohh.. this is literally my first attempt with 2022 and 1.0, so i'm hoping it is :S
Could and should probably merge logic into components + baking systems that work on it
So in the end
Bakers only define what sets of temporary instructions to get
that will add all required component data in baking system
you're out guinea pig then ๐
Haha yeah I think I like the new design now. But, as was mentioned above, I think the manual page on baking should outline the restrictions of the Baker more clearly.
Well i think the crucial thing is it's still experimental, so if there are major pushbacks from people about certain workflows i guess there's scope to change things still
so for example if certain things feel a bit wonky rather than getting salty about it let them know, seems like the sensible thing
just referring to the ongoing discussion
Currently as it stands, I dont want them to change/remove anything, just add a few features to make baking easier
Yeah i mean was just a general comment tbf
i'll be the one crying if/when i ever migrate ๐
Yeah, I need more time with it before deciding if I like the new design. My initial saltyness was more from a lack of understanding the new restrictions. But its just a different workflow now that I'm sure I can get used to. In general, I would happily trade more verbose code and boilerplate if it means safer, more predictable, and more deterministic.
Yeah i mean have you ever written any codebase that you haven't refactored several times.. not often ๐
ArgumentException: Cannot create an instance of ScriptableObjectConverter_Baker`3[TSOClass,TBlobStruct,TBlobReference] because Type.ContainsGenericParameters is true. whelp ๐ฆ no generic bakers apparently
oof
Oh yeah, I have an error about that. That would be unfortunate if true.
one of my projects has been rewritten from scratch 5 times ๐ด
I have lmao, my networking library for instance has been rewritten 4 times from almost the ground up
previously it was a GOCS, ran fine. then i tried a systembase but I was warned here that building blobs in baking systems aren't tracked. so now i tried a generic baker. running out of options
Exactly imagine doing that for a public api you're co-writing with 10's of other devs.. there's going to be changes and it evolves
cool, so 4 times down to 0.4 hehe
i guess you're damned if you do damned if you don't change stuff.. i think recent comments on here have the right of it, just do what's best and to hell with people complaining about it.. people will complain either way ๐คทโโ๏ธ
I only complain if there's a legit reason behind it. None of this "its ToO hArD/lOng nOw" bullshit when it comes to changes
so far my only complaint has been the rather frustrating limitations of GameObject-Entity positional tracking
and the hybrid workflow (which is actually subjectively better now with the baking system)
tbf the conversion system was the one thing that bugged the hell out of me and really hoped they'd simplify.. just hoping it's not more obfuscated than it was before ๐ it does look simpler on paper but i can see people having issues
- cough * @rustic rain * cough *
๐
๐ด
hehe
Conversion == OOP
Baking == ECS
in the end i just use gameobjects with conversion mono's for everything, no subscenes etc i just had too many bugs etc, that was 2020 tho not sure if later versions were better
it loads quickly enough so no real love lost
2022.2.0b9 comes with a bunch of fixes for UI Toolkit, and I see a little fix for domain reload too, but other than that, nothing too much related to entities usage https://unity3d.com/beta/2022.2b
I'm getting a bunch of random ui toolkit issue on inspecting so hopefully this helps
I'm also hoping that GameObjects are decoupled entirely from the baking system (optionally). This IMO would be ideal for procedural baking, or other solutions
Something I'm still struggling with is how to get data used in scheduled jobs onto the main thread for some stuff like UI.
E.g. I read NetworkSnapshotAckComponent do get the last ping time, but netcode systems write to it...
If you use Physics in your current project, does the Improved Transform System mean it's actually not possible to upgrade to 1.0.0 ?
i noticed if you have a subscene closed and an entity selected and exit playmode, it will spit out uitoolkit/element errors
If you use physics or netcode it force enables the old transform system for now
I guess the easiest way is write a job that depends on the component so the scheduler can figure out the order of operations, and then complete that job, since I don't have a h andle on the netcode system ๐คท
thanks
hm, so i there's any trick to code a generic baker. i'm too dumb to find out ๐
What's the use case
to bake some scriptable objects into blobs
or i find a solution to bake blobs in a baking system. an idea was to instantiate an entity with a seperate blobAssetStore and simply manage the disposal.
Yeah I'm missing the part where it needs to be generic though
What does the generic part provide
public class ZoneDropConversionSystem : ScriptableObjectConverter_Baker<ScriptableObjectConverter,SO_Zone, ZoneBlobAsset, ZoneBlobReference> { }```
i can implement this very easily for each SO
i mean isn't the point of generics always that you don't have to write the same code over and over again? ๐
i could make this non-generic of course
Why does this have to use any entities or baking at all?
to easily use them in systems. it's really nice to use
apparently the 1.0 physics package is compatible with 2019+, would that mean it works with 0.51?
I just put them in a native hashmap, pretty boring ๐ฆ
Although I do inject them sneakily
That may not work on an ISystem though
i'm not fully there yet because the 1.0 release interrupted me ๐ i have a hashmap now too but it should turn into just an array and ids for direct access
the blobs or SOs?
The blobs
so you're doing runtime baking of the blobs?
yeah
You can load mods between shutting the game down and starting a new session, and those mods are also converted to blobs
makes sense, i did that also at one point but recently moved the process to the conversion stage
I just store all my config data in scriptable objects, and then convert those
And I have a struct reference type that stores the guid to the scriptable object which then lets me access the blob in jobs
when did unity add manual cache locations??
i don't see my game having mods but maybe i should rethink the baking of blobs. it's really fast anyway and who knows when dots addressables are showing up
i just don't like being defeated by regressions ๐
seems DreamingImLatios has also brought up generic bakers in the forum
I'm pretty good at that โ ๏ธ
so there's no samples for ecs/physics as yet?
ok, got the generic baker to work ๐
the important part is a generic baseType too public class ScriptableObjectConverter_Baker<TAuthoringType, TSOClass, TBlobStruct, TBlobReference> : Baker<TAuthoringType> where TAuthoringType : ScriptableObjectConverterBase where TSOClass : ScriptableObject, IConvertToBlob<TBlobStruct> where TBlobStruct : unmanaged where TBlobReference : unmanaged, IComponentData, IBlobAssetReference<TBlobStruct> is my definition
But you'd still need to define how the object gets converted somewhere right?
previously I just used Baker<ScriptableObjectConverter> and that threw errors
public class ZoneDropConversionSystem : ScriptableObjectConverter_Baker<ZoneConverter, SO_Zone, ZoneBlobAsset, ZoneBlobReference> { }``` this is such an implementation
yes, that's done in the SO itself and defined by IConvertToBlob
shouldn't this discard the main entity that will be converted? [TemporaryBakingType] public class ScriptableObjectConverterBase : MonoBehaviour
the main entity still gets converted but I would like to destroy it after conversion
would dots make it easier for open world maps?
for everything
but you can practically consider as different engine
the V-Rising devs would agree I think ๐
im pretty sure you add this component to IComponentData
that is true, forgot about v rising. was debating between unity dots or ue5 since they have 64 bit floating precision
yeah, the tag was a dumb guess. i actually have no idea how to get rid of the main entity ๐
EntityManager.DestroyEntity ๐
in a baker?
in a post process bake system
add a component called
[TemporaryBakingType]
public struct DeleteEntity : IComponentData
to the parent
then just post process delete them
hm, well then. i have this remove system anyway, just as might put a delete in there too ๐
was that remove system working with linked entity group?
when i last saw it didnt think it'd work
because linked entity group is added i the phase after from what i saw (or did you update it)
Try adding the BakingOnlyEntity component to the main entity
That's how CreateAdditionalEntity(bakingOnlyEntity:true) is implemented internally
i have only tested this for trans/rot/parent. i currently have just flat entities, need to test it
did it not work for you?
oh do tell ๐
Mines just a generic system which is what I used before
no component, just remove all LEG that are length 1
if you want to be more specific you can do something similar
TLDR just remove LinkedEntityGroupBakingData
nice, good find
There is a pending pull request, you can pull it from the github repo
so the actual setup of LEG runs afterwards, huh?
these are traditional systems now and prefab is added
so it won't return prefabs in the query!
(i think this is why staticoptimizeentity doesn't currently work on prefabs atm [there's a note in code this is known])
you could update in PostBakingSystemGroup instead I guess
Can you set values using reflection on an ISystem?
but i like the idea of just not having to run the LEG system on things that don't need it
yep, the LEG buffer sucks ๐
yeah see i think this component should exist in hierarchies (though I wish chunk size was 0)
my issue with LEG is it's added to every prefab
even if the prefab is flat
and there are new really cool ECB functionality with LEG
with the new 128 cap, the LEG is less of an issue ๐ง ๐ง ๐ง
128 cap?
i agree of course ๐ i need to check about the flat prefab thing. i either have not witnessed this, always removed it or i dunno ๐
chunks have a limit of 128 entities
ah
hm, i don't have LEG anywhere right now. just Parent for the most case in hierarchies
only on prefabs you say?
Is there a significant performance difference in removing it on flat hierarchies?
LEG takes a significant amount of memory
BakedEntityData.cs
internal Entity CreateEntityForPrefab(GameObject prefab)
// ...
var buffer = _EntityManager.AddBuffer<LinkedEntityGroupBakingData>(entity);
buffer.AddRange(linkedEntityGroupArray);```
All it needs is
if linkedEntityGroupArray.Length == 1 early out ๐ข
i could live with it being not in chunk so only 16bytes instead of 160
that's quite the oversight
one does not simply put a buffer on an entity!
i'm confused though what triggers this as i don't have any
GetEntity
on a prefab field
{
if (gameObject == null)
return Entity.Null;
var gameObjectId = gameObject.GetInstanceID();
// If it already exists, just give back the reference
if (!_GameObjectToEntity.TryGetValue(gameObjectId, out var entity))
{
if (gameObject.IsPrefab())
{
// Okay, it doesn't exist so we need to create it
entity = CreateEntityForPrefab(gameObject);
}
}
return entity;
}```
`entity = CreateEntityForPrefab(gameObject); `
haha, i just realized in my game project the conversion is still missing. just checked my other projects, yep, there it is.
beautiful, length 2 and a reference to itself
the other prefab length 1. yeah. that needs some work
no idea how the entity itself ends up in the LEG buffer
it's always self added
as first step
it's never a 0 length buffer
first element is always self
you are right. hm, what sense does this make?
i see. well, i think the biggest problem is that we can't set where the LEG buffer lives. I wouldn't mind it so much otherwise
on the other hand, that kind of buffer behaviour could be utilised very easily without any auto-magic that does the wrong thing for most of the time
well yeah, i'm a firm believer it should exist outside chunk
it's not something that is high performance and iterated every frame in a chunk
it's only really used during initialization/destruction
yeah i agree
cheatsheets, intro and tutorials if someone interested : https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/DOTS_Guide
ooph, i'm onto my 1 library that uses GenerateAuthoringComponent
if someone had a lot of these that'd be painful
maybe it's used in runtime for animation. i dunno. anyway, it's a weird core feature for sure.
rewriting comps is painful anyway ๐ i rewrote 64 bakers
most of my authoring is just
1-2 mega scripts per library
so it's been pretty easy
it is easy and tedious ๐
I personally never used them because of how many fields it thought it was supposed to add
As many as you write? ๐
well I had fields that were intended to be converted, but some other fields that were not (I don't remember why, but I never used the attribute from there forward)
you could kind of trick this by using accessors or properties
but yeah i only have them in 1 library from a while ago
wasn't a huge fan of it except for like single field components
Oh I remember, I was lazy and didnt want to make an editor script so I had "toggle gizmos" "toggle handles" "toggle vectors" etc on the monobehaviour
found it easier to just write the conversion process
There is no way to get a singleton inside a job is there?
no as it involves a query.
How can I "safely" get a singleton then that is written to by another job without getting a direct jobhandle from that system?
can you not get it outside the job? you'd just need the entity. the comp itself is no problem
I guess? I was just wondering if there was a better way. So basically just get the entity and then read it using a ComponentLookup?
basically
Hmm
What if I needed the singleton data on the main thread? I guess the only way is to then call Complete on my schedule job, forcing the job that is writing to the singleton (and then my job) to complete?
if you write to the singleton from jobA and need the updated data in jobB there's not really a way around it unless you .Complete before scheduling jobB and get the updated data
I'm confused how this worked before, I guess netcode updated how they write the singleton somehow, maybe it was all mainthread before
i don't know how they did it. maybe they just used a NativeReference and used the same ptr?
I feel like that is generally tricky with something like UI, since you would need to complete all the handles that contain the data you want to render to UI that frame, unless there is some way to do it inside a job
Are build configurations deprecated?
yes
Can you still use custom build steps? Would be kind of odd if they get rid of the entire Unity.Build stuff
of course it's internal ๐ [BakingType] internal struct LinkedEntityGroupBakingData : IBufferElementData
internal public what's the difference ๐
I definitely would have made that internal as well though
could be just hidden in an internal named namespace.
one doesn't stumble into unsafe namespace for example
for asmref, what's the most sensible thing to do? using guids or strings?
guid would define the version, right?
and tertle, how have you set this up when you need internals for more than 1 dll? i'm lazy and made different folders but i'd like to merge this into one which doesn't seem to work
I think it just uses the asset GUID of the asmdef meta file, so it should be fine across versions
so it doesn't really make a difference? the nice thing about string is that i can actually read it as txt file
Only my core library has access to asmref
So it's all in 1 place
If other libraries need access to something internal is just wrapped by core library
have you managed to put them into 1 folder? i organized it that way now
Oh no it's 1 folder per
ok thanks
Where can you check if a package is compatible with a specific unity version?
I think unity 2022.2 broke input system 1.3.0
That'd be a pain because 1.4 has a pretty bad bug
I haven't got around to updating my input / control library yet so can't confirm
what bug is it? i have been using 1.4.2
From memory binding like wasd to a composite?
Yeah
hm, was running 1.3 in 2021 too
iirc it only breaks the composite binding if you change control scheme
Something whacky is going on with the 2022.2 importer
Whatever it was exactly it was pretty bad and input devs basically just said stick with 1.3
Asset import failed, "Assets/ScriptableObjects/Input/InputActions.inputactions" > InvalidOperationException: Failed to add object of type `InputActionReference`. Check that the definition is in a file of the same name and that it compiles properly.
UnityEngine.InputSystem.Editor.InputActionImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/com.unity.inputsystem@1.3.0/InputSystem/Editor/AssetImporter/InputActionImporter.cs:130)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <b12a1bad0ca64ab6a93de8c0b845ea64>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
It works on 1.4.2, so I'm guessing it's a unity version issue
It also still isn't fixed in 1.4.3...
whoa, what the hell. my inputs suck, don't use composites yet
Like I said, iirc it works fine if you don't use control schemes, but I might be misremembering
Ah, I just checked the needle mirror repo
But yeah they specifically say this on the 1.4 forum post
Dear Input System users!
Please hold upgrading, we're investigating the issues found below.
I feel like this issue has been around for quite a long time now
It has
hehe, prompted me to look at their codegen. i found a really nice Writer struct that handles indents in InputActionCodeGenerator
This reminds me to work on my codegen tool

hi... I haven't been updated on dots... is it fully supported now? is it ready to use?
1.0 is released, but I still wouldn't call it production-ready (it's also still labeled as experimental)
I understand THANK YOU
๐
Ok, it looks like InputSystem is completely unusable on 2022.2b9
The importer keeps breaking for some reason
If you have a generated C# file it should keep working but you can't make any changes to the asset
I think this is a general issue of the actual unity version though, my BuildConfigurations are also not importing, with a similar error
have you tried b8?
Yeah, same issue
Very annoying
The build configuration importer breaks immediately
InputAction I can open and edit until I save it with a single action in an action map, then the same issue occurs
Very odd
iirc I read in the forum it works on b3, although I'm guessing 1.0.0-exp.8 won't work on that version
(you dont need build configurations anymore)
Yeah I know, I was just remarking that it has the same issue
Is the old ClassicBuildPipelineCustomizer still applicable or did the entire system get deprecated?
I actually liked the build configurations ๐ฆ
i also liked the build configuration
tbh seemed like a more clean, modern version than the build system
no idea why they abandon it
yeah. is a shame though
i had hopes it will be the default build system one day
most in the dots forum were baffled as well
How do you add custom build steps now?
Do you just write some method you can trigger as a MenuItem and call your code one by one?
iirc there was an attribute you can hook but that was only for post-processing a build, not pre-processing...
sounded like they simply didn't want to resource it atm to update it
i actually liked it as well
i really hope they will bring it back
can i get EndSimulationEntityCommandBufferSystem.Singleton in a system in OnCreate() ? i seem to get errors saying none exist
Did something change with the physics system in 1.0? A lot of my old code isn't registering any collisions at all
for example, this used to work before
PhysicsDebugDisplayData also isn't showing any colliders, so I'm guessing that's the issue
Besides that I can't really see anything wrong on the baked entity
ok. is that supposed to be this way or are you really supposed to get the singleton each time in update without caching it in the isystem ?
yeah that's why i'm asking
Well I'm stumped, time to sleep ๐คท
maybe you have a similar error as me. HR wasn't rendering, had to clear the entities cache. seems some baking stuff isn't refreshed correctly. although as i just added the graphics package this might be more of an edge case
yeah i had a similar issue after adding a new baker it would just not run it until i cleared cache
it certainly is odd that colliders are just missing. might be the best reason for baking to not have run
oh actually it was worse
it would bake into the preview so when i checked entity in authoring view it appeared to have the components
but when i started game
they didn't have the components
damn, there are 2 states? lol when in doubt clear cache
this was from like 5 min of testing so take it as a grain of salt
but it looks like the preview state is only the Baker
not the Baker systems
i noticed my collision drawer fails in this state because the collider isn't built and it's null when inspecting the entity
where is live baking logging logged to?
oh the console ๐
was hoping to be able to use debug.log though, not sure why this baking system isnt working
ok i guess im an idiot, query isnt matching and debug does work..
is there a way to compare 2 entries of the burst inspector?
print screen ๐
i print screen 1 and put it next to the other
to see them side by side ๐
but you can only ever open 1 burst inspector
yeah so i open it, look at something
print screen the code, put it in paint
then open the second job etc
or store it for a recompile/code change
(or just copy/paste entire thing to notepad++ and do a diff)
but yeah it would be nice to have some proper tooling for this
Absolutely
Is there any best practice for selectively creating systems depending on the scene?
for example, I might have a "Pong" scene which needs a BallMoveSystem.
I might have a "Tetris" scene which needs a BlockPlacementSystem.
I don't want all of them to run all the time.
only depending on the scene which was opened by the user.
You could check for required components to run the system or enable it manually
note this is a simplified example.
the actual problem: for netcode, you may have different interest management.
spatial hashing, distance checks, raycast checks etc.
all need their own system.
but all should not exist at the same time. only one.
- Personally i only have 1 scene so this is never an issue for me (did this pre-dots as well)
- In theory though, there shouldn't be a need to create different systems for difference scenes. in your pong scene the BlockPlacementSystem should never have data to run (though now you need to tell it not to run by default)
- In practice it's somewhat nice to be clean system per scene for certain styles of games, I think dreaming's library has an implementation for this that you might want to look at for inspiration
hm ok, thanks for feedback
systems don't have much overhead. that said, they are auto created by default and they can be created and destroyed as you wish. down to your own bootstrap and update groups
previously I used Bootstrap to search the GameObject scene for "CreateMySystem" MonoBehaviour and if exists, I would create that system.
however, since DOTS 1.0 Bootstrap only finds a "DefaultWorldInitializationProxy" GameObject. nothing else is available during Bootstrap
hm, i don't feel that bootstrap should be reliant on any gameobjects
afaik it runs as one of the first things so probably before scene loading
you can create these systems at any point, it doesn't have to be in the bootstrap
CopyTransformToGameObject authoring gone, how do I sync entity transform to GameObject in 1.0?
there should still be the copy system around that's relying on a companion object
i can't give any info though how that's setup.
you can copy it and edit it to your liking
system is called CompanionGameObjectUpdateTransformSystem
the whole code path for setup seems inaccesible as AddHybridComponent is gone and the CompanionLink class is private
are you aware that the dots hierarchy, even when not open is drastically reducing performance?
i just ran my game (finally) and it was stuttering like crazy! closed the dots hierarchy and all gone
can reproduce the effect when opening the dots hierachy again and hit play again
That sounds like a bug to me; repro would be great if possible, else instructions hopefully? Like how many entities exist / are visible in hierarchy, what does window look like when itโs visible
wait, first you say when not open, but then it goes away when you close it? Confused
ah. So if it exists itโs expensive whether or not itโs visible. Seems like it should be fixable?
i never saw the GameObjectChangeTracker. must be something new. i spawn lots of gameobjects ๐
i wouldn't have caught this bug if i'd have already implemented proper pooling ๐
this bug was certainly not around in 0.51 - i have the dots hierarchy open all the time
๐forwarded
very nice! thanks
how many goโs spawned per frame, ish?
i spawn around 6-10 monsters/GOs per frame
๐
if I want to create an additional entity inside of a baking system do I just use EntityManager.Instantiate? or something else?
kind of not having success creating new entities(in baking systems)
call CreateAdditionalEntity
and use TransformUsageFlags.None if you don't want any transform stuff on it
oh baking system... ๐
i use an ecb for this
...
ecb.Playback(state.EntityManager);```
๐คฉ testing now....
kinda looking like I shouldnt be making entities inside of baking systems and only bakers? DuplicateEntityGuidException: Found 6 EntityGuid components that are shared by more than one Entity
hm, that's weird. not even sure what that means.
and that's just with ecb.CreateEntity?
YES!! It works!!! ECS with GLES 3.1 on medium-low end devices such as my Android 6.0 CAN benefit from ECS graphics rendering performance ๐คฉ๐คฉ๐คฉ
congrats!
that's a very good point, thanks ๐
Awesome! Are you seeing OK performance?
not yet... not for this medium-low-end device... trying to figure out what would be the next best way to optimize, either less geometry or maybe i should try more sub-scenes if the ECS graphics optimizer might do more optimizations with that, or something else...
i'm having another issue which is that this asset plugin Splatmap shader is not SRP batcher compatible, and altho i thought i fixed that for unity editor player - apparently it's not working on the device yet...
still super glad ECS 1.0 brings GLES 3.1 support so that it seems to be able to work at all on these older devices
just need to work around some of these issues and who knows maybe the results will be worthwhile
Gotta figure what is bottleneck
CPU or GPU
Right. Yeah it was a big push getting that working. But you might not see as good perf as you expect as we did not write a completely different data model for GLES. Loading things on a offset is slow on these kind of devices so don't expect super good GPU perf. You should be seeing some better CPU perf than game objects though (hopefully)
ah ok good to know
You might even be slightly slower on GPU than game objects, due to the way that per instance properties are loaded. But that's completely content dependent (For GLES/mobiles that is)
Last time I did stress test in build on windows I ran into gpu bottleneck
bit of a bummer... i was hoping ECS renderer will definitely do better on mobile than gameobjects, if only it supported GLES...
still testing & comparing to find that out...
Yeah, but we can't do magic. How some of these mobile GPUs want the data is pretty much that it needs to be able to preload everything into constants, so no way of reading per instance data or have a persistent GPU state, which is the foundation this tech was built on
I did test it, as I worked on it. And I know it can be slower, but it's highly device dependent. And it should not be that much slower in the general case
supporting 6 yo phones will be pain ๐
this LG G4 i'm testing with seems to have Qualcomm Adreno 418, 600 MHz
Especially that they will be at least 7 yo old by the time you finish game
That will most certainly be slow. I tested mostly on an Adreno 612 and before we moved some data into a global cbuffer it was slower. Now it is about the same as GO on that phone IIRC
We know that more modern devices are handling it better, and we have some potential ways to move forward and making the property loading slightly faster as well
Ngl, hard to see the reason to focus support on such old phones with a game that meant to be graphically intensive
That is my opinion as well. We have limited time, and focusing on this and creating new architecture and systems for it moves resources from somewhere else
๐ค hm
gonna sleep on that, will get back to this (2:20AM here ๐ )
thanks for all the guidance & info ๐
Good night, hope you get it working with reasonable perf ๐ค
I've got a question about the unity jobs system.
Can I do this?
struct TestJob : IJobParallelFor
{
public NativeArray<byte> type;
public void Execute(int index)
{
if (type[index] == 1)
{
if (type[2] == 1) // CAN I DO THIS??
{
// do something
}
}
}```
only if you mark the type NativeArray [ReadOnly]
or turn off safety and promise what you are doing is not breaking threading safety
ok thanks
this seems to be a common complaint
This isn't the issue in my case, since if I log e.g. the collider size during runtime it is correct. However, the physics debug isn't showing any colliders and none of my queries are hitting. Are there any additional components you need to make the build physics world system "recognize" your objects now?
anyone know why Unity.Burst.CompilerServices.Loop.[...] is not found anymore? i have the compiler directive enabled
ok, now I start to hate baking
since it relies on ECS runtime components
whole transform hierarchy is broken
๐
what?
you can't rely on runtime things since you bake the entities at compile time
but that's the way baking system work
you can only query entities
no managed components during baking, unless it's Baker
There is no way to add components to children precisely
you can't figure which entity belongs to what in linked entity group
i don't get it
let's say you have transform hierarchy
in 3 layers
parent, children of parent, children of children
you want to add said component tags according to layer
you can't do that ๐ฅฒ
why not?
how would you do so
get the relation from the Parent Component or Child Buffer respectively?
those are runtime components
they don't exist during baking
they should exist in a BakingSystem
that's strange though. because they are also baked when you close the subscene
yeah, let me try smth
[UpdateAfter(typeof(TransformBakingSystemGroup))] nope
that didn't help
maybe there's like a Parent baking group?
idk, I tried to look for any BakingSystem in IDE
so far that's the only thing I found
[UpdateInGroup(typeof(TransformBakingSystemGroup), OrderLast = true)]
That didn't work either
๐ค
[UpdateInGroup(typeof(PostBakingSystemGroup), OrderLast = true)] that too
๐ฅฒ
feels bad you can't even see the order of baking systems
isn't there UpdateAfter?
I tried both
static void PostprocessBake(World conversionWorld, BakingSettings settings, BakingSystem bakingSystem)
{
using (s_TransformBakingSystemGroup.Auto())
{
var transformBakingSystemGroup = conversionWorld.GetExistingSystemManaged<TransformBakingSystemGroup>();
transformBakingSystemGroup.Update();
}
using (s_BakingSystemGroup.Auto())
{
var bakingSystemGroup = conversionWorld.GetExistingSystemManaged<BakingSystemGroup>();
bakingSystemGroup.Update();
}
bakingSystem.UpdateReferencedEntities();
using (s_LinkedEntityGroup.Auto())
{
var legSystem = conversionWorld.GetOrCreateSystemManaged<LinkedEntityGroupBaking>();
legSystem.Update();
}
Judging by this, transforms should be baked by default when baking system runs
Is there a way to check if a system ran its Update method?
I think something is borked in NetCode + Physics...
You can definitely access transform components because I remove them
welp, doesn't work for me
Are they prefabs?
The one thing I got tricked by was the prefab tag being added
So the Entities don't appear in default queries
You need to do query option include prefab
no
they are certain to be processed
as I get log message
public static NativeArray<Entity> GetAllEntitiesInHierarchy(this EntityManager em, in Entity parent,
Allocator allocator = Allocator.Temp)
{
var list = new NativeList<Entity>(1, allocator);
list.Add(parent);
if (!em.HasComponent<Child>(parent))
{
return list.AsArray();
}
var buffer = em.GetBuffer<Child>(parent);
foreach (var child in buffer)
{
var children = GetAllEntitiesInHierarchy(em, child.Value);
list.AddRange(children);
children.Dispose();
}
return list.AsArray();
}
I do this
and each time it returns lenght 1
meanwhile after baking is over
I feel like baking randomly breaks and doesn't convert some things
Even unity internal stuff
This is the game object:
and this is the baked data:
it seems to randomly work again sometimes after clearing cache
interestingly one of the main issues with one of the asset plugins i'm using is some shaders that were incompatible with SRP batcher due to variables not being declared in the CBUFFER. i thought i fixed that already though - i spent hours finding & moving all those properties from various cginc files into the CBUFFER_START section... it was working fine in the editor player, dunno why on the mobile device it's still rendering pink...
fair point, as well as-
- you too
this is indeed more of a passion project to get more experience in unity etc. sort of aiming to make a kind of benchmark to test the farthest limits of what can be pushed, and i thought it would be a good exercise / proof of concept if I could demonstrate that it is possible to make scenes like these even on medium-low devices from several years back, with potential to maybe eventually make an actual game of this type using this "engine" (optimizations / solutions / techniques i come up with) which does not leave users with older devices in the dark...
i still think this would be an interesting target/goal/challenge to achieve. however - maybe i should open to be convinced to drop this goal... ๐
i was hoping ECS 1.0 graphics renderer with GLES 3.1 just might be the "performance by default" boost that will make it much more possible, however now you're telling me that for these GLES3.1 devices there might not even be that much performance improvement... bit of a bummer.. but ye i get that you guys can't do magic when it comes to all these older devices
i guess the options are 1) keep trying to implement the concept in regular game objects for lower devices (and maybe ECS for higher end devices) 2) keep trying to find good performance with ECS on older devices, but is there any hope for this really?...
Strangely the Parent components seem to exist, but not the Child buffers
Or I'm also missing something
yeah, child are filled by Transform system
at least in runtime
I thought BakingSystem ran after that?
Doesn't this kind of look like the ComponentSystemGroup is updating but none of the systems inside are?
Or is this normal behavior for the system inspector (not showing run duration on the right for some systems?)
Nevermind, the PhysicsSystemGroup showed 0.01 seconds runtime in one frame...
I'm so confused 
IIRC what I saw, there's an option to always display run duration whether it's zero or not
Anyway, regarding your collision query issue, did you see there are new physics groups ?
Yeah, I don't use the actual simulation part though. I just use queries and character controllers
For some reason (as you can see in the above video) the Build physics world system matches 131 queries, but the CollisionWorld has 0 for numbodies, numstaticbodies, and numdynamicbodies
From MB then ? Anyway yeah I dont see something wrong in the code snippet you shared earlier
MB?
from monobehaviour ?
Anyway syntax is the same apart from where you get the singleton from (and GetEntityQuery will be deprecated later but still supposed to work now I assume)
how do you get Entity with SystemAPI.Query?
SystemAPI.Query<>().WithEntityAccess()
Strangely the entity is the last value in the tuple, not the first one
'QueryEnumerableWithEntity<RefRO<StarIndexTemporary>>' does not contain a definition for 'Item2' and no accessible extension method 'Item2' accepting a first argument of type 'QueryEnumerableWithEntity<RefRO<StarIndexTemporary>>' could be found (are you missing a using directive or an assembly reference?)
great
foreach (var aspect in SystemAPI.Query<RefRO<StarIndexTemporary>>().WithEntityAccess())
{
Is StarIndexTemporary an aspect?
Is this in an ISystem or SystemBase?
SystemBase
It might be this limitation, but I'm not 100% sure since it has worked for me and I don't have any ISystem yet:
it's waaaay too large
Is this a runtime or compile error?
seems like compile
Ah, then it's probably because you need to do this:
foreach (var (starIndex, entity) in SystemAPI.Query<RefRO<StarIndexTemporary>>().WithEntityAccess())
hmm?
Deconstruct the iterated tuple
huh
yeah, that works
uh huh
really sadge ngl
that we can't query over game objects anymore
I don't see what's even the point
of doing it Baking way
You can with an entity query right?
hmmm
manual says
that baking systems must not touch managed objects
and instead iterate over entities data only
the way I see it
now I don't only need to create authoring components
I also need temporary components
๐
Why temporary components?
how else would you be able to create a conversion pipeline?
Baker does not allow other entities
Ah you meant to post process after the Baker step?
and BakingSystem has no access to game objects
so the only way to modify entities referenced by initial authoring component
is temporary component
Yeah, I think that is the intended approach. It's how TransformBaking does it
๐ฅฒ I'll miss convenient conversion
I'm pretty sure they'll at least add something similar to [GenerateAuthoringComponent] back in. At that point it would only be the "post-process" system, and the generated authoring component would just be another authoring component