#archived-dots
1 messages · Page 254 of 1
damn, enable/disable would have been a huge optimization as well as simplified workflow
Are we reading the same roadmap?
Because that isn't huge, that is barely a repaint with some additions from other teams.
that's planned after 1.0
complete rewrite pretty much is 'barely a repaint'???
I'm not seeing where they completely rewrote anything. Are you talking about ECS library implementation? Is a rewrite of that even a big deal for 1.0?
source generators alone....
0.50 was a pretty big rewrite
btw, they'll have to rewrite the source generators again for 2022 i think / hope
well... not fully rewrite, but change them up fundamentally still
The time they took to get to source generators is nothing to write home about if I'm to be honest. There's practically nothing else, some limited support from other teams and that's it.
Not even animation.
You know, the team that took a year from communication just to focus on... you know... animation?
I'm not happy with animation but I'm not really sure what you were existing from entities itself
they never said that. animation is pretty much abandoned for now since forever and will only return late after 1.0
It seems you guys got used to lackluster development speed so this is just par for the course.
Api wise I think it's mostly done. Tooling etc is the primary focus
1.0 will be a big breaking change
I am definitely annoyed about the delayed animation though, kind of throws some plans in the air
For different reasons
Don't expect a giant fundamental change to how systems and jobs work
just means more funding really
that made me laugh, abandoned? Let me find some links.
by the roadmap seems like 0.50 covers most of what 1.0 brings so I dunno if theres really more or its mostly just like an overall showing of what 1.0 has, which by definition also includes 0.50
Ah, well, looking forward to that then!
Anybody got a link on hand with the roadmap please?
https://forum.unity.com/threads/animation-status-update-q4-2020.1023445/
Existing animation tech will receive general maintenance and bug fixes throughout 2021 (and beyond). As always, we’ll do our best to back port as many fixes as possible to 2020 LTS.
New Animation Tech (i.e., DOTS)
We are actively working on building the foundation of future animation tools and technology
When will animation devs become more active in the forum?
We will still drop in on occasion, but will not be engaging in “front-line” support in the forum for the next few months.
That was from Animation Status Update (Q4 2020).
https://forum.unity.com/threads/animation-status-update-q2-2021.1125482/
The road to 2021.2
Advancing DOTS
We have been working with productions to ensure our new high-performance, multithreaded Data-Oriented Technology Stack is delivering on our vision of a scalable, streamable, networking ready and highly customizable platform.
Basically they've stopped working on animation for dots animation, any old feature was on maintenance and minor qol only mode... since 2020?
Anyway, the disappointment from that 1.0 is rather sobering, for me at least.
But DOTS got their roadmap page. Finally. I guess that's nice. ¯_(ツ)_/¯
that was 2020. there's more than a year between that 'announcement' and today
I guess reading comprehension isn't your strong suit since you skipped the 2021.2 update. I'll be ignoring you from now on. Peace.
!warn 939565957947486288 Do not insult community members. Read #📖┃code-of-conduct .
TermsOfService#1906 has been warned.
so, anyone here going to gdc?
no :( I was considering it until I saw the last minute plane tickets 😅
The 2021 post you linked does not mention animation
second link
that's the only thing he posted
Does IJobEntity accept more than 8 ref/in parameters unlike Entities.ForEach?
I think you can put as many as you want into the struct but I haven't tested that. That was the main reason they got rid of the original system where you add them as generic types. Could only do up to 6.
@rotund token Hello friend, Collections had an issue with a NativeArray which you made a workaround to copy paste Collections and fix the change, is that needed anymore in 0.5 ?
no
Anyone else getting this error message while trying to resolve package dependencies for Entities 0.50?
Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities.Hybrid/GameObjectConversion/GameObjectConversionMappingSystem.cs(1093,36): error CS0030: Cannot convert type 'Unity.Entities.Chunk.<Buffer>e__FixedBuffer' to 'Unity.Entities.Entity*'
Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities.Hybrid/GameObjectConversion/GameObjectConversionMappingSystem.cs(1099,52): error CS0019: Operator '+' cannot be applied to operands of type 'Chunk.<Buffer>e__FixedBuffer' and 'int'
2020.3.31f1 (LTS)
oh did 31 just come out?
i assume it doesn't break it
do you have custom package dependencies?
like on collections/maths/etc
As in specified in manifest.json?
yes
Yeah, I'll get rid of them then
haha this is a weird piece of code isn't it
var entities = (Entity*)chunk->Buffer;
public fixed byte Buffer[4];
but yeah should be fine
try .30f1
Thanks guys!
@rotund token those packages no longer exist after upgrading Entities. I'll try downgrading to .30f1
it would be amusing though if they broke it just 1 editor update later
Yeah that's just mean
@rotund token as you upgraded some of your code, whats the best thing about 0.50? I read somewhere there is still no enabled/disabled state of components, so is there something really groundbreaking or just UX and QoL with some minor upgrades?
they could just build .30 differently with additional DOTS integration
i belive they did something similar in the past
i spent 14 hours upgrading projects yesterday i've barely had a time to play with it. imo the best thing is IJobEntity though.
The profiler stuff is nice as well (I spend a lot of time optimizing so all these tools are really useful for me)
For most people though nothing will be ground breaking.
do you have any info about plans for enabled/disabled feature?
if I did I couldn't say!
though personally I'm not expecting it till after 1.0 (or ever 🤣)
I mean if there was, i could missed something XD
@rotund token well darn Entities 0.50 broke your Event System package
Library/PackageCache/com.bovinelabs.event@1.2.2/BovineLabs.Event/Systems/ConsumeEventSystemBase.cs(13,5): error DC0058: All SystemBase-derived classes must be defined with the `partial` keyword, so that source generators can emit additional code into these classes. Please add the `partial` keyword to ConsumeEventSystemBase, as well as all the classes it is nested within.
yeah you have to add partial to it
i've already fixed 2.0 in a 2.1 branch
i've fixed 1.2.2 in my work project (we use 1.X at work, but i personally only use the 2.x branch now)
i'll try find some time to upload a new 1.2.3 version that fixes it but yeah just copy it to the packages folder and unity will auto update it itself
Sure, I'll edit your code to fix the problems for now, but every time I modify package code the entire thing just regenerates. I have to do it twice each time
But for now you said to use the latest 1.x version?
Ohhhh, thanks!
i wasn't originally intending to update 1.X to 0.50 but it the only thing that actually broke was the unit tests and after fixing those everything pass first try
been using 2.X for a few months now and while it doesn't have the same test coverage I'm yet to have an issue with it
i'm just too lazy to write any documentation for it atm - also i'm too lazy to update my work project so i have to keep supporting it
Yeah that sounds like a ton of work. You're not obligated to maintain that... but it would be greatly appreciated
Ok, Unity is claiming ```
Packages/com.bovinelabs.event@1.2.2/BovineLabs.Event/Systems/EventSystemBase.Extensions.cs(244,38): error CS8377: The type 'T' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'
but you clearly constrained T like so
public readonly struct Extensions<T>
where T : struct
{
oh yeah actually
yeah i did have to make changes
all those need to be : unamanged now
a simple find and replace for
: struct
: unmanaged
anyway as i say, i'll try to get it up soon~ as i've already done all this work
Thanks a ton for the support!
Are either of you using any generic jobs in your projects and encountering play mode errors or issues with 0.5.0 ?
yes i have a lot of generic jobs and systems
and after upgrading no issues?
What are you talking about, you have a framework based on DOTS @rotund token ?
i have a 2.X version of my event system i released it a good 6+ months ago but only on a git branch
it was designed in advance for 0.50 (and ISystem)
Is the purpose of your events for DOTS to talk with Monos for things like collisions or what
not really
it's to extract info out of jobs without having to worry about threading or safety
the most common us I use it for is a drawing library, but we also use it at work for telemetry etc
it's 0.50 😄 sorry
can you show me an example of it? I did never use those as I don't have any inheritance
hush you! was on mobile in the kitchen 😊
can it be used in some different way?
I took a stab at updating the anim package to 0.50, its actually just those generic structs need to be unmanaged and an asmdef change but it silently fails on play, nothing happens unfortunately
I wonder if I should use more interfaces
though on exiting playmode I get InvalidOperationException: Reflection data was not set up by a call to Initialize() and was wondering if you ran into this with any of your upgrades @rotund token
hmm I saw a lot of errors but I don't ever recall seeing that
the main problem with porting animations is that you cannot integrate it with HR unless you use ComputeBuffers and GPU Skinning
I think its actually dataflowgraph which didnt have any compile issues that I can recall
anim package has those things
if you don't you will loose all benefits of HR
so probably this with constantly changeing API of DOTS is main reason animation package is moved in time
dont need compute either, can do vertex skinning which is what I use currently. actually both compute and vertex are the same performance for me in the samples
so how do you send data to the GPU?
I mean I'm also using vertx shader for skinning
but I need instance data
and I send it by ComputeBuffer
I guess I dont fully understand how the animation package packages up data for the hybrid renderer, but its all there in the samples repo https://github.com/Unity-Technologies/Unity.Animation.Samples
I don't remember either
I have my own custom solution
still not integrated with HR but I think I know how and it shouldn't be hard
main problem is how to feed animation data arrays into proper material before anything renders
is your shader shadergraph or code?
I could bake them to textures but is seems cumbersome in handling
shadergraph with custom code node for skinning
oh
I did use shadergraph as a reference for mine, but it might be easier to look at joachim's gpu package if you havent already.
I think I did, and I found older unity test of gpu instancing also I think
I did it this way to let artist do their stuff in shader graph
btw, regarding GDC DOTS talks
from Unity GDC FAQ: https://unity.com/events/gdc2022#faqs
you going @dull copper?
nah
would be crazy expensive to go from here
plus I'm not fond of current covid situation still
also not too fond of the GDC monetization scheme either 😄
would love to go and ask questions
Question regarding Animator and Hybrid Components:
I've barely ever had to deal with hybrid DOTS before, but now with the animation package removed, I have no choice but to make my animated character hybrid
I was under the impression that simply drag n dropping a GameObject with a mecanim Animator component in a subscene would just work, but it looks like the mesh has no animation when I do this. Same problem if I instantiate the mesh at runtime via an ECB. But it does work if I don't put it in a subscene
Does anyone know what the hybrid workflow should look like, to get Animator to work on a converted Entity?
imo your best approach is to just separate the entity converted part with the presentationg gameobject
have a 'key' on an entity component which references X gameobject then instantiate the gameobject (and bind it) at runtime
just keep a very basic separate presentation gameobject with renderer, animator, etc
that said, i've done a lot less experimentation with hybrid approaches but i believe the dots shooter demo did something like this and that's the approach i'm looking at going forward if i can't implement or don't have the time to implement a pure animations solution myself
@light badger what tertle said is more or less what I did. doesnt work in subscenes, kind of a fiddly mess. https://gfycat.com/unitedpoliticalasianporcupine it works, though its obviously not performant, and quite honestly I hate mixing monobehaviours(since you cant really avoid it for some animator callback stuff) with dots. end up writing a lot of intermediary systems just to communicate crap back and forth. that gif is from 2020 😩 fuck me cant believe been waiting so long just to wait even longer
also if its not clear, that is a pure ecs player/weapon and unity physics driving the collision + ragdoll for the mecanim enemies
sorry @safe lintel it seems to be some damn problem with the unity dots. i found a solution in the forum for this and now everything works perfectly.
does anyone know why unity apparently can not find these packages? although it recognises them AND links me to the changelog?
0.50 version of these packages are released. any particular reason you need those older versions ?
also what unity version are you using ?
ok, I would recommend using all dots packages in 0.50 with unity 2020.3.30f1
ok, why's that?
because older version were said not to be supported with unity 2021. Some made it work but no guaranty from unity. DOTS is already "fragile" as it is, I would not move away from the recommended version support.
the 0.50 includes the "essentials"
com.unity.entities
com.unity.rendering.hybrid
com.unity.netcode
com.unity.physics
com.havok.physics
this breaks behaviour
should be good I suppose
thats the one sitting there in my unity hub
works
@uncut rover I just grabbed the one that it says. Thanks for your help
@haughty rampart what behaviour breaks??
you just used an invalid allocator. that's dangerous
Well nothing has broken for now. So I am going to keep it. But i will watch out for the future. 🙂
no problem
Hey, out of curiosity, is it Rival related ?
yes, I've started working on the update to 0.50. There are quite a bit of breaking changes, but the majority affect the samples project and not the core CC itself:
- need a Hybrid replacement for animation
- some Netcode stuff needs to change
- Physics dependency handling has changed (as far as I remember, this is the only major thing that will need a manual fix in the CC user code)
Argh, this is pain.. i hope you continue to include the option of using the anim package in Rival for any hardcore folks that want a leg up, it definitely has a lot of value..
I wonder the scope of manually porting the animation package to 0.5
TurboMakesGames has just posted a vid for anybody looking for an overview of 0.5 ( easier than trawling through discussions hehe ):
Entities 0.50 Release Overview - https://forum.unity.com/threads/experimental-entities-0-50-is-available.1253394/
DOTS Development Status Post - https://forum.unity.com/threads/dots-development-status-and-next-milestones-march-2022.1253355/
Entities 0.50 Installation Guide - https://docs.unity3d.com/Packages/com.unity.entities@0.50/manual/instal...
I know it's disappointing, but for now I'll have to stick to Hybrid for animation. Trying to maintain the DOTS anim package may end up being more support work than I can handle, and for an asset store product I think it's important to use stuff that is as "standard" as possible...
But Unity did mention in the thread that there is still a plan to have a DOTS anim package eventually. As soon as this comes back, I'll change the animation handling again
One thing to remember though is that the animation handling in Rival is only in the samples; not in the core controller. So if you want to attempt using the old DOTS animation package with Rival, you may still be able to make it work
I'm working on some custom 2D rendering and need my system to run in the editor and during runtime. I'm using assembly definitions and I'm kinda confused on how to split my system to allow it to run during both play & editor.
I'm kinda stuck on how to get the relevant camera(s). In editor I need access to UnityEditor.SceneView.camera, but in runtime I'd just grab Camera.main. Is the idea here that I would simply IFDEF all the parts of my code that requires editor? If so I'm not sure how I would combine that with assembly definitions??
instead of #if UNITY_EDITOR you could also use [Conditional("UNITY_EDITOR")]
Binding GOs to entities is not that complicated. I just wonder why Unity doesn't provide that feature. It's highly annoying to not have a standardized package for this
it's finally time to test 0.50 in my project. wish me luck 😄
Or rather I should say, why did Unity support that feature but then decided to remove it. It's like the left hand doesn't know what the right one does
yeah companion gameobjects are a bit wonky, like conversion and subscenes. not even sure if companion gameobjects are here to stay or not, would be nice to get further details on their plans for hybrid to try to work around current limitations
Uhm ... World.GetExistingSystem<TRSToLocalToWorldSystem>() doesn't work anymore?
it's a struct ISystem now
and they haven't fixed their dependency order
The system NZSpellCasting.TargetInfoSystem reads NZSpellCasting.TargetMatrix via TargetInfoSystem:CalculateTargetInfo but that type was not assigned to the Dependency property. To ensure correct behavior of other systems, the job or a dependency must be assigned to the Dependency property before returning from the OnUpdate method.
damn
[UpdateInGroup(typeof(Stage1SystemGroup), OrderFirst = true)]
public partial class CompleteDependenciesSystem : ComponentSystem
{
TRSToLocalToWorldSystem tRSToLocalToWorldSystem;
private ExportPhysicsWorld exportPhysicsWorld;
protected override void OnCreate()
{
tRSToLocalToWorldSystem = World.GetExistingSystem<TRSToLocalToWorldSystem>();
exportPhysicsWorld = World.GetExistingSystem<ExportPhysicsWorld>();
}
protected override void OnUpdate()
{
exportPhysicsWorld.GetOutputDependency().Complete();
foreach (var eq in tRSToLocalToWorldSystem.EntityQueries)
eq.CompleteDependency();
}
} ```
I had this system to fix the problem
For some reason TRSToLocalToWorldSystem doesn't complete on the next frame. I don't understand why
I always was under the impression that every system completes before the next frame but that wasn't the case even in 0.17
well, I'm stumped. No idea how to get the entity queries now from that system.
and it's sitting right here in the ISystem with private EntityQuery m_Query;
no getter of course because why would it?
does hybrid renderer2 still require URP or HDRP?
yes
"still"?
has Unity messaged they will bring built-in support back?
I thought they deliberately removed that
yeah @unkempt silo builtin has been removed permanently from the hybridrenderer
and isnt coming back
holy shit, I'm having dependency problems left and right. seems entities doesn't like it when you .Complete() a job - I mean, how could there be any dependency problems with it?
i saw philsa made this comment, not sure if it's related:
from where is this, think it's related but I have other components too so it's really weird
deactivated some systems and now others are crying with the same error but other components.
it was just his announcement on his Discord server re having to make updates to the Rival dots character controller
has anyone noticed the companion transform update system producing garbage? is a thing/bug with 0.17 but havent yet updated my own project to 0.50
is anyone of you using .Complete()? it seem completely broken
systems in my stage2 system group complain that some comps used in stage1 system groups are not in the dependency chain
this worked totally fine in 0.17
is it relating to physics? does seem like there are new requirements for setting up dependencies there
I'm having too much errors right now but this seemed to fix it for one system
no, it's related to my other systems too. basically everywhere where I .Complete() a job
after the job runs I'm doing some MonoBehaviour UI setup so that's why I'm using it
I need to find out what's going on but right now my hunch is that things break when Dependency is not assigned
like something gets assigned to Dependency regardless but then the dependency safety checker doesn't know that the job actually completed. something like that
ugh cant they fix this stuff?
big fun to have shit like that after 1 year of waiting ... hope it's something I'm not doing right but the project ran fine in 0.17 so ...
huh, what's actually producing the garbage? m_TransformAccessArray?
i guess? its directly proportional to the amount of companions you have
ouch, not sure what can be done with that though other than caching
the whole Transforms package has been pretty bad thus far. no idea who writes this stuff
i think mike acton was/is architect of the transform system
lol, well he shouldn't put that on his CV
unity improved their safety to highlight issues it previously missed
for example query.GetComponentArray<T> will break now unless you do query.CompleteDependencies() first (or use the proper GetComponentArrayAsync<T>)
that said, i don't know why you need so many completes?
i literally have 0 in my entire project
if you were doing hybrid work i can understand 1 before your hybrid presentation interactions
i sure have some unnecessary completes but that shouldn't be a reason to break stuff.
they shouldn't break things no
but that means something is broken about your dependency chain
you've dropped a handle or something
i found a whole bunch of safety issues when i updated our project at work
from code that was 2+ years old
i suspect some of it caused some very rare crashes we had
so the update and stricter safety has been really good for us
yeah, must be something like it. just weird that 0.17 didn't complain. it had dependency checks in place and was pretty strict about it
i think the update has also slightly change system orders if you didn't have strict ordering
so there are cases where things wouldn't have broken in the past just because they finished in time
but now they occur earlier or at a different time
(oh and there's just quite a bit faster main thread work now as well)
wish me luck 😄 time to untangle the systems
took me 14 hours
was not fun
so yeah gl, get a heavy drink
3 hours personal project, 11 hours work project. did personal first so took more time than it would if i had done it second
huge range of code gen issues did not help
damn, that's a lot of time :/
To guarantee safety, you must include Broadphase:PrepareStaticBodyDataJob as a dependency of the newly scheduled job. - Do you know how I'd get this dependency?
are you using the new registerphysicsdependency()
you shouldn't have to worry about physic dependencies anymore
not yet, I need to read up about this
where would you put it, beginning of frame?
OnStartRunning()
this.RegisterPhysicsRuntimeSystemReadOnly() or
this.RegisterPhysicsRuntimeSystemReadWrite()
is how you handle physics dependencies now
they also said yesterday they're going to expose the physics world via singleton (in 1.0 probably)
https://forum.unity.com/threads/automatic-dependency-management-and-isystembase-support.1045105/
something i did a year ago!
so we'll probably have to go through and redo all this again in a future update 😐
Thanks a lot. Gonna try it
What's "this" here?
this is just to enable the extension method
on the system
(systembase)
PhysicsRuntimeExtensions
is where the extension methods were written
ok got it, Unity.Physics.Systems namespace. man, I'd have never known
its in the upgrade guide
but its only a tiny note in the actual manual
so anyone who is just starting out going to have trouble
on this page? https://docs.unity3d.com/Packages/com.unity.entities@0.50/manual/upgrade-guide.html#physics am I blind? 😄
https://docs.unity3d.com/Packages/com.unity.physics@0.50/changelog/CHANGELOG.html
Upgrade guide
RegisterPhysicsRuntimeSystemReadOnly() and RegisterPhysicsRuntimeSystemReadWrite() (both registered as extensions of SystemBase) should be used to manage physics data dependencies instead of the old AddInputDependency() and GetOutputDependency() approach. Users should declare their UpdateBefore and UpdateAfter systems as before and additionally only call one of the two new functions in their system's OnStartRunning(), which will be enough to get an automatic update of the Dependency property without the need for manually combining the dependencies as before. Note that things have not changed if you want to read or write physics runtime data directly in your system's OnUpdate() - in that case, you still need to ensure that jobs from previous systems touching physics runtime data are complete, by completing the Dependency. Also note that BuildPhysicsWorld.AddInputDependencyToComplete() still remains needed for jobs that need to finish before any changes are made to the PhysicsWorld, if your system is not scheduled in between other 2 physics systems that will do that for you.
but it's under [0.7.0-preview.3] - 2021-02-24
ah there it is! stuff is all over the place. thanks for letting me know!
huh, that was basically it. that physics thing tripped up the whole dependency chain and resulted in garbge errors that had nothing to do with it
that's convenient for you
well, I had an early out from my biggest system so I'm not really done yet 😄
oh, haha, well everything works now. that was quicker and much more painless with your help. thanks a lot again. you saved my a couple of hours.
I agree on that. It seems to be overly complex around parenting but also not super reliable when it came to getting data. Updating translation and rotation does not immediately update LocalToWorld. I ended up dumping those two components and only using the matrix. But now the matrix carries a lot more data to and from to modify. I wonder why they did it that way.
i'm pretty sure unity's solution to a lot of the transform issue is IAspect in 1.0
when i was reading it it sound designed very specifically for the annoyances for transform
did you notice any general performance improvements in 0.50 and what do you think are the bigger changes with 0.50? I haven't invested much time yet and apart from the great tools we have now it seems quite similar
actually i was about to benchmark my entities 0.17 version
i'll let you know if there are improvements in like 5min!
on an actual released game
I'm doing the same, on top of that I'm only using the pointer to LocalToWorld
(that is a huge mess and terribly coded) - so a great real world example!
oh wow! haha nice timing then. good luck!
setting up the pointer every frame is freaking fast
no difference 😄
😦
if anything, 1% lower fps
this is not very scientific though, just loading the same seed between 2 different builds
but yeah i didnt expect it in this project tbh
it's mostly capped by legacy monobehaviour code
Ive been far to scared to use pointers but maybe it's time to take the plunge. How do you point towards the matrix information instead of passing the data?
i'll have to test on xboxone/ps4 as they are actually capped more by internal entity performance
but yeah seeing no different on windows
pretty sure last time i checked though, this project was garbage and had 86-91% idle time in my worker threads
oh wait i just remember this isn't a fair test, there might be some advantages on new entities
since it now has this debugging system every frame
in development builds
which the old one doesn't
i don't have release builds to compare atm
This is what I'm using right now. The solution came from the need for a fast target system and random lookups being slow with struct copies
i'm surprised burst treats this any different to just using the native array
so now I'm just copying the pointers to the TargetMatrix and overall it was quite an improvement
ah, so if it has around the same timings it's actually around 1.6ms faster?
yeah i pretty much left is new entities, right is old entities
that yellow strip at the bottom is the recording system
0.75-1.5ms/frame
but it's kind of hard to say
i'm very gpu capped here
got a good 3ms wait on gpu every frame
i have a 3900x but only a 1060gtx
though im testing this on min graphics and low res so i'm surprised it's still capped
anyway anecdotally i'd say at best it's a few % better by default. we haven't applied any new optimizations to our code (caching ComponentTypeHandles or using ISystem etc)
damn! how much did it cost you? those things are rarer than gold here
3900x its a few years old cpu now
i nearly bought myself a 3080gtx yesterday, they are like super cheap all of a sudden
was as low as $1100AUD (They were $1800AUD 2 months ago)
but who needs a graphic card
i just look at numbers all day 😄
good old capsule all i need for my player
lol, that's the ryzen, not the geforce 😳
"cheap" 😅
haha, right 😄 my 1080 is still working fine. gonna check the prices now, I'm like, when was it released? - 2 years ago and waiting for prices to drop
it's lower than RRP finally!
they had 3060ti for $650, 360 for like 550?!
(aud)
1100 aud like 735 euro i think
covid turned the gpu market even more to shit than the crypto miners
i actually did just pick up a 3060 from newegg at 400usd and ive been seeing stock alerts way more frequently so I do hope the market for them crashes finally
if you think it can't get any worse ...
yeah last month prices are tumbled though
cool to hear, hope the prices soon cascade to us
ps5 is also totally sold out and double the price
oh yeah cant get that here
at least not easily without a wait
but im not a console gamer (even though i've spent most of the last year doing console dev -_-)
it took us over a year to get a dev kit delivered...
me neither, except when there's a game I really want. like bloodborne for ps4. basically why I even got one 😄
from sony? wow, that's a long time
anyway way off topic, how good its ijobentity 😄
I'm afraid I'm an IJobEntityBatch snob
is there any reason not to use ISystem now? have they been improved since 0.17?
Need to do some testing. All the job types before had some small differences in performance
but for jobs that don't need chunk level optimization i have ijobentity now
It's really nice to get rid of the boilerplate code
although I got so fast at typing it that I honestly don't care that much
much of Unity.Transform has been rewritten to ISystem now. Good place to look at when I start writing them myself
They seem largely fine now from what I heard but the most interesting thing is how they compare to a class SystemBase
IJobChunk, IJobEntityBatch, IJobEntityBatchWithIndex, and IJobParallelForDefer now have ByRef() versions of all .Schedule() and .Run() methods. These should be used in cases where the corresponding job struct is too large to pass by value to the existing methods (~10KB or larger). Functionality is otherwise the same as the existing methods.
I havent yet found any uses of updatebefore/after with them, I recall that not working prior
This sounds interesting, I don't think I have a job struct that large. Some are rather big though
Could be a nice optimisation to use even with smaller structs. ByRef mostly paid off
and I'm not sure how this gets treated for multi threading. AFAIK the job struct gets copied to every worker thread. so with this, the same struct is used?
yeah that could cause issues if you weren't careful
my project has no differences in performance.
the archetype view is pretty great. to see all the bytes that are used up by each comp is really cool
the journal is really interesting
but atm only accessed via breakpoints
but you can see the huge amount of interesting data that it records
and i expect tooling will come with it in the future
(or users will develop tooling from it)
also the profiler stuff is useful
just got around to the journaling. pretty cool indeed. Without tools though, I don't know how helpful it actuall is
for something like networking it's a lot more useful I guess
you should be able to add it with the package manager. + icon -> from git url: com.unity.rendering.hybrid
missed opportunity that the Systems window is not linked to the profiler timeline
really want some damn buttons on the main editor that opens these various windows
just bind hotkeys to them?
it's kind of nice you can just bind hotkeys to anything
personally i just have most of them docked permanently
theres lots of other windows and things I use often but not quite enough to bind to hotkeys but dislike hunting for them inside dropdown menus
i appreciate the hotkey tip though, for dots windows I will hotkey em
i really should unbind the ctrl + X keys for the default windows
i literally never use those hotkeys
and they could be so useful for other tings
certain things like renderpipeline asset, should be a button somewhere that brings it up. I feel that theres wasted opportunity to allow for more editor visual customization(and customizing the top area with the play buttons is not just like making any old editor script)
(and customizing the top area with the play buttons is not just like making any old editor script)
i actually wrote a script to easily add buttons there, dropdowns or anything there
like maya or zbrush, can turn literally any editor function into a custom button on the shelf or palette
dont suppose its on github or posted somewhere?
like this is my work project where i injected a drop down to change game modes or skip startup
it was based off someone elses work from a previous version of unity
let me see if i can find it
i probably can't post it because it's technically work code
but it's basically based off this
it seems like they've updated for recent support
so should work fine
oh yeah reason I tend to need to open the entities window often was at least prior to 0.50 it was terrible for performance
alright removed all traces of animation 😒 lets see how this upgrade goes
so something i haven't really seen mentioned
NativeArray<int> array = CollectionHelper.CreateNativeArray<int, RewindableAllocator>(5, ref World.UpdateAllocator);
/// An allocator that is fast like a linear allocator, is threadsafe, and automatically invalidates
/// all allocations made from it, when "rewound" by the user.
/// </summary>
[BurstCompile]
public struct RewindableAllocator : AllocatorManager.IAllocator```
i have no idea why one would need to rewind an allocator?
so based off the sample it doesn't need deallocating
i think based off the fact it's called World.UpdateAllocator
it just clears after each update
so you don't need to schedule dispose methods after your jobs, it's just handled for you
they used it in this example
{
// Calculate amount of entities in respective queries.
var boidCount = m_BoidQuery.CalculateEntityCount();
var obstacleCount = m_ObstacleQuery.CalculateEntityCount();
var targetCount = m_TargetQuery.CalculateEntityCount();
// Allocate arrays to store data equal to the amount of entities matching respective queries.
var cellSeparation = CollectionHelper.CreateNativeArray<float3, RewindableAllocator>(boidCount, ref World.UpdateAllocator);
var copyTargetPositions = CollectionHelper.CreateNativeArray<float3, RewindableAllocator>(targetCount, ref World.UpdateAllocator);
var copyObstaclePositions = CollectionHelper.CreateNativeArray<float3, RewindableAllocator>(obstacleCount, ref World.UpdateAllocator);
// Schedule job for respective arrays to be stored with respective queries.
new CopyPositionsJob { CopyPositions = cellSeparation}.ScheduleParallel(m_BoidQuery);
new CopyPositionsJob { CopyPositions = copyTargetPositions}.ScheduleParallel(m_TargetQuery);
new CopyPositionsJob { CopyPositions = copyObstaclePositions}.ScheduleParallel(m_ObstacleQuery);
}```
no disposes
Woah, automatic garbage disposal
"automatic". But still, woah
why is their slab and stack allocator internal 😦
i basically wrote my own versions of these before and was hoping to replace them with this
so much for using StreamBinaryReader too
they even use 2 allocators alternating to avoid end frame syncs
{
var UpdateAllocator0 = (RewindableAllocator*)UnsafeUtility.AddressOf<RewindableAllocator>(ref UpdateAllocatorHelper0.Allocator);
var UpdateAllocator1 = (RewindableAllocator*)UnsafeUtility.AddressOf<RewindableAllocator>(ref UpdateAllocatorHelper1.Allocator);
UpdateAllocator = (UpdateAllocator == UpdateAllocator0) ? UpdateAllocator1 : UpdateAllocator0;
UpdateAllocator->Rewind();
}```
(Well it seem to reset in Initialization so I guess start frame syncs)
Is this better for performance? Dispose costs quite a lot
That's funky to alternate two of those. I don't get it though 😄 Can someone explain?
because then your previous frame jobs would have to be Complete() instead of allowed to run into the next frame
oh god its so painful adding partial one by one and it compiles
the second section tells you how to make it automatic
yeah i guess i have too many compile errors but that option doesnt show currently
ah probably too late but that means the partial isn't the problem yet 😄
i think most people just didn't update to 2020.3.30 before updating dots
hmm will try doing all the physics stuff first
are you in safe mode?
the menu won't show in safe mode
i was basically able to enable this menu straight away even with 1000+ compile errors
nah out of safe mode now
i could delete the library but not convinced it would change things, ive restarted a few times so just gonna keep going
at least try to do all the physics stuff and see if it changes anything
ok well physics aint it
welp
suppose its not like transitioning off of IJFE
its also enlightening to see how many systems i dont use anymore but keep around
did anybody try using the [GenerateAuthoringCompoenent] attribute with unity's field attributes (NonSerialized, Header etc)?
I kept getting burst not in asmdef in my GenerateAuthoringComponent files even when it was included
just removed the decorator but wondering how much i screwed up my project in doing so
ahh yours is probably a diff issue haha
my unity attributes aren't getting copied over with the generated authoring components
not sure if it's just me
what exactly is codegen adding to systems now that require partial?
there's a temp file under your projects folder where u get to see the output
i was hoping it was easy to customize but ayy
crap just unity entities errors now
hm removing memory profiler package fixed it, maybe it needed a restart or something
nope it finally plays!
and its utterly broken lol
and gotta wake up early tomorrow too 🛌
So the dots animation package is not usable with the new 0.50
would it still be reasonably easy to adapt a baked vertex animation is the hyrbid renderer?
Anyone else getting an endless spam of Internal: deleting an allocation that is older than its permitted lifetime of 4 frames whenever the Netcode package is present in the project? I tried a fresh new 2020.3.30 project with the Entities, Physics, HR and netcode packages, and repro'd the issue
i just read a thread stating it might be something to do with the framerate?
most recent thread in the netcode subforum
Make sure your play view has vsync enabled
This has been around forever. They physics step is probably way slower than the frame rate on an empty scene so you get console spam.
The system TUK.Arena.Systems.OnHitDoDamageSystem writes TUK.Arena.ArenaHealthComp via OnHitDoDamageSystem:OnHitDoDamageSystemJob but that type was not assigned to the Dependency property. To ensure correct behavior of other systems, the job or a dependency must be assigned to the Dependency property before returning from the OnUpdate method.```
After upgrading to 0.5, I am getting this spammed, I don't understand what it wants >.> help please
you need to write to Dependency
you're code should be
commandBuferSystem.AddJobHandleForProducer(jobHandle);```
commandBuferSystem.AddJobHandleForPRoducer(Dependency ); ?
Dependency = job.Schedule(X, Dependency);
this line here
you are only writing your jobhandle to a local variable
not back to the system
but I don't have a jobHandle anymore to speak of
InvalidOperationException: The previously scheduled job Solver:ParallelApplyGravityAndCopyInputVelocitiesJob writes to the Unity.Collections.NativeArray`1[Unity.Physics.Velocity] ParallelApplyGravityAndCopyInputVelocitiesJob.InputVelocities. You are trying to schedule a new job OnHitDoDamageSystem:OnHitDoDamageSystemJob, which reads from the same Unity.Collections.NativeArray`1[Unity.Physics.Velocity] (via OnHitDoDamageSystemJob.EventReader.m_InputVelocities). To guarantee safety, you must include Solver:ParallelApplyGravityAndCopyInputVelocitiesJob as a dependency of the newly scheduled job.
Unity.Jobs.LowLevel.Unsafe.JobsUtility.Schedule (Unity.Jobs.LowLevel.Unsafe.JobsUtility+JobScheduleParameters& parameters) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0)```
have you registered your dependency with the physics system?
using the new
this.RegisterPhysicsRuntimeSystemReadOnly();
O_o I have not, i used to commandBuferSystem.AddJobHandleForProducer(jobHandle);
that's not for physics
that's for command buffer system
previously you should have been getting output dependency of the physics system and making your job depend on it
but now you need to call this.RegisterPhysicsRuntimeSystemReadOnly(); (in OnStartRunning)
Thanks @rotund token ❤️ ❤️ ❤️
After 0.5 update, HideInInspector no longer has any effect :/ I don't wanna make multiple manual authorings just to hide a property or two. Anybody reproducing this?
[GenerateAuthoringComponent]
public struct ArenaFadeOutThenDestroy : IComponentData
{
[HideInInspector]
public float timeCurrent;
}
Starting a new project with DOTS. Is Version 0.17.0-preview.42 the most recent?
For the Entities package
0.50 is the most recent version for Entities (only works on 2020.3.3x lts)
same here, field attributes are not working, made a bug report a few days ago
was pretty surprised no one was talking abt it, thought i was the only one using that [GenerateAuthoringComponent] attribute :X
You're not alone, I will be there for you V_V thanks for putting that bug.
I am also ticked that Rider can't see the /// <summary>
So I just saw that dots finally got some supposedly big update?
@gusty comet Yup, 0.5 but it's a little buggy
I do not mind if its a little buggy I was honestly having no hope that DOTS was getting any updates. So anything is welcome at this point.
has the way you spawn entity archetypes changed at all?
While playing with material property and having fun at it, I started getting these errors, and my shaders are borked as you can see in the screenshot. Those are thin boxes bundled up into a big square, but it looks like the normals are flipped...
I tracked down the SRP compatibility and my super simple Shader Graph looks to be compatible but I still have issues. May I ask for help once more?
A Hybrid Renderer V2 batch is using a pass from the shader "Shader Graphs/WoodenShardSG", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer.
public struct ColorMaterialProperty : IComponentData
{
[HideInInspector]
public float4 color;
}```
WAIT did it just get 2021 support 1 day after i downgraded to 2020? LOOOL
ig it's back to... upgrade again LOL
nevermind there is no 2021 LTS yet... ig it's coming soon?
gotta wait until Q2 ohh ok
new update? poggie woggie?
please dont...
why?
I just can hear those words and see the visuals with that....
uhhhhhm the painnnnnnnm the suffering
why are you passing _Color as the alpha value? aka _Color.R
I won't be needing _Color in the end, I just couldn't tell what was going on with the bug you see there, so I temporarily made a color variant
yeah but why is it going into alpha?
It was a miss-click 😄 but even a vanilla Shader Graph will reproduce the error seen
hmmm. do you have gpu instancing enabled on the material?
tried with and without
hybrid renderer only supports gpu instancing btw. don't not do it
I am happy to fix the inside-out that's happening, for now
no idea what's happening there. if they're default boxes...
actually, might it be you are using the builtin render pipeline?
URP
I downloaded the ECS URP Sample project and will dig there, maybe copy paste some stuff, see if there's a setting somwere
where can i start with the DOTS thing, like one of those stupid tutorials where monkeys could understand... need such a tutorial XD
You will have to do a lot of digging yourself so you're not off to a good start 😅
Also if you're not already very comfortable with Unity & C# I would highly advice against it. Anyway the docs for primer: https://docs.unity3d.com/Packages/com.unity.entities@0.50/manual/index.html
TurboMakesGames has some decent tutorials https://www.youtube.com/c/TurboMakesGames
Keep in mind it's experimental tech so a lot of stuff has changed since most videos/posts were made.
im familiar with unity and c# but never touched dots
This guy also has some really high quality stuff on his blog https://gametorrahod.com/tag/unity-ecs/
Even though a lot of the code examples are outdated the info is still pretty much the same
i tried to upgrade my project for IOS/Android to 0.50. Im on Unity 2020.3.21LTS. After Updating packages i have trouble with Platform Android package. Looks like its require 0.10.0 (i cant install higher) and on this version im getting error
Library\PackageCache\com.unity.platforms.android@0.10.0-preview.10\Editor\Unity.Build.Android\Components\AndroidKeystore.cs(12,25): error CS1929: 'HierarchicalComponentContainer<BuildConfiguration, IBuildComponent>.ReadOnly' does not contain a definition for 'GetBuildTargetGroup' and the best extension method overload 'BuildTargetExtensions.GetBuildTargetGroup(Platform)' requires a receiver of type 'Platform'
0.50 is supported from 2020.3.30
and platforms-specific packages disappeared now
you only need the main com.unity.platforms package
was this here already?
there will be DOTS Q&A livestream session on GDC livestream day one
hmmm... "We’ll be streaming with some of our amazing creators for 3 days from March 23-25"
so I guess that DOTS Q&A will be on Wed
they really do their best on making it confusing
roadmap schedule is only clearly communicated on this:
@gusty comet
but even that misses mention of the timezone (but it's San Francisco time)
we might get slides earlier but will see
just to clarify further, their livestream day 1 is 23rd March
I honestly don't get who thought it was good idea to label those days like that
Hi, I am returning with the following issue, due to not being able to find any solution.
Situation: My kinematic car drives on the road and hits a Box entity which "shatters it."
Goal: Shattering the box will result in instantiating from a Entity (Stored as a GameObject prefab) that has no components on it but it does have multiple children with dynamic physics and mesh on it. The system that does the spawning has to exist after the physics system because the car hits the box, which results in the shards being created after the collision
Issue: Regardless if I spawn the parent, or spawn each individual child, the children are spawned at 0,0,0
Attempts:
- Spawn and set position of parent, or individual children, still they go to 0,0,0
- Spawn the child, and recalculate position and rotation, they still go to 0,0,0
- Attempted to split creation of the children before Physics, so that whatever SET(0,0,0) does it's thing, and set them to my intended position/rotation after physics. Failed because I can't figure out how to have two CommandBuffers play nice with the same dependency.
This url was a promising solution but ultimately I could not succeed: https://forum.unity.com/threads/properly-moving-teleporting-a-physics-entity-with-its-children.874315/#post-5843251
My system: http://pastie.org/p/1p0wgyTXzbR0cCut9D1Xdt
was there a setting that allowed us to edit the chunk size within Entities? I can't remember if that was possible in earlier iterations
can I somehow apply textures from jobs?
I think they only proposed more options in the future but never anything more than that
Ah that sucks - cool thanks
just throwing random suggestions, but is that continue right smack in the middle intended?
Hi, I am new to DOTS but am trying to use it to increase performance for my Mobile game.
I have up to 2,000 objects from class 'ConsumableObject' that I use their Update() functions every frame. I also have a couple more classes that are children of this 'ConsumableObject' class.
I have a struct I made inside the 'ConsumableObject' class. This struct is called 'Data'.
Inside of a ConsumableObjectsManager class, it handles all the job's functionality. This class also contains the NativeArray of 'ConsumableObject.Data' for the jobs to run.
I fill this NativeArray whenever a new Level is loaded in, in my game and it does a FindAllObjects of type 'ConsumableObject', converts the Array into a List, and then parses it into the NativeArray.
I can post more code of these if needed.
However, the question I ask is; I am getting an error upon Level loading that says:
Any help would be greatly appreciated!
you can't use classes in NativeArrays
or any managed data (arrays, strings*, etc)
Oh okay, how would I go about doing something like this? I used a class in the native array because I saw someone else do it
ConsumableObject.Data needs to be a struct
Data is a struct inside of the ConsumableObject class
oh wait, sorry, hold on
so Data itself should be a struct inside of the ConsumableObject class, and then it should work?
as long as Data doesn't have any managed data on it
public struct Data
{
// STORE DATA THAT ISNT TO BE CHANGED VIA INSPECTOR
[Header("Consumable Object")]
// Consumable Object
private ConsumableObject consumableObject;
private Vector3 staticPosition;
public float yOffsetTrigger;
private Transform transform;
public MMFeedbacks feedbacks;
// Constructor
public Data(ConsumableObject _ConsumableObject)
{
transform = _ConsumableObject.transform;
feedbacks = _ConsumableObject.GetComponentInParent<MMFeedbacks>();
staticPosition = Vector3.zero;
yOffsetTrigger = 0.5f;
// Consumable Object
consumableObject = _ConsumableObject;
}
// Update
public void Update()
{
if (!consumableObject.isConsumed)
{
// Check the Y positional difference
if (transform.position.y <= staticPosition.y - yOffsetTrigger)
{
consumableObject.OnObjectConsumed();
if (consumableObject.feedbacks != null)
{
consumableObject.feedbacks.PlayFeedbacks();
}
consumableObject.isConsumed = true;
}
}
}
}
This is what the struct looks like currently
yeah you can't have this
private ConsumableObject consumableObject;
private Transform transform;
and probably this since i assume it's a class
public MMFeedbacks feedbacks;
no classes
Ah so they can only be native values
How would I go about handling these other functionalities then?
no references!
Would I use them outside of the struct, like normal monobehaviour?
you can't use them in burst jobs
you can use
bool, sbyte, byte, short, ushort, int, uint, long, ulong, float, double, boolX, uintX, intX, floatX, enums, structs and pointers
structs/pointers include stuff like the native containers NativeArray, NativeList, etc
i would highly recommend trying to understand how to develop in a data oriented way and the limitations before you try to port existing code
you need a very different mindset to the OOP you'd be use to
Yeah, I understand. I have seen and do have some basic knowledge of the different mindset needed when programming in this way and considering how the compiler works, etc. I wanted to just sort this very first part out before delving further as I may not need to after this.
So, just to be clear for my understanding, I am still a little confused about if I shouldnt be using Jobs for this particular class
Is it still possible to, and if not, do I just do the needed functionality outside of the Data struct and in the Monobehaviour class that its still stored in?
nothing in your Update function can be done in a job at the moment
Thats unfortunate. So I can only really use it on classes that contain completely native variables?
yes that's the limitation of the burst compiler
but this limitation is what makes it fast
Okay, thats understood. Thank you for helping me!
But its still possible to change my code in a way that only uses Native values and then have another script outside that performs checks or something, and then performs appropriate functionality that way?
there's nothing stopping you writing a job to process this, something like
{
public bool IsConsumed;
public Vector3 Position;
}
[BurstCompile]
public struct WasConsumedJob : IJobFor
{
[ReadOnly] public NativeArray<Data> Data;
[WriteOnly] public NativeArray<bool> WasConsumed;
public float YOffsetTrigger;
public Vector3 StaticPosition;
public void Execute(int index)
{
var data = Data[index];
if (!data.IsConsumed)
{
// Check the Y positional difference
if (data.Position.y <= StaticPosition.y - YOffsetTrigger)
{
WasConsumed[index] = true;
}
}
}
}```
Ahh okay! This is great. I was thinking that I may have to do things this way. Basically still optimizes the script. Thank you for writing this up however. I do have a question. I see that in the Data struct, it is outside of any class. Would I just put this into my ConsumableObject class or does it have to be seperate still? Because if so, then how do I update the Position variable? Thanks
is there an easy way to update systems with partial keyword ?
Tried multiple pieces of code, those after continue are ignored
Invoking all that is good and golden to summon @rotund token as I've exhausted all mortal hope 🙏
😅
i had a look at your code before but it's too messy to know what's happening with all the alternatives
and it has no indication of what your prefab was or how it was converted which is probably the more important part
there's an option in the DOTS menu to auto add this to all your systems
if i want exactly 1 shop, would i just make it a regular class and not an entity?
entities are things, never just a singular thing?
You can have a singleton entity
why would i tho?
Depends on your use case I guess. For me I use singletons entity to store blob asset reference of "cached" data. so it ocntains all data I need i my system for abilities (base attack, cooldown, cast time, range,...) for a shop I guest you could use it to store the list of items with the price and so on
is it a IAP shop or an in game "merchant" ?
i was thinking of this.. i have a GameHandler that creates one Shop, of course, the shop code could just go directly inside the GameHandler code, but i wanna separate it. The Shop then would be responsible for using the EntityManager and create a Entity with a ShopUnitComponent and populate a NativeHashTable with all entities holding said component
sorry im new to ecs i hope that makes sense?
what's IAP?
My prefab is set as a reference into a Entity property in an authoring component.
I want to spawn that prefab and it's children at the collision point around (0,0,-4000)
Regardless if I spawn the prefab, or I individually spawn the children, they get reset to around (0,0,0)
I have a feeling it has something to do with LocalToWorld and WorldToLocal having different values and the physics systems (next frames) override my Translation.
A fix could be spawning them (next frame) before the Physics and setting the Translation AFTER them, but I dont know how to have two entityCommandBuffers with
//TODO: move this into the struct;
BufferFromEntity<LinkedEntityGroup> entityGroups = GetBufferFromEntity<LinkedEntityGroup>( true );
for( int spawnIndex = 0; spawnIndex < doSpawnComponent.Length; spawnIndex++ )
{
//Prefab and spawn;
Entity prefab = doSpawnComponent[ spawnIndex ].prefab;
DynamicBuffer<LinkedEntityGroup> entityGroup = entityGroups[ prefab ];
for( int spawnChildIndex = 0; spawnChildIndex < entityGroup.Length; spawnChildIndex++ )
{
Entity childPrefab = entityGroup[ spawnChildIndex ].Value;
Translation _pos = GetComponentDataFromEntity<Translation>( true )[ childPrefab ];
Rotation _rot = GetComponentDataFromEntity<Rotation>( true )[ childPrefab ];
Entity spawn = entityCommandBuffer.Instantiate( entityInQueryIndex, childPrefab );
_pos.Value += translation.Value;
_rot.Value = rotation.Value.value + _rot.Value.value;
//Translation;
entityCommandBuffer.SetComponent( entityInQueryIndex, spawn, _pos );
Debug.Log( $" - child {_pos.Value}" );
//Rotation;
// if( doSpawnComponent.doIgnoreRotation == false )
// {
entityCommandBuffer.SetComponent( entityInQueryIndex, spawn, _rot );
}
}
IAP = In App Puchase. in game item for $/£/€. so not your case. (I would have said to not use DOTS in IAP case 😉 )
oh, maybe i would add it in the future for some cosmetics or whatever
also you mentioned baseAttack... that would be a constant right, im a bit confused as to where i should put my constants with ECS
do you just make a [ReadOnly] int baseAttack or whatever?
yes it is a constant. If you have static (constant) ready only I would advise to use BlobAsset
_rot.Value = rotation.Value.value + _rot.Value.value;```
not sure about this, but the rest seems fine
i'd usually also set the localtoworld as well to avoid the model appearing at 0,0,0 for 1 frame before it's updated
ok ill read about blob assets
i'm literally doing something quite similar here atm
{
var prefab = assetRegistry.FindEntityPrefab(fractures[i]);
var shardEntity = this.CreateFractureShard(batchIndex, prefab, parentTransform);
// ...
private Entity CreateFractureShard(int batchIndex, Entity prefab, RigidTransform parentTransform)
{
var pos = this.Translations[prefab].Value;
var rot = this.Rotations[prefab].Value;
var localTransform = new RigidTransform(rot, pos);
var worldTransform = math.mul(parentTransform, localTransform);
var instance = this.CommandBuffer.Instantiate(batchIndex, prefab);
this.CommandBuffer.SetComponent(batchIndex, instance, new Translation { Value = worldTransform.pos });
this.CommandBuffer.SetComponent(batchIndex, instance, new Rotation { Value = worldTransform.rot });
this.CommandBuffer.SetComponent(batchIndex, instance, new LocalToWorld { Value = new float4x4(worldTransform) });
this.CommandBuffer.RemoveComponent<PhysicsVelocity>(batchIndex, instance); // make it static
return instance;
}```
and my shards are all spawning in the right place (it happens when the red lines appear, that's when i've fractured all my meshes)
i'm basically fracturing each large wall piece into 9 pre-computed pieces (random side note, red one simulated on server, rest are simulated on client)
i see most of u use var i, but i do int i, they're both fine right?
unity uses var in general?
yes
actually 1 more thought
Translation _pos = GetComponentDataFromEntity<Translation>( true )[ childPrefab ];
this will likely be 0,0,0 or a very small value because it's in local space vs the parent. are you expecting your parent to have a translation?
since the docs and stuff uses var i might just change my code to do it more like the "unity way"
use var when it makes sense, use make it explicit when it doesn't
when you start to have big type names it's a bit cleaner but not necessarly easier to read
I personnaly don't use var
NativeHashMap<int, Entity> shopUnits = new NativeHashMap<int, Entity>();
var myvalue = GetValue();
some would argue that isn't very clear
but
List<int> myList = new List<int>();
you obviously don't need the left side declaration because you can clearly see the type
just do whatever you prefer
many people var everything
some people dislike var
yeayea alrighty
I am expecting the child to have a localPosition offset compared to it's parent
@rotund token why are you making your shards static ? Then I see that they are falling which would mean dynamic
they are made static when they first fracture
then individually make dynamic when i break parts off
(i'm hitting a hotkey to randomly break pieces in that video)
the whole thing isn't meant to break at once, basically i'm meant ot be able to break pieces off the wall
but i don't want them to always shattered as that's way too many objects so i only shatter once a piece is broken
in that demo i just happen to break them all at once with a hotkey
hence they all change model at once
I implemented what you wrote (quite elegant) and they still spawn around 0,0,0 worldMatrix destination for the children is correct
I will try to make them static and see if they spawn at the correct location.
i don't think the static has anything to do with it, i tested them first as being dynamic
I am getting partial success, seems that LocalToWorld was the key, but also that RigidTransform is an upgrade as well!
I will do my best to reach the goal on my own. I can't thank you enough Tertle
make sure you disable it again once it's upgraded all your scripts
NativeHashMap<int, Entity>
instead of using Entity here, would it be possible to use "Entity which holds a ShopUnitComponent"?
you can put whatever entity you want they are just a set of 2 int so they all have the same data structure. One thing to be cautious about though is that whenever you store a "reference" to an entity, if that entity gets invalidated (destroyed) you need to do the clean up yourself.
but i can't do something like ```csharp
Entity<ShopUnitComponent> shopUnit = entityManager.CreateEntity(
typeof(ShopUnitComponent)
);
right?
no
kk thx
There's no way to "reference" any data, except storing an Entity and looking up the data at a later date, assuming the Entity is still alive (and still has the component).
Does anyone know about a rollback and fast forward physic state implementation with Unity Physics (ECS). I'm struggling in achieving that, and I've seen a couple of posts with similar questions, but haven't found a clear answer. It's like just a handful of people know enough to make it work, and they've had to change the package code to achieve it. For me, it's kind of contradictory that the package Unity Physics itself says that one of the main USP of the physics engine is that you can rollback and fast forward, but there is no easy way of doing it.
I was thinking of posting in the forum, but I figured that I should ask here first
it depends what you're trying to achieve
if you want time to go in reverse, that's going to take some effort on your behalf
if you just want to have previous physic states to test for networking or past snapshots that's pretty easy to do
for that you can just save the collision world every frame
this is what netcode does, you can see how they do it in
com.unity.netcode@0.50.0-preview.29\Runtime\Physics\PhysicsWorldHistory.cs
What I'm trying to achieve is load back a previous physic state of a previous frame (let's say 5 frames ago), and then simulate a couple of frames forward, all of that within 1 frame
Thanks for that, I'm gonna check it out!
Did anyone manage to make UITK and entities work in build ?
sure
I'm having an issue in built but discord don't let me post the error message...
I found someone on the forum with the same issue but nothing to fix it...
https://forum.unity.com/threads/exception-when-building-and-running-standalone-project.1020016/#post-6956897
It seems to be samothing about a shader it can't find but I have no clue how to fix this... if someone has a suggestion it's welcome.
@rotund token I succeeded! Can't thank you enough, and I will not stop being grateful V_V
okay so is this right..
a blob asset holds baseAttack
a ShopUnitComponent holds a blobreference to said blob
the ShopSystem sets the baseAttack of the blob to 3 and creates a blobreference
and finally, the ShopSystem creates a new Entity with a new ShopUnitComponent which sets blobreference onto it?
yes
okay cool :))
Hi, I believe I am doing something wrong. I am new to Jobs and I am trying to dynamically add ~2000 objects of type 'ConsumableObject' which contains a struct (called Data) to be processed through Jobs.
I am however, trying to add a list of objects directly to a NativeArray of type <ConsumableObject.Data> but as I add things to this NativeArray, it is removing everything and so the size ends up being 0. Why is this? Any help is appreciated!
are you allocating the array before the job or in the job ?
I use a <ConsumableObject> list that I fill when a Level is loaded. I then fill the <ConsumableObject.Data> NativeArray with the Count from the first array
consumableObjectDataArray = new NativeArray<ConsumableObject.Data>(consumableObjects.Count, Allocator.TempJob);
In this line here
protected List<ConsumableObject> consumableObjects; public List<ConsumableObject> ConsumableObjects { get; set; }
This is the first array I was talking about
I add the ConsumableObjects to this list whenever a Level is loaded and these objects are found within that Level
ok so you make a native array that has enough allocated space to take in all the data from the list. where/how are you populating the array with values of the list ?
So when the level loads, I do this:
// Consumable Objects
List<ConsumableObject> consumableObjectsList = new List<ConsumableObject>(objectsInLevel);
FindObjectOfType<ConsumableObjectsManager>().ConsumableObjects = consumableObjectsList; // Add the ConsumableObjects to the Manager
objectsInLevel is just a variable that has the amount of ConsumableObjects in the level
I don't follow, your list is empty. where do you set your data ?
oh, my mistake. I meant to say that 'objectsInLevel' contained all the ConsumableObjects in the level, thus the name.
Here is it:
ConsumableObject[] objectsInLevel = currentLevelGameObject.GetComponentsInChildren<ConsumableObject>();
so I convert it from this array, into a list (noted above)
ok and your issue is taht your native array is empty, correct ?
consumableObjectDataArray
[SerializeField] protected List<ConsumableObject> consumableObjects; public List<ConsumableObject> ConsumableObjects { get; set; }
This array is empty
which means that the NativeArray is empty as well
I may not be familiar with this notation but aren't consumableObjects and ConsumableObjects 2 different lists ?? so if you do
FindObjectOfType<ConsumableObjectsManager>().ConsumableObjects = consumableObjectsList;
it has no effect on consumableObjects which you then use in
consumableObjectDataArray = new NativeArray<ConsumableObject.Data>(consumableObjects.Count, Allocator.TempJob);
Wait, you're actually quite right in regards to the get; set;. I have forgotten to add the logic part to the getter and setter. Now I have fixed it and it looks like this:
public List<ConsumableObject> ConsumableObjects { get { return consumableObjects; } set { consumableObjects = value; } }
So now, this works and obtains all the objects and fills the array
ok good. not sure why you have 2 variable but glad if that works 😉
Initially it is for protection, maybe later I will change it. I am however, now recieving these:
currentJobHandle = job.Schedule(consumableObjects.Count, currentJobHandle);
This line is where the error is pointing to
can you share your job declaration it seems you are not assigning the WasConsumed variable of you WasConsumedJob
job = ???
job = new WasConsumedJob
{
Data = consumableObjectDataArray
};
[BurstCompile]
public struct WasConsumedJob : IJobFor
{
public NativeArray<ConsumableObject.Data> Data;
public NativeArray<bool> WasConsumed;
public float YOffsetTrigger;
public Vector3 SavedPosition;
public void Execute(int index)
{
var data = Data[index];
if (!data.IsConsumed)
{
// Check the Y positional difference
if (data.Position.y <= SavedPosition.y - YOffsetTrigger)
{
WasConsumed[index] = true;
}
}
}
}
public NativeArray<bool> WasConsumed;
need to be assigned
like Data when you make your new WasConsumedJob
Oh true
consumableObjectDataArray = new NativeArray<ConsumableObject.Data>(consumableObjects.Count, Allocator.TempJob);
consumableObjectWasConsumedArray = new NativeArray<bool>(consumableObjects.Count, Allocator.TempJob);
for (var i = 0; i < consumableObjects.Count; i++)
{
consumableObjectDataArray[i] = new ConsumableObject.Data(consumableObjects[i]);
consumableObjectWasConsumedArray[i] = consumableObjects[i].isConsumed;
}
job = new WasConsumedJob
{
Data = consumableObjectDataArray,
WasConsumed = consumableObjectWasConsumedArray
};
No errors anymore but I do have this concern:
you need to deallocate the native arrays after the job.
consumableObjectDataArray.Dispose(currentJobHandle)
same thing for the other
and you probably need to assign your other job variable otherwise they'll have default values so 0 and (0,0,0)
I deallocate current in the OnDestroy but I did not include the currentJobHandle. I now do
In regards to the "other job variable", what do you mean by this?
doing it on on destroy will not be enough. the TempJob allocator is made for 4 frames max. after that you'll get the message you see indicating a probable memory leak.
If you want a native container to live for the duration of you app you need to allocate it on system creation with the persistent allocator and destroy it on system destroy (or on system start/stop running)
for the other variable, a job only work with copies of the data. Si when you use SavedPosition and YOffsetTrigger, it's using it's local copies.
If when you create the job (new job()) you don't assign those local variables, you'll get their default values so (0,0,0) for SavedPosition and 0 for YOffsetTrigger.
Ah okay, I understand the 2nd part clearly. As for the 1st, should I then call .Dispose after .Complete?
you should call dispose after scheduling the last job that use the native array.
with the job handle of that last job
Okay, so call .Dispose on both of my NativeArray's after scheduling the very last jobs in the appropriate array with the jobhandle
yes
and also, bit of a noob question just for my beginners knowledge sake, I am using this job to handle an Update() function that has been quite hefty. I was previously just checking every frame about the "isConsumed" variable but upon thousands of objects as well as a few more things, it got a bit slow. I created this job and now I use it to check if it WasConsumed or not. How do I then obtain that boolean within my original ConsumableObject class and check it? Also, doesnt that mean I still have to use the Update() function in my ConsumableObject class to check if the WasConsumed variable is true or false? I am a bit confused on this part as it seems like I am running in circles. If you could help me to understand, I would greatly appreciate that. I also appreciate all the help youve given me so far
So, to get it in you original list, you would need to copy back the data from the native array to the original list. And yes you would still need to have an update on your consumable to check if it was consumed or not.
If I may it seems you are facing a performance issue and that you jumped on the jobs to solve it but it may not be the best first step you could take.
From what I gather from our discussion, you have a scene with some number of object that based on proximity can be "consumed" (or picked up).
I would take advantage of the physics system to detect that the object is in range (player collider collides with object collider) and trigger the consumption logic.
Thank you for your suggestion also. You are pretty much correct except we use the Physics system a lot with tons of objects all being "Consumed" by a big hole you create in the ground, almost like a sink hole. The physics updates are also quite daunting on the performance and I have heard that you can use something similar to handle this? I am unsure and will have to look more into it potentially. The Update function of our ConsumableObject script was causing a bit of a chunk of processing however and seemed less of a scare than figuring out physics multithreading.
Also, for my own sake, how would I go about obtaining the completed data performed by the Job but inside of my class when there are thousands? I know an easy answer would be to obtain the value from the array but how does the ConsumableObject know it's related Index value?
Thank you
Am I able to have an entity pathfind on a nav mesh yet?
Don't think so but have a look at :
https://forum.unity.com/threads/dots-pathfinding-system-updated.853969/#post-7950343
The same way you did to populate the native array. The list is a reference type so as long as you don't reassign it or refresh it the index order should remain the same.
Ah okay, thank you so much!
Do you know anything about multithreading physics btw? Or do you know a good place I could look to learn
not for monobehaviour, sorry. you could look into DOTS physics if you feel like it.
https://docs.unity3d.com/Packages/com.unity.physics@0.50/changelog/CHANGELOG.html
https://forum.unity.com/forums/dots-physics.422/
Thanks for all your help
this channel only for dots or also ECS in general?
ecs is part of dots
ye i know but i mean other ECS implementation other than dots
not really
DOTS Q&A stream schedule here: https://www.twitch.tv/unitytech/schedule?segmentID=411748c1-e9e2-4bd4-a853-6310d22a0704
Remind me to unpin that when it's over 😄
Did anyone try making an IL2CPP build with 0.50 yet?
I had to annotate all shared comps with [GeneratePropertyBag] to make sub scenes load properly
Yes but I don't use shared components
Same, but I even had to add that attribute to inbuilt components like Unity.Entities.SceneSection
Did you try to disable code stripping ?
You can with the scriptable build setting. At least it let you set the option don't know if it does anything :p
Yea you can set it but it uses 'low' stripping anyways 😄
That was the error by the way:
No PropertyBag was found for Type=[Unity.NetCode.SharedGhostTypeComponent]. Please make sure all types are declared ahead of time using [GeneratePropertyBagAttribute], [GeneratePropertyBagsForTypeAttribute] or [GeneratePropertyBagsForTypesQualifiedWithAttribute]
is that a netcode requirement or 0.50 for every sharedcomponent? @north bay
Hey, has anyone noticed that environment reflections stopped working with hybrid renderer in 0.50? The left is a game object and right is converted to an entity. This used to work just fine for me prior to updating (unity 2020.3.24f1 -> 2020.3.30f1, entities 0.17 -> 0.50, hybrid 0.11 -> 0.50)
I haven't tested it outside my own project but that error also happened for Unity.Entities.SceneSection so it was definitely not netcode specific
I've made il2cpp builds with no issue on 2 seperate projects
Interesting, I might try to repro it outside of it later
What version of the property package do you have installed
Have you manually added one?
Let me check
We had a bunch of issues with the property package years ago but I had totally forgotten about it in recent times
Seems to be the latest, 1.8.3
Not sure. The project I've built the most is my work project but we don't use build config for that as we don't have subscenes
I did build my own library with build config but didn't test it long
I might give it another shot
It happens during deserialization of shared components from subscenes
Unity.Entities.Serialization.ManagedObjectBinaryReader.ReadObject
Unity.Entities.Serialization.SerializeUtility.ReadSharedComponents
Unity.Entities.Serialization.SerializeUtility.EndDeserializeWorld
Unity.Scenes.AsyncLoadSceneOperation+AsyncLoadSceneJob.Execute
Unity.Jobs.IJobExtensions+JobStruct`1[T].Execute
Called from: UnityEngine.Debug:LogException(Exception)
Unity.Debug:LogException(Exception)
Unity.Scenes.SceneSectionStreamingSystem:UpdateLoadOperation(AsyncLoadSceneOperation, World, Entity, Boolean)
Unity.Scenes.SceneSectionStreamingSystem:ProcessActiveStreams()
Unity.Scenes.SceneSectionStreamingSystem:OnUpdate()```
Ok well that's why it won't effect my work library
Let me get out of bed and test my own project
This is concerning and I'd like to bring it up with unity earlier than later if it's an issue
As it would break most platforms that you can't use mono on
True but the workaround/fix seems to be really straight forward
Are generic jobs not supported with IJobEntity?
Haven't tested but probably not
I suspect it has the same generic rules as entities.Foreach
Aha, sad. It was supported with IJobForEachWithEntity, and they wanted it upgraded to IJobEntity :/
Learn to love ijobentitybatch! 💩
Right, might still work with IJobChunk as well?
No reason to use ijobchunk over ijobentitybatch
It'll be replaced at some point
But yes generics work fine in these jobs because there are no code gen
I am having some real trouble here. I had created my UI in 2021 version, and now that I have migrated to .50 entities I had to go to 2020 version. So now I am getting an error about not finding "UIDocument". So I am not sure what to do, I was just hoping someone else here ran into this and could push me in the right direction. Not sure to ask here or UI section
I just added these to manifest "com.unity.ui": "1.0.0-preview.18", "com.unity.ui.builder": "1.0.0-preview.18",
Is there another that I am missing
Ok so is this error on starting untity?
Can you right click your file and reimport
Annoyingly I have to do this on 2 files every time I start unity
But then it solves itself
I believe it links to the wrong dll first time
Which "file" do you mean?
The ones that are missing uidocument
It starts in safe mode, and gives that error alone. If it doesnt start in safe mode, I get 999error I guess missing all unity references
Just click your error, it'll select the file
Okay yeah ill give that a try
Yeah you can't do this is safe mode so exit that
Yeah that seems to solve it, now I need to figure out why zero unity references are working. Fun stuff thanks tertle, you are the goat
My super hero name is 'bug man', I've just experienced and had to debug everyones bugs already 😢
then it's rather "debug man"
still I wonder how or even if I should backport my renderer to 2020.3 for new entities
or rather wait for 0.51
i can repo this
do you have the runtime UI toolkit package installed out of interest?
Niceee, no I don't
Do you want to submit a bug report or shall I?
don't worry, i have a more direct line
Created a thread about this here: https://forum.unity.com/threads/environment-reflections-not-working-with-hybrid-renderer-0-50-0.1256121/. I'm curious if anyone else is encountering the same issue or has any ideas on what I might be doing wrong. Thanks!
For those who want to have a look and can't wait
https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/upgrade-to-050
PR is in review at the moment
can i just confirm if you added the property bag attributes yourself and it worked?
Yes I added it to all SharedComponents I could find via Rider and now IL2CPP builds work just fine
Finally able to work through the errors for my first run. Riddled with "This method should have been replaced by codegen" pretty much everywhere lol
dont suppose anyone has gotten these errors? TLS Allocator ALLOC_TEMP_THREAD, underlying allocator ALLOC_TEMP_THREAD has unfreed allocations, size 795
@north bay
Ok spent some time looking at this and did some dependency checks on the entities package and I can see the issue.
The problem was having the Properties package version 1.8.3 instead of the 1.7 that entities depends on. I didn't upgrade this directly but it was brought in by an upgrade to the serialization package 1.8.3. Downgrading the serialization package and this issue seems to resolve itself.
i.e. make sure your serialization and properties package are 1.7 not 1.8.3
I still get the error but now it's only on my own type.
MissingPropertyBagException: No PropertyBag was found for Type=[BovineLabs.AI.Data.AIGraphs`2[[Shattered.AI.Core.AIContext, Shattered.AI, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null],[Shattered.AI.Core.AIStorage, Shattered.AI, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null]]]. Please make sure all types are declared ahead of time using [GeneratePropertyBagAttribute], [GeneratePropertyBagsForTypeAttribute] or [GeneratePropertyBagsForTypesQualifiedWithAttribute]
So this is something I can fix without editing the packages.
That said, I would have expected
[assembly: RegisterGenericComponentType(typeof(AIGraphs<AIContext, AIStorage>))]
Would have been enough
hi, a few days latter than "tomorrow" but kind reminder 😉
there you go
is there any way to deep profile a bursted job?
add a lot of profilemarkers
i've been running intel vtune but I want to do it in Unity
you can use profile markers in burst to see in the profiler
using (new ProfileMarker("THIS IS SLOW").Auto())
{
}
yikes 😄 profile markers ... 😄
i've already some profile markers. my code looks like a damn mess
the job I'm profiling has 1k loc or smth
hm, maybe I just need to profile unbursted then. Timings should stay relative
huh, deep profiling unbursted is a lot more insightful than I thought
quite the overhead
i'd be careful with what you read with deep profiles and stuff in the entity system - it significantly inflates the costs
I don't have much love for the change version approach. Maybe there's some underlying importance to it but I think it should be opt-in to track change versions of chunks
I'm aware I have to take this with a grain of salt. Vtune has a spike on the same line though
Bascially on any form of data acquisition 🙂
It's a line where I get a trigger map from the source and the target, so to be expected
Thanks
damn physics collider display still sucks
Does it still run at 1fps when rendering terrain colliders?
I wrote my own physics collider rendering on top of aline which works pretty well
havent ever tried the terrain, I remember tertle did the same and was meaning to get around to my own. kinda was hoping it would be fixed by now
yeah did the same, i have my owner drawer for physics (but on top of my own draw library similar to aline)
assuming I replaced Dependency = JobHandle.CombineDependencies(Dependency, exportPhysicsWorldSystem.GetOutputDependency());
with
exportPhysicsWorld.RegisterPhysicsRuntimeSystemReadWrite(); it should just work right? still getting errors about the physics world job must be completed
gizmos are just slow
are you using query.ToEntityArray<> query.ToComponentDataArray<>?
no
i'm noticing the Write, are you editing the physics simulation?
im modifying the velocities
you still need to use BuildPhysicsWorld.AddInputDependencyToComplete() under some circumstances
Note that things have not changed if you want to read or write physics runtime data directly in your system's OnUpdate() - in that case, you still need to ensure that jobs from previous systems touching physics runtime data are complete, by completing the Dependency.
Also note that BuildPhysicsWorld.AddInputDependencyToComplete() still remains needed for jobs that need to finish before any changes are made to the PhysicsWorld, if your system is not scheduled in between other 2 physics systems that will do that for you.
wey that fixed it @rotund token
stuff like this is also in release builds, right?
Not that I remember
It usually just segfaults if you access a component that doesn't exist
But maybe they changed something 🤷♂️
no, all the asserts don't exist
public void AssertEntityHasComponent(Entity entity, int componentType)
{
AssertEntityHasComponent(entity, ComponentType.FromTypeIndex(componentType));
}```
all conditioned out
however they nicely added a UNITY_DOTS_DEBUG so you can debug builds easier in the entity component store (instead of segfaulting) (since ENABLE_UNITY_COLLECTIONS_CHECKS is always stripped)
great! thanks!
Do we have a way to get rid of ENABLE_UNITY_COLLECTIONS_CHECKS? I'm not aware of any
ENABLE_UNITY_COLLECTIONS_CHECKS is always stripped out of builds
you can't enable it (it breaks since unity engine won't care about your definition so native array always strips it in builds)
i mean, can we disable it in editor?
alright, thanks
Did someone try the new netcode physics prediction out yet?
will IAspect be userful for random lookups, like the target position, etc... or is it for something else?
Looking forward to have proper server authoritative vehicle physics 😍
not a lot has been mentioned but from what i understand it seems useful for adding behaviour to things
like, all the missing transform methods that unityengine transform has
there are some big downsides on it
not sure if you've read the documentation about them
Naa not yet
Let me take a look
When using physics in client prediction all dynamic physics objects must be ghosts, you cannot have any client-only physics which means you cannot have particles or debris colliding against dynamic physics objects.
Oh I remember reading that part
Hmm I wonder if I can have static colliders in two worlds and have a separate physics world for client only stuff like fractured objects
it was so exciting to read about cross platform determinism but that has been mostly scrapped now and due to this programming netcode has far less options what you can do with client side calculations
if you just want to make a shooter or something in that scope, it's pretty great i think
Yep, been using it since 0.1 or smth
Works great for my use cases
i have not touched netcode 0.50 yet, seems it's great and just got a little easier, more streamlined
yeah, mine too 🙂
hm, how would you design a combat flag, data oriented? an attack can put someone into combat, so when processing the attack you'd have a random access to the target and its combat flag, not good. but how could this work any different without being a random access and without writing additional data that would only live for 1 frame?
I'm still stuck in OOP mode for some things. :/
I tried some intermediate approaches to this but then it couldn't outperform the naive approach of just writing to a random address.
Did you notice performance issues when you use the naive approach?
Like I wouldn't try to get stuck on stuff like that until you actually see that you have a bottleneck there
One of the coolest things about DOTS in my opinion is that it's super easy to just optimize things when you see them pop up in the profiler
All the separated execution logic makes this really easy
Not really for that particular mechanic but it adds up
and I have a few places where this line of thinking applies and ends in random writes to a targets data
as this should work for netcode, one loop can run 8-12 times so it adds up even more
Not sure how I would optimize that myself
I wonder whether it's faster to write the attack flag into a bitarray instead of writing it directly to the other entity
some overhead would be gone but you'd need some logic to determine which index an entity is in the bitarray and keep up with allocations of the bitarray itself when npcs/players spawn/despawn
i think it would come out pretty even
gonna take a look now at ArchetypeChunk.GetComponentDataPtrRO() and ArchetypeChunk.GetComponentDataPtrRW(). Did anyone play around with it?
That's the correct GetNativeArray and looks familiar
so GetComponentDataPtrRO is using m_LookupCache which seems neat, GetNativeArray doesn't
I've read about lookup cache previously in some other context. I think it was for getting data in CDFE. No idea how relevant that is and why GetNativeArray wouldn't utilize it
The lookup cache is a fast path to skip the loop to acquire the correct index of a component array.
guess it only gets reset on structural changes
sorry if I'm talking to myself. hope anyone finds this interesting 😄
nice side effect of GetComponentDataPtrRO: I was raising the issue of getting a ref from a native array instead of a struct copy. with GetComponentDataPtrRO that's very easy now.
So I think every GetNativeArray should be replaced by this. We don't even have to rewrite the access to the array, code is the same. Only thing you'd need from the NativeArray is the length but we have that anyway in chunk.Count
sadly, in my test it didn't make any difference even with a pretty high entity count of 250k
What namespace is Transform and Rendermesh in nowadays? Or has it changed with 0.50? I can't find it anywhere
EntityManager entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
EntityArchetype sceneryArchetype = entityManager.CreateArchetype(
typeof(Translation),
typeof(RenderMesh)
);
//Define sceneryMesh also
Entity entity = entityManager.CreateEntity(sceneryArchetype);
entityManager.AddSharedComponentData(
entity,
new RenderMesh
{
mesh = sceneryMesh
}
);
Is this approach outdated now?
pardon the weird indentation lmao
oh, never mind. Found em
the question of "is this an outdated approach" still stands though
hmm ok well. when my mesh is generated at runtime I can't seem to see it. troubling
When I look at the mesh object in the inspector it shows up correctly, though.
Question: Am I supposed to be able to click and drag entities around the inspector during runtime like GameObjects. Isn't that a feature now
@white island just use the runtime utility https://docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.50/manual/runtime-entity-creation.html
and no, no picking yet(1.0 supposedly)
Wow, reading that makes my head spin. Can I just author a prefab entity instead, however that works?
Well. That would probably be less efficient.
I’ll take a second look at this in a minute. On my PC where the line wrapping doesn’t make everything look like crap
hmm, okay, so say I had a lot of different meshes in an array that I needed to give to a lot of entities. Could I multithread like a compute shader, where I give it a big list of data and an index and it will pick the right one automatically?
Looks like I may be able to
personally for my runtime meshes i just create a prefab entity via conversion rather than using the RenderMeshUtility
that RenderMeshDescription works in conversion(where I use it)
yeah I might just do that, this is proving to be a bit of a hassle. Apparnetly I can only use RenderMeshUtility on the main thread, which sort of defeats the purpose of this whole exercise
Tried to create a spawn job like this, but it didn't like it. Drats.
public struct ScenerySpawnJob : IJobParallelFor
{
public Entity Prototype;
public EntityCommandBuffer.ParallelWriter Ecb;
public void Execute(int index)
{
//Instantiate
Entity e = Ecb.Instantiate(index, Prototype);
//Add components to entity
RenderMeshUtility.AddComponents(
e,
World.DefaultGameObjectInjectionWorld.EntityManager,
//create render mesh description
new RenderMeshDescription(
meshData[index],
mat,
shadowCastingMode: ShadowCastingMode.On,
receiveShadows: true
)
);
//TODO: Set transform
}
}
Unless... I called RenderMeshUtility on the prototype, and then set the mesh inside the job?
Im just thinking out loud pardon me
but how would I get the component from the prototype to set the mesh ?...
it might sound weird in entities but i actually have a pool system for my dynamically created meshes
and i use Mesh.MeshDataArray to set the mesh data
then use Mesh.ApplyAndDisposeWritableMeshData to apply the data to the meshes
and I have the spare meshes stored in a List and this meshes are already referenced on the RenderMesh so i don't need to worry about setting the shared component data
but yeah you still need to call ApplyAndDisposeWritableMeshData on main thread
Well, I dont totally know how to accomplish that. But what I do have is AddSharedComponent, but I'm not sure what the component I need to add is exactly.
Ecb.AddSharedComponent(index, e, something);
ok yeah this isnt working, I went around in a big circle and I still cant see the cube. How id you go about implementing this?
i wanna create a collection of things so i can create entities later. i tried to make a list with a bunch of typeof(mycomponent), but System.Type is nullable. would i create a list of archetypes instead? or how do i create a list so i can create entities later on in general?
not necessarily anything to do with dots, but i've got a quick low level question. i'm assigning a byte* (from a byte array) to a struct field that accepts a byte*, this operation throws an index out of range exception. what am i missing?
@eager pawn Have a look at TypeManager
GetTypeIndex
https://docs.unity3d.com/Packages/com.unity.entities@0.50/api/Unity.Entities.TypeManager.GetTypeIndex.html#Unity_Entities_TypeManager_GetTypeIndex__1
Can you share the code you are using ?
struct MYSTRUCT
{
internal unsafe byte* data;
}
byte[] b = new byte[1];
fixed (byte* clientDataJson = b)
{
MYSTRUCT myStruct = new()
{
data = clientDataJson
};
}
Aren't you missing & ? Byte* clientDataJson = & b ?
no, if it were so, it would throw a compiler error. and fixed takes care of that already. also, that is not the line that fails
Maybe it want b[0] to be assigned first ?
thank you, that's simple and clean! ^^
I've figured it out with the help of Zombie and someone else. it was not actually related to this code and there seems to be a bug in the runtime that pushes the error to a different line
so, you can't GetExistingSystem with ISystem, right? How are we supposed to interact and change internal system variables? Fallback to GetSingleton?
i think im using the blobasset wrong.. is there any point in doing myComponent.blobReference.someValue = 0; instead of just doing myComponent.someValue = 0; from within a system?
components are not immutable but you can design them like it. getting blob data is faster than getting a component
i will only access the blob once, which is the only time i access myComponent too
but yeah ig maybe im doing it right, since components are writeable and blobassets aren't (which is what i want, just a const int someValue)
a component also reservers 16k of chunk data and an archetype so using a blobasset in your case is the right thing
well, i'm using both? a component with a blob asset reference
that's okay too.
Did someone manage to download burst 1.7?
I keep getting this error when I try to do so:
[NotFound].
UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()```
Just found out that GetAllUniqueSharedComponentData still returns shared component data that is not used any more. Is there any way to find only the ones that are currently in use or to unload the unosed sharedcomponentdata's?
if you use it as filter, you can then check if Query is empty
the problem is I use a shared component to determine all entities in a level. now if I unload a level and load a new one I need to find the currently loaded one to filter by it
Atm I am doing it like this:
this.maps.Clear();
EntityManager.GetAllUniqueSharedComponentData(this.maps);
var map = this.maps[1];
Interestingly this consistently fails when loading the 5th map as the list of maps always gets longer even when unloading all entities that have this maps shared component
I guess I could filter by each one and check if it has entities but that sounds cumbersome
shouldn't var map = this.maps[1]; be this var map = this.maps[0];?
you can always save value in some singleton component
Thats a trap I already fell into 😅 [0] is some kind of default instance that always exists
sorry I never used it this way
sure storing it somewhere would be an option but that would be kind of redundant and get harder with possible multi map loading
what do the render bounds do on rendered entities? That might be why I cant see anything
I'd the render bounds are zero, the camera will see that object and note it is out of what the camera should see and decide to not render it.
Every frame the whole scene does quick pass to see what meshes should be used and the render bounds are used since it's very cheap to see if a camera sees a box or not.
To get a proper bounds you just need to loop through every vertex in the mesh and encapsulate it within a bounds struct. Unity can do this for you as well by doing recalculate bounds.
is it unsafe to use unsafe? it seems like it's used for stuff similar to malloc/free and dynamic memory allocation stuff which im not very familiar with
Unsafe just means the Garbage Collector won't touch it, so you have to free memory and use pointers and stuff yourself
iirc
its called unsafe because if you dont do it right you could cause memory leaks n stuff
yeayea i think i kinda got it. i read somewhere it's never necessary to use pointers in c# but it can be useful if you know what you're doing
also is there fixed size equivalent to dynamic buffers?
By dynamic buffer, do you mean a list?
Anyone else's "Application.Reload" hanging after making changes to code? I have had to force quit probably 4x today
Hmm, still not working. Any other components I need to set to make it appear?
your localtoworld is invalid
Wait, what? What does it need to be?
I want a fixed size list on a component. Everyone suggests that I should use dynamic buffers, but I know I want a size of exactly 5 indices
Check out NativeLists. It works like a list but you pre-allocate how many spots it has
i forge tthe namespace, i think unity.collections
I thought nativearray and nativehashmap etc didn't work on components 🤔
Anyone else had issue with upgrading to new entities package for netcode?
Unity.NetCode.GhostAuthoringComponent.OnAfterDeserialize () (at Library/PackageCache/com.unity.netcode@0.50.0-preview.29/Runtime/Authoring/Hybrid/GhostAuthoringComponent.cs:320)```