#archived-dots
1 messages ยท Page 28 of 1
A
{
public int Value;
}
public class TestBaker : Baker<TestAuthoring>
{
public override void Bake(TestAuthoring authoring)
{
}
}```
B
```public class TestAuthoring : MonoBehaviour
{
public int Value;
public class TestBaker : Baker<TestAuthoring>
{
public override void Bake(TestAuthoring authoring)
{
}
}
}```
Opinions?!
Manual + DOTS_Guide use A
Samples use B
A
Cleaner solution
Considering bakers might be related to components from other assembly
Like Transform
i use B. no idea what sticks yet
There's practically no difference though, no?
Just code styling
not really, the bakers won't show up in intellisense they do ๐
my bakers are in editor only authoring assemblies which nothing reference
keeps the old IS a bit smarter
but yeah was just curious which people prefer and if there was a clear majority
personally i've been doing A but not sure if this was just swayed by original documentation
there's something I like about separating the data and the logic
no one's doing this
{
public int Value;
public struct TestSystem : ISystem
{
// ...
}
}```
I want to adapt my system to be compatible with SubScenes, but there's pure info about how SubScenes work with SCD. I want to bake some data to SCD with assets reference (Material, SOs). But i doubt about how subscene can serialize such data. Any advice? ๐
they can serialize it fine
alternatively to SCD they also work with class based IComponentData fine
yea - I have a managed object in my subscene since it originally held some materials
Ok, thank you for clarification @rotund token @coarse turtle. Btw want to use SCD because it can be already an ID, i use to batch render process, no matter what it holds
speaking of, is the correct way to add class IComponentData through bakers using AddComponentObject?
surprised there's no managed AddComponent overload
That's what I've been doing, but I would also like to know if this is correct.
ah same, ive just been using AddComponentObject also
Has anyone had success with removing the transform components from an entity in a Baker? Is this possible?
I tried call AddTransformUsageFlags(TransformUsageFlags.ManualOverride) in a baker and it seems to cause all sorts of problems in the editor.
com.unity.cinemachine.dots ๐
my cinemachine wrapper might not be needed soon
kind of a shame, it actually worked really well
maybe they stole your wrapper while you weren't looking
someones enjoying the cat discord ๐
i'll do the same. the cool thing is that the authoring dll can only exist in editor
It's kind of weird that they removed a specific job type for requiring the entity index
Since now you just kind of gotta do it yourself, it's not like every job computed it before, only the WithIndex ones
Especially since they could have then built the counting mechanism into ChunkEntityEnumerator
You are aware there is a method to calculate it right?
Yes, of course. I just find it weird that they removed the automated version
basically overhead ๐
The automated version had overhead over computing it manually by scheduling the presum on the entityquery?
wait, which job are you talking about? ๐
IJobEntityBatchWithIndex
oh, hm. yeah, i don't see the reason either
maybe that's exactly what they wanted to prevent?
because you would need 2 jobs then. one that uses the enumerator with enabled/disabled and one that works on normal entities
Huh? They could just add an IJobChunkWithIndex that supplies the index and works with enabled/disabled components
true, maybe they'll provide the job
or they want to reduce the job clutter of too many options. hard to tell what their thinking process is
well they'd probably need
IJobChunkWithIndexWithFilter
IJobChunkWithIndexWithoutFilter
because the indices generation are different
and at this point it's just becoming a huge mess
i think it's rare enough used that simply calling a single line method to generate this is not a big deal
Wait what? I thought the method on the EntityQuery is the same regardless of whether there are enable-able components or not:
EntityQuery.CalculateBaseEntityIndexArrayAsync
I'm guessing it skips to the first enabled index
CalculateBaseEntityIndexArray vs CalculateFilteredChunkIndexArray
Oh wow I didn't even see that
it's probably for like shared filters etc
but yeah you need to factor this in (i havent tested enough yet)
Ah, so CalculateBaseEntityIndexArrayAsync is the correct method if you have enable-able components
Ok then, that makes more sense on why they kicked the job
yeah, right. some chunks could be totally skipped with enable comps
wait, isn't it the filtered one?
To check how it works try the [EntityInQueryIndex] on an IJobEntity and see the code it generates for both Schedule and ScheduleParallel :3
Wow that doc is great! Explains exactly what it does! o.o (didn't know we added it, thx for telling!)
Haha
but you mentioned enable comps and the doc doesn't
That is true, I actually have no idea. I just started converting my job code ๐คท
Well, guess then my answer is still valid Check IJobEntity :3
I'm guessing it's correct though, since the header for that section is Update IJobChunk to handle enableable components
when would we use CalculateFilteredChunkIndexArray then? ๐
^
Maybe shared filters? I have no clue
hm, that's a bit confusing tbh. i'd expect filters/filtered in the context of enable comps
lets look at code! ๐
ignore me, i didn't read right, chunk index != entity index
Well, there are only two filters, Change and Shared ๐
Enabled comps is more masking ๐ (tho I have no clue what that specfic function does, I'll check nvm, seems you guys got it!)
Actually I think CalculateBaseEntityIndexArrayAsync does it all, since it knows about the filter (it is ran against an EntityQuery after all)
I'm assuming it skips until the first enabled component index, since otherwise that section of the docs doesn't make a lot of sense
/// unfiltered list of chunks matched by this query. Most commonly, this is the chunkIndex parameter available
/// within <see cref="IJobChunk.Execute"/>.```
CalculateBaseEntityIndexArrayAsync specifically doesn't filter
I thought it just meant you are supposed to pass unfilteredChunkIndex
To read the starting entity from the NativeArray
At least that's what this comment reads like to me
It even mentions Execute
/// unfiltered list of chunks matched by this query. Most commonly, this is the chunkIndex parameter available
/// within <see cref="IJobChunk.Execute"/>. For queries with no chunk filtering and no enableable components,
/// array[N] will equal N.```
CalculateFilteredChunkIndexArrayAsync
it mentions enabled components
Yes, the unfiltered chunks, but not the unfiltered entities in the chunk
I think we are just speculating though, so someone will have to look at the actual implementation ๐คท
i am
If it doesn't that would mean the docs are wrong. I don't see any other function to calculate the entity index on entityquery though...
i realized that i have IComps and authoring sometimes in the same file. that's not a good idea going forward
yeah ok they are definitely a little different
So it gives you the correct index even if you have enable-able components?
meaning it could e.g. skip half a chunk
that depends how the scheduling part of the job works
if it passes in chunks with no enabled elements or not
That makes sense, and if the enabled entities were 14-18, it would return 0, 14, 20
Why doesn't it handle filters?
just if you use shared filters you need to use filtered version
from my 2min look at like 400 lines of unsafe code
what do you mean?
Like it returns incorrect values if you set a sharedcomponent filter on the entity query?
I feel like it should completely ignore the filters, since you access the native array with unfilteredChunkIndex, implying it skips the filters for the creation of this index (i.e. just the chunk index)
Are you sure those two methods are intended for the same thing? The names aren't even the same
I feel like it would have to be named CalculateBaseEntityIndexArrayWithFilterAsync
(which again doesn't make any sense to me, since the filter is set on the entity query, so this function would know about it, meaning the same function could handle both cases...)
Yes, like I said earlier, it should ignore it, always
there's a reason there is IsEmpty vs IsEmptyIgnoreFilter
it should definitely not ignore it always - it's extremely useful to get the full chunk list sometimes
but yeah i don't know how this is handled in the job we haven't tested
For the use case of passing the returned array to a job for reading the first entity index for that chunk, it has to
Since the accessing chunk index is unfiltered
i think testing it to see how it works is probably more prudent than just discussing it ^_^'
Definitely
Many disputes can be resolved with a little empiricism
but what about the juicy speculation
it's the hot takes that keep them coming back
If I'm switching over to ISystem, I need to mark all methods (and structs?) that I want to burst inside the ISystem with [BurstCompile], correct?
make the system as [BurstCompile]
then any of the create/destroy/update that can be compiled as well
And if I call a function on a struct inside one of those methods, does the function / struct also need to marked with [BurstCompile]?
pretty sure that doesn't need the tag
when you're calling a method from a burst compiled method it will always be burst compiled
these methods do basically what i expect
2 components
Filter : ISharedComponentData
Enabled : IEnableableComponent
6 entiies
filter = 0, disabled
filter = 0, enabled
filter = 1, disabled
filter = 1, enabled
filter = 2, disabled
filter = 2, enabled
query.SetSharedComponentFilter(new Filter { Value = 1 });
above results
Yep, that makes sense
let me throw it into a job to just confirm that part
So the docs are correct
(i dont really understand what you mean by that since the docs don't mention filtering or anything)
The part about how you get the "old" firstEntityIndex
(since IJobEntityBatchWithIndex was removed)
the old version ideally you should do the filter calc within the job
instead of on the query
(otherwise you got sync points)
That means they could add an IJobChunkWithFilter
but yeah ok this works as expected either way
only index 1 is passed in
so the answer is, either works ๐คฃ
let me just confirm with multiple chunks filtered
Is there any point in caching singletons, assuming they are never destroyed?
i don't know why but CalculateFilteredChunkIndexArray looks faster to me
Do you keep your entity queries in the system and pass them to the struct that holds type handles, or store them in the struct?
i have no type handles for this test
and just to confirm multi chunks of the same filter work
No I meant in general, as a code style ๐
oh funny you ask taht
historically stored them in the system
but i did just test this morning storing in the job
By job you mean the struct that holds all the type handles, and schedules the job?
What if two "jobs" use the same entity query?
Just create it once in OnCreate and pass it to both?
I never cached my type handles, component lookups, etc since I didn't know you could do that, so now I'm cleaning a lot of stuff up
I saw that ISystem even logs a warning if you don't cache them
what are you two talking right now? where to store ComponentTypeHandles?
No, where to store the entity query for the struct that schedules the job
(assuming you store the component type handles in this struct)
(since you could also just store those in the system if you wanted)
{
private EntityQuery query; // todo
private ComponentTypeHandle<Translation> translationHandle;
public void OnCreate(ref SystemState state)
{
translationHandle = state.GetComponentTypeHandle<Translation>();
}
public void OnUpdate(ref SystemState state)
{
this.translationHandle.Update(ref state);
state.Dependency = new TestJob
{
TranslationHandle = this.translationHandle,
}
.Schedule(this.query, state.Dependency);
}
private struct TestJob : IJobChunk
{
public ComponentTypeHandle<Translation> TranslationHandle;
}
}```
what i'd traditionally have done
{
private EntityQuery query; // todo
private TestJob job;
public void OnCreate(ref SystemState state)
{
this.job = new TestJob
{
TranslationHandle = state.GetComponentTypeHandle<Translation>(),
};
}
public void OnUpdate(ref SystemState state)
{
job.TranslationHandle.Update(ref state);
state.Dependency = this.job.Schedule(this.query, state.Dependency);
}
private struct TestJob : IJobChunk
{
public ComponentTypeHandle<Translation> TranslationHandle;
}
}```
what i tested this morning just from curiousity
Is it safe to reuse the job struct like that?
why not
struct is copied onto the JobChunkWrapper
but yeah it breaks down if you have 2 jobs in same system using same handle
but it does save you a bunch of lines if you only have the 1 job
You can't give them the same handle?
ok, you posted what i expected from the conversation ๐ yeah, i dunno. doesn't seem too bad. reducing the list of parameters in the system is pretty good
you'd just need to update them both separate
Wouldn't it be faster to copy the updated handle to the other jobs? Or does that break everything
still gonna stick to the traditional method. makes it obvious at least what's all used on a quick glance
Also, if you had a job with a lot of component type handles do you think (from a style perspective) wrapping the job in another struct with a single update method that updates all handles, componentlookups, etc, is a better pattern to keep the system cleaner?
thats actually what i was testing this morning
because i had something similar setup that a single job had like X sub jobs
thanks for testing @rotund token. i'm gonna need to read all you've posted later. i'm moving namespaces and creating files for authoring -.-
and each sub job was setting itself up
I think you used something along the lines of what I mean in the PositionBuilder file you posted some time ago
Yep
this is really useful for re-usable code
Since it basically wraps the job you are calling, and updates all handles
i dont write like this for regular systems though, just if i want some chunk of logic usable in multiple places
Doesn't the OnUpdate method get kind of cluttered otherwise though?
e.g. if you have
job.Handle1.Update();
job.Handle2.Update();
job.Handle3.Update();
...
I guess you could just put it in a method, basically just where to put the code ๐คท
my on updates are pretty empty for the most part
i mean, it's a few Updates()
then a job schedule
and that's it ๐
public void OnUpdate(ref SystemState state)
{
this.effectHandle.Update(ref state);
this.statEffectHandle.Update(ref state);
this.statValueHandle.Update(ref state);
this.attributeTargetChunkCacheHandle.Update(ref state);
this.statValueBufferHandle.Update(ref state);
state.Dependency = new UpdateActiveChangesJob
{
EffectActiveHandle = this.effectHandle,
StatEffectHandle = this.statEffectHandle,
StatValueHandle = this.statValueHandle,
AttributeTargetChunkCacheHandle = this.attributeTargetChunkCacheHandle,
StateValueBufferHandle = this.statValueBufferHandle,
SystemVersion = state.LastSystemVersion,
}
.ScheduleParallel(this.query, state.Dependency);
}```
typical system
Yeah, but if you have 3+ jobs in that system, it's quite a bit more lines ๐
why am i doing an IsEmpty check on this system hmm
i hate when i just randomly grab some code
Also, since you are checking if the query is empty here, is that better than adding a RequireForUpdate?
Ah ๐
and something puzzles me
well IsEmpty is for including filtering
RequireForUpdate does not include filtering
this is why i'm confused
because i have no filtering on this system
but now i'm wondering if it got lost when i changed it to a EntityQueryBuilder
Also, is using [RequireMatchingQueriesForUpdate] fine if you aren't using any filters?
I thought I read somewhere it is worse performance wise
it just gives old behaviour back
i actually have to go through and check all my systems at one point
and add those tags where required
I'm not sure if I should be using RequireForUpdate vs [RequireMatchingQueriesForUpdate] if I have no filters
it just iterates all queries and does a IsEmptyIgnoreFilter, if any return true, stops then and runs system
but a lot of them time you don't need to check all queries for a system
they do different things if you have more than 1 query
[RequireMatchingQueriesForUpdate] is more like RequireAnyForUpdate
So maybe RequireForUpdate for "minimum" requirements, and [RequireMatchingQueriesForUpdate] or RequireAnyForUpdate for specific parts of the system? ๐คท
fwiw, i am frequently also confused when working with filters on queries. what i don't know is if this is just a fundamentally always confusing subject, or if there's some other design we could have gone with that would have the same performance but been less confusing
i think it is confusing with how many nuances there are. nothing that a good doc and a small cheatsheet with a bunch of use cases couldn't explain though.
top tier would probably be a static analzyer - if that's possible
to eleborate, something that warns us, hey you have 2 queries but you're using alwaysUpdate. no idea how viable that really is.
it is something our team has thought about before, however for self-evident reasons we chose to wait 1. Can't analyze an API that wasn't stabilized yet (that's about to change) 2. Performance is likely gonna be questionable, as a result it probably has to be a once every now again check you can use as a diagnostic tool when stuff isn't working rather than the normal usecase of an analyzer which is to keep things working. This being said, our SourceGen will throw error at you if you do something you were not supposed to do, as any good compiler should :3 (we've also thought about adding so it warns about lack of BurstCompile on ISystem and IJobEntity, tho that's actually not especially performant inside an ISystem, since we don't know which syntax is managed without doing type analysis on everything, it's a little easier with IJobEntity as that only really has one way to get managed data into the execute in the first place, which is pretty easy to analyze for) Anywho none of this will happen in any near future
@errant hawk Hey, did you ever figure out how to prevent this from happening? Same thing is happening to me
Meant to reply to this message
nope, still happens. It's a bug and other users have reported on it afaik
Got it, thanks. Looks like I can work around it by closing the subscene. Seems like it also works when I disable live baking (using the "internal" trick to see that checkbox)
Is it normal that when I click on an entity in the scene view, it opens up the inspector with the authoring data instead of the entity data? There is also no circle at the top right of the inspector to switch the view mode
there should be a circle o_O
right there
Yeah, it just doesn't show for entities that I click on in the scene view. It shows that circle when I click in the entity hierarchy though.
odd
When I build ECS 1.0 on the Quest 2, I get this error log. The build works fine on Rift S and the editor...
Anyone know what might be causing this?
Will PhysicsCategoryTags be forced to be authoring only in future dots physics release? Currently I still use it at runtime
Hey everyone! Can anyone share their experience combining monobehaviors and entities? I've made a system that loads SubScenes and it looses all non-ECS data. Can I somehow combine SubScenes with MonoBehaviors? Or can I use regular scenes with ECS? And what would you prefer?
only entities can exist in subscenes (there are a few built in companion objects setup though)
So, only scene loading + converting objects to ECS is supported? Can I benefit from SubScene features like blob storages if I use simple additive scenes?
For 1.0 Baker, wat's the conversionSystem.GetEntities() replacement?
Could this il2cpp bug explain why my ECS Quest build works in mono but crashes with il2cpp?
Almost certainly
๐ค , it only starts crashing when the renderer kicks in apparently...
We'll update the known issues in this post: https://forum.unity.com/threads/experimental-entities-1-0-is-available.1341065/ when they become available
One of the issues is a discrepancy in calculation of the size of an object between il2cpp and other sources of object code
A crash isn't the only possible outcome, and it's dependent on the links of memory references that are followed at runtime
(if it's indeed the same problem).
@balmy thistle, have you had any luck finding Anyone who has successfully built ECS, either 0.51 or 1.0, to the Quest 2?
No, thanks for reminding me. If it is related to the il2cpp issue cited earlier, it would be dependent on the editor version specifically.
Ok, I tried 2021.3.11, 2021.3.7, and 2022.2.0...
Ok, Thanks!
if you have a blobassetreference with other data in an IComp, 100%
if your build works in mono, wait for next unity 2022.2 release
I basically have a hello world setup. One GameObject, one subscene with one "GameObject and nothing else. No systems or anything...
Any ballpark on when 2022.2 might release?
betas tend to release every 1-3 weeks
might be an unrelated quest problem. hello world setups are working in il2cpp (at least on windows)
Excellent, Thanks!
fingers crossed we get one on Wednesday.
The same project works fine with il2cpp on Rift S and Editor. It's only a problem on the Quest 2 with il2cpp. It even works on the Quest 2 with mono...
For what it's worth: I just realized the crash happens as soon as my entity authored by my subscene is spawned...
SubScenes never stored their Unity assets, such as Textures, in uncompressed formats. They use AssetBundles with compression turned on, and going forward they will use the new ContentArchive, which is also compressed. Huh, ever heard of ContentArchive before?
Nope, VERY new to DOTS...
1.0 Baker API replacement questions
wondering with the new tranform system, will there be any easy way of creating rectangular prisms (like how before uniform scale existed we could just make one axis have a larger scale than another on a cube), or will we have to create it externally in something like blender?
actual game with netcode has been a bit rough to upgrade compared to my libraries
Trying to do a hacky fix for something but this doesn't seem to be working:
Hard to tell from the error i'm getting from the ecb further down the chain..
In theory is the above possible?
actually no it makes sense right, as i'm not creating a native memory allocation for the SpawnPointBufferElement right, it's just a local struct
actually no, that's what the native reference should be doing isn't it
hmm
well... what's not working?
i'm not sure it's throwing a null entity in the ecb after the job that takes this native ref..
just grabbing some lunch so i'll investigate a bit more, just checking if there was anything obviously wrong with this
such as 'can i create a native ref of a buffer element'.. but it's just a struct anyway right
i have no idea what you're doing because the above code does not have any reference to ecb or an entity
That sounds like the issue isn't the NativeReference but something you're doing with the ECB, no?
yeah i think possibly yep.. will double check as soon as i'm back.. just checking there wasn't anything obviously wrong with that
my other version of this same code runs perfectly but it's grabbing an actual buffer element, so i thought maybe there was some issue with how i'd written that native ref, just started using those recently
So any consensus yet on whether to put the baker in the authoring component or just in the same file? I know it doesn't really matter but I want to try and keep everything consistent...
just do whatever fits you styling I guess ๐ค
I doubt bakers will be stripped of build
even though conversion will
and it's a good thing
Yeah it's more about code style, I just wanted to know what everyone else was doing
Why? It doesn't run at runtime anyways
because how else will modders figure out how conversion works
besides
they will be able to use it too
in their builds
I have my modding set up very differently so I don't think this is an issue for me
I want to allow modding for literally everything
I explicitly don't ๐
depends on a game, right
Also a security issue
don't care about it, singleplayer game ๐
I meant more in the context of downloading a mod that installs a bitcoin miner on your PC
I'v worked with RimWorld game for a while and it has literally 0 security.
And after about thousands of mods installed
not a single virus
Not a multiplyer security context
allthough there was a story about guy who crippled game (not PC) if you were using some 18+ mod ๐คฃ
Anecdotes don't really matter, it's still a potential security flaw
I get it, I just trust that people will use trusted mod shop
That doesn't really matter if someone gets a virus and sues you because they used your official mod shop
or at least some antivirus software, kek
It's an issue about covering your legal bases as well
If people really want to make a crazy mod for your game they can just use something like BepInEx after all, and then everything goes ๐คท
nah, modding is way bigger than that
implementing new mechanics, game modes or even multiplayer kek
You can do all of that with BepInEx
Is there any documentation on modifying the drawn inspector for components?
no doc sadly. i think there should be a supported way, right now all we can do is lend some implementation. previously it was Inspector<T> now its PropertyInspector<T>
i still haven't updated my inspectors to 1.0 ๐
Where are these types located?
Unity.Platforms.UI
ok, that was weird. yesterday i moved all my authoring comps to a new assembly def. checked some files if they are working during the process. they did. today i finished the process and my prefabs all have missing authoring scripts. for no apparent reason. now i ticked allow unsafe code in the def and it works now. yet i have no unsafe code. nor was there any compiler error. i can untick unsafe code again and it somehow fixed itself.
eh, now some other authoring scripts are not working. must be some cache problem -.-
reimported the file and works again. hm, maybe this is a 2022.2 bug. i usually don't move so much files around. ๐
I just remade all of my prefabs, since I was to lazy to attempt to port the old values 
That would have bummed me out ๐ I already had all authoring data in MBs so it was just a matter of writing the bakers and now moving everything to seperate namespaces and asm defs. But I realized that the effort was not that great because if I mark the asmdef editor only, I can't use the authoring MBs. (errors, can't put editor scripts on a GO) - the plan was to not even have the authoring dll in a build. that didn't worked out.
would anyone know how to convert a NativeList<float3> to a Vector3[]?
Two quick questions: I'm currently trying to learn DOTS (and ECS in particular), so I'm going through some basic things. Currently: Moving an object to another one. I finally got the actual ECS part of it working, but I'm running into some strange issues. Namely, the chasing object arrives at an offset what looks an awful lot like 1 unit, so I'm wondering if there is some kind of offset involved in gameobject -> entity? Furthermore, is there any difference between mathf.normalize and math.normalize? Because the latter appears to produce nonsensical results for me?!
no offset between GO and entity. @rustic rain has a method to convert without a memcpy if i remember correctly. haven't seen a difference of normalize. what are you normalizing, float3?
๐ค
Hm. Odd. It's just a cube and a sphere and, just tested it, the sphere (the chaser) ends up exactly 1 unit off course and I can't seem to explain it. And yes, I'm normalizing float3, simple direction stuff. I can't even explain the behavior I'm seeing with it, it feels almost like the function can't produce negative values or something, it kinda sorta works on positive axes and then just stops chasing entirely on negative values. Or... something.
you sure you pinged the right person?
Cause I have no idea what you're talking about ๐
oh, sorry then ๐ i thought you posted a method to convert NativeArray<T> to T[]
actually vice versa, and it's originally was tertle's
ok ๐
i would like to point out that that method has unsafe in the name for a reason, and if stuff moves around under you, you'll crash the editor
It uses GC pin
and you have to unpin it manually
Any reason why this would produce nonsense? (More specifically, the normalizing appears to not produce negative values, because it works when the object is in front (as in in a positive direction) but ceases to work in the other direction. Granted, I've not programmed nor done math in a while, but... that's not how that should work, is it? Or am I just going crazy?)
i see no errors here
normalize does Returns a normalized version of the float3 vector x by scaling it by 1 / length(x). so negative values are fine
Yea... me neither. Problem is, the rest of the setup is as simple as it gets, you can infer the entire codebase from that screenshot, it's the simplest components and, well, the system setting up the job. In Unity, there's a subscene with a box (the target) and two spheres (the chasers) and that's it :|
It works without the normalizing (but, you know, then the speed thing is kinda pointless), but then I somehow get this odd 1 unit offset. I'm so damn puzzled...
i was about to ask, what if you don't normalize. yeah the speed is off but other than that it works? hm. are you using transform system v2? as i'm using physics i can't say much about it. such a simple usecase should work though. same goes for transformAspect
Uhhh, v2 would be the new 1.0 thing, yes? I don't even know, I just started learning and then 1.0 dropped so I'm all sorts of confused lol. But yea, I'm using whatever is standard in the experimental 1.0.
That's the result without normalizing
can you try math.normalizesafe?
Which, ironically, is 1 unit off, so some kind of normalized vector thingy appears to sneak in there or... something oO
Uh, sure, can try
does the job always run?
No clue, jobs and I are still on a need to know basis, but I see no reason why it wouldn't
Noramlizesafe produces that...
Now I'm even more confused.
you are getting closer! ๐
Well, one of the spheres is, anyway :D
PathFindJob pathFindJob = new PathFindJob
{
gridSize = gridSize,
startPosition = startPosition,
endPosition = endPosition,
resultPath = path
};
JobHandle jobHandle = pathFindJob.Schedule();
jobHandle.Complete();
The UNKNOWN_OBJECT_TYPE PathFindJob.resultPath has not been assigned or constructed. All containers must be valid when scheduling a job.
so i keep getting this error even tho i assigned a value to the resultPath,any idea why?
@oblique cosmos can you post the system where the job is scheduled?
how is path constructed/declared?
@viral sonnet
NativeList<float3> path = new NativeList<float3>();
That's basically it, ignoring the empty OnCreate and Destroy
ah you need to pass in arguments (length and Allocator). The default constructor would create an invalid native list
it is a list that is used in a job,so i basically pass in TempJob?
yes
I kind of dislike the name CleanupComponent... It feels weird to store data there
Maybe that's just me
@oblique cosmos yeah, sorry that all looks fine to me. the only thing that could be off now are the values itself. open the dots hierarchy and look if you find anything odd. math and job is all correct so it's really the only thing that could cause issues
and maybe give it a try without using TransformAspect
i'm not too sure about this. from TransformAspect.Position: LocalPosition = HasParent() ? math.transform(WorldToParentMatrix, value) : value;
doesn't seem like your entity has a parent though
and give setting LocalPosition a try
Hmmm. So, firstly, I have no idea how this Entities Hierachy is supposed to work now. I seem to recall that looking different in the previous versions I started with (like a few days ago). Now it just seems like a copy of the normal inspector (just with all the other entities in there) and it displays nothing useful, it doesn't even update stuff?!
Pretty sure I already tried LocalPosition, actually, just as a reality check but nothing changed. I'll try again though, to be sure. Throwing out the Aspect thing might also be worth a try, yea.
I need to mark the ISystem with [BurstCompile] if I want to burst any of the 3 callback methods right?
there's a circle at the top right. make sure it's fully orange to see the actual entities
yes
Is there any documentation on ISystem anywhere? I couldn't find any...
Ohhhh, so that's what that was about ๐ค I'll look into it, thanks!
Okay, so LocalTransform and not using the Aspect produces identical outcomes, as expected. Guess I'll check out those values, see what the hell is going on there.
Looked around in the values, it all looks good, as far as I can tell. IDs match up, positions are as they are displayed, all checks out. Just the math doesn't. Thing is, when I move the target around in a certain way, the chaser hit perfectly. It's got something to do with certain axes, I'm not sure. It's weird. I don't see how this could be happening, other than something being up with math.normalize, but I figure that would've been spotted already, given how common that function is. Puzzling.
That's what's happening.
Wow. Okay then, I figured out what's been going on. Got nothing to do with DOTS, got everything to do with weird background file management stuff. It would appear that, somehow, a previous test (which I deleted entirely) somehow got restored and that had another speed system in it. Why exactly nothing complained about the exact same file and struct names is not entirely clear to me, but after sanitizing the entire project it appears to actually work. ... Now I just feel even dumber :)
Either way, at least I got a "looks good" out of it, so at least I know I'm not being entirely off track here. Thanks for the attempt to help, @viral sonnet
np, glad you figured it out
Wish I also knew how absolutely nothing complained about that ghost file existing, yet it still actually working somehow. Mystery in itself, that one ๐ค
Is there any documentation on
i was testing sentris problem myself in a new project because i found it odd but i got hold up by setup problems ๐ setup with entities.graphics could be better handled. i mean, you install it and then. nothing. confusing for any newcomer because you now need to know to install either urp or hdrp. and then you install urp and again, nothing. i remember some kind of wizard appearing? anyway, here you need to know to start the urp converter wizard. after i've done that. crash. ๐
On the bright side, the DOTS guide thingy posted on the forums actually tells you about that. So that's nice. Anywho, I for one will go sit in a corner now and feel ashamed for getting bested by file management!
A UnsafeMultiHashMap is just a faster NativeMultiHashMap so long they are both read only?
It doesn't have any leak detection
Or does it now that that's built into the allocator? I'm actually not sure
there's no real speed differences to speak of
but one has thread safety and the other does not
there is no way thread safety is zero cost
you could say there's some overhead in Native because of safety system but that can be turned off and isn't in builds
Delayed waiting...
i'll have to check, there were some rewrites in the hashmaps.
but not for multiHashMap
yeah, nothing changed in multiHashMap. NativeMultiHashMap uses UnsafeMultiHashMap. UnsafeParallelHashMapBase uses atomic operations via Interlocked. what you are maybe referring to is NativeHashMap and NativeParallelHashMap. those were rewritten to work either with only single thread or multi threaded.
As enzi said this only exists in editor (and even then can be turned off in burst jobs). In a build you should expect no difference it's all stripped
ahh
I guess I will use the normal one
In general (but not all) the native version just holds a pointer to the unsafe version
Indeed. Native prefix is to signal there is safety checks for lifetime and r/w safety with the job system.
Leak checking is handled elsewhere via the memory system.
Performance should be nearly identical between Unsafexxx and Nativexxx when safety checks are off. Safety checks are on by default in the Editor and unavailable in standalone player builds. However, we have added a slew of safety checks that do not rely on the engine job safety system (primary around bounds checking) that can be forced on in standalone player builds via defining UNITY_DOTS_DEBUG
Note there is a bug in Burst compiled builds where some of our safety methods may be removed by Burst in standalone player builds. So if you have a crash in standalone player builds originating from a DOTS package, a good procedure for now is to disable burst and define UNITY_DOTS_DEBUG
Are there any use cases for unsafe collections besides nesting?
I have a few but they are in the realm of super hacky things
I meant for normal people ๐
Like a shared static with an unsafe hash map pinned kind of hacky - something that bypasses the job safety
! Would this bug crash in Mono or just IL2CPP???
Less than there were historically. The primary reason for Unsafe vs Native was that Native containers contained a managed safety type called DisposeSentinel which made using Native containers in any codepaths expecting a generic constraint of where t: unmanaged impossible.
We no longer rely on DisposeSentinel so Native and Unsafe containers are all unmanaged
Use cases now would be you really want to avoid safety checks for various "I know what I'm doing" codepaths
Yeah I know the history, that's why I was asking now that dispose sentinel is gone and all the non parallel collections are unmanaged and can be put in components
You can disable safety via attributes but that isn't always possible based on what you're trying to do
Something else I was wondering, is there any performance benefit in using IJobChunk over IJobEntity if you are only processing entities? (converting old Entities.ForEach to job structs)
Since it's a lot more boilerplate
I guess if the system shares component type handles for multiple jobs in that system they only need to call update once?
Exceptions thrown from Bursted codepaths in standalone player builds will abort the application and present the exception message in the player.log be it a mono or il2cpp method. The bug I'm referring to only applies to bursted codepaths that crash on a safety message that should be thrown only when UNITY_DOTS_DEBUG is defined. Without defining that, there is no safety checks in collections so you may crash and not get any messages but just a stack trace
So just to confirm: if its this bug it should crash in Mono as well?
The bug in burst doesn't prevent or cause crashes. The bug is that today you might crash due to a problem in your code and not get any messages about what went wrong due to a lack of safety checks -- mono and il2cpp. You can add in extra safety checks by defining UNITY_DOTS_DEBUG in standalone player builds. The bug I am referring to is that those extra safety checks may not be enabled so you're back to the original case of getting a crash due to a problem in your code and no nice message
Got it
But if you disable Burst and define UNITY_DOTS_DEBUG you should get a nicer message (for standalone player builds -- this isn't required in editor). We have some more improvements in this area that will be in the next release, but it should cover most code in the current release
i'm trying to use aspects in IJobChunk. i've got the most covered but I don't know how to write back. ```[BurstCompile]
public partial struct ChaseJob2 : IJobChunk
{
public TransformAspect.TypeHandle TransformAspect_WriteHandle;
[ReadOnly] public ComponentTypeHandle<Speed> Speed_ReadHandle;
[ReadOnly] public ComponentTypeHandle<Target> Target_ReadHandle;
[ReadOnly] public ComponentLookup<LocalToWorld> LocalToWorld_Lookup;
public float dt;
public void Execute(in ArchetypeChunk chunk, int unfilteredChunkIndex, bool useEnabledMask, in v128 chunkEnabledMask)
{
var speeds = chunk.GetNativeArray(Speed_ReadHandle);
var targets = chunk.GetNativeArray(Target_ReadHandle);
var ltws = TransformAspect_WriteHandle.Resolve(chunk);
for (int i = 0; i < chunk.Count; i++)
{
var ltw = ltws[i];
var speed = speeds[i];
var target = targets[i];
var targetPos = LocalToWorld_Lookup[target.target].Position;
var chaserPos = ltw.Position;
var dir = targetPos - chaserPos;
dir = math.normalizesafe(dir);
ltw.Position += dir * speed.speed * dt;
ltws[i] = ltw; // has no setter
}
}
}```
Do you know of any bugs that would ONLY crash on IL2CPP for Quest 2 and work fine on Rift S and Editor. Seems to be related to the new rendering pack
the code generated IJobEntity version just uses var ltws = TransformAspect_WriteHandle.Resolve(chunk); and sends a ref to the Execute. so i thought cool, seems we don't need to write back but it's not working ^^
Anyone that uses rider know if you can set the struct member autocompletion to only show missing members, and not all? Visual studio only showed missing ones, which was nice ๐ฆ
Something else I was wondering is there
does 0.50+ use regular build pipeline?
I thought 1.0.0-exp.8 already supports the normal build pipeline?
you know, i should check.
Otherwise I'm not sure why my builds using the normal pipeline have worked ๐
i've used File->Build Settings->Build with 1.0exp - guess that's what tony meant with regular pipeline
i see. reading up on it, it's a somewhat under-tested setting in preferences in 1.0-exp, but if it works, great! or maybe il2cpp builds are just crashing sooner than you could notice that there was a problem ๐
i think so far the only bug i noticed with il2cpp builds have been the SceneSectionStreamingSystem (although I did this with the previous build config assets) ๐ค
0x00007FF8F2FC0221 (GameAssembly) [some_path\cpp\Unity.Entities9.cpp:20720] DotsSerialization_CreateReader_mD449775FCAA012FBD6CF131CB7C488037D473745
0x00007FF8F33D68A4 (GameAssembly) [some_path\cpp\Unity.Scenes.cpp:13013] AsyncLoadSceneOperation_UpdateAsync_m25C4533BE332945DB9ACFCF80AB913B132653253
0x00007FF8F33E9CF1 (GameAssembly) [some_path\cpp\Unity.Scenes.cpp:25911] SceneSectionStreamingSystem_UpdateLoadOperation_mC3CC60795D148C4D5B4DBC1BAB083B129ABECEE7
0x00007FF8F33E92B3 (GameAssembly) [some_path\cpp\Unity.Scenes.cpp:25646] SceneSectionStreamingSystem_ProcessActiveStreams_mE7326AB99FF0AC55EDB08634A5B9449DA849E7FE
0x00007FF8F33E9141 (GameAssembly) [some_path\cpp\Unity.Scenes.cpp:26863] SceneSectionStreamingSystem_OnUpdate_m48E550F61E3B9720FA4CBC7B99BE33FD55750A85
0x00007FF8F2F9F4A7 (GameAssembly) [some_path\cpp\Unity.Entities7.cpp:27485] SystemBase_Update_m795994EE60C054DFA78C313A60ED025B2668C9B4
0x00007FF8F2EF92CF (GameAssembly) [some_path\cpp\Unity.Entities1.cpp:24782] ComponentSystemGroup_UpdateAllSystems_m78B1AA9EAF07133497E9BA556B592AC93935441C
0x00007FF8F2F9F4A7 (GameAssembly) [some_path\cpp\Unity.Entities7.cpp:27485] SystemBase_Update_m795994EE60C054DFA78C313A60ED025B2668C9B4
0x00007FF8F2EF92CF (GameAssembly) [some_path\cpp\Unity.Entities1.cpp:24782] ComponentSystemGroup_UpdateAllSystems_m78B1AA9EAF07133497E9BA556B592AC93935441C
0x00007FF8F2F9F4A7 (GameAssembly) [some_path\cpp\Unity.Entities7.cpp:27485] SystemBase_Update_m795994EE60C054DFA78C313A60ED025B2668C9B4
0x00007FF8F27DBD06 (GameAssembly) [2022.2.0b8\Editor\Data\il2cpp\libil2cpp\vm\Runtime.cpp:608] il2cpp::vm::Runtime::InvokeWithThrow
0x00007FF8F27DB7A9 (GameAssembly) [2022.2.0b8\Editor\Data\il2cpp\libil2cpp\vm\Runtime.cpp:593] il2cpp::vm::Runtime::Invoke
have you read the notice about havok dots physics where you need Unity Pro+?
This confuses me ๐ a lot! personal and plus is free. at pro it's not? what am i missing?
pro now for consoles?
oh i think i answered this myself. pro is needed for consoles
This is a known issue. It's fixed internally, but won't be out until at least 2022.2.0b10 (but it might be 0b11)
Think pro has been needed for consoles since 2021
yeah i was just a bit confused in regards to havok
I think the change mentioned on forums for havok in 1.0 is its now included with a unity pro licence
No longer need a seperate subscription
hope its still available for us poors ๐
oh dear I guess it isnt
hard to showcase demand for a product if all you can do is beg on the forums(given how prevalent application metrics are)
yeah unfortunately the announcement did not sound like it was available outside of pro, but we'll see i guess
gotta say I think gigaya getting canned was one of the largest community outcries and that was for nought so dont really have expectations on this decision changing
quick question before i start breaking things, anyone tried to manually create multiple ISystems of the same type in a single world?
from what i understand this is not supported but I kind of have an idea I want to try
i don't see how this can work ๐
why not
aren't there way too many cases where the type is cached somewhere?
(and no, i've never tried ๐ )
there's nothing in the code as far as i can tell on creating a system
that checks or would break
internal SystemHandle CreateUnmanagedSystem(Type t, bool callOnCreate)
anyway let me explain what i'm thinking
my saving currently works by simply adding an attribute [Saved] to a component
It finds all these, creates 1x ComponentDataSave (or buffer version etc)
public sealed unsafe class ComponentDataSave : ComponentSave
per component
the only difference between these on a per component is a ulong stableTypeHash
there's no generics
what i'm wonder is if I could turn this ComponentDataSave into an ISystem
1 per [saved]
it's basically just a subsystem atm, sets up handles, schedules jobs
in theory there is nothing in here that would stop this being an ISystem
so what i'd like to do is create 1 per [saved] attribute and put them under a single system group
and simply stop the system group updating unless it needs to save/load
this way you could more naturally inject new save alternatives into it in a more dots fashion instead of inheriting my ISaver in some class and i find it via reflection
certainly worth a try.
(i'm basically procrastinating updating my game library because too many changes =D)
hehe. contrary to what i said before - it should be possible. although i hardly, if ever, saw a system getting added twice in a world so that's where my hesitation comes from
i can totally do this in 0.51 with systembase
havok should be free for unity personal/plus
i hope so (even though I have a pro license) but there was no specific mention of it in the announcement
A new cohesive experience for Havok Physics for Unity is being rolled out, and will be included in Unity Pro, Unity Enterprise and Unity Industrial Collection offerings.
the one tricky bit is writing a value to each ISystem
what you're trying to do is the closest we can possibly get to a generic ISystem
got an answer in the forum We will continue to evaluate the uptake of Havok Physics for Unity upon release to understand how users are interacting with it, whether there's significant demand for it in Free/Plus tiers and ultimately, drive for better user experience. https://forum.unity.com/threads/dots-development-status-and-next-milestones-september-2022.1341077/#post-8489882
Havok Physics for Unity's exclusive availability in Unity Plus, Enterprise and UIC upon release with ECS for Unity 2022
I feel like that is meant to say Unity Pro
also that does sound like atm no plans for free
yeah its pro/enterprise/uic only now
right, we have to see if there's demand in free/plus tier ...
i don't know what i'm paying for in plus ... haha
anyway, var statePtr = ResolveSystemState(GetExistingUnmanagedSystem(TypeManager.GetSystemTypeHash<T>())); that could be a bit difficult. if (_unmanagedSlotByTypeHash.TryGetFirstValue(typeHash, out ushort handle, out _)) { var block = _stateMemory.GetBlock(handle, out var subIndex); return new SystemHandle(block->States[subIndex].SystemHandle.m_Entity, handle, block->Version[subIndex], (uint)SequenceNumber); }
they rely on hashes and types a lot
really, plus is the shit tier for games in development ๐
but if you notice
_unmanagedSlotByTypeHash
is actually a multi hash map
it just returns the first
but it can hold more than 1 of the same type
oh, good catch
and the hashmap is private
well, the handle is all you'd need anyway
the downside on the system handle, i've not looked into this. how to get a ref from the system struct
i can get the systemstate easy enough
there used to be a way to get a ref<T> of an ISystem
but i think it was removed
a unity dev said they introduced the handle to prevent writing to systems from outside. but that's exactly what you need now
(if anyone else is reading this, do not do what i'm trying to do. just ignore this entire conversation)
an option would be to create the system struct yourself and register it
i could, i know how it's allocated
it would require a lot of extensions and probably modification of the entities package
which i tend to refuse to do
(extensions fine, modifications no)
yeah
var sysHandle = new SystemHandle<T>(handle, block->Version[subIndex], (uint) SequenceNumber);
void* ptr = (void*)(IntPtr)block->SystemPointer[subIndex];
return new SystemRef<T>(ptr, sysHandle);```
ok this is how it used to work
in 0.51
let me diff
It didn't seem to break anything when I tried it, but there could be edge cases ๐คท
oh right, i still have the unanswered question. how to add an ISystem that has [DisableAutoCreation] - i think i never found out how to do that in a non weird way
can't you just call CreateSystem<T>
then add it to whatever system group you want
default(ComponentSystemGroup).AddSystemToUpdateList(systemHandle);```
something like that
(obviously don't use default)
SystemHandle CreateSystem<T>(this World self)
/// This can result in multiple instances of the same system in a single World, which is generally undesirable.
///```
hey it's commented you can have multiple systems fine
1 less concern
maybe this is doable
damn, i can't remember anymore where i got stuck. it was with the generic ISystem test i did which had a bunch of problems ๐
wait, i said, how to write to the system but that's dumb anyway now that we have a system entity
If you really need to you can just memcpy values into the struct
and you can write your hashes to these entities. so seems to be just a case of manually creating the systems with the method you posted
how would you memcpy without the ptr?
if we have the ptr we can also get a ref struct. no need for memcpy
What type are you going to return?
type is known. i dunno, whatever the system is called ๐
You'd probably need to make generic methods using reflection though
yeah that might be the best approach
i can just use the entity
avoid a lot of hacks
sadly work starting so now i'm going to think about this all day
well it will work and the implementation seems even easier than expected
now i'm thinking of going back to the generic stat system
i just need to save all that would be generic in the system entity comp
generic jobs already work fine
I was thinking of something else, I iterate over all systems and call a method on the ISystem, so I don't know the type there at compile time ๐
Hiya, can you think of why this job isn't working? Basically, when debugging, the function exists on the marked line
Entities
.ForEach(
(Entity e, ref LocalToWorldTransform position, in MoveToDestinationComponent move) =>
{
float3 dist = move.dest - position.Value.Position; <<<<<<<<<<<<<<<<<<<<<<<< F10 exits here
float len = length(dist);
dist = normalize(dist);
position.Value.Position += dist * deltaTime * speed;
if(len < 0.2f)
{
ecb.SetComponentEnabled<MoveToDestinationComponent>(e, false);
}
}
).Schedule();
what do you mean by exists?
as in you can't step through with a debugger?
because that line is very much not doing anything exciting
exits... sorry
are you verifying this with a debug log or something?
F5... F10
so yeah the debugger from my experience does not work reliably in entities.foreach
Debug.Log it is ... thanks
Wasn't there some way to go to the generated code using rider?
rider only wants to take me to the generated code most of the time >_>
I had that issue before, now I can't get there ๐
;'(
IJobEntity really removes a lot of boilerplate if you don't require chunk level optimizations
For logging in an Entity.Foreach... is there something special for this to work? I don't see any logging
Entities
.ForEach(
(Entity e, ref LocalToWorldTransform position, in MoveToDestinationComponent move) =>
{
Debug.Log("0");
float3 dist = move.dest - position.Value.Position;
Debug.Log("1");
float len = length(dist);
dist = normalize(dist);
position.Value.Position += dist * deltaTime * speed;
Debug.Log("2");
if (len < 0.2f)
{
ecb.SetComponentEnabled<MoveToDestinationComponent>(e, false);
}
}
).Schedule();
if it's not logging then the job is never entering
i just need an optional
{
}```
i can implement
and i could replace 90% of my ijobchunks
i should probably request this
{
return chunk.DidOrderChange(LastSystemVersion);
}```
and if false it does not call the Execute()
or
private NativeList<bool> buffer;
bool ChunkExecute(in ArchetypeChunk chunk, int unfilteredChunkIndex)
{
if (!buffer.isCreated)
buffer = new NativeList<bool>(0, Allocator.Temp);
return true;
}```
the source gening is pretty good, just look at this var __Unity_Transforms_TransformAspectTypeHandleArray = __Unity_Transforms_TransformAspectTypeHandle.Resolve(batch); var speedData = InternalCompilerInterface.UnsafeGetChunkNativeArrayReadOnlyIntPtr<Speed>(batch, ref __SpeedTypeHandle); var targetData = InternalCompilerInterface.UnsafeGetChunkNativeArrayReadOnlyIntPtr<Target>(batch, ref __TargetTypeHandle); int chunkEntityCount = batch.ChunkEntityCount; int matchingEntityCount = 0; if (!useEnabledMask) { for (int i = 0; i < chunkEntityCount; ++i) { var __Unity_Transforms_TransformAspectTypeHandleArrayArray = __Unity_Transforms_TransformAspectTypeHandleArray[i]; ref var speedData__ref = ref InternalCompilerInterface.UnsafeGetRefToNativeArrayPtrElement<Speed>(speedData, i); ref var targetData__ref = ref InternalCompilerInterface.UnsafeGetRefToNativeArrayPtrElement<Target>(targetData, i); Execute(ref __Unity_Transforms_TransformAspectTypeHandleArrayArray, in speedData__ref, in targetData__ref); matchingEntityCount++; } } actually uses ptrs and refs even for in
I mean in may technically be slower than ref, but yes it is very well done
it's much better than the usual chunk.GetNativeArray and local struct copies
There's not much they can do about that though since in and ref is also used to define the dependencies
is it in burst?
I actually have no idea ๐
last i checked i thought burst treated them exactly the same
nah, never seen a difference
Then disregard what I said ๐
it probably is for mono (maybe)
Even outside of burst it should be the same speed if you don't accidentally copy the struct
in theory i assume a compiler could even optimize an in somehow
How would it? It could technically break your code if the compiler doesn't copy the struct
Unless it does some magic to avoid that possibility somehow
what concerns me a bit is the amount of boilerplate for enabledMask
IJobChunk jobs i've seen with enabled support don't have all that masking. i dunno if that's needed
It's the normal code that is also used to check the mask iirc
this looks like a near duplicate of the utility method
i'm aware of the methods existence. ok, kind of relieved then ๐

I also wish it supported destroying entities, but it seems that breaks the iterator
really, they mentioned somwhere, less things should break the iterator. hm
One of the devs said you can't call DestroyEntity a few days ago, I never tested it though
it was kind of annoying how careful you have to be when adding buffers and filling them with data
at least a local ecb works
just use a local ecb
damn too fast enzi
๐
๐
Yeah I know it's possible guys ๐ I just meant I wish it code generated it
SystemAPI.Query is kind of in a meh state. it doesn't quite know what it wants to be yet. right now i haven't found much usage. most where i wanted to use it I've then converted to an entityQuery
codegen for it is quite complex
My main use would be for cleaning up + getting rid of clean up entities on world disposing
This works for me, not sure if that's intended:
seems intended. so DBs work after all.
I guess you just can't get a read only dynamic buffer
oh there we go
ahhhh this seems like new behaviour? instantiating a prefab from an entity that sits inside of a hierarchy will parent the new entity to the same hierarchy level?
was that not happening before when the parent also gets converted?
prefab shouldnt be part of a hierarchy but let me see
nope, prefab def not part of that same hierarchy(just a root space entity)
With how the generator works if it works it's most likely intended.
So currently Query works with RefRO, RefRW, Managed Comps, SharedComp, EnabledRefRW, EnabledRefRO, DynamicBuffer and Aspects
so the only thing that's missing is monobehaviour and read only dynamic buffers.
how can i get the ref from RefRO then?
ok, i'm not supposed to get a ref from RO. makes sense. in case it doesn't return a local struct copy all is good. ๐ haven't tested that, seems there's a struct copy involved though
in which case i have to ask, why use a RefRO in the first place
Quick heads up, as I can see you're using the thing, .WithEntityQueryOptions will be renamed .WithOptions.
As for RefRO, it's essentially just a pointer to the component memmory, but ReadOnly so no copies here, well, until you copy values over that is ๐
ok cool, thanks!
SystemAPI.GetSingleton or SystemAPI in general is not supported in MonoBehaviour code? it errors InvalidOperationException: No suitable code replacement generated, this is either due to generators failing, or lack of support in your current context
haha, well, i guess it's called SystemAPI for a reason ๐
what world / EM would it even be getting it from
right ๐
tryna optimize a for loop using the parallel for loop job thing, wondering though what for the 2nd parameter in .Schedule(ForLoopLength, ItemsPerProccessingBatch), is there a guide on what to set it to in order to get optimal speed? My for loop can operate on anything from 0 fluid particles to over 30 thousand incase that helps
basically, the batch size is the amount of work that is scheduled at a time. you're trading off between the overhead of scheduling more units of work (if you have a small batch size) and risking that one core will run longer than the others (if you have a large batch size). the only real way to decide is to try it on your target hardware and see what's best (or if it even matters)
ah ok, im guessing it also depends on what work im doing in the for loop then?
yes
if i wasn't sure what to do, i would probably just set it to something arbitrary like 1/128 my total workload and forget about it, and come back to it maybe never, or maybe if i looked at the profiler and saw a million tiny jobs of this thing dominating the profile
I usually use a value of 1 or 256
ok ill mess around with it, and see what works best!
1 is more of a special case where you have really heavy work and not many indices
So you want each element to have its own worker to go as wide at possible
ok, im not really doing much heavy work (just checking each particle's list of 6 contact planes and seeing if any of them match any of the shapes that are checking for collisions), Thanks for all the info yall!
But generally from my benchmarks on high index counts anything above 64 isn't that noticeable performance difference
Hence I just use a nice number as a default unless my profiling points to an issue
ok awesome!
There are a couple of other values that might make sense depending on your data
If you're using a grid packed in a single array
It might make sense to use width as the value
Therefore each worker gets 1 row
You can do this to be smart and minimise bound checks
Actually that's probably more useful for ijobforbatch
ok that sounds clever, ill mess around and see what i can get working best!
hm, i currently have a case for a system with RequireForUpdate<SingletonStruct> - the SingletonStruct exists on a system entity. yet the system that has the RequireForUpdate doesn't run. (it also has the RequireMatchingQueriesForUpdate tag)
well this is weird. filtering with c:SingletonStruct in the hierarchy has 0 results. clicking on the system entity, the comp is there.
are system entities not picked up or smth?
hmm it appears that the parallelfor job does not like me trying to write to a NativeList, is there anyway to make the NativeList have parallel writing?
NativeList<T>.ParallelWriter
aha thanks, and where would i put this?
in the job, instead of the NativeList you have now
oh ok thanks!
it can't resize though, so set the list.Capacity before scheduling the job
ok and making certain that the capacity is seperate to the length right, so i dont end up with tonnes of ints equalling 0?
Capacity is just how much the list can store
Length will be how many elements were added
ok good i think lol
ok, yas, thanks!
You need to make sure you set capacity high enough it can add all the elements you want
If you are iterating 3000 things and each can add 1, set capacity to 3000
whelp, i have set some debug logs to see if the system is running. changed it to alwaysUpdate and put a SystemApi.HasSingleton in place. now it's working. but before that it error'ed on some other stuff that i know works. (couldn't find a spell) - there are some very weird caching issues going on
ok ill just set that to the max particle limit the container has, cause if ever the amount of particles goes above that it instead just overwrites the beginning, so should work great, thanks!
with RequiredUpdate the system still won't run. which is funny because HasSingleton clearly works
__query_175196122_0 = this.CheckedStateRef.GetEntityQuery(new Unity.Entities.EntityQueryDesc{All = new Unity.Entities.ComponentType[]{Unity.Entities.ComponentType.ReadOnly<NZSpellCasting.SpellLoaderMetaData>()}, Any = new Unity.Entities.ComponentType[]{}, None = new Unity.Entities.ComponentType[]{}, Options = Unity.Entities.EntityQueryOptions.Default | Unity.Entities.EntityQueryOptions.IncludeSystems}); THERE IT IS. Unity.Entities.EntityQueryOptions.IncludeSystems! This is clearly missing from RequireForUpdate<T> preventing a system from running when the singleton is on a system entity. @wraith hinge would you kindly forward this ๐ or is this intended behaviour?
i haven't been following but based off your result is this a fail on RequireForUpdate with a system entity?
follow up question, why would you do this ๐
i.e. when would you not expect the system component to exist?
Well if you did some setup stuff in another systems OnStartRunning, then the component would surely be missing until everything has loaded in ๐
OnStartRunning shouldn't execute until all Systems are created unless you were manually creating systems?
yep, it's setup stuff and the reason is that the system which does the setup has to wait for a subscene to load
oh subscene loading
i feel like thats a common issue
but i disliked putting RequireForUpdate on all my settings files i all my systems
so i simply turn off Simulation/Presentation Updating until my 3 (client/server/client+server) subscenes have loaded
therefore i can guarantee all settings are loaded onto entities before any system starts running
avoids 1+ query check on nearly every system....
yeah true, i also don't feel like having so many RequireForUpdate is a great solution. but it's pretty clean when it comes to unloading/reloading the game. don't have to do any management of system groups
i have 1 system that handles it, it's pretty much hidden from the world
it oes other work like only like scene X, Z into client, Y, W into server, A,B,C into both
setup load rules such as only load subscenes in range
this is the 0.51 version, it's pretty simple. currently deciding how to handle 1.0 netcode group changes
nice stuff ๐ and when the player logs out you disable all the simulation groups?
when a user is disconnected i destroy client world and re-created it
i always have a client world (except in dedicated server)
but it's disposed and re-created every time a game ends
i'm not doing any multiplayer (yet) but i can surely clean this up better to take advantage of enabling/disabling system groups to prevent such very redundant checks. thanks
yeah, i see it the same way. i make 1 sytem now handling the sub system groups. i'm okay querying something once a frame.
i'm a huge fan of system groups that limit updates these days
(very happy system groups became SystemBase in 1.0)
haven't realized until now. that's pretty cool
does RequireForUpdate also require the [RequireMatchingQueriesForUpdate] tag? i don't think it does
yeah true. just wanted to make sure ๐
Hey guys I am interested in exploring dots for my new project. Do you have some good tutorials, docs I can look at.
I plan on building a settlers game in a pherical procedural generated world which mean I would need navmesh and collisions physics to work. Is there any good material on these subjects?
navmesh will take you a little work (it's doable)
physics is pretty solid
probably should start with manual
but they also released a new dots guide as part of the samples
i haven't really looked at it too much but from a quick glance gives a basic start point
not sure how but i kind of broke live conversion =S
๐ฅฒ Until now subscene conversion still kind of broken
Anyone know what component datas I need to render sprites in pure dots?
Are pointlights supposed to work in Entities Graphics & URP? For me only directional lights work at the moment.
Hey everyone, is 1.0 working okay? Is it time to upgrade from 0.51?
I managed to get my project upgraded but there are still a lot of issues. For me it's basically crashing every time I save my scene. Subscene conversion is kinda broken. The new baking system is missing some features I needed (For example removing components). But if you want to get started you can definitely try. Just make sure you create a backup/new branch.
Can't say
too much critical bugs (at least for me)
can't even keep working
if i ignore netcode and the complete rework of how systems/groups get assigned to different worlds
honestly it's been pretty smooth
but netcode is bending me over backwards atm
๐ฅฒ Still slowly upgrading project
starting to get the hang of this though
huge pain to update everything but it's starting to make sense
and it can do some really useful things that solve some major issues i had before
as in i can finally setup my libraries to work with or without netcode without the need of a dependency without having to write a bunch of conditional code
has something drastically changed for netcode or in general?
How does il2cpp/burst handle integer overflows in a job?
it doesn't. it overflows ๐
re Burst overflow: Specifically: https://forum.unity.com/threads/does-burst-support-the-unchecked-keyword.761495/#post-5072381
Ugh. Burst spoils me. I need deterministic floating point math in compute shaders... fixed point is pain
I keep getting a crash and I think it is due to this error: "System.IndexOutOfRangeException: Index {0} is out of range in DynamicBuffer of '{1}' Length." any idea why that might happen?
@olive kite is it in a build or editor? if editor, you can disable burst on the code in question to see a better error. if in a build, builds are just in bad shape right now, need patch release
Whatcha working on now Mr Flaks?
in Editor, I'll try that. It is in ScheduleParallel but didn't think I was modifying any values in the buffer. I'll also try not running in parallel
also i assume it isn't literally an editor crash, but just an exception? if the editor itself is crashing to desktop, that is likely unrelated and something that needs another editor beta or two
oh yes, it is an exception. I am trying to trouble shoot a build crash and am having a hard time doing so, I thought this might be what is causing it
i mean, it could be. but as i said, builds are not in good shape anyway, so if it were me i would just wait
Next Fest demo is live ๐
ยฏ_(ใ)_/ยฏ
well, at least try to stick to mono builds then
and turn off stripping
(these two things work around a bunch of our known bugs)
yeah I am doing mono, though I don't believe I did anything to turn off stripping
thanks, i'll look into it
i have a pr open to master now that makes things work again with high stripping, but it hasn't landed yet and then i need to backport it to the experimental branch
oh cool, rough eta?
yeah I have stripping disabled and using Mono. I'll try to disable Burst although it only seems to happen with 1500+ pathfinding agents active and it's rare, so maybe i'll leave it running overnight
oof
hey guys. is there any trick to get a Baker to run?
my Baker<T> is neither called for prefabs, nor for scene GameObjects
I have a mesh who's at a wrong front facing angle. In GameObjectUnity I just make it a child of an empty object and adjust its rotation vector,but DOTs doesn't convert it right if it is a child of an empty. How do I adjust the angle of a Mesh in DOTS so when scripts change the angle, it doesn't nuke my offset rotation?
My DOTS ECS game is finally nearing close to being super super fun. Thanks guys for all the help over the year and a half.
Trying to put dragons in for lols, and I can't offset angle it right. When script changes angle on the fly, it nukes my offset of the mesh.
We run a guild. Opportunity: I can teach you how to make games for free better they teach at expensive universities. If you help us, you get revshare.
#1 Senna NA mastery I sa...
No Runtime baking, so Scene GameObjects can't be baked, but SubScenes can, so put your GO in a SubScene and you're all set! :3 (To make prefabs work, you can simply call GetEntity in your baker from your prefab field)
Yeah no more update in world or custom simulation groups for client server etc
Now uses flags from entities
oh, last time i used netcode was in 0.6 ๐ care to explain or have some code snippets?
Is it possible to rotate an Entity that has a Mesh rotated inside it?
I haven't had a question in weeks since DOTS / ECS was in such a good spot. My only other question is: How could I put graffiti paint on a mesh in HDRP DOTS/ECS? In regular, you just skin it again, but DOTS/ECS doesn't let you skin on the fly.
What's cool is that my game would be super super fun and have a patch out if I got these two very basic questions answered.
Am I articulating it correctly? Do people know what I mean by a badly centered mesh that you fix by rotating it?
Like the initial mesh doesn't align 0,0,0, so you by hand rotate it.
But when you put it in a DOTS/ECS Systembase, the rotation of forward facing there, nukes your offset since you're using the translation.
For painting I'd probably be going this with shaders not actually changing the mesh
I haven't looked much into shaders, but now you give me reason to. Thank you. I might do like I did with particles and make a random shader generator.
Translation is local space you probably need to use the local to world to get the actual world forward
I have a script that already works for other ships.
I'm trying to align another mesh with it, and they work and shoot like a ship.
But they don't face forward.
Because the mesh itself is off centered.
I could do an ugly hack where I test the entity type in the loop,slowing the game down and readjusting it rotationally.
Why not just fix the mesh
In GameObjectUnity it allows you to make an Empty GameObject and then place a GameObject as a child then rotate it there.
I did not make the mesh myself. It came from Unity Asset Store.
I hate offset meshes, position or rotation
Just an extra hierarchy call for no reason =/
I didn't know I could edit a mesh.
I haven't opened a modelling app in ages but from memory it's actually super easy
It is not possible to edit a mesh in Unity. Ok. So I should try blender I suppose.
This is super valuable information.
I would have never thought of that. You'd think Unity would have some rudimentary mesh editor built in by now.
or an offset rotation for DOTS/ECS
Ok this is great, I thought it was a trivial issue, but it was not. I'm super glad I asked you guys about it.
God bless ya tertle,ain't no way I would fix this on my own,except hacky in line script
I may resort to that if the proper way is not working.
ahahaha, it workd Tertle and it looks so freaking tacky and dumb like I wanted!
Did you just change the model?
Yah, I got blender and changed the model...Now I'm dangerous, I can make my own models.
You might not laugh, but this made me laugh, came out just as I wanted
Space is boring,right? So I'm doing the old Oregon Trail thing of an event every 30seconds to 3 minutes
Absurdity trail. Weird stuff and funny stuff,dialogue, trading, anaomolies to research and normal fights and strange fights
Like space dragons, looks so tacky, I love it!
We run a guild. Opportunity: I can teach you how to make games for free better they teach at expensive universities. If you help us, you get revshare.
#1 Senna NA mastery I saw no hate ever in arcades. Choose love. Also #1 world in Starcraft/Broodwar/Warcraft3/Diablo2/C&C3/SC2 2v2. No gamer has been #1 world in as ...
you use [WorldSystemFilter]
for example
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation | WorldSystemFilterFlags.ServerSimulation)]
but there's also a cool little feature called ChildDefaultFilterFlags
which is what worlds your systems go into if you add them to this system group without specifying a group itself
have they built this or is it core entities?
core entities
this is not part of netcode which is the other useful thing (get to that in a sec)
so you can do something like this
public partial class DebugSystemGroup : ComponentSystemGroup```
bit of a mouthful
nice, thanks. have to look into it
but basically this system group will be added to all worlds, including editor
and by systems that use this system group will by default be added to all worlds except editor
so yeah the other really useful thing, in particular for me who writes a lot of standalone libraries
is this is built into entities
so i can setup my systems to run either for a single world game or specify into client/server where it makes sense
without having a reference to netcode and/or conditionally compile it out
(or the better approach where i previously wrote a copy of the updateinworld in my core library that was compiled out if netcode was present)
Is there a trick to making a baker work? I have code nearly identical to this and a cube in the world with a MyAuthoring component attached... but the baker code never runs. Do I need to create an instance of the baker and run it?
https://docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Entities.Baker-1.html
your cube is in a subscene yes?
The main scene
Trying to do some deterministic multiplayer real time fluid simulation.
Is that documented somewhere? I Thought that I had been thorough...?
i haven't read the documentation in a long time, but a quick search through it does feel like there is a missing page on subscenes
With no runtime conversion the rule is nice and simple.
SubScenes = Entities only
Main Scene = GameObjects only
(this being said, gameobjects can get references to the world, and as a result add entities, likewise, entities can have references to managed data, and even instantiate GameObjects)
But yeah, docs, samples etc. Those are still WIP
So, I just created a scene, added a cube with that MyAuthoring component in it, and put the scene under my main scene... main scene is in Red, and the cube is in blue... is this a good setup?
create 2 scenes, 1 main, 1 your subscene for entity data
in your main scene create a gameobject, add a component called subscene
put your second scene in the field on the subscene script
but your entities inside that second scene
you can open/close the subscene with the buttons in the inspector or the toggle in the hierarchy
Wow... I would never have guess that...
ideally have it closed when entering play mode
I've always just right clicked my main scene and click "New Empty Sub Scene"
or that ^
Didn't even know you could manually add a subscene component or even that a subscene was registered via a component
Two ways to create a SubScene in the Editor, one is New Empty Sub Scene, the other is Empty GO with a SubScene comp, New Empty Sub Scene is just short hand for the latter
you should see something like this peon (ignore the SubSceneLoadConfig script, that's my own thing)
Have you seen this DOTS 1.0 tutorial?
https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/DOTS_Guide/ecs_tutorial
ah there is a page with the info
Very quick to set up (if your not building for Quest 2)
That is new to me.
i couldn't see it when i had a very quick look
Thank you David777, Tertle, and Dani
there's meant to be a link from the ecs package page to this
but i noticed it's broken
DOTS Cookbook: Information about data-oriented design and the fundamentals of Unity's ECS implementation.
DOTS Tutorial: A tutorial that guides you through creating a simple scene with Entities.
both of these just send you to dead links, seems like it should send you here instead
https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/DOTS_Guide
I can't remember how I found this page... 
But yah, I do remember now coming across the broken link...
pretty sure a unity guy posted it here when they added it post 1.0
but it's just part of the samples so it shouldn't be too hard to stumble across
hmm my 1 complaint atm is
ClientServerWorldExtensions
IsThinClient()
IsClient()
IsServer()
are part of Netcode not Entities, even though it only uses entities flags
so if i want to do something conditional for like a thin client in a library that works with or without netcode i either need to wrap it or manually check the flags
just going to make a copy and put it in my core library, just annoying
Hi! what is the easiest way to render 1k simple animation (just idle) meshes (800vertx) on mobile now? I found vertex animation plugin https://github.com/maxartz15/VertexAnimation but it seems outdate and maybe doesn't support mobile cause have a lot of error inside shader graph
Depends what you mean by easiest. But for the best performance, I think vertex animation textures (like the library you linked) are the way to go if just want basic idle animation playback. There are quite a few different libraries out there that use vertex animation textures and I'm not sure if any of them are actively maintained. So you'll probably need to update one of them yourself. There might also be some assets on the store (like this: https://assetstore.unity.com/packages/tools/animation/flipnote-texture-based-skeletal-animation-130904). I haven't tested any of these libraries or assets myself recently, but I did experiment with vertex animation textures with ECS a couple of years ago and got something working.
Have you been able to build DOTS to mobile?
builds in general are in bad shape, as we've said. however, david it occurred to me that i wonder if mono works on android with stripping disabled, since a lot of the issues are related to il2cpp and/or stripping
Ohh, nice
Are you meshing it?
nah, just 2d integer (fixed point) texture and the lagrangian iterations acted upon it.
I'm trying to get a hold of the source code of this: https://www.youtube.com/watch?v=_3eyPUyqluc and combine it with an existing codebase this: https://github.com/diwi/PixelFlow and do so in a massive scale (8000x8000 grid at most) in a multiplayer deterministic environment.
ah that should be cool.. i'm curious why you're creating a massive fluid sim..
have you looked at piping the point data into vfx graph?
Just for fun. And to see if I can.
Ideally, this fluid sim will be overlaid on a 2D tilemap with physics based static walls and, a very far stretch goal, dynamic rigidbodies.
sounds like a fun project ๐
hrm, i think maybe with burst and a distributed update sequence, I might be able to do the fluid sim using deterministic floats on the CPU...
Just update 32x32 or however many I can get away with chunks per frame, distribute the workload of updating the entire map's fluid data over the course of hundreds of frames. Maintaining 60fps is key, hrm. But first, I need to see if my lighting system explodes when updating to 1.0
do you have it actually up and running on the gpu so far?
I have a form of copy pasted version, very old project of mine. https://github.com/diwi/PixelFlow/blob/master/src/com/thomasdiewald/pixelflow/java/fluid/DwFluid2D.java
Not that repo of course
but a copy of it ported to hlsl in unity
It was for an old version of unity and was pretty clunky, back when I was dipping my toes into compute shaders, but it worked back then. Dont know where my screenshots went. The fundamentals aren't hard. Just requires massive numbers of iterations to converge on a usable approximation. 40 for pressure projection and 20 for each diffuse property (60 in total for velocity, temperature, and density). So 100 iterations in total. Very expensive. That youtube link promises to cut down on these jacobi iterations significantly with a separable filter approximation but the source code is locked behind Ubisoft corporate copyright. Which is pain.
ahhh.. do they talk about how they achieved the reduction beyond just saying that no?
not that i know much about it tbh, but it's something i was always interested in trying out
that and meshing an actual fluid
They have research papers and pseudo code but not enough to recreate it. Especially since they only describe the mathematical derivation of the poisson filter construction (which apparently requires use of neural networks?) but not the finalized per iteration mathematical 2d filter values.
Yea, this is just numerical transport with color coded value ranges. Not actual meshed fluid interactions.
that's some fairly heavy duty maths stuff ๐
Derivation of all this stuff is pretty crunchy but the utilization is simple enough. A set of constant filters to sample and sum together (I think) multiple times in expanding concentric rings for a set distance.
It's like poisson blurs, the faster alternative estimation of a gaussian blur.
just skimming through the paper, the math is way over my head but they do mention machine learning as a possible avenue to help create the depth field ( section 4 ) where basically the simulation is 1d and they fake the depth to avoid doing multiple sims on different dimensions
machine learning is the newest academic buzzword for magic
haha yeah
it's interesting though i wonder if a neural network could be trained on fluid data and then used to simulate it faster ๐
Thats the key formulas for reproducing but it lacks the application and starting points. Ugh, they were suppose to publish a sample project using it but last I heard from the pipeline a month or so back was that it was locked in paperwork for unclassification.
What
IJC overthrows its successor
They even purged the section relating to IJC in the documentation. What is going on?
Yea. We were really spoiled with 0.50 release with accurate documentation on release. Not comprehensive but at least largely accurate. Ugh. Gotta shift gears back to the old unity ecs trial and error days.
Nice, good find. Thanks. I just managed to scrape together enough free time to dive into 1.0 right now so this is all completely new for me
Yeah, sorry about that one! deadlines are slightly skewed for docs vs features, so we don't have to e.g. write docs for the old thing then while next weeks task is called remove the thing and make docs to that now instead, tho any question can be asked here or on the forums and we do try to answer them! :3
Is there a version that includes IJobFilter? I dont think it changed (outside of a rename) in 1.0 but it's odd that DOTS makes no mention of it.
Isnt IJF the only specialty job now that the NMHM variants got purged?
IJobFilter
IJobParallelForBatch
IJobParallelForDefer
IJobParallelForTransform
Oh right. Huh. I even use the defer version. Transform hasnt changed right? I need to find their implementation of GO-Entity syncronization and reverse it with the new transform changes that messed my implementation up.
also 6 in physics
Oh right, the physics jobs. I wish tiny got revived with 1.0. All their 2d stuff made my life easier
They didnt expose the companion component type addition (still internal). I'm concerned about the radio silence surrounding hybrid dots. But that is just unity in the end.
And with the runtime conversion being deprecated, I need to find a way to add monobehaviors to the engine physics loop somehow.
ugh, i would've sworn that DOTS Netcode guy said that runtime conversion wasn't getting chopped. Well that was a lie.
usually when we say things that are wrong they were true at the time
we're trying to get better about not saying things that might be false in the future, though
Yea, it's just me venting.. I had a lot riding on that and now I need to figure out a hybrid workaround.
to be fair to the netcode guys
At the moment are speaking, ConvertToClientServerEntity it is still present in 1.0. A final decision is still in progress for what I know.
I will check fore more up-to-date status, but it is safe to assume it will be still there.
is what i suspect you're thinking of
and then followed up with
The component has been deprecated. A new baking flow for the ConvertToClientServerEntity will be provided for the final 1.0 release but there is not a replacement for it right now in 1.0 preview.
My fault with bad reading comprehension. Thats what I am also remembering now. I just took their statement but ran with it.
in general, my feeling has been that we were correct to focus on a) deleting most of the things that we knew were permanent nightmares in one way or another (with the exception of entities.foreach), and b) fixing all the things that users absolutely positively could never fix under any circumstances (e.g. job system overhead, isystem not working properly, most jobs not being schedulable from burst, etc)
correct me, but so far my observation has been that users can staple their way around hybrid interop, it's just pretty annoying. and that is much easier to fix in a patch release than e.g. conversion just permanently being unreliable
personally i find hybrid fine, it took like an hour and a single system/component to solve all my issues
and i can have gameobjects + components referenced/managed from subscenes
For what I call "static" monobehaviors. Basically everything except physics and I got them working with an assembly exposed baking system. However I'm tied to the engine's box2d physics which requires interplay and recognition between the monobehavior and engine. Baking prevents the Physics2D from recognizing MB scripts and components as part of the physics world.
Well, not baking. The 0.5X GOCSs. Havent tried with the 1.0 baker yet but I doubt its different
The alternative of course is inversion of the entities - GO data structure. Which I think is the way forward.
2d is indeed a bit behind the times. that said, i'm surprised a 2d game has sufficient scaling issues to create interest in dots
I like DOTS and the linear data structure makes CPU-GPU-CPU communication a lot more streamlined.
true, it is nice for that
Oh not to brag but I've made 2d Unity games with performance problems
I've tried to make my own physics engine, which was a great learning experience into really in depth data layout burst optimization, but what it really made me appreciate was how robust unity's physics engine was. Sure, it's not the fastest but it is rock solid and robust.
Mine had bodies overflowing velocity just trying to calculate friction vectors. I know there was some math issue somewhere inside the polygon body but in the end i just went back to the built in version.
Friction, really? Nice. What friction model were you using?
Just basic single scalar friction on the contact point application. Something was borked with the tangent calculation. I had everything hyperoptimized using vector4 wide math operations and debugging why the orthogonal vector was not normalized was just too much work in the end
Everything else worked, kinda. Multiple manifold / contact bodies didnt seem to resolve in a logical manner, how I was doing it at least assuming every pair contact was independent of another.
Theoredically that shouldve worked but what it turned out to be was a lot of jittering. Might have been an issue with resolving cases of multiple contact points per pair contact independently in parallel resulted in extreme values.
It was just basic box 2d but vectorized. Fun project overall
Huh, does anyone know what happened to the dots tab? Im trying to enable live conversion
Hrm, GO positions no longer reset when play is cycled?
Or is that a side effect of domain reload disabled
ok so the settings are all in preferences -> entities
however it seems that the live baking option in 1.0 was hidden by accident
i believe it's on by default but if it was off when you upgraded it will be off and hidden
you can go into the help -> about
type internal
and it will enable the option in the preferences -> entities tab
huh, that is weird. I dont trust Unity's upgrader for major versions so this is a manually ported project and that option is also hidden
Yea, that worked. Any way to disable the internal again?
Or will a restart do it
type it again
pretty sure it stays on between sessions (it just sets an editor pref)
ugh, yea
Neat. The boxes around the component types are missing though. May be a broken UI which was why it was hidden
I wish all the components were listed, one component per row, instead of compressed together. But that was how it was since live conversion was a thing so eh.
I've often thought the same. For me at least the readability would be better
I guess, is it really needed anyways? With the inspector view, this tiny preview is largely redundant.
that's true, hadn't even thought of that
I am liking this burstable builder API. Makes query construction a lot more compact. Real nice.
If I have a bunch of jobs that are going to all perform actions on a single float value, is it safe to parallelize it? Like a float like position. If I want 50 jobs to all add X amount to the position, is it safe to do something like:
public void Execute(int i)
{
float blah = obj.x;
blah += something[i];
blah -= something[i];
blah += something[i];
blah *= something[i];
obj.x = blah
}
If the operation isn't instant, say it takes several lines of code. Could the jobs potentially step on eachother's toes?
50 to 1 can not be parallelized. That's a classic race condition situation. You must either do it in sequence (singlethreaded) or use interlocked commands.
ah, duh. Thanks
wondering do we have any dates as to when unity physics will support the new transform system?
Soooooooon^tm
ah, welp atleast soon is better than never!
Welcome to DOTS where waiting is the only constant around here.
lol
And no optional components in IJE, shame. I have a perfect use for it, if only there was optional components...
i dont even know what IJE is, but sounds cool!
IJobEntity
oh ok cool!
@rotund token Do you know why Unity made the transform system AoS instead of the old SoA? Seems like jobs wanting just the position will waste a lot of cache line bringing in scale and rotation in.
I know there's the option to go back but it's getting deprecated.
think they wrote up a post about it somewhere