#archived-dots
1 messages Β· Page 137 of 1
huh, so they're merging all the web stuff into .Net 5+? cause its not included right now thats why core exists?
full framework last is what it is
Core was done to make a subset that took up less space and did things differently using new stuff etc.
since we are all off topic here now, can I rant a bit about Unity Hub again? π
But it became clear very fast that as demands rose up, they were heading for a new situation similar to the one they were trying to get away from
why would I want to learn more about that?
well they was merging all to .net Core so name change then make sense
I assume those are patch notes?
why even notify that hub actually works?
The new .NET going forward will be a ton of Dependecy Injection
So you can set up your system exactly as you want it
@dull copper yeah.. its distracting enough i feel compelled to click dismiss, and then get angry because they made me do it. classic abuse of alerting systems, after a while people will just stop reading it.
Well at least you don't have to deal with all of the shit that happens in #π»βunity-talk . I've never seen so many people have trouble using the Unity Hub
it opens changelog
I've muted #π»βunity-talk
Now how is animation supposed to work with DOTS and ECS? Do you have to do some weird conversion tomfoolery?
I wanna make a small bee that can flap its little wings
there is a dots animation package, but its at 0.2 i think
sweats in unfamiliar
basically, there isn't any good out of the box solution for dots anims right now
So what would be the approach?
not animate
:I
the people who actually can use dots animation (outside of the unity staff) are probably countable with your hands fingers
i guess for avg Joe dots animation does not exist π
So what, you'd have to make a prefab with that on it and convert it or what?
you have to add a monobehaviour to your entity and do query and change your animation according to your datas
on paper anyway
But wouldn't that be closer to procedural animation then?
dots sample (that newest 3rd person shooter) does use dots animation
it's like the most extensive example you can find for it I suppose
mkay
but the package does ship with some samples I think
its also probably still using like entities 0.4 no?
but also I dunno if the dots animation we have access to right now is even compatible with latest entities
probably
Right.
welcome to dots
this is the world we live
So procedural might be something that can act as a bandaid
It's not like I need complex animations. Need the flap flaps
and have actually functional stuff you can use
It's not like I need complex animations. Need the flap flaps
@tardy locust simple shader, it's what you want for things like bee
A shader that looks like flapping wings?
yes
ah, if you can just drive it via shader, then that's one way
Yes
Okay
vertex offset on shader
that would be a decent way to integrate simple animations
Vertex animation it sounds like
My animation solution works on shaders
did the fishes on the boid sample do something like that?
or do they even bend there
yes, they bend
Same
Sam Jackson in Unity Park: "They bend...they do bend!"
maybe no one watched Jurassic Park
For example all this fish pack is only one mesh with custom shader and animation baked in to texture https://www.youtube.com/watch?v=rCjIfKIW_qQ
Shaders have always seemed like black magic to me
because it is
It means I don't get how to do any of what was just shown to me
Pure math and matrices
it does get easier when you realize it's all math programming π
That implies I do math
for game programmer, one would hope so π
I have a really akward relationship with math
i can handle vectors, but matricies ? naaaah
Long story short, I had a math teacher in highschool that made me genuienly believe that I was actually hopeless at math and that I shouldn't even try 'cause I'd never get better at it.
So every time I engage with math now, if I don't understand what I'm looking at almost immediately then my brain locks up and goes "Well, don't get any of this, time to give up"
Hope you're familiar with pointers an low level memory in C#? π It will help a lot in writing your own Native containers and custom job types and just in avoiding different things which can feels like limitation with burst π
but vector is just a 1x4 or 4x1 matrixπ
Pointers always vexes me because I've never been taught when to use one. I just know it points to something in memory. Never taught why I should give a damn about it.
For example have native array of structs which store array inside but like pointers which allow you have fast array of arrays without dynamic buffers and native multi hash maps π
but you cant put them into an entity right ? how its going to work then ? your system holds the data ?
depends. in some places is MyStruct* in other void* in other int*
but you cant put them into an entity right ? how its going to work then ? your system holds the data ?
@opaque ledge systems only relative for call dispose
Usually I using couple of my hand written native containers, project specific, and they support async disposing in dependency chain like any other things
seeing occasionally low level stuff like that is going to scare a lot of people from DOTS
Well they make life easier π
I'm avoiding low level stuff like that myself as it just multiplies the time spent on fixing that stuff when it inevitably breaks on next package updates
I'm sad that I was never taught proper C++. I was only taught some hardware architecture by a german dude who had some problems when explaining in English (which was the main language of the course) π¦
I'm avoiding low level stuff like that myself as it just multiplies the time spent on fixing that stuff when it inevitably breaks on next package updates
@dull copper opposite, how it can breaks if it's not relates to any package
In case of native containers it depends only on Collections package
pretty sure @mint iron just fought with some burst issue related to something like that
but I do get the idea you are after (if you have your own implentation,it's not tied as tightly to stock container code
in context of native containers only DisposeSentinel and AtomicSafetyHandle which we using, all other is regular C# stuff
still fighting it to upgrade my example project, a week later, encountered like 5 different editor crashes. Mostly not my code, just doing things in areas with very low coverage. It just comes down to risk, if nobody is using it, and they're not testing it, then you're more likely to hit issues.
Which sort of issues you stuck?
I mean what you does with pointers whic cause problems?
Can you store a pointer as an entity? A number?
a pointer is a number
yea
it's just a memory, range of bytes, it can be any value
but pointer itself it's just number
I was thinking about it in the context of unity components
int*, void*, byte*, MyStructOfAwesomeness* are all the same thing, a number for a memory address
"but you cant put them into an entity right ? how its going to work then ? your system holds the data ?"
Was asked earlier
It would seem that, yes, you can indeed put a pointer in a component
then
Hey, I have a basic question just to clear something up. Are systems ever run in parallel in Unity ECS?
Systems itself - main threaded
only jobs multithreaded
systems runs sequentially on main thread and scheduling jobs, and job runs on worker threads
Synch points it's synch points, place where ALL jobs completes before structural changes
For jobs with multiple systems
if systems have same type dependencies
If systems not share any types and haven't dependency on each other, or all share only read dependency then they can work in parallel (jobs i mean)
for example SysA read component A SysB read component A SysC read component A, all systems runs sequentially shceduling jobs
and this jobs run in parallel
But if SysB, for example, write to A then in BeforeUpdate it complete dependency chain (not all jobs from all systems but only shared types dependencies and job handles involved in that chain)
This is why you can see error about "You should call Complete on previous scheduled Job bla bla bla" when your job not use system input dependency or use wrong dependency and not return own job handle in to dependency chain.
Right.
(you don't return job dependencies anymore manually in systembase unless you explicitly need to do so)
Then, if SysB introduced a synch point, all jobs would be forced to complete before anything else could run?
yes
Yes
Awesome, thanks for clearing that up :)
and no jobs would be schedule until SysB is done
Yes if it has Sync Point, usually all of EntityManager calls is sync point
And here sample of dependencies described above
Awesome, thank you :)
Is there any way to improve the main thread performance in ECS? (regarding the jobs scheduling)
IIRC FPS sample had something like that, a scripting define that forced a simpler job scheduling algorithm
Not talking about .Run() on the jobs though, just for scheduling them normally
It gets quite expensive with many systems unfortunately
Yes, that's the plan
I don't think I ever heard about such a plan on any of the unite talks. Was it somewhere on the forums?
Yes
About define you can enable simple mode which reduce cost of dependency calculation
Can't remember which define name, because not using that
Yeah, that's the one. Forgot how it's called though, didn't find it in the docs either
But in this case
you'll sacrifice dependency chain
and every system will work like with Always Synchronize System attribute
But yeah I really wonder how are they going to make the scheduling systems burstable. Are they really going to burst-optimize the code that fills out the job struct?
ENABLE_SIMPLE_SYSTEM_DEPENDENCIES
I am using the latest packages and after 20 minutes (wasted), I found out that [GenerateAuthoringComponent] doesn't work with enum variables.. π©
ENABLE_SIMPLE_SYSTEM_DEPENDENCIES define can now be used to replace the automatic dependency chaining with a much simplified strategy. With ENABLE_SIMPLE_SYSTEM_DEPENDENCIES it simply chains jobs in the order of the systems against previous jobs. Without ENABLE_SIMPLE_SYSTEM_DEPENDENCIES, dependencies are automatically chained based on read / write access of component data of each system. In cases when there game code is forced to very few cores or there are many systems, this can improve performance since it reduces overhead in calculating optimal dependencies.
I really wonder how are they going to make the scheduling systems burstable I've scheduled from burst jobs before, you could do it before in earlier versions of Entities/Burst before they locked it down. Its definately possible, they probably just need to fix whatever safety concern they had previously.
Maybe we get struct based systems
I really wonder how are they going to make the scheduling systems burstableI've scheduled from burst jobs before, you could do it before in earlier versions of Entities/Burst before they locked it down. Its definately possible, they probably just need to fix whatever safety concern they had previously.
@mint iron From bursted job on worker thread not from main thread?
it was like a year ago so i dont clearly remember but i believe it was scheduled from a sceheduled job
I guess you mean burst codepath on main thread. Because scheduling job not from main thread newer was possible from the every beginning. ~2 years of public DOTS existance
I guess burstable system will work similar to how EntityComponentStore now works, which allow ECB have burtsable Playback (based on function pointers)
We can only guess at the coffee grounds now, until Unity will give us some additional info π But because it's their plane, they definitely will do that
interesting, so CreateJobReflectionData i think it used to be exposed, i basically constructed the JobReflectionData in burst and it accepted the ptr/data you gave it on the schedule method.
Adding support for completely bursted struct based systems. So a system itself can be burst compiled.
From Joachim on forum
Well yeah make system burstable not a unimaginable thing, it's still will be main threaded code anyway, just mush faster
yeah, shouldn't be too bad, they'll just need to sort out alterntaives for the class based functionality, like EntityQuery, EntityManager.
Can an IComponentData store an enum variable?
Yep, or make a joke and fixed their parts π π€£
Can an IComponentData store an enum variable?
@wide fiber Yes
@wide fiber and GenerateAuthoringComponent works with enums also
It doesn't work for me...
hello
GenerateAuthoringComponent currently very sensitive
and can just breaks from small things π
Yeah but if I select another option, when the entity is converted the value of the variable is always the first of the options..
like missed space
can somebody help me with anti aliasing because my unity looks terrible
@frozen halo go to shaders channel
If from the inspector I select OnHold, when it gets converted the value becomes OnClick..
this?
Shaders channel in discord
aa
This is DOTS channel
Put the component on a prefab and then put the prefab in the hierarchy
Maybe it doesn't work with prefabs
Doesn't matter, on prefabs it will work same it will call same code path
Which Unity version and packages you're using?
It's not first frame π Frame debugger show every time correct value
Where you get wrong value
Wait, I'll send some screenshots
After ToComponentDataArray?
(The packages are updated at the latest version)
Burst preview 10?
Well it can be issue, which we investigated whole morning today with Lee Hammerton from Unity Burst team
Okay, first
close editor
open Library folder
Ok
Ok
then open Unity, change your authoring, like add one more enum value just for test
or reorder fields
like trigger with fire
Ok
Unity crashes when I press the play button...
(now it doesn't crash) It still doesn't work
Well authoring definitely work
How you use that
I mean where you get wrong values
asking the people here
Is it possible to destroy a system during runtime?
Lets say I want to spawn something at the start of my game, though I have no other use for that system.
What do I do with it?
Does Unity dispose of it?
Or do I just put things in OnCreate() ?
@storm ravine sorry, I am stupid, I've found the error
Is it possible to destroy a system during runtime?
@tardy locust RemoveSystemFromUpdateList on group which contains that system
And then put logic in OnCreate?
But usually just have empty OnUpdate also fine when you only initialize some things in OnCreate and maybe Dispose other in OnDestroy
I'm thinking it would be optimised to get rid of the system so Unity doesn't have to care about it after init.
I have for example system with OnCreate and OnUpdate for initialization of some singleton entity and disposing data on destroy
Okay
I'm thinking it would be optimised to get rid of the system so Unity doesn't have to care about it after init.
@tardy locust Well it will be only cost of ShouldRunSystem
Also
Enabled
public class SelfDeletingSystem : SystemBase
{
protected override void OnCreate()
{
// Do Something
Enabled = false;
World.DestroySystem(this);
}
protected override void OnUpdate()
=> throw new System.NotImplementedException();
}
I won't have to catch that? @mint iron
uhh no, the update never runs
Okay.
Another question
What would be the point of making multiple Worlds?
I'm assuming it gives you multiple sandboxes of entities
But what could be a nice usecase?
Save\Load game, data streaming, moving entity creation form the main thread by ExclusiveEntityTransaction, etc.
Is that related to the "subscenes" some mentioned?
data streaming part is how sub scenes works
okay
Under hood they have streamingWorld which using ExclusiveEntityTransaction for subscenes data streaming
Can you do instanced materials for the Hybrid Renderer @storm ravine ?
I did this by making 12 different materials and just assigning them randomly during creation.
But with GOs you could make instanced materials to get the same effect right?
Only in SRP, for built-in render pipeline HR not support that, for built in render pipeline you should write your own custom render system
I have the URP
I really don't get how one should solve things with dependencies that doesn't revolve around components and in systems you have written yourself.
E.g. in my character movement I want to use the last frames PhysicsWorld (because Prediction group order n' stuff), but I don't know how I can specify the BuildPhysicsWorld system to be dependent on my system. Sure I can call Complete() on the handle to make sure it's done, and maybe even Clone the physics world before I run my system(not sure of perf on that one though), but isn't there a clean way to solve this?
So if I understand this correctly, you have to make your own shader for this to work @storm ravine ?
Using the MaterialProperty decorator?
Oh wait...it's only from 2020.1
I'm using 2019
fuck
So if I understand this correctly, you have to make your own shader for this to work @storm ravine ?
@tardy locust no
my custom system writes data to some compute buffers asynchronous with new API for compute buffers (Begin\EndWrite) and use DrawMeshInstancedIndirect for rendering
How can I make a SystemGroup which runs at the beginning of Update or at least at the earliest possible time inside the SimulationSystemGroup. I have tried to create a ComponentSyystemGroup with this attribute: [UpdateBefore(typeof(SimulationSystemGroup))]
However if I read the EntityDebugger correctly this group seems to run somewhere in the middle of the SimulationSystemGroup...
@mystic mountain i'm not quite sure if this is what you want, but BuildPhysicsWorld calls at the begining of OnUpdateEndFramePhysicsSystem.FinalJobHandle.Complete(); and EndFramePhysicsSystem has NativeList<JobHandle> HandlesToWaitFor so you can add jobHandle via EndFramePhysicsSystem .HandlesToWaitFor.Add(jobHandle) this will make BuildPhysicsWorld dependant on your job π€
@storm ravine Well when you put it like that I feel like I can't even attempt that Lol
oh, but it will not combine it until EndFramePhysicsSystem updatesπ
@warped trail yep, that is the problem <.<
@warped trail If they only just made the FinalJobHandle fully public π
Expose it to the public. Make it feel the exhibitionism
If there was an easy way to do this without duplicating package and keeping track of updates manually, sure.
How can I make a SystemGroup which runs at the beginning of Update or at least at the earliest possible time inside the SimulationSystemGroup. I have tried to create a ComponentSyystemGroup with this attribute: [UpdateBefore(typeof(SimulationSystemGroup))]
However if I read the EntityDebugger correctly this group seems to run somewhere in the middle of the SimulationSystemGroup...
@bold pebble Why you need that in first place?
I would like to make sure that my "init" systems (which for example initialize components on entites created in the last frame) are always run first in the update.
Usually all my systems order independent, considering that our game not simple and complex enough
Order Independent would also be preferred for performance reasons of course
But there might be cases where it can't be decoupled like that
I would like to make sure that my "init" systems (which for example initialize components on entites created in the last frame) are always run first in the update.
@bold pebble Put them inside InitalizationSystemGroup?
But there might be cases where it can't be decoupled like that
@tardy locust examples?
@storm ravine Ah, is that group running every frame?
all groups are running every frame
Well you might have a system that needs to do a bunch of transformations on a couple of components but you use a different system to apply logic after those transformations.
unless you make them not
OK, then that's the place to put it. thanks π
That's something I did at least for my first ecs project
Well you might have a system that needs to do a bunch of transformations on a couple of components but you use a different system to apply logic after those transformations.
@tardy locust and how it order dependant? π order its only from which side you look
I'll show you image
Which order here? A after B or B after A? π
Considering systems run every frame, B after A
Surly if it didn't matter, it wouldn't make sense for Unity to include ways to order when systems run would it?
But then I ask; If there is no order why does Unity give you the ability to order when systems run?
what about adding one more system C ?
Because people still thinking in OOP way and they think about that like how ScriptExecutionOrder works π Case of UpdateBefore here mostly using inside some nested group which inside ordered for processing some specific algorithms π Your and brookman cases doesn't fit that and can be absolutely independent.
But wouldn't you think that given Unity is Unity, they'd not give that option if it has no effect anyway?
Seems rather weird to let that be in there while making this package if it has zero effect
You can order them
What you are saying doesn't make much sense if it's just a case of "people still think too much in OOP"
but main goal not relate on that in most cases
Say I have a system which collects user input (clicks, key presses). Wouldn't the order matter here if I would like to reduce input lag?
Because in most cases it's not required
most cases is the important word
Hey folks, having a ton of trouble working through the NetCode/NetCube example here: https://docs.unity3d.com/Packages/com.unity.netcode@0.1/manual/getting-started.html ... Some easy hacks/fixes got everything to compile, but nothing moves or works right -- my cube does not seem to have ended up with the same components (none of the Render bits shown in the multiplayer github version of this, for example), for one thing. For another, I cannot seem to catch GoInGameRequest ever being sent or received in the debugger. A bit stumped as to how to debug or what I am doing wrong. Unity version is 2019.3.11f1
Say I have a system which collects user input (clicks, key presses). Wouldn't the order matter here if I would like to reduce input lag?
@bold pebble for networking it matter, for regular without multiplayer - don't. 1 frame don't give you a difference
Indicating you'd think there was no examples.
Who said that? It's only what you imagine
That implies you think there are no examples of that being the case.
Otherwise you'd have said "probably some, yea" or nothing at all
Anyway, small point there. So there are examples then. Cool. The ability to order system execution and why its there has been established π
I don't even want to think about DOTS and networking...phew. I've looked into the FPS sample and...well
A lot is going on in there
Oh, fun. I figured out why my RPC wasn't happening. I had ConvertToClientServerEntity setup wrong
But now nothing renders
fun
Internal: deleting an allocation that is older than its permitted lifetime of 4 frames (age = 6)
I also see zillions of these
Is that a known bug?
You forgot to dispose of native arrays
Am I supposed to fix generated code?
Lemme double-check
unity's safety system is not very friendly with low frequency update systems π
hm
Main point was - example you will tell me right now from your mind wouldn't fit that, because I was sure in that π And it's was it and I showed you that it's usually not the case as you think about that at first place, cases for matter order mostly exceptions than regular thing π brookman example about networking - definitely good and partially fit that because in networking game it matter and you can't (but not always) spread this across 2 frames.
if your systems will update much slower then your frame rate you will probably get a lot of Internal: deleting an allocationπ
@storm ravine okay
Don't think about blaming or something
I only showed that if look at case from different direction you can exclude that order dependency, and it usually suitable for 90% of cases
I didn't blame. I pointed out how the language you used came across.
That's it
Either way we've moved on. It's resolved.
No I missed words here "Don't think about that like I'm blaming you or something"
π
question: I have a collection of scriptable object containing all the fancy game stuff (prefabs, materials, stats, names, ...)
should I reference them using a blob asset reference, or using an identifier (array index) stored in entity component data and access the collection using that index from system ?
Depends, we're using both
I'm assuming the Addressable system was made for this?
I even run some testing
At application start converting scriptable objects with stuff from Addressables to entities prefabs, materials maps etc and store some things inside blobs, other things in singleton entities
looks like accessing scriptable object using an index is slightly faster than blob
so I should not work with SOs during runtime at all ?
For entities data just needs to be available best possible right? So if you need to convert then that's it
You can use them. Depends on type of data in your scriptable objects
if all blittable you can convert that to entity with component storing that, to blob, etc.
You for you mush convenient have some dictionary with indices - also valid way
usually all the stuff that would be part of a regular game object, and is shared with multiple entities
but I don't prefer that because code become mess when growing
So, this shows the multiplayer cube on the left and my cube on the right... can't figure out why my cube doesn't have the Rendering components:
usually all the stuff that would be part of a regular game object, and is shared with multiple entities
@gilded glacier blobs
if data immutable
Hm. But my plane doesn't show up in Play mode either
@gilded glacier then blobs is what you want for shared immutable data. Like MaxHealth, or DefaultDamage etc.
And just have BlobAssetReference in your component
okay, but what about non-blittable data ?
For that I store that data on IComponentData class (not struct) associated with singleton entity
and every system can query that and access that data
It's easy to use, data usually read only for every system, thus not affecting dependency chain, can be accessed from any system
and fit whole code style
And you don't need to use any statics in here and this exclude unnecessary direct dependencies
Moreover it's useful for RequireForUpdate
which you can declare in your system an system wouldn't run until required entity appear
and is there any reason to use shared data components ?
Filtering
Groupping things
It's main purpose of ISharedComponentData
not to be container for managed types
@sand prawn dumb question, but did you install hybrid renderer package?π€
Because how ISCD implemented it's just side effect that it can have managed data (because it's not part of chunk)
@warped trail That's not a dumb question at all! I did not
BUT neither does the multiplayer package.json seem to include it?
AND the tutorial doesn't seem to call for it
No, you should install it by yourself
Thanks, trying that
ugh. it wants a newer entities than the one I'm using?
Or should I downgrade to an older hybrid renderer?
you need newest entites for newest hybrid
yeah, it's just, old hybrid isn't all that great
I think I'll try an older hybrid first. Ran into mayhem last time I tried newest entities
oh, hm
Yep, but if he don't use SRP it's doesn't much matter π
Not probably planning to use SRP for a while
this is now fixed on latest 2020.2 alpha: https://issuetracker.unity3d.com/issues/streaming-texture-is-not-working-when-there-are-only-instantiated-entity-objects
How to reproduce: 1. Open attached project "textureStreaming.zip" and scene "SceneFailing" 2. Enter Play mode 3. In Game view, press...
"Fix In Review for 2019.3, 2020.1"
Okay, much better. Added HybridRender 0.3.4 or something and I'm now seeing 2 cubes
but one of the moves, yay!
Not sure where the extra cube is coming from
Call exorcist
is the other the gameobject version?
can't remember what authoring methods were on the older entities anymore
@dull copper That's my guess. How can I prove that?
you'd see the gameobject on your scene in that case
Scene in play mode looks like this
then no idea
@storm ravine For while world?
Err, sorry. Which world
Both
I have quarantine brain
Firstly you should find which is moving and where
I guess you have just couple of entities
just check which one matrix changing
Client world looks like this, wtf
The cube with index 19 is the one that "moves" (based on its transform)
Not but this is also useful
Inspector tab
with selected in Entity Debugger entity
MovableCubeComponent it's your?
yes
Checked off is disabled, presumably? Yes, it still moves.
Yeah, now it does not move
And then when checked back on, the cube snaps to what I guess is the correct spot
Guess some initial values for prediction causing that problem
does your initial values 0 everywhere?
I mean Input etc
In first frame
Causing me to have multiple cubes?
yes, I agree
does your server world have render system?
Oh, maybe this is my problem
You should exclude that and it will exclude rendering additional cubes
I probably JUST want Server here, right?
oh, actually. heh
I didn't change the prefab, I changed the instance
when I added the render items
Your prefab haven't render mesh initially?
MeshRenderer I mean
and what component on that duplicated cubes (in entity debugger inspector)
I guess one of them is client world prefab entity and instance and 2 other is server world prefab and instance
Oh it's all in client world
well need to see inspector from entity debugger for that cubes
K, so. I have weirdly got 2 cubes on the server, and 4 on the client, heh
that's the server view
I was wrong though, I think... I'm pretty sure I cleaned up the checks and regen'd all the code and still see 2/4
@storm ravine K, definitely didn't follow exactly what you are asking for screenshots of, though
Prefab does have a Mesh renderer initially
Inspector form Enetity Debugger
of all this 4 cubes
And how you instantiate you cubes?
You mabe already posted that above
But now it's too far π
afaik I don't instantiate them, they're just in the initial scene
Well, you have 1 cube initially without MeshRenderer?
Cube ID #4
Cube ID #17
This is one of cubes which you see on scene, next
Prefab, not showing on scene
Well this is different players. 5 and 4 it's their prefabs. 19 is player 1, 17 is player 0
Yep 1 player. Show you scene hierarchy in edit mode
not in play mode after conversion
And inspectors of cube collection and plane
delete cube π
Oh, that's it?
your prefab is already in ghost collection
okay, gotcha. Thanks for the head-extraction
so you are spawning one cube from code when player connects and one with scene prefab is spawned as clinet/server stuff π€
Don't know, maybe
I'm not using networking in current game and only checked packages code fluently just to be in general flow of how new networking growing
It looks tremendously cool
nothing super in that networking π
last time i tried netcode it was jitterlandπ
It's just to early for decisions
Seems pretty smooth here.. I should play with the tuning to see what bad networking looks like
it was kinda smooth with moving cube(while i was moving it), but everything else was horribleπ€
"everything else"?
there is some interpolation components. but i haven't figured out how to use them and there is almost 0 documention about this stuffπ
yeah like objects which are moving on server and client only gets change in position
hehe, I'm coming from recent Unreal hell, so even "this shit is brand new in Unity" documentation looks way better than what Epic provides
@warped trail So, losing rotation?
jitter
ah
very noticeable jitter
hm
Thanks for the help, @warped trail and @storm ravine and @dull copper and @tardy locust
Did I help?
You did, early on!
oh okay
i guess they will fix that in couple of yearsπ
Glad I could help
@warped trail You can override and fix yourself, can you not?
Well, I meant more specifically the interpolation of rotation data?
i think this should work out of the boxπ€
Oh, I'm not disagreeing there
I'm more asking if it's easy to end-around issues there for developers who just need to plough ahead
i don't think smooth motion is some exotic featureπ
Well, you're obviously super picky. /s
What do the colors and icons mean here, exactly? Is that documented somewhere?
Green ones means that system queries for it, white ones means system only check if that component exists (so WithAll<ComponentType>), red ones means system checks if that component does NOT exist (so WithNone<ComponentType>)
afaik
@opaque ledge Ah, thanks
What is the best practices for optional components with ecs?
Add them if you need them?
Make systems that looks for the optional components alone and if they find any, look for other needed components on the same entity (if any is needed in that context)
If none of those optional components are found and cannot be added during runtime, then delete the system and move on
Those are my first thoughts at least @wise monolith . There might be a better solution.
How's DOTS so far in 2020.1? Last I was looking last year it was still not quite there yet, or at least not as approachable
tooling is still pretty much the same
Reposting, been stuck on this π
https://forum.unity.com/threads/burst-compiler-failed-on-macos-for-ios.879190/
I have a prefab (that contains multiple game objects) that I convert to an entities. What's a good way to give one of the child game objects a tag?
Can't you just add the component manually to the child GameObject? @cosmic sentinel
I try to search for in after calling EntityManager.Instantiate() on the prefab. but it doesn't seem to work. I might try to go down the route of using IConvertGameObjectToEntity
So I'm getting some weird differences in behaviour with Camera from when I'm using GameObject.Instantiate vs being in scene from start using Conver To Client Server Entity (marked to client) with convert&Inject. Basically I'm copying position in presentation group from my player entity, when I'm keeping it in scene it seems like it copies the camera, but the updating of position seems delayed? Basically if I do it with Instatiate it is smooth, but with keeping it in scene it laggs a few frames behind.
Entities 0.10 and Hybrid 0.5 are out β€οΈ
really, is it 0.10 ? i really thought it would be 1.0 π
π€£ I seem to remember joking it would be 0.10 a few weeks ago
yeah exactly, i thought it was just a joke π
this is just modern versioning, a version isnt a fraction π
hmm but how do you tell the difference between 0.9 and 0.09 then? π
There is no 0.09 π
anyway... new packages π₯³
its not a fraction, each part of the version is its own separate number
can someone put the notes π
version 0, minor version 10
it says I can't view it 'offline' atm π
you have to check it inside the local package
yea, currently obtaining
Last time I pasted it here someone got angry that I was "spamming" π
### Added
* Added `GetOrderVersion()` to ArchetypeChunk. Order version bumped whenever a structural change occurs on chunk.
* Added `GetComponentDataFromEntity` method that streamlines access to components through entities when using the `SystemBase` class. These methods call through to the `ComponentSystemBase` method when they are in OnUpdate code and codegen access through a stored `ComponentDataFromEntity` when inside of `Entities.ForEach`.
* Added support for `WorldSystemFilterFlags.ProcessAfterLoad` which enable systems to run in the streaming World after a entity section is loaded.
* Added `DynamicBuffer.CopyFrom()` variant that copies from a `NativeSlice`
* Added `DynamicBuffer.GetUnsafeReadOnlyPtr()`, for cases where only read-only access is required.
* Added PostLoadCommandBuffer component which can be added to Scene or section entities. This plays back a command buffer in the streaming World after a entity section is loaded. Adding it to the Scene entity plays back the command buffer on all sections in the Scene.
* Added `WorldSystemFilterFlags.HybridGameObjectConversion` and `WorldSystemFilterFlags.DotsRuntimeGameObjectConversion` which annotates conversion systems that are used specifically for Hybrid or DOTS runtime.
* Added missing profiler markers when running an `Entities.ForEach` directly with `.Run`.
* Added support for storing metadata components in the header of converted Subscenes. `GameObjectConversionSystem.GetSceneSectionEntity` adds components to the section entities requested. The added components are serialized into the entities header and are added to the section entities at runtime when the Scene is resolved.
* ResolvedSectionEntity buffer component is now public and can be used to access metadata components on a resolved Scene entity.
* Bumped Burst version to improve compile time and fix multiple bugs.
* ChangeVersions behavior more consistent across various entry points.
* Updated package `com.unity.properties` to version `1.1.1-preview`.
* Updated package `com.unity.serialization` to version `1.1.1-preview`.
* Updated package `com.unity.platforms` to version `0.3.0-preview.2`.
* `ConvertToEntity` no longer logs a warning if there are multiples of a given authoring component on the converted GameObject. As such, it is now compatible with conversion systems that can support multiples.```
btw some really cool changes in Hybrid renderer 0.5
* Deprecated `EntityManager.UnlockChunk`.
* Deprecated adding components to entities converted from GameObjects using proxy components. Use the new conversion workflows with `GameObjectConversionSystem` and `IConvertGameObjectToEntity`.
* Deprecated `ComponentDataProxyBaseEditor`, `DynamicBufferProxyBaseEditor` from `Unity.Entities.Editor`.
* Deprecated `ComponentDataProxy<T>`, `ComponentDataProxyBase`, `DynamicBufferProxy<T>`, `SharedComponentDataProxy<T>`, `SceneSectionProxy` from `Unity.Entities.Hybrid`.
* Deprecated `MockDataProxy`, `MockDynamicBufferDataProxy`, `MockSharedDataProxy`, `MockSharedDisallowMultipleProxy` from `Unity.Entities.Tests`.
* Deprecated `CopyInitialTransformFromGameObjectProxy`, `CopyTransformFromGameObjectProxy`, `CopyTransformToGameObjectProxy`, `LocalToWorldProxy`, `NonUniformScaleProxy`, `RotationProxy`, `TranslationProxy` from `Unity.Transforms`.
* Deprecated `ScriptBehaviourUpdateOrder.CurrentPlayerLoop`. Use `PlayerLoop.GetCurrentPlayerLoop()` instead.
* Deprecated `ScriptBehaviourUpdateOrder.SetPlayerLoop`. Use `PlayerLoop.SetPlayerLoop()` instead.```
it seems like the Dots Editor package isnt working properly (again). Getting a few errors with it
I've reported it already
oh, good job - I deliberately didn't update that one yet π
yeah dont if you can get away with not doing it
I think the problem is that editor isn't on the same schedule as entities
* Fixed the synchronization of transforms for Hybrid components to handle scale properly.
* Improved JobsDebugger error messages when accessing `ComponentDataFromEntity`, `ArchetypeChunkComponentType`, `ArchetypeChunkComponentTypeDynamic`, `ArchetypeChunkBufferType`, `ArchetypeChunkSharedComponentType`, `ArchetypeChunkEntityType`, and `BufferFromEntity` after a structural change. (requires Unity 2020.1.0b2 or later)
* Fixed an issue where Scene Camera culling masks weren't reset when using ConvertToEntity but not any Scene conversion
* Fixed IL2CPP compilation errors happening in IL2CPP builds with Entities.ForEach with nested captures.
* Fixed an issue where incorrect data for chunk components was shown in the Entity Inspector.
* Fixed an entity Scene load error when serializing hybrid components with conditionally compiled fields, which caused a type hash mismatch.
* `LambdaJobTestFixture` and `AutoCreateComponentSystemTests_*` systems are no longer added to the simulation World by default.
* `GameObjectConversionSystem.DependOnAsset` now correctly handles multiple Subscenes
* Fixed an issue where patched component access methods (`GetComponent/SetComponent/HasComponent`) broke `Entities.ForEach` when there were a lot of them, due to short branch IL instructions.
* Fixed deactivation of Hybrid components when the entity was disabled or turned into a Prefab.
* Improved the performance of singleton access methods (`SetSingleton`/`GetSingleton`).
* Fixed an issue where managed components were not being serialized during Player Livelink.
* Fixed an issue where `CompanionLink` was incorrectly synced during Player Livelink.
* Fixed a false-positive in the EntityDiffer when a shared component in a changed Chunk has its default value
* Fixed Entities.ForEach lambdas that call static methods as well as component access methods (`GetComponent/SetComponent/HasComponent`).```
this happened the last time when 0.9 came out.. the Editor one broke then too π
Hybrid 0.5:
Changes that only affect *Hybrid Renderer V2*:
* V2 now computes accurate AABBs for batches.
* V2 now longer adds WorldToLocal component to renderable entities.
Changes that affect both versions:
* Updated dependencies of this package.```
* Improved precision of camera frustum plane calculation in FrustumPlanes.FromCamera.
* Improved upload performance by uploading matrices as 4x3 instead of 4x4 as well as calculating inverses on the GPU
* Fixed default color properties being in the wrong color space```
"Improved upload performance by uploading matrices as 4x3 instead of 4x4 as well as calculating inverses on the GPU" this is quite big for performance π
I think this build also includes hybrid component fixes, so Lights and such should convert better than before
apologies for the spam but I look forward to these updates. Also Collections 0.8:
* Added `UnsafeAtomicCounter32/64` providing helper interface for atomic counter functionality.
* Added `NativeBitArray` providing arbitrary sized bit array functionality with safety mechanism.```
no idea what * Fixed Entities.ForEach lambdas that call static methods as well as component access methods (`GetComponent/SetComponent/HasComponent`). above means though
I think there was a discussion on the forums about an issue with static methods from the lambda
still no srp bumps to 9.0 though π§
true π¦
Bumped Burst version to improve compile time and fix multiple bugs. π
Anyone know a good way to detect whether you're running on the process that is in charge of converting subscenes in the background, or if you're on the main Unity process?
that means that i can't use new entities until they release new burst package with fix for meπ©
i really hope that, those one of the fixes was for my case where a system crashes editor but works fine in build
Maybe it will come before 2020 LTS
@bright sentinel 1.0 will be in 2020.1 release
I'm curious... what's the difference between adding WithStructuralChanges() or not to a lambda with Run & WithoutBurst()? (if there is one)
Allow to use EntityManager
Without .WithStructuralChanges() compiler will throw you error even with Run
Entities.ForEach Lambda expression makes a structural change. Use an EntityCommandBuffer to make structural changes or add a .WithStructuralChanges invocation to the Entities.ForEach to allow for structural changes. Note: LambdaJobDescriptionConstruction is only allowed with .WithoutBurst() and .Run().
WithoutBurst() and Run() can be used without EntityManager for avoiding hard sync point for example, or for work with some managed data, but if you want structural changes you should use WithStructuralChanges, wich will create sync point
@storm ravine Where have you seen that? π
And don't forget that Sync Point is specific thing which completes ALL jobs not only dependency chain
Oh of course... the missing part in my head was that although Run would run main thread, that doesn't mean there aren't jobs on other threads safely running. This ensures a hard sync point. Got it.
@storm ravine Where have you seen that? π
@bright sentinel This is what compiler will tell you if you putEntityManagercall insideForEachwithoutWithStructuralChanges
hmm I think new entities has caused entity debugger spam for me.. going to rollback to check
Meh they changed conversion mapping system....uuuuuuuf π
hmm errors are from ComponentObjects - wonder if they're not really supported any more
how have they changed conversion mapping system?
wow i am screwed if they are not supported anymore
might only be the previewing in the entity debugger.. hard to guess
I haven't got my head around the Companion stuff yet - I only heard of its existence the other day.
like camera, light etc.
i want to 'add' my managed scripts to entities
And we use only companions for monobehaviours which required in DOTS world
WorldSystemFilterFlags.ProcessAfterLoad with this you can make system that can move all loaded entities before they moved to default world?π€
i actually was thinking some kind of event system like that, like adding "KilledEvent" script to entity, then fire the event when entity is about to die etc.
Then just add them through conversion and AddHybridComponent
At the moment for hybrid workflow, I create an entity that tweens a classic GameObject Cube let's say. An entity with the tween components you'd expect is created and the cubes Transform is associated via AddComponentObject. Then in a lambda I can do e.g. (ref Transform cubeTransform, in float lerpedTime). I'm a bit unclear on the new suggested workflow in this context.
And the lambda would stay the same right?
yeah but thats conversion, not everything is GO -> Entity
For any other managed instances (like you wan't you script NOT MonoBehaviour associated with Entity) use class IComponentData (not struct)
yeah but thats conversion, not everything is GO -> Entity
@opaque ledge Seems you don't understand that π
It's still hidden GO
But with convenient processing through DOTS systems
under hoow they create hidden GO's which used for that
With that tool you can convert every thing from UI to Camera
AddHybridComponent only exists in a GameObjectConversionSystem right? But I'm not converting anything.. just creating a companion entity as it were.
i am creating objective entities for my quests, and i am going to add controller monobehaviour to them so i can add some trackers which is monobehaviour, can you tell me how to do this thru conversion ?
isnt AddHybridComponent only viable when converting ?
i think AddHybridComponent is more for GO components like camera, light etc like you said
with stored in field instance of your MB
More code gen π₯³
Btw why you decided AddComponentObject not work?
yeah i was doing that, i had a TextMeshProUGUI in my monobehaviour that i added to class IComponentData, but build failed because of it, so i had to convert to AddComponentObject
As I can see source code it's still here and used in many places include tests which pass successfully
I haven't decided it doesn't work.. I'm concerned that support may not persist if the entity debugger is broken
Worried that I'm using an out-of-date concept
AddComponentObject still here and works
For example Convert and Inject relates on that completely
I suspect you're right and that ICD classes are basically the replacement for this long-term - maybe I should seek clarity on the forums
It's not out of date π
how does your game going btw Eizen, without any pain i hope π
Posted on the forums for clarification - it works right now but as there's an overlap in functionality it would be good to get clarity on the future vision.
@storm ravine Sorry before, I meant where did you see that 1.0 will be for 2020.1?
how does your game going btw Eizen, without any pain i hope π
@opaque ledge Yes, I didn't stuck anywhere and upgrades goes smoothly. From time to time I have some Unity side issues, but I just copy package locally fix that and use it. And tell Unity teams (depends on which package I fix, it's different teams) and use local version until they fixed that (usually right in next release), like it was with shadows in HR in built in because of bounds, or addressables inspector issue for serialized fields etc. They work hard and fast, and I really appreciate that they fix problems so fast. Like in Burst was problem with small sized structs and fix arrived right after report π
@storm ravine Sorry before, I meant where did you see that 1.0 will be for 2020.1?
@bright sentinel DOTS roadmap
Which roadmap? π€
I know this one https://www.youtube.com/watch?v=dDjsS4NPqFU
This is the first installment of our 2020 roadmap, Unity 2020: Core Engine & Creator Tools.
Watch the second installment, Live Games: https://youtu.be/w6sn8bJiZ2g
We know you'll have a lot of questions about this roadmap, so we're hosting a Q&A on the Unity forum following ...
But that's not really DOTS specific
i actually dont know either
π
@mint iron
Library\PackageCache\com.vella.events@5322dcf5ba\Runtime\Extensions\UnsafeExtensions.cs(32,39): error CS0029: Cannot implicitly convert type 'Unity.Collections.AllocatorManager.AllocatorHandle' to 'Unity.Collections.Allocator'
i guess i have to remove your package, i would love to use it tho when its ready^^
Thanks for your hard work as well
I'm rolling with my own extremely simplified ECS, and I do NativeHashmap<int, Data> to store component data of entities.
Now I need a NativeArray as data which doesn't work (basically what DynamicBuffer solves in ECS). My data array has a fixed and known size so right now I'm doing away with FixedListFloatxxx but it's kind of a pain to work with them (and a smaller down side is that I only need 64 in length but the smallest that fits is FixedListFloat512 which is basically wasting half the memory)
Any simple alternative to this?
use pointers in data which points to required array
or use those unsafe lists some guy made
@vagrant surge Unity have built-in unsafe lists maps and arrays
I thought about using pointers, are unsafe stuffs good to use in production?
Even with mobile?
if you understand that and can track properly (for exclude corruption and leaks) it's fine
I read somewhere that they are bad or something but maybe I'm only remembering it wrong.
You already using them
NativeHashMap is wrapper around UnsafeHashMap*
Which already pointer
Which in turn use one more pointer internally
yes
unsafe in c# basically just "turns on" the cpp style stuff
with pointers and malloc
With custom field offsets
Okay good to know, that's something I'm pretty confident with.
is there any hard data on how faster/slower the native collections are compared to the regular .net ones?
last i read theyre basically all slower, except if you're using them in burst, then theyre faster
that's what I expected tbh but people are switching to native* left and right
even without dots
It's not the same
I was wondering if it's just a counterproductive fashion trend (because omg it's c++ so it must be faster)
NativeCollections slower not because of pointers
you're doing c++ calls for every little thing
oh sorry by native* I didn't mean a pointer, I meant the NativeSomethingSomething containers
Yes just use collections on main thread without burst will be slower
Working just with raw pointers and raw memory will be faster, if you use them properly
And know what you're doing π
sure but that's you doing it from c#, not doing unmanaged calls for every single operation
How do I enable unsafe code? Is it still adding some file in Asset folder or is there an option in Project Settings now?
Googling gives me things back in 2014.
project settings/player i think
if you're using asmdefs this is a setting on the asmdef
sure but that's you doing it from c#, not doing unmanaged calls for every single operation
@gusty comet Yes and I never told you that it's opposite, this is why I told you that pointers not a problem of NativeCollections π
Okay thanks.
@storm ravine all those void* pointers are such heresy
?
sure but its basically a raw memory adress with no type info, so same as a void*
Well all type info you needed is in generic arguments
UnityEngine::UnityException: Log can only be called from the main thread. π
i thought Burst supported Debug.Log now
sure but its basically a raw memory adress with no type info, so same as a void*
@vagrant surge it's not the same π Yes they "points" to memory, same as int* and other but void* have different behaviour, void* indicates the absence of type, it is something you can not dereference or assign to, byte* instead have defines on processor level instructions (like BYTE PTR , WORD PTR) which tell how many block processor should read. And ifais void*++*awill give error , because it doesn't know how many chunks(bytes) should be incremented.
@vagrant surge using byte* is pretty much to avoid having to cast to byte* every time you want to add/subtract :S
Yep endorse @mint iron
And I guess also Burst involved here, this is why they use just byte* instead of generic parameter pointer. But this is only thought.
Moreover you just cant do that
It will give you error with generics
Cannot take the address of, get the size of, or declare a pointer to a managed type ('TKey')
damn thas busted
on cpp you can
so basically to write native containers in C#, you have to rely on essentially void*
and manual memory management with it
And there is no generic restraint that you can implement that would ensure compile-time safety to make sure the struct would satisfy those requirements. As such, you can't make a pointer to a generic type.
This is the reason
very interesting
so basically to write native containers in C#, you have to rely on essentially void*
@vagrant surge not on void* π
well, the difference beetween void* on cpp and byte* on C# is really not much
both used to represent "random" memory adressed
at least from a conceptual standpoint
@opaque ledge are you using 2020.1?
Above void* indicates the absence of type, it is something you can not dereference or assign to
I understand what you mean
about byte*, and this is only because of C# limitations
yeah
But just clearing up that it's not the same as void* π
I dunno about debug.log but debug.draw works on jobs when using 2020.1
yep but have some limitation
Maybe the logging support is still coming
Which you can expand
Size of buffer for drawing
Which can be expanded through -debug-line-buffer-size boot parameter
a pointer to a managed type only option is unmanaged constraint or AsRef<T> / CompilerServices.Unsafe hardcoded workaround.
So basically can use debug.draws in jobs but not in burst and can use debug.log in burst but not in jobs?
No I speak only about count of draws π
It just will ignore part of this calls
like we have ~50k draws for test
but obly 5-10k was in scene because of this buffer default size limit
Ah I didnt have anywhere that much on my test
Wouldnt 50k debug draws tank the perf quite badly
Not much
But of course all depends on hardware π
And as I said that was just a test
oh great @storm ravine (and others) - I noticed in some earlier tests that I think entities with a BlobAssetReference load the associated data into cache even if the job doesn't actually require the ICD/data - it should be possible not to load that data and consequently fit more entities in a chunk right? Thinking it could be a nice little optimisation. Though there may be good reasons why it's not possible.
I have updated entity packages to 0.10.0 and now when I press the play button it gives me the error:
A component with type Camera has not been added to the entity..
I have a camera GameObject with ConvertToEntity script attached and now it doesn't work
interesting that they've pretty much switched to explicit layout for everything with a pointer in it hardcoded to 8, i guess that avoids x86 ptr size complications entirely.
I have updated entity packages to 0.10.0 and now when I press the play button it gives me the error:
A component with type Camera has not been added to the entity..
I have a camera GameObject with ConvertToEntity script attached and now it doesn't work
I am using Unity 2019.3.8f1
Yep
HybridRenderer team wrapped camera conversion
in to define
because of bug with cameras in editor
You should put HYBRID_ENTITIES_CAMERA_CONVERSION in to project defines
And camera will convert again
Or mirror what they do in your GameObjectConversionSystem, if you don't want relate on defines Entities.ForEach((Camera cam) => { AddHybridComponent(cam); });
hmm anyone have any notes on the new build pipelines and how they work with subscenes?
@storm ravine thanks :D
oh great @storm ravine (and others) - I noticed in some earlier tests that I think entities with a BlobAssetReference load the associated data into cache even if the job doesn't actually require the ICD/data - it should be possible not to load that data and consequently fit more entities in a chunk right? Thinking it could be a nice little optimisation. Though there may be good reasons why it's not possible.
@amber flicker Why you think so? I mean why you think this data in chunks
all blobs live in one big 200mb preallocated memory place - one per scene
hmm so I thought it was the case because in my previous tests it was slower to do work on entities (let's say, each with a unique blob) than it is if those ICD's were just an int. In jobs that didn't require the blob/icd.
I thought it still must be being loaded into the cache line
but perhaps not?
And this memory not used by chunks. Only space you waste with BlobAssetReference in ICD is size of 8 which hardcoded explicitly [StructLayout(LayoutKind.Explicit, Size = 8)] as @mint iron mentioned above
hmm... maybe I'm wrong.. guess I should do some more tests
why 200mb exactly?π€
@storm ravine I should add this code in a system inheriting from GameObjectConversionSystem in the update function?
The define doesn't work properly so I will use the code way
Yeah I've put it there
Well it's definitely work as previously in that case
Because it's just wrapped around previous code
That's all
The define gives me a lot of warnings and errors:
(Warning) The referenced script (MyScript) on this behaviour is missing
(Error) NullReferenceException: Object reference not set to an instance of an object
Well because you have missed script
?
if you click on that warning
it should select your GO
You have other components on camera&
Like MyScript etc?
Cool
yup, looks like I was wrong.. π₯³ π
interesting that both EntityManager and EntityQuery are structs now
Hello people of the dots channel!
prepare the Burstable systems lieutenant!
Random question of the day: what is the equivalent of [NoAlias] in Entities.ForEach ?
Is this the answer?
ExpectAlias
ExpectNoAlias
Lol
Well then
I thought it was interesting you both had "sebas" as your username but not entirely the same xD
but I don't think it applies to Entities.ForEach does it?
(the avatar is the same π )
@scarlet inlet i think you don't need have to specify [NoAlias] yourself
with Entities.ForEach
@warped trail does it assume no-alias?
just open DOTS compiler and see for yourself π
yeah
it shows generated code
oh very interesting
OK thanks I'll be back
doesn't put NoAlias on external containers
I would have found that weird, but also not that weird, because eventually having aliased containers would be werdier
but point is they should be NoAlias
π€ These attributes do not need to be used when dealing with [NativeContainer] attributed structs, or with fields in job structs - the Burst compiler is smart enough to infer the no-alias information about these without manual intervention from you, our users.
really
not sure if I agree with that, but anyway what would happen with pointers?
so data structures that are not native containers
time for a post on the forum maybe
Guys I am making a weapon system.. I have the LauncherProjectileSystem that instantiates the projectile.
I want to apply a physics impulse to the projectile, so I instantiate the bullet and I apply the force but it says that I can't add the force because the entity has index = -1.
The projectile spawns correctly but I can't add the force, probably because the command buffer doesn't instantiate it immediately and the physics need it.. How can I solve it?
commandBuffer.Instantiate() returns invalid entity
it will become valid when commandbuffer wil be played back
basically you are trying to get PhysicsVelocity from entity which doesn't exist yetπ€
Yeah, is there a way to solve that?
you can set physicsvelocity like this cs commandBuffer.SetComponent(entityInQueryIndex, projectile , new PhysicsVelocity { Linear= ..., Angular = ... });
Ok ty :D
and you can get PhysicsVelocity and PhysicsMass from launcherData.ProjectilePrefab
how do i add an existing subscene asset to a scene? if i drag it into hierachy it just creates a new normal scene from it π¦
create empty object and add subscene script ?
thnx that worked, what a weird workflow
i think there is no such thing as subscene assetπ€
subscene script just convert normal scene to some binary fileπ€
@scarlet inlet about ForEach and different attributes, all attributes from job will work with Entities.ForEach it you create custom struct like you does that before for IJobForEach, (but without IJobForEach obviously) and use that struct inside ForEach. like that:
{
};
Entities
.WithName("Newborn_Handle")
.WithNone<ParentBuildingState>()
.ForEach((Entity e, int entityInQueryIndex,
in AttachParentBuilding parentBuildingData) =>
{
handleNewbornCitizensJob.Execute(entityInQueryIndex, e,
parentBuildingData);
})
.WithStructuralChanges()
.Run();```
{
//fields with attributes
public void Execute(int index, Entity e, in AttachParentBuilding parentBuildingData)
{
//Do stuff
}
}```
If I understand your question right
@warped trail so instead of
//Apply the force to the projectile
varΒ bulletVelocityΒ =Β GetComponent<PhysicsVelocity>(projectile);
Β varΒ bulletMassΒ =Β GetComponent<PhysicsMass>(projectile);
I should use
//Apply the force to the projectile
varΒ bulletVelocityΒ =Β GetComponent<PhysicsVelocity>(launcherData.ProjectilePrefab);
varΒ bulletMassΒ =Β GetComponent<PhysicsMass>(launcherData.ProjectilePrefab);
if your velocity is zero you can just create new PhysicsVelocity instead of getting it from prefab
π
So when instantiating Prefabs inside Subscene conversion i have to remove the EntityGuid component of the instantiated Prefabs otherwise i get an DuplicateEntityGUIDException.
Is that supposed to be this way? Shouldn't that component be removed automatically or am i missing something obvious?
The comment for EntityGuid states that it can be used to map back to the authoring GameObject from which it was converted. It also states that the component is unique within a World.
Why would that be the case? Can't multiple entities be authored by the same GameObject?
i don't think you're supposed to instantiate prefabs inside a subscene conversion. That would put it into the conversion world, but it won't be saved properly to show up at runtime unless you've used CreateAdditionalEntity
Jobs package is updated, its only for updating dependincies
With the new system base, how are we supposed to schedule dependencies for stuff that isn't Entities.ForEach? That's how I did it before, but that wont work with systembase, and so far none of my various permutations has gotten me the right result.
protected override JobHandle OnUpdate(JobHandle inputDeps)
{
var baseJob = new GetTargetJob
{
Aggression = Settings.Instance.Aggression,
RandomizerType = GetArchetypeChunkComponentType<Randomizer>(false),
EntityType = GetArchetypeChunkEntityType(),
};
var firstTeamJob = baseJob;
firstTeamJob.CommandBuffer = mCommandBufferSystem.CreateCommandBuffer().ToConcurrent();
firstTeamJob.Enemies = mSecondTeamQuery.ToEntityArray(Allocator.TempJob);
var firstHandle = firstTeamJob.Schedule(mFirstTeamQuery, inputDeps);
var secondTeamJob = baseJob;
secondTeamJob.CommandBuffer = mCommandBufferSystem.CreateCommandBuffer().ToConcurrent();
secondTeamJob.Enemies = mFirstTeamQuery.ToEntityArray(Allocator.TempJob);
var secondHandle = secondTeamJob.Schedule(mSecondTeamQuery, firstHandle);
return secondHandle;
}
Dependency property is the job handle now
Dependency = new SomeJobStruct {}.Schedule(...);
so Dependency = new YourJob().Schedule(Dependency)
Great, that worked, thank you :)
is there new entities package? π€
yes
1.0 ?
0.10.0π
π
does anyone actually got a good 'thing' out of the newest patch ? they all seem like... very abstract or for very specific purposes
like.. what is entity section exactly
The new unity release or the entity/hybrid renderer/.. new releases?
I can't open the link of the changelog of the Entity 0.10.0 package
I don't know what's changed
i guess main thing is that you can edit stuff before entities are moved from streaming world to your world
i would love to test this things, but i have to wait for next burst package releaseπ
and i hope they won't forget to include fix π
looks like entities wont be out for another year lol
seems like the latest entities package has some sideeffects
π
aside from what I see on the forums, in my own project some things arent getting parented for whatever reason π π©
no errors, just no parenting
heh, so it actually has fewer side effects than usual? π
idm man, i really appreciate their work
i mean this shit works you know π
after i saw the thing i was doing with 35 ms in MB was only taking 0.06 in ECS, so i am ECS person now
@opaque ledge unity ecs is very very memory efficent
except if you have a lot of archetypes and tons of empty blocks
tho should still be alright even there
what is empty block ?
@opaque ledge mem blocks are 16 kb, no matter what
if you have 1 entity they are kinda empty
so you can fragment stuff
ah empty chunk then
Can't believe in 2 weeks I've made 0 progress in storing basic item data =.=
Still, yeah. I have had some success with storing them as blobAssets, but then referencing becomes a issue. I can pass the references bloody everywhere, but doing that makes no sense.
Currently, basic item database without using entities for it. So I need to store item data, its name, price, sprite etc, and store say recipes that use those items, and assign items to entities inventories.
At the moment i have the data stored in ScriptableObjects thats then converted into a blobasset list
Can some one tell me how to use Arrays in Components other than to use Buffers? I have to write so much code just to use Arrays, it feels wrong.
dont make it blob assets
blob assets are for pros
just go with some singleton components
But that was the one thing that worked XD
Can some one tell me how to use Arrays in Components other than to use Buffers? I have to write so much code just to use Arrays, it feels wrong.
@formal scaffold You can write your own implementation of an array and put it into a structIComponentDataor use UnsafeArray (believe that's what it's called)
Why are you using BlobAssets? Can't you just use normal components?
What do you mean by a singleton component for it?
The blob asset stores all the data, the components just store the index to the data
Ah ok, you are trying to store an item database in a component
So my cargo component stores index 1 and count 12, but it also needs to currently store the reference to the blob asset
as ill be damned if i can get a blob asset reference into a static class
blob assets are actually very straight forward.. don't be put off... @loud matrix do you have monobehaviours that get converted and need to ref the data or pure entities?
no pure ECS, only mono is my bootstrap currently
so when you create the data, you can give it a key and put it in some data structure right? Then when you create an entity, use that key to obtain the reference?
@coarse turtle How would I define my own array?
I have the reference to the blobAsset, but being able to access it is my current issue. At the moment I have to pass it into my cargo component because I can;t find a way to just make it globally available
so at the moment my entire DynamicBuffer for cargo contains a reference on every index
you could just create a static NativeHashMap for example no?
and put your blobs in that
well, your blob references
you'll have to give me a second to google what that is.
NativeHashMap is just a dictionary basically
That sounds annoyingly like exactly what i need
the issue with it being static is the new editor assembly reload stuff can be a bit of a pain but I think I'd either do something static or else in an instance of something
If you need to write your own you can start off with something like this (the caveat of this is your own implementation to allocate it and all its additional extensions you need), but the Collections package should have an UnsafeArray that you can use @formal scaffold
struct ArrayLike {
// Where T is blittable
T* ptr;
int Size;
public T this[int i] {
get => ptr[i];
set => ptr[i] = value;
}
}
but NativeHashMap sounds worth looking into
you can use Shared Static as well, so you can access your data inisde bursted jobs
@formal scaffold just my opinion but I'd stick with DynamicBuffers rather than messing with pointers