#archived-dots
1 messages ยท Page 59 of 1
If i'm reading this right, this continuously writes the same section of bytes until it succeeds in writing all of it?
@misty wedge I think you were the one who asked about explicit field offset for autoproperties. A bunch of digging later and I figured out how to specify the offset of the field that the property would wrap around: [field: FieldOffset(1)]. Just that "field:" in the attribute will correctly target the actual value to set it's offset.
Yep, I got the same answer from the C# discord ๐ The offset will target the backing field
iirc it's not supported on all platforms though? I might be misremembering though (I checked my conversation there and I think I'm thinking of something else)
Yea. I'm using auto-props to prevent netcode from serializing parts of a input component.
An IInputComponentData?
Yep.
The forced buffer inside the chunk is unfortunate but player entities are so fragmented anyways it doesnt matter.
I still think it's a bit odd you can't specify serialization settings as with other ghost components (with [GhostField])
You can, if you write the serialize deserialize portions. They're like an RPC.
having fun with blobs. my requirement is to reference a blob in a blob array. doesn't seem possible though -.-
maybe i should reference the hash
you can record offsets but yea, doesnt really work with baking
bit clunky, i have conditions where the evaluation can go to another condition. a chain basically
Anyone know why the source generator doesn't like this? Getting
C:\dots2\Packages\com.unity.netcode\Runtime\SourceGenerators\Source~\NetCodeSourceGenerator\Generators\NetCodeSourceGenerator.cs(95,1): error NetCode: Index was out of range. Must be non-negative and less than the size of the collection. (Parameter 'index') at Unity.NetCode.Generators.NetCodeSourceGenerator.Generate(GeneratorExecutionContext executionContext, IDiagnosticReporter diagnostic)
When adding a [GhostComponent(PrefabType = GhostPrefabType.Client)] on a class based IComponentData ๐คทโโ๏ธ
no one can see something obviously wrong here that just breaks netcode right?
before i go make a forum post asking wtf is going on
and why my ghost size is not matching expected
public struct Snapshot
{
public FixedBytes512 Buffer;
}```
Failed to decode ghost 707 of type NetworkPacket(5), got 4242 bits, expected 4247 bits
the asm ref that the component is within must have all the networking references, netcode, collections, mathematics, burst, and networking.transport
took me a few hours to figure that out as that error does not help whatsoever in debugging what netcode wanted
I thought that was it and that I had them all, but I was missing Unity.Networking.Transport
I swear that error message was better in the past
there's a different version when you add a [ghost field] that does tell you that the asmref is missing references but without ghost field, it's extremely vague.
Do IJobParallelForTransform jobs need to run in TransformSystem?
Something is overwriting the value but I don't think it's me
i don't believe so
Weird
I debugged the job and the value being set there is different than what is on the gameobject transform
is it a root gameobject? or child?
Root
i assume something does move the gameobject at some point?
I'm probably messing up the setting logic somehow, I'll check a few things more before wasting your time
By the way, why is this relevant?
probably doesn't matter, i don't think go hbave the whole delayed child updating
is there anyway i can make a certain isystem's OnStartRunning() happen before a certain SystemBase's OnStartRunning()?
only if they are starting on same frame
an updatebefore/updateafter would cause 1 to run before other
but if the trigger to make a system start running happens on different frames no
ooh that gives me a good idea, i could make the systembases OnStartRunning() require a component that will only exist after the isystem has done what it needs to
You need to require the component in OnCreate though, not in OnStartRunning
ok thanks!
(But I guess that's what you already meant)
(ye...)
Is Dispose called automatically on components that implement it?
Wow, that seems to be the case. TIL
Makes having native containers in components so much easier 
only works on managed components as far as i'm aware right?
{
if (obj is IDisposable disposable)
disposable.Dispose();
}```
it's called in ManagedComponentStore
It's also in the docs, guess I must have never read them for managed components
For managed components that reference external resources, it's best practice to implement ICloneable and IDisposable, for example, for a managed component that stores a reference to a ParticleSystem.
i'd like to see a feature that blobs can reference other blobs. it works very fine for entity references to blobassetreference
which seems a lot more complicated to me
Hey everyone. Please remind me, is it thread-safe to change component's fields directly?
Within the job system, you got safety systems ensuring that it's thread safe. Actual C# threads? Ehhhh, it depends.
So, while it's jobs, it's ok?
You'll get errors if it even seems like you're crossing the wires anywhere in your job chain.
But otherwise, yea. It's fine.
Ok, thank you!
@light badger I would like to offer another suggestion, in ProcessCharacterHitDynamics, the condition to execute "processor.OverrideDynamicHitMasses" should be a || check between the two bodies for inverse mass != 0. So long as one mass is not indicated as kinematic through the inverse mass, the override should be called.
@light badger With this change, a kinematic being slowed by pushing a dynamic mass is as simple as this 1 line. Your controller is very flexible and amazing.
A bit of trimming and some manual constants to patch up holes in the solver and I have done it, a 2D top down Rival Character Controller.
Surprisingly very painless. Rival is very well designed.
Being able to slap debugs everywhere throughout actual rival code helps a lot when figuring out what constant I assumed accidentally zeroed out everything.
Huh, rival characters of spheres with radius of 0.5 can not fit in tubes with diameters of 1.
Easy fix, make characters slightly smaller than what they are, 0.495 works.
Why is my game running so slowly? (checks profiler, sees wall of blue) Oh, I turned off burst...
getting this error, and im very confused, as line 67 is a closing curly bracket....
surely there are only so many things in that function that could be using a min and a max
ok yup managed to fix it, still kinda odd that it was giving me the wrong line, perhaps to do with the source gen stuff, or perhaps inconsistent line endings?
Is it ok to create entities in OnCreate? I need my system to initialize a singleton once and not update anymore.
perfectly fine.
Time to throw out my own character controller and use rival then 
I only did basic CCD, and sliding stuff, and I probably still want to add characters pushing dynamic bodies, so at that point I may as well switch to Rival
If I destroy an entity, does it not automatically destroy its child entities?
I've barely used the transform system
It seems to only remove the Parent and PreviousParent components on the child
I'm guessing it's because the child is missing from the parent's LinkedEntityGroup. Do I need to add this manually?
(in addition to adding the Parent component on the child)
That seemed to have worked so I guess that was the issue
it shouldn't
Coming from game objects, that's the intuitive assumption, that's why I was confused
is there a way to query for entities in a job, or a way to run a query and pass in the components?
that's just basic entity query job
I mean other than the ones being iterated over for the job
you use lookups for that
I have a job processing AICharacters, and I want to get all the AITargets
I found EntityQuery.ToComponentArray, is that what would normally be used?
no
It depends on whether or not the AITargets have any kind of connection to the AICharacters or not
you use Lookup
no connection
if you just want them all you can get the component array, otherwise use a lookup
If you want to run it asynchronously there is also ToComponentDataListAsync
(which you would schedule before the job requiring the data, then pass the dependency to the next job)
I don't know the entities the AITargets are on so CompoentLookup isn't much use afaict
don't suggest him bad things ๐
Why? Maybe there's a good reason he needs all of them
nothing wrong with that, depends on what exactly he is trying to do
even if he does, lookup is better
are you trying to make target finding?
yeah
I see
Ideally you'd use some kind of spatial hashing system to more quickly find entities that are "close by"
I did it this way, but no idea whether there's most efficient one:
I made a job that queries for all potential targets and just add them to one big HashMap, while also putting all required data here (position, smth else and etc)
and then I pass that hashmap to jobs that want all targets
and in my case, I have "rooms" which separates targets
as shared comp
so this way I then split hashmap based on room id
If you are extra lazy you can also just e.g. overlap sphere using the physics system and find the correct things by layermask
so target finding has less misses
Anyone ever get this when making a build? UnityEditor.dll assembly is referenced by user code, but this is not allowed.
It doesn't tell me where though for some reason
Building addressables works fine
Is it trying to say you have a reference to UnityEditor when building a standalone player?
in which case you can just search all your asmdef files for unityeditor?
UnityEditor is part of the engine, you don't need to reference it in an asmdef
And since the namespace is automatically missing on build, it should throw a compilation error telling you that namespace doesn't exist
For some reason it's not doing that
yes, but you may be able to directly add an assembly reference
Why? If I add an assembly that references UnityEditor at build time, that reference wouldn't compile either, since it is referencing something that doesn't exist
Unless you mean a precompiled assembly from unity itself
editor assemblies would have to reference it when being built so I thought maybe you could trick it by adding it as an override reference, but it looks like unity just removes the reference
so I have this:
var targets = _targetQuery.ToEntityArray(Allocator.TempJob);
var job = new AIControllerJob
{
PhysicsWorld = SystemAPI.GetSingleton<PhysicsWorldSingleton>().PhysicsWorld,
WorldTransformLookup = SystemAPI.GetComponentLookup<WorldTransform>(true),
Targets = targets
};
job.ScheduleParallel();
but I can't figure out how to set up the job to dispose the array after
targets.Dispose(jobHandle);
sorry, this is an ISystem, I don't seem to have JobHandle
and ScheduleParallel returns void
you have
just pass state.Dependency
as paramter
you are using codegen overload
which assigns dependency in code gened version
targets.Dispose(state.Dependency); ?
no
The scheduleparallel(state.Dependency)
or yes, but only after scheduling main job
The ScheduleXXX functions return the new dependency if you pass in an explicit dependency
var jobHandle = job.ScheduleParallel(state.Dependency);
targets.Dispose(jobHandle);
yeah, but then assign state.Dependency to jobHandle returned by Dispose method
or assign main job handle to state dependency
It's probably not important in this case is it?
not much difference actually
Since disposing the collection isn't a requirement for code after that to run
he is not assigning main job to dependency
this way
Ah yeah, the jobHandle
it's so annoying that I read a bunch of stuff on how to do something with dots then realise it's all out of date
If you are working in an ISystem I recommend just schedule everything with state.Dependency = job.ScheduleXXX(state.Dependency)
Unless you actually want multiple jobs to run in parallel
I like being explicit like that anyway
Yeah I'm also not a huge fan of the "automatic" dependency handling
it's fine
in small systems it reduces boilerplate
after we get default interface C# feature
our ISystem will look very short
I know, I'm just saying not by a huge amount ๐
and etc
compared to e.g. the SystemAPI codegen for ComponentTypeHandle
the problem is it's hidden using magic, you can't go to code for ScheduleParallel to see what it's doing
you can
You can check the code-gened system
just lookup what another partial declaration of your type looks like
this will give you actual code that will run
I get public global::Unity.Jobs.JobHandle ScheduleParallel(global::Unity.Jobs.JobHandle dependsOn) => __ThrowCodeGenException();
don't inspect method
If you search for the ISystem struct name you should get something like this
The bottom one is the code generated one
yeah that is from the codegen
This is the method used in the code generated struct
It's the actual method being called at runtime
Not the "mock" method used for code generation
yeah, that's the problem, I can't just go to definition
You need to inspect the method in the code generated file
yeah, and there's just an Execute function and __ThrowCodeGenException() for everything else
then you are still looking at smth wrong
besides
Execute function
is from job
and is probably your Execute method
well I call job.ScheduleParallel(state.Dependency); so the function I'm taken to is on the job
you should have a system type declaration which is codegened
which contains
OnUpdate method
Is wanting to spawn multiple entities from one gameobject a valid use case for using Baking systems?
I implement OnUpdate, remember this is an ISystem
it doesn't really matter, it'll probably change again later anyway :p
hold up
try to remove codegen part
temporarily
I feel like
because you don't use any codegen features
it's not generated
or easier
just add any SystemAPI call
like time
and just assign it to unused var
this will generate OnUpdate for you
and you will be able to inspect how it looks
I'm already using SystemAPI in my OnUpdate
then you 100% should have codegened OnUpdate
well it's just not showing up in visual studio then
Doesn't show in intellisense either
anyone else has domain reload problems? i need to restart the editor quite often because of it.
this is where its stuck
should be disabled at all
it will only trigger on recompile
yes i have it disabled in enterplaymodeoptions. im talking about recompiling
no idea then
Anyone used MaterialPropertyOverride?
I made this override through asset
and while it works while subscene open
it doesn't closed mode
in play mode it looks like this
or more like, override is ignored completely
@rotund token sir? Any thoughts on this?
So for some reason this happens when upgrading burst from 1.7.4 to 1.8.2
no idea why
have you tried just looking for all Editor references in your runtime project?
I don't see what that has to do with the burst version?
I don't think burst is related at all tbh
maybe some kind of burst type has been moved to editor
Then that compiling assembly would fail compilation, since the editor types are stripped
For some reason it's not giving me an error message of what is referencing the dll
Really weird, no idea how I can debug this
0 messages saying what is going on
@rotund token had some weird things going on with burst. somehow functionpointers got scrambled. Burst was calling wrong functions. i dont remember the details. maybe somehow an editor function is called like that?
Burst 1.8.0 also doesn't work, so it has to be a change between 1.7.4 and 1.8.0
have you tried full reimport inbetween?
Ill try deleting the library folder on 1.8.2 and see if that helps
Nope, still doesn't work
really weird, it fails pretty far into the build, on Running Backend
This is after my scripts have already compiled afaik
Not sure if I should make a forum post about this, I can't find anything online
My thought is I get this multiple times a day
I haven't used this feature recently and TIL there's a handy asset for it now
But my best guess is the Shader is not setup for it properly
yeah, and it only works with opened subscene
idk about, shader considering BRG sees it as compatible and even draws stuff
If you want a copy of my hacked together rival controller, i can give ya the entire library. Do note I have not tested the controller out fully and it does require 1 line change in actual rival package to enable the kinematic behavior I want.
I'd definitely like to take a look at it if you are willing to share!
I looked at rival a little bit and used some of the concepts there to hack together my own janky controller, but a lot of it went over my head
Actually, the controller is one file
Was rival updated in 1.0 to use aspects?
Ah cool, didn't know
The whole thing is now just a single aspect. It's really neat.
Maybe I'll take a look at it again
And thanks to aspects, the physics character update is just this```csharp
[BurstCompile]
[WithAll(typeof(Simulate))]
private partial struct CharacterPhysicsUpdateJob : IJobEntity
{
public CharContext Context;
public KinematicCharacterUpdateContext BaseContext;
private void Execute(ref CharAspect characterAspect)
{
BaseContext.EnsureCreationOfTmpCollections();
characterAspect.PhysicsUpdate(ref Context, ref BaseContext);
}
}```
The only half complete implementation I still have on the character controller is moving platforms. I'll need to do some custom physics querying to figure out how to do it and ehhh, i dont have any moving platforms to test anyways
@rotund token have you had any issues building mono and il2cpp on burst 1.8.2?
I've changed the prefab i'm spawning to something that actually looks better but now I'm getting
A BatchDrawCommand is using a pass from the shader "Unlit/Transparent" that is not SRP Batcher compatible. Reason: "Material property is found in another cbuffer than "UnityPerMaterial"" (_MainTex_ST) This is not supported when rendering with a BatchRendererGroup (or Entities Graphics). MaterialID (0x5) MeshID (0x3) BatchID (0x1) UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
It renders fine as a normal GameObject
I'm guessing the shader is not SRP batcher compatible. If you select it in the editor it tells you
@robust scaffold you ever have a weird issue in netcode in builds where an RPC is just not send? I swear I had it previously but I forgot what the issue was
No? I have had a few times where I use IComponentData instead of IRpcCommand but otherwise it works fine.
The shader is URP/Toon, my project is URP too, not sure why SRP is a problem
It works fine in the editor
URP default shaders are not SRP batchable until 2023. Entity Rendering requires srp batchable.
If that's on the client, you dont need to specify target connection. Furthermore, no clue.
No, that's sent on the server
it requires even more
it requires dots instancing code as well
I have dived into learning how to do it
The player joins, sends an RPC, the server receives it and checks if the player has a player entity in the world, and if not, sends an RPC to request character creation
Yea, it's annoying. I just run my own custom renderer.
not annoying
it was very easy to implement
If the client -> server rpc works, why wouldn't server -> client
I'm fine considering perfomance gains and fully burstable overrides
I have no idea
but holy shit, they just don't work
Kinda regretting going with ECS right now lol
it's called preview for a reason
lul
Heh, it's practically still pre-alpha.
Yeah... >_>
there is this guy
who made ecs system for C#
which is very similiar to unity one
it's called Arch
well first animations and now just rendering prefabs.... I wanted to make it look nicer to feel like things were coming together, but I guess I just have to wait on it.
I want to try it
for some small project
maybe until we get proper instruments that's the way
but I hope I can fix material overrides
and start working on sprite renderer
Not that I'm aware
Weird, I get this error both in mono and il2cpp: UnityEditor.dll assembly is referenced by user code, but this is not allowed.
1.7.4 works fine
1.8.0 is also broken with the same error
Guess I'll make a forum post and hope someone responds ๐คทโโ๏ธ
Well, sadly, i've tried everything i can think of to make physics Motors emulate what config joint Drive does, and have to conclude it's not workable
yep, dots has brought only disappointment lately
Aren't we a set of positive people today!
I'll be happy if my builds work again 
For some reason the client scene isn't loading in the build, and the character creation system requires it
Why the scene isn't loading in the build? I have no idea
Yeah, I have a component in the scene, and the system requires it
Loading the scene?
Yes
Or what do you mean by open
Sec
Haven't touched this in ages, it used to work though
It definitely works in the editor though, not sure what the issue in the build is. Like I said, this also used to work in a build at some point
Seems fine
Maybe I should read
What does that even mean though? This is a gameobject I'm referencing in a baker
referencing a prefab but not baked?
It's baked to an entity with GetEntity
I'm not using it for anything atm, I'm gonna try and remove it
that error seems to imply the subscene thinks there is a gameobject reference not a converted entity
Just tried build testing my project: Works with burst 1.8.2 using mono.
The error message is so strange
I'm not using any pooling so I dont know
No, that has nothing to do with the build error
That's in a working build
With burst 1.8.2, I can't build anymore, it fails at the end
The only error message is: UnityEditor.dll assembly is referenced by user code, but this is not allowed.
It works fine in 1.7.4
Fails for mono and il2cpp
I'm not sure what else I can try
Oh wait, unity editor. Yea, that's not allowed in build
I thought it said unity engine and then you might have a problem. Unity editor assembly is not allowed in build.
But how can that be the issue when the user code is the same
The only change is switching burst version
you have to use compiler conditionals. I dont know why it was allowed in burst in the first place.
#if UNITY_EDITOR and whatnot. Including around the using UnityEditor;
Burst allowed editor code before?
Shouldn't have. They might have included a test for it in the most recent burst versions. Either way, it shouldnt be allowed.
I don't understand how my code is even compiling then
The UnityEditor assemblies are stripped, so the code should fail to compile at all
It could be compiling and then silently failing inside build. If your code doesnt touch editor, then it would be fine to silently fail but you should always have the conditional around any reference touching the editor in the first place.
It's an easy enough fix, just slap the if check around all editor functions
Gotta find them first ๐
It's weird that it isn't telling me where the issue is
But I guess it has to be inside burst somewhere or something?
inside a bursted system probably.
Can I disable burst completely? Maybe then I'll get an error message
@misty wedge where do your bakers exist
In which assembly?
yes
The runtime one, I haven't moved them yet
(or I should say, they are in a runtime assembly)
this is so weird. testing rival, open subscene -> InvalidOperationException: GetSingleton<FixedTickSystem+Singleton>() requires that exactly one FixedTickSystem+Singleton exist that match this query, but there are 0. closed subscene. everything's fine
also wondering why even new assets use the old input system ^^
In rival's case, it's just because it makes one less package to depend on. New input system is used in the samples though
ok makes sense. it's so weird that the new input system can be activated but then it needs a package.
would be nice in like unity 2024 or something the old system is just replaced
weird as a new user to just get this old system and think that's what you should be using
new system could just be included as a default package
agreed, more than enough time has passed to force the new input system by now. old input system is really OLD ๐
and a pain for anything more than a quick prototype
you can use the new system in a similar hacky way for testing anyway, like
Keyboard.current.spaceKey.wasPressedThisFrame
etc
without having to setup bindings/actions etc
that's what i have been using mostly. now i'm setting up action maps
but yeah, that's very close to the old input system
i dont understand why there are some super legacy things being held on to like reserved rigidbody and animator etc fields in monobehaviour as backwards compat stuff, but if you actually updated a project back from unity 4 or 5 or whatever they are from, theres bascally zero chance it would actually update without errors. makes sense to drop the old input system as well at this point but there are other worse offenders
because people don't upgrade that many versions at once
they upgrade 1 at a time
and fix as they go
there are plenty of unity games built in unity 5 that still get regular updates that would have slowly upgraded their version as they come to end of life
(hearthstone)
yeah, we've upgraded 1 version at a time, tried to fix all the errors in that version, did some tests, then proceeded to the next one.
trying to leap over multiple versions only made it a big mess that ultimately we'd had to reset to the original state.
alas, at least I have some experience using many Unity versions so I know what should change in that specific version.
along the way I also did many refactoring changes so I can say that it wouldn't be a simple task.
makes sense to drop the old input system as well at this point but there are other worse offenders
disagree. we still use the old input for various reasons.
that would explain keeping those reserved fields around for a few editor versions, but keeping it now kinda runs contrary to the 1 editor version at a time though doesnt it?
At every upgrade you would see many warnings about deprecated APIs. Just fix them too and it would be fine.
I fixed most warnings and all errors, in the end everything goes smoothly.
Compared to the previous attempts (jump over multiple versions), this time I feel very confident about the result.
no but this annoys me ๐
checked the manual, its back from unity 5 days, its like a 7 year old upgrade warning at this point
Try to live with that. It annoys me at first too but it just a small thing for me. I can just rename my fields.
Btw, I've built a good convention for my company and a companion .editorconfig to enforce the convention.
i dont even use monobehaviours much now except for authoring components but keeping it around is just endemic to other areas unity keeps a lot of baggage around for that really fractures the sort of onboarding experience you have with the product
Well, I just forget about all of them. I suggest you the same too. Just focus on things that are really important. I don't have much time to spare for little details.
you can ignore whatever you want, ill continue to whinge about things I dislike, squeaky wheel gets the grease and all that, or not but I feel better venting
Hey everyone. Experiencing something weird here. I'm calling the SystemAPI method and it throws an exception:
No suitable code replacement generated, this is either due to generators failing, or lack of support in your current context
I went inside the method and it looks like this:
How is it supposed to work?
i get the same error message when ujsing SystemAPI.HasComponent in systembase
so i guess some missing cases
odd
using it inside a query/job or something?
we'd need to see your context @stiff mesa of where you're using it
reported just waiting to hear back
used inside of EFE instead of HasComponent but switched back(obviously)
I indeed use it in a different class, called inside a system. I use this method to add some code re-usability. Can I fix this by passing SystemState in?
often yes
though it usually gives an error that it requires systemstate
so it's odd it's not saying that
Hm... How do you usually avoid boilerplate code? So far my main problem with DOTS is I have to write A LOT of code multiple times.
the vast majority of code i need to re-use is from jobs
not from systems
so i just write little helper structs
and even when it's a system, i again just write helper structs
and just do it without systemapi
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
[UpdateInGroup(typeof(LateSimulationSystemGroup))]
public partial struct CameraStateSystem : ISystem, ISystemStartStop
{
private StateModel impl;
[BurstCompile]
public void OnStartRunning(ref SystemState state)
{
this.impl = new StateModel(ref state, ComponentType.ReadWrite<CameraState>(), ComponentType.ReadWrite<CameraStatePrevious>());
}
public void OnStopRunning(ref SystemState state)
{
this.impl.Dispose();
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var bufferSystem = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>();
this.impl.Update(ref state, bufferSystem.CreateCommandBuffer(state.WorldUnmanaged).AsParallelWriter());
}```
for example
That looks somewhat similar to what I'm trying to do. I probably just doing it wrong.
thank god for ICollector. now one can write proper collectors and i don't have to postprocess raycast hits with checks like (hit.point != Vector3.zero || hit.normal != -targetDir) && (hit.point != Vector3.zero && hit.normal != Vector3.zero)
lol, the wrench in the machine. uhm, how should i handle this? ๐
Use .Equals to compare two float3's. Or math.all on the bool3, but I doubt that's the best way. math.any(hit.Position) is also a fine way of asking if it's not 0
InvalidOperationException: Entity Entity(72:1) doesn't belong to the current authoring component. is it just expected to have to workaround not being able to add components to other 'GameobjectsWhichWillBeBakedIntoEntities' on your baker and require using a BakingSystem to get around it?
what happens if you legit hit at 0,0,0 ๐ค
like a hierachical gameobject, cant add ICD to a child with the root baker, only via a baking system?
thanks! math.all seems reasonable.
yes you can't add cross baker and i assume it's very intentional for incremental baking
how do you incrementally bake a single entity if its touching other entities
its hard to break out of the mentality from the old conversion systems/interface ๐ฆ
this has bit me as well but it does make sense and is conceptually quite nice
tbh, i have to evaluate raycast hits validity in unity.physics. with the builtin system, this check is really the only way to get rid of bogus hits. a valid hit at 0/0/0 would be a collateral mistake ๐
best case would be that i don't have to check for 0 positions because they are filtered before hand
how are you getting bogus hits?
it's interesting because we've actually had a lot of edge cases of things breaking at exactly 0,0,0
we catch them because our dev scene starts at 0,0,0 but they rarely rarely popup in the build since you aren't usually at 0,0,0
im wondering if i just make 0,0,0 not valid in a future project
make world from 1,1,1 ->
rival uses math.dot(hit.SurfaceNormal, _cameraDirection) < 0f to check for valid hits. cinemachine also uses the same check as i posted above
the hits are mostly edge cases when using sphere casts and the hit is inside. always result in 0/0/0 position
took me a long time to get rid of all the quirks in my asset.
nowadays they are mostly documented
also can I use idiomatic foreach with structural changes? i dont see that With option
only on very specific operations which i forget which are
i think only things that don't affect the current queries chunks
just use a local ecb
but its planned for later? can use ecbs for now
dont need to use ecbs
just create your own ecb and pass it in and play it back after
imo better than structural changes anyway
i mean entitycommandbuffers not buffersystems
dont have to worry about buffers being invalidated etc
its like 3 extra lines of code sandwiching the foreach, so ugly! ๐
so is entitymanager in isystem though!
yeah but it's also faster than with structural changes
you dont have to duplicate all your data
man, this looks worse than a dot product ```private static bool IsValidRayCastHit(ColliderCastHit hit, float3 targetDir)
{
var check1 = math.all(hit.Position != float3.zero) || math.all(hit.SurfaceNormal != -targetDir);
var check2 = math.all(hit.Position != float3.zero) && math.all(hit.SurfaceNormal != float3.zero);
return check1 && check2;
}```
why not just use equals?
yeah, i should
Equals or any on something you want to check isn't 0 were the suggestions I was recommending
anyway switching gears: for an animated character in dots and their rigidbodies/colliders, do you guys think they should reside on the actual converted bone hierarchy, or should an extra ragdoll setup be created in tandem?
im trying to figure out whats best for my setup as well as what unity intends as the best practice moving forward. I envision alot of extra busy workarounds to do the dual ragdoll + hierarchy setup since baking and accessing so many sub entities is a bit painful.
i can't comment much on it. whatever reduces the most amount of random access and lookups is preferable
return math.all(((hit.Position != float3.zero) | (hit.SurfaceNormal != -targetDir)) &
((hit.Position != float3.zero) & (hit.SurfaceNormal != float3.zero)));```
& | work with bool3
ah nice, thanks tertle
(check my logic =D)
but i think doing them separate and the final all check at end should be equiv
i'm far away to test anything. only have ported like 20% ๐
what are you changing?!
Anyone have a recommendation on how to pause the FixedStepSimulationSystemGroup? When I set FixedStepSimulationSystemGroup.Enabled to false, it pauses just fine. But when I set the Enabled property back to true, it looks like the FixedStep group updates continuously until it has caught back up with elapsed time, which makes sense in a weird way. Code here: https://gdl.space/iwinovorok.cs
porting my third person camera to dots.
exciting
seems to be working as intended
you'd have to pause the whole game not just that group
i think you have to manually patch the time to prevent this
seems like a very common use case maybe someone else can tell you how it's done
Yeah, that's what I was afraid of.
That's what I was hoping. I want to pause my Physics and some specific Game Logic systems, but keep my UI and other misc Systems running.
there are 2 time entities. MostRecentFixedTime and WorldTime. it's worth a try to set the elapsed time from WorldTime to MostRecentFixedTime once you unpause
you can usually just pause simulation group
because your UI etc should be in presentation
true that, it's probably for the best to setup proper groups
at least this is how I think you should handle this - i very specifically set up my groups in my project from the start thinking about pausing (caused us issues in current game)
it's very ideal to just be able to disable your simulation to pause
even just for testing
pause game, fly around with 3rd person camera or toggle debug settings on UI etc
Makes sense. Was planning on using the default groups, looks like I just didn't think it all the way through.
Looks like the SimulationSystemGroup doesn't have a Timestep property to speed up or slow down I'll poke around the documentation more tomorrow.
it's controlled by world time
did anyone else miss the RegisterBinding attribute? super useful for feedback from authoring
Sets a monobehavior field to a value in a runtime component for feedback without having to switch to runtime data inspector
well this is fun
unity logged me out of my account on hub
now won't let me log back in
so i can't open unity
That sucks
reason "Query parameter is invalid. Failed to get current clientId unity_hub"
what does hta teven mean
literally can't sign in to https://unity.com/user/login
[Resolved] Service is back up.
[Issue] According to our monitoring system this service has become unresponsive, weโre investigating.
[Resolved] Service is back up.
[Issue] According to our monitoring system this service has become unresponsive, weโre investigating.
[Resolved] Service is back up.
was great timing 45min before cutoff for candidate build for launch is due ๐
wha
wha indeed ๐ฆ
stress
ok less work thinking, more personal project thinking
anyone got a good solution to changing ghost owners?
as far as i'm aware this is not supported by netcode atm (though maybe this is outdated, i can't find a source in last year) and it's kind of a big sticking point for me atm
to the point if i can't solve it, i'll just have to settle on not having owner prediction and make everything interpolated...
no prediction, while not a deal breaking in click to move style game, will still be a much less nice user experience
Is there a way to see all the baking systems?
Anyone know if there are some issues with referenced entity prefabs not getting run through baking systems?
hmm you could break point during baking to see whats in the group
not sure of an alternative atm
On this note, anyone can see if they spot anything wrong with this code?
https://pastebin.com/YFEthbcg The spawned entity does not get the debug value of 666 from what I see in the entity hierarchy. Am I missing something?
How do i go about getting access to the shared RenderMeshArray, i've naively tried this:
it's useless for runtime
this array is only required to free resources once entities are unloaded
or for loading resources properly
during subscene load
what do you want anyway?
Hmm, I'm collecting nav mesh sources at runtime and require the mesh of each entity that is tagged for collection in order to add it to the nav mesh build sources list
Converting this from 0.51 to 1.0
So I dont have access to RenderMesh component any more
So previously, i had this:
so you can see the NavMeshBuildSource requires a reference to the mesh to be passed in
the navmesh api later uses that buildSources list to update/build the navmesh
So i'm just trying to figure out, how to do the same thing, assuming using MaterialMeshInfo, now that RenderMesh is gone
you will need to obtain BRG from private field
in graphics system
and then
collect all meshes through mesh index
on your entities
Yeah, reflection as per the bottom of this thread:
https://forum.unity.com/threads/rendermesharray-getmesh-materialmeshinfo-returns-null-why.1359493/
Surely not
ah, there is GetMesh even
I just obtained BRG reference
in OnCreate
and then used it's public methods
du have an example of how you did this?
same reflection, but GetField
of BatchRendererGroup instance
and then it's pretty straightforward
well, my way is more efficient
because I only use it in OnCreate
otherwise you'll need to modify package
yeahhhh.. i'm assuming they're going to make this easier ๐
Hmm the brg field is returning null, am i doing anything obviously wrong here:
ah damnit
i just realised, type is wrong
so what is the best Unity version to use with DOTS 1.0?
you'd think with a history of modding i wouldn't make such mistakes
well i'm getting regular crashes with 2022.2.1f1 but others aren't experiencing this ๐คท
hmm is it viable to just go straight to the 2023.1.0a24 alpha?
Hello! So I'm following some sort of a tutorial and in there they did
BuildPhysicsWorld buildPhysicsWorld = World.DefaultGameObjectInjectionWorld.GetExistingSystem<BuildPhysicsWorld>();
But I'm getting the error:
Cannot implicitly convert type 'Unity.Entities.SystemHandle' to 'Unity.Physics.Systems.BuildPhysicsWorld'
Anyone know why?
just change the BuildPhysicsWorld type to var for a quick fix
Yup but then If I try to do
((BuildPhysicsWorld)buildPhysicsWorld).
I get the same error
:/
that's because you can't convert between the types
I don't what tutorial your using but maybe its out of date or something
Yup just saw that its 2 years old
I just wanna do an overlapshpere to find Entities and apply force to them, don't know where to start cannot find much information for it
GetSingleton<PhysicsWorldSingleton>().PhysicsWorld.CollisionWorld.OverlapShere
ideally pass the CollisionWorld to a job and do the overlap tests there
Anyone have an idea what is going on here?
I have a baked component where I am baking a reference to a VisualTreeAsset for use in a UI system.
In editor the baked components looks like this:
As you can see the CharacterCreationTemplate has the asset correctly baked, and everything works in the editor
However, in a build, that reference is null
This used to work, as this code is relatively (a few months) old, so I'm not sure why it broke now
The other values on the baked component are properly set. However the 2 VisualTreeAssets are null
I have another system that also reads a VisualTreeAsset from a baked component, that asset is also null.
I don't think anyone here has tried dots with 2023
doubt
but you can try and let us know how it went ๐
Maybe not ๐คจ
pretty sure 2023 is not compatible. otherwise there woukd have been a mention
0.17 was compatible with so many versions but that was before unity played around with the asset importer and caused all of the problems seen today
Something is really broken with scene loading / baking for me
Replacing the direct VisualTreeAsset with a WeakObjectReference<VisualTreeAsset> now throws this error
InvalidOperationException: Operation is not valid due to the current state of the object.
Error when processing 'AsyncLoadSceneJob(StreamingAssets/EntityScenes/6086a43b86fc4d648a3ce1d94c0b822a.0.entities)': Operation is not valid due to the current state of the object.
I'm just gonna start loading it via addressables, but it's pretty annoying
What have you done ๐ฌ
Can you show the baking code for this quickly
Does it use dependson? (don't actually know if this matters)
I don't even know what that is
I tried changing it to WeakObjectReference, which also didn't work, then I changed it to AssetReference (AssetReferenceT can't be baked since it is missing a default constructor) then gave me the "type missing in typecache error".
I've now resorted to just loading the VisualTreeAsset using addressables with a string directly, that works
DependsOn adds a dependency to an asset in a baker
Yes
๐
that's probably why my VisualAssets didn't work in build
only 1 did for some reason
everything else was null
The baker should detect changes and rebake if it changes
Is this new? I swear I built in 1.0 without using this
I mean the DependsOn thing
Been there since the start
Weird. Then I have no idea why this used to work
As I said here though I don't know if it matters or not for builds
I made a build after upgrading everything to bakers iirc
What is it used for then?
If not for builds
It's used to tell baking that it has a dependency on this
To rebake if the asset changes
Ah, I see
It's worth a test for a build though
Yep, already on it
To me it seems like unity is just striping the asset from the build because it doesn't think it's used
Yep
Interestingly enough the Sprite reference is there, but for some reason I have marked that as addressable, so that's why I'm assuming it works
if(InputManager.main.Input.Player.Mouse.IsPressed())
{
GameObject player = GameObject.Find("Player");
float3 overlapPosition = (float3) player.transform.position + (float3) player.transform.forward;
var hits = new NativeList<DistanceHit>(100, Allocator.Temp);
if(GetSingleton<PhysicsWorldSingleton>().PhysicsWorld.CollisionWorld.OverlapSphere(overlapPosition, 1f, ref hits,
new CollisionFilter{
BelongsTo = ~0u,
CollidesWith = ~0u,
GroupIndex = 0,
}))
{
foreach(DistanceHit hit in hits)
{
if(HasComponent<PhysicsVelocity>(hit.Entity))
{
var forceVector = (float3) player.transform.forward * forceAmount * SystemAPI.Time.DeltaTime;
PhysicsVelocity physicsVelocity = GetComponent<PhysicsVelocity>(hit.Entity);
PhysicsMass physicsMass = GetComponent<PhysicsMass>(hit.Entity);
physicsVelocity.ApplyAngularImpulse(physicsMass, forceVector);
Debug.Log("hit");
}
}
}
}
So for some reason I'm getting spammed with the message "hit" whenever I'm close to an Entity but it doesn't move at all? The force doesn't get applied?
You haven't written it back to the component
You are only applying it to the local copy
Remember components are structs
Hmm how would I do that? I'm watching some tutorials and I'm really confused about it xD First time dealing with DOTS
SetComponent(hit.entity, physicsvelocity)
You've basically done this
int x = class.value
x += 3
???
class.value = x
Would be required
@rotund token nope, still null ๐คทโโ๏ธ
Rip
No idea, you and issue both have problems with this
I just have a single array of all my VisualTreeAssets and never had a problem
Maybe it's having a second field is issue ๐คทโโ๏ธ
Are you building with a build config or just straight from the file menu?
ah, i thought was the preferred way especially with dots
i think i had some issue previously that forced me to use build config with a dots project
that was back in pre 1.0 days though
it was required in 0.51 for subscenes
but they didn't have resources to support it anymore so in 1.0 it should all be done via old build pipeline
ah ok, good to know
another transient unity thing
maybe worth a spin with build config in Schnozzle's case if still available, in the off chance it avoids whatever thing is causing it to not include that asset
i'm pretty sure you can't even use them anymore
ahh
File menu
It also won't let me load a gameobject. I get this error when attempting to load the scene:
Error when processing 'AsyncLoadSceneJob(/StreamingAssets/EntityScenes/6086a43b86fc4d648a3ce1d94c0b822a.0.entities)': The given key 'PoolStaticSpriteWithRemap (UnityEngine.GameObject)' was not present in the dictionary.
I can't even bake a buffer of only entity references to game objects for some reason anymore, this is really strange...
Nope
I don't even understand why it's looking for the game object in the error message
It's baking the entity using GetEntity
This is incredibly annoying, since I can't even convert the game object anymore. With runtime conversion gone it basically blocks me from using this prefab at all
I can't even load this using addressables
I get this error before even attempting to load the scene
KeyNotFoundException: The given key 'PoolStaticSpriteWithRemap (UnityEngine.GameObject)' was not present in the dictionary.
at System.Collections.Generic.Dictionary`2[TKey,TValue].get_Item (TKey key) [0x0001e] in <8f06425e63004caf99a79845675f751e>:0
at Unity.Scenes.SerializeUtilityHybrid.DeserializeObjectReferences (Unity.Scenes.ReferencedUnityObjects objRefs, UnityEngine.Object[]& objectReferences) [0x000b2] in <186d582aad224082a9094c15d05052cf>:0
at Unity.Scenes.AsyncLoadSceneOperation.ScheduleSceneRead () [0x00026] in <186d582aad224082a9094c15d05052cf>:0
at Unity.Scenes.AsyncLoadSceneOperation.UpdateAsync () [0x00187] in <186d582aad224082a9094c15d05052cf>:0
This is in build right
I think I'm just going to give up on building for now, as annoying as that is
Not editor
Yes
In the entity hierarchy in the inspector everything looks correct
(for the subscene)
Did you say you've cleared your library artifacts
It's as if it isn't including any UnityEngine.Object references used by my baked entities
I haven't yet, I'm gonna do that next
the thing is it shouldn't be including the gameobject reference
if you say it's only used for conversion
Unity.Scenes.SerializeUtilityHybrid.DeserializeObjectReferences
it's going through hybrid deserialization which implies it's trying to access the actual gameobject reference
The baked entity has a component on it that references it, I forgot about it earlier
So it should be including it
wait so you are referencing the gameobject
yes
that kind of changes the story!
is this gameobject a prefab refernce
or a reference to another gameobject in the scene
It's a prefab
is this prefab also converted to an entity?
maybe!
can you test
duplicating the gameobjects
reference the one that isn't being converted
(why are you even referencing the gameobject that was converted to an entity?)
I spawn the entity which spawns itself as a game object
I was just too lazy to make a second prefab
Still trying to figure out if this is a dots bug or me missing something?
i don't see anything obviously wrong
is this the runtime value in your screenshot? (as in you're playing game and looking at entity)
Yes
Putting the entity manually in the subscene makes that entity be run through the baker. Just that the spawned entity through the prefab entity does not.
ohb
yeah ok
is this a prefab?
yeah queries by default don't include prefabs
entityqueryoptions has options for prefab, disabled, systems etc
foreach (var dummyData in SystemAPI.Query<RefRW<DummyData>>().WithOptions(EntityQueryOptions.IncludePrefab))```
you need that
Still doesn't work
I'm going to go insane
I wish I could just tell the baking system to include the gameobject manually if it can't pick up on this automatically
Now what are EntityQueryOptions.IncludeDisabledEntities?
Try to repro in empty project
I have similar bug
could be internal unity problem
Disabled component
Did you manage to reproduce it?
Didn't try yet, I'll try it tomorrow ig
Let me know if you manage to reproduce it
I don't understand why it works for other game objects
Thanks ๐ Is this used for some internal unity purpose when loading or something or free to use where one see fit?
you can use Disabled on anything
Prefab and Disabled are just 2 built in components of entities
That will not appear in queries by default (as you would not want that)
would i be right in saying - why would you expect the baked scene data to hold onto a reference to a gameobject asset when the whole point is to create a self contained streamable piece of data for runtime..
Because the baked entity has a component on it that references said game object
yeah i get that
i wonder if for example you had the gameobject referenced inside a scriptable or something like that, and create a reference to that GameObject field in the scriptable for your component but use a separate GetEntity for the prefab conversion
The game object is also marked as an addressable, so it's definitely included in the build
The issue is the lookup for it is missing in the scene data
I even tried also adding a component to the main scene that references it to force unity to include it in the build, also doesn't work
Can you have class components in an aspect?
hmm
things marked as addressable are not included in the build
they're included as addressable
Like I mentioned I also tried adding a reference to it to the scene
Also didn't work
yeah but is it still in addressables?
Both
It's not an addressable reference, it was a direct reference to the game object prefab
yes but is it being stored in addressables
Sure, I assume it would be stored in both
i don't believe so
Really? Does unity load the object on scene load from addressables then?
hmm just made a build
might have same issues
if so i believe this would be tied to 2022.2.X
because this worked in beta
Yes, the code that is breaking for me has worked for ages
(at least the VisualTreeAsset stuff, the other thing breaking I wrote a few days ago)
this error is from inputactions
I didn't get a stacktrace iirc
this.inputEntity = SystemAPI.GetSingletonEntity<InputBuild>();
input.Select1.action.started += this.OnSelect1Started;```
null on that bottom line
i'm getting stack traces
Oh, I thought you meant the josephs line
So a baked input action asset is null for you?
yes
Seems similar to the VisualTreeAsset being null.
but i have some other issues first
I have no idea why my Sprite object is being included in the build though, since that's also a UnityEngine.Object
ArgumentException: Type BovineLabs.NavMesh.Debug.NavMeshDrawSystem couldn't be found in the SystemRegistry. (This is likely a bug in an ILPostprocessor.)
a bunch of my systems just don't seem to exist
epic
I feel like I also had some issues with the incremental build pipeline sometimes not building correctly
switching build folder then seemed to do a proper rebuild and work
good point
this was a mono though
but it was on an existing folder
that was like 4 weeks old
I was also on mono when I had issues
It would build super fast but seem to not include some changes I made
like 5 seconds build
Also something strange I ran into recently: does IsEmptyIgnoreFilter not work with managed components?
It was saying false, but the entity array from ToEntityArray had length 0
hmm should work fine
Weird
toentityarray doesn't ignore filters i don't think
so IsEmpty should match ToEntityArray
sure you didn't have a filter on your query?
enabled components
None of those either
no idea then
Eugh I list my code style settings when I was trying to debug something 
I wish rider had a "use all of the files in this folder" option to auto detect code style, instead of just the whole solution
I wonder if it makes sense to pool managed instances to reduce GC strain
oh boy, this info seems like it's being baked using release settings
so breaks in development builds
yeah.............
this is totally the issue
if I wrap the assembly in
#if UNITY_EDITOR || DEVELOPMENT_BUILD
it breaks in debug builds
because it's building with release config
i can provide this easily enough by
#if UNITY_EDITOR || DEVELOPMENT_BUILD
public partial class DebugSystemGroup : ComponentSystemGroup
{
}
#endif```
```cs
[UpdateInGroup(typeof(DebugSystemGroup))]
[BurstCompile]
public partial struct NavMeshDrawSystem : ISystem```
and making a development build this fails to build even though the DEVELOPMENT_BUILD should be set
and if I do this
#if UNITY_EDITOR || DEVELOPMENT_BUILD
[UpdateInGroup(typeof(DebugSystemGroup))]
[BurstCompile]
public partial struct NavMeshDrawSystem : ISystem```
and make a development build
ArgumentException: Type BovineLabs.NavMesh.Debug.NavMeshDrawSystem couldn't be found in the SystemRegistry. (This is likely a bug in an ILPostprocessor.)
because it's built as release

Weird bugs.
wow its kind of crazy how quick and easy it is to set things up and get going in DOTS 1.0
I have to say i've found it pretty smooth so far.. Baking feels like a huge improvement over the previous mess of a mix of subscene and runtime conversion, everything is much simpler and cleaner there
yeah I'll have to get more familiar with the baking process but it seems pretty good albeit a bit more complicated at face value
i honestly don't think it is once you get the swing of it.. it even tidies up some problems in more complicated setups by allowing BakingSystems ( for example to give access to physics components after conversion but before baking is complete )
yeah it might be just because I was used to the old way
yeah i mean previously i was using only runtime conversion ( because i got tired of bugs and other issues with subscene conversion etc ) but honestly switching everything over to subscenes and bakers was pretty straightforward
it was the thing i thought was going to take the longest and be the most painful
woot!! and I can select entities and view there properties in the scene view
yeah, it's a nice step up in a lot of ways
i even ported a couple of SystemBase over to ISystem with jobs and found that to be quite painless
Still a lot to catch up on though with all the new RW stuff etc etc but i think it's straightforward
yeah I'm starting a new project and gonna mess around with some physics
Tertle, I will not mention you but if you see this, is your Event System up to date? Can I use it with Entities 1.0? Cuz' I see there is no documentation anymore.
Thank you!
i transitioned my libraries off using it in 1.0
as i think a singleton approach is better
and now that i've experimented with this i intend to write a helper to setup similar behaviour at some point
Would be interesting to see some code examples
just how command buffers work
SystemAPI.GetSingleton<X.Singleton>().Create<Y>()
best way to draw physics raycasts in burst/jobs? aline?
what's a good way to be able to click on a visible entity when the game is playing?
can always just use Debug.DrawLine()
ah ok, never used that. also found PhysicsDebugDisplaySystem.Arrow
yeah, nothing major
is there any way to determine if a scene asset in AssetDatabase is a subscene? Trying to collect all subscenes that exist through some editor extensions
lol, for whatever reason PhysicsDebugDisplaySystem.Arrow is totally wrong
not aware of any method. a subscene is a normal scene. only the usage and reference in a subscene component makes it a subscene
yea makes sense, I guess I could label them in AssetDatabase and query for that label instead
or a real simple method, use string search and name them xxxSubScene
true
XxXSubSceneXxX
what type of tool is this?
you could literally just make it open every scene 1 at a time and get all subscenes within each
Added com.unity.physics, and now my project doesn't know LocalToWorldTransforms anymore. :\
what version are you on?
2022.2.0b16
you should defnitely update to the pre version
They're the latest for my 2022.2.0b16, I guess i could try going to 2023.1.0a24
they are not the latest, they just don't appear in the package manager
we've progressed passed experimental builds into preview builds
add
com.unity.entities 1.0.0.pre-15
com.unity.physics 1.0.0.pre-15
com.unity.entities.graphics 1.0.0-pre.15
the preview physics now supports new transform system
Ah, i figured since I enabled the 'show pre in package manager' toggle that they would... lol
thanks, i'll give that a try
ha yeah i wish
I have the pre15 versions, but now I'm getting the same error even without the physics package...
1.0 brings a new transform system
there are 4 components
LocalTransform
WorldTransform
ParentTransform
LocalToWorld
but generally you hide this behind the TransformAspect
ok i'll have to figure it out. I has moved some of my stuff to using the TransformAspect except for places where I was doing a ComponentLookup, or creating a new entity with a starting location of localtoworldtransform, but most of the things that I moved to TransformAspect were just using.Position, which will be removed soon too.
you can pass in TransformAspect.Lookup
wondering is there a special way to change between scenes, or will it just work if i do it the normal way?
Scenes as in capital S scene? The normal scene manager works.
ok thanks a ton!
Although I would recommend transitioning to entity subscenes. I've moved everything into a single Scene with multiple procedurally loaded subscenes containing the entities that need to be loaded at that time. No Scene switching outside of major level loads.
ok ill look into it ,thanks!
If I call ToComponentDataListAsync, can I depend on the fact that the order in which the array is returned is the same as if I were to get the entity array for the same query?
Also, how does the transform system know when to update the parent? I'm guessing it queries on WithAll<Parent>().WithNone<ParentTransform>()?
it should be, but I haven't tested it
change filters and yeah, such queries
in fact
just take a look at source
new transform is way more easier to understand
than v1
Oh cool
Is there a way to get the euler angle from a quaternion?
not recommended
but it is possible
Convert to Quaternion and then get euler angles?
I need the angle in a shader
It seems I don't even use the rotation in the shader even though I'm writing it to the compute buffer, so my question is moot ๐
just for level selection w/ subscenes with a menu in ui toolkit - was doing some looking around to see if there was a direct way i can grab subscenes directly w/ asset database - was thinking of writing out the guids as an asset post processor to a file that the UI would read to display the levels
Q: How do I store a large array on an entity (e.g. is using a BlobArray the only way?), if that array had several hundred or thousands, possibly 10^6 entries?
It's important that indexing the array for reading later is fast and parallelizable. (it's a navigation search structure)
I'd rather just have a NativeArray somewhere, e.g. in the PathfindingSystem, but I struggle with loading such resources into Systems, and technically it is a violation of how Systems are supposed to work (holding significant state; even if it is only static state).
there's dynamicbuffers or you can do nativearrays now , although if the array is huge I personally would question whether I needed to store it as an array
I also have this system I wrote that allows you to store any sort of unmanaged data into a singleton struct per World
this is easy to obtain inside/outside of systems
and as easy to modify
but beware, it does not support entities dependency detection, so all thread safety is up to you
unless you use jobs
in which case it'll throw errors if you risk race condition
I wish you could implement a factory method for managed component creation
Kind of annoying it always creates new instances
I guess I could pool the entities themselves
Although I don't think there is a way to inject the release of the pool object for automated destruction systems like LinkedEntityGroup
I figured a better approach for managed components
I just create managed singleton
in which I store list
and then have some other management
๐
way easier to work this way, also faster
Isn't entities also just looking up the managed component in an array stored in the world?
they do
but it includes extra steps
like getting to managed store
and also
it uses List<object> which requires cast
I doubt that's going to make much of a difference unless you have a massive amount of managed components, which you shouldn't in the first place
for me it's just easier to manage this way
You mean I can just add a IComponentData with a NativeArray to an Entity during baking, and that magically serializes/deserializes? That would be the best scenario. I thought I needed blobassets for that. DynamicBuffers are for a different purpose, this is static data.
What other data structure do you suggest other than arrays for large data? I mean, it's a graph packed into an array, it's more about getting the data to persist and into a system, ideally parallel jobs, after baking.
Have you encountered these errors at all:
I've tried with both brg.GetRegisteredMesh and entitiesGraphicsSystem.GetMesh via reflection and both throw this error
what index are you using?
It's been working fine with assets baked as part of the subscene, but when i later run this after runtime spawning i get these errors
runtime spawning?
are you sure you register your assets properly then?
well the assets are prefabs, which are baked as part of the subscene
and they spawn and render with no issue at all
it's just getting the mesh that seems to be a problem
assuming the instances are registered by the graphics system automatically when they are spawned
no they are not
they are registered on subscene import
when you import your assets
into world
the index on the MaterialMeshInfo components do match up from what i can see
how du mean import
i'm just spawning entity prefabs
you don't use subscene, right?
i do, this is 1.0
oh