#archived-dots
1 messages Β· Page 220 of 1
yea my guess would have been safty checks
np, thanks for trying :)
What is happening here, you're supposed to see some toggle-able "leak detection" option π Unless it's DOTS-only
DisposeSentinel is used to track memory leaks
so yeah your nativecontainer registers itself to it in the editor run
π€ this should come with the Collections package, right ?
Maybe you need some combination of Collections, Jobs, Burst and Entities to see it appearing π€·ββοΈ
Do you have the ENABLE_UNITY_COLLECTIONS_CHECKS define ?
I mean can you remove it ?
Is there a simple way to pause physics bodies like how you can set rigidbody.iskinematic = true in gameobject world?
right now I set velocity to zero, but then rotation keeps going, I could just cache rotation I suppose but I figured there was an easier way?
so physicsMass.InverseInertia = float3.zero; seems to work but I get odd behavior when spawning objects
How are people handling unmanaged shared component data? It's been confirmed to be implemented in a future DOTs releases, but do people have a solution of sharing frequently changed data between entities?
Hi, so, I installed the Jobs package and the leak detection thingy you mentioned appeared so I turned it off and boom, the overhead is gone! It was apparently in Full Stack Traces mode... Thank you very much!
This is how Unity does it in their physics samples
So using PhysicsMassOverride https://docs.unity3d.com/Packages/com.unity.physics@0.6/api/Unity.Physics.PhysicsMassOverride.html
I've currently been using synchronized chunk component data with identical shared component data to fragment chunks. If theres unmanaged shared component data accessible in a bursted job, that would make my life a hell of a lot easier.
Thank you @karmic basin that is very helpful! I ended up using stepPhysicsWorld.Enabled = false; which adds some lag so removing the physics component per object may perform better
I wouldnt remove the PhysicsVelocity component as it would indeed result in structural changes. Unless you know the entity won't move anymore until the end of the sim. The physicsMassOverride override is great, because you can keep components that make your entity dynamic physics-wise, but just basically increase mass to infinite-ish, thus forcing them to be static through massive inertia
then you can toggle back, and you never mutated the archetype
ahh I guess I'll stick with this method then. Now figuring out how to store the velocity so it stays on resume
But at the same time, having the PhysicsVelocity present means the entity will be processed, which also cost a lot of performance over many frames. It's a tradeoff basically
I did try physicsMassOverride and I could not get it to work lol
When resuming the physics sim, I can tell it has a hard time calculating and hangs for a second if there's too much going on. While it's totally fine If I use something like setting InverseInertia to 0'
Fair point but I think I'd rather have more entities in the query than structural changes. But you're right cache miss could get things worse. A tradeoff like you said, which needs to be profiled for each project π
Yeah the problem is 99% solved thank you for all the help. for a package still in preview and minimal documentation it works pretty well
I didnt test myself, so not sure I can assert further on this topic. I can only direct you to the Unity samples I showed code from, if you missed it
Anyone ever get this error?
Burst error BC1042: The managed class type `Unity.Collections.NativeQueueBlockPoolData*` is not supported. Loading from a non-readonly static field `Unity.Collections.NativeQueueBlockPool.pData` is not supported
I get this when trying to create a NativeQueue with an Allocator.Temp inside a burst compiled job
Alright, it seems you can't create queues inside jobs for some reason π€·
I feel like the error could be a bit clearer on that.
Are there any useful workarounds to handling stuff like Action inside a job?
I'm trying to think of a system that makes handling ScriptableObjects data / functions inside jobs easier, but I'm not sure how to go about it..
BurstFunctionPointers?
That's a thing?
What if the job isn't burst compiled?
it'd probably still work - maybe not in the same ideal sense
Still seems very useful, thanks. Didn't know about it
I feel like I could encapsulate a lot of my data stored in ScriptableObjects inside structs to make them accessible in jobs, but that becomes a problem once I need a list / array inside that struct...
Since afaik you can't serialize native collections
Well if possible, you can always pin your array
int[] arr = new int[5];
// Fill in array with some function
...
// Remember to free the GCHandle when you don't need it anymore
var arrHandle = GCHandle.Alloc(arr, GCHandleType.Pinned);
unsafe {
int* head = (int*)arrHandle.AddressOfPinnedObject().ToPointer();
// Pass the head ptr to your job
var job = new SomeJob {
Ptr = head,
Length = arr.Length
}
}
Hmm, interesting, but it seems like a lot of boilerplate. I feel like it makes more sense to just handle scriptable object stuff outside of a job
I'll keep it in mind though, thanks
The fixed statement is also somewhat convenient if it fits your need too
I think my greater issue is actually the way I have some of these scriptable objects set up, they use a lot of class-only stuff like inheritance
It seems like that would be impossible to achieve with jobs, since there is no such thing as a non-nullable interface
Which makes sense since the storage size couldn't be known ahead of time
Fun with unity. Yet another week passes with no news of 0.18.
@robust scaffold Does the editor logs tell you anything as to why?
Also make sure to press that report button whenever there's a crash
Are there any good resources for unit testing using DOTS/ECS?
@sage mulch I'd recommend taking a look in the package source tests, they have pretty good coverage
Entities, Physics, NetCode etc all have unit tests
for Tiny, I don't need hybrid renderer right?
Tiny uses it own rendering
Can you use a System.Guid in a component data?
Or is that not a good idea
My issue is I need to save something inside a component data to reference a guid for the addressables system. I'm currently using Bytes16, but converting it to a string is slow, and it's hard to cache in a dictionary since Bytes16 has no gethashcode implementation, and defaults to reflection
Not sure if it will burst compile but even if it does its a pretty large footprint and would pull in sorts of .net cruft, environment static methods, culture stuff. Maybe make a stripped down version or just use a CRC32-esque int id.
if you want to just store the existing addressables id as an actual string in there for viewing in the entity debugger or whatever, you could also use a NativeString
Hahaha. Nah. I know what caused this. Errors in the code skips disposal of native collections. After every error, I need to restart unity and occasionally just shutting down unity causes the editor to crash. Standard procedure, it's been crashing on me for years now. I don't need to report it, its harmless.
I have more crashes than ever since switching to DOTS π
As long as the build works, I dont care how many times the editor crashes.
I have a question: How do I use monobehavior to instantiate a gameObject into an Entity? This old Codemonkey example doesn't work since dstManager is gone: https://hatebin.com/nvtorrktfh
I found one way to induce a crash is to copy/paste assets into the assets folder while unity is open.
If you gotta chuck some assets in like that, always close unity first.
I'm talking via windows.
thanks, didn't think of that
This specifically, but you wanna read the whole page https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/conversion.html#the-iconvertgameobjecttoentity-interface
dstManager is not deprecated, it's the EntityManager of the destination (dst) world
Wow Awesome Mr.K, so it wasn't just me being dumb, itw as a thing
Ok, after reading: https://docs.unity3d.com/Packages/c...html#the-iconvertgameobjecttoentity-interface
I got this error on my attempt at understanding the tech: https://hatebin.com/trzkpmmoeo
I always look at programming like being able to tell time. It is easy, anyone trained can do it. But go ahead and try to figure out to set a clock on your new Toyota. You can't understand what the engineers were thinking. So you need to find someone to help you set the clock then you're good to go, you can tell time again. This is what techs are like.
Assets\Scripts\DOTS\PrefabEntities.cs(9,46): error CS0535: 'PrefabEntities' does not implement interface member 'IConvertGameObjectToEntity.Convert(Entity, EntityManager, GameObjectConversionSystem)'
if you create a new authoring script from the Create menu, it should give you a working example.
using Unity.Entities;
using Unity.Mathematics;
using UnityEngine;
[DisallowMultipleComponent]
public class AuthoringScript : MonoBehaviour, IConvertGameObjectToEntity
{
// Add fields to your component here. Remember that:
// * The purpose of this class is to store data for authoring purposes - it is not for use while the game is
// running.
// * Traditional Unity serialization rules apply: fields must be public or marked with [SerializeField], and
// must be one of the supported types.
// For example,
// public float scale;
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
// Call methods on 'dstManager' to create runtime components on 'entity' here. Remember that:
// * You can add more than one component to the entity. It's also OK to not add any at all.
// * If you want to create more than one entity from the data in this class, use the 'conversionSystem'
// to do it, instead of adding entities through 'dstManager' directly.
// For example,
// dstManager.AddComponentData(entity, new Unity.Transforms.Scale { Value = scale });
}
}
THANKS RYAN!
new DOTS updates incoming? π€ quick PSA: don't update Collections. it breaks the Entities packages
Maybe ... Collections are relevant without Entities, so who knows π€·ββοΈ
i thought they normally updated around the same time, but yeah i guess it is completely unpredictable π€·
Could someone remind me how Any and All querying are useful in practice?
I'm making an ecs library for use outside of Unity
So I kinda forgot how it all works
think of Any as an OR statement.
think of All as the AND statement.
Actually, nevermind, finally figured stuff out from examples
They were a bit hard to find
Wouldn't that be a bloody miracle lol
New updates would be nice π
Anyone have an idea where I can find the Bytes16 implementation?
Says it's in Unity.Collections but I can't seem to find it
@jaunty heraldNativeString.gen.cs
Thanks @warped trail !
Hello! WHat is the most efficient way to check if an Entity has a specific component from a MonoBehavior?
enititymanager.hascomponent<>()
Oh ok as simple as that, thank you!
I think I'm asking the wrong question... People are telling me how to access an entity after converted from GameObject. I want to know how to convert a GameObject TO an Entity, not collect Entity data after that happened.
I don't even care if I get an entity reference, I can do that elsewhere.
I just want to take a GameObject and put it into the world exactly as is as an entity.
Via Monobehavior for now
Hmm, I'm experiencing a strange bug(?)... When I try to deserialize my world using SerializeUtility.DeserializeWorld(ExclusiveEntityTransaction, StreamReader) I get a null reference exception in GameObjectSceneManager.cs:106 
Collections is slated to come out of preview and into full package status "very soon". It's grouped with the JobSystem and Burst, not HR and Entities ecosystem. What changes breaks Entities that the update brings?
GameBoardModel.peers[a].myShipGameObject.AddComponent<ConvertToEntity>(); //This converts and destroys an entity. How do I set the conversionMode?
If you add a ConvertToEntity component on a gameObject, it solves the problem of turning a gameObject into an Entity.
I need convert and inject however.
I guess you could either call one of the static methods, or if ConvertToEntity does the conversion in Start and not Awake you can simply change the ConversionMode after adding it @remote crater
ConversionMode is a method after <convertToEntity>().conversionMode
But I don't know how to set it
OOOH!
I found out how to find LOTS of good info about DOTS
Ok first go to the https://forum.unity.com/forums/data-oriented-technology-stack.147/ forum
then search keywords!
YOu get toooooons of samples!
this is awesome!
The more I learn about dots the less I know about dots
I can add a monobehavior script to a gameObject by addComponent, but try and add an iComponentData script to a gameObject and Unity errors out: https://hatebin.com/aczvqnqbtr
@remote crater again, your questions will be answered if you read the Conversion Workflow page on the manual. There's a lot to digest, but the value you get in learning is worth it
Ok I've just recently learned about dots and how it can massively increase a game's performance. I'm pretty far into my current project and I'm curious about it. So, how hard will it be to switch over to dots from a game that has quite a lot of game systems already?
It will take quite a bit of work, especially if you aren't familiar with data-oriented design.
The performance gains also depend a lot on what kind of game you're making.
You can get a lot of performance gains by switching some of your most performance heavy code to jobs, which you don't need to do too much work to do.
Mr.K, I did read it twice, and many documents like it several times, and many videos. I'm just wondering why a certain syntax does not work.
It lets me attach one script, but not another... It simply doesn't make any sense...
wait, so I don't have to switch everything to dots?
If I just switched stuff like enemy pathfinding and terrain generation (since they're the bulkiest) would that be good?
oh and I'm making an open world 2d game if that makes sense
make enemies dots
Make player same player controller
But just change according to game mode depending on input
Yes, exactly. Any cpu-heavy tasks/algorithms are good candidates
I actually have sample code if you want to see it.
ye go ahead
This lets you instantiate a player gameobject to en entity singleton: https://crystalfighter.com/bin/wumbla.zip
I wrote it custom for a guy who showed up on my stream
and he said it works like a charm
I would think it is the best code for anyone who wants to use best practices of design patterns to keep their player controller from being written in two different places
But you can't do it with your enemies, bullets, etc
You need to do the majority of the work in pure DOTS/ECS.
I see
luckily I don't need to learn DOTS just yet cause it will be a future task of mine, but this info has helped me decide what my plan is
Waiting on DOTS is a very good idea.
is it not stable now?
It can do a lot, but it is the opposite of user friendly
It is stable
But stuff that should be a 5 second one line of code can take days or weeks.
Cuz the Unity Engineers don't know proper user friendliness
or how to write proper documentation
oh boy
I guess I'll be coming back here when I get to it then huh
is it well documented?
Like you should easily, easily be able to link a gameobject being converted to an entity into another script as an entity, because indexing would remember...
But this task is monumentally difficult
Instead of just being drag and drop
Or...
My current task
Of trying to attach a script
Works for some scripts, but not all dots scripts, despite being able to attach one before run time.
I merely want to Instantiate an entity
But I'm on day 5...
A line of code that should take 10 sec tops
5 days...
Why does Unity not have a single function: Take a prefab and make an entity out of it and instantiate it?
The world may never know.
When you find out, let me know.
lmaoo π
Just wait on DOTS... Its functional, it works, but you need to know the arcane language of fae dragons to write it.
Just wait on it, do your thing, come back when they hire a technical writer for the documentation that gives use cases and samples
Wait on it for when things that should be one line of code aren't dozens over many scripts and race conditions.
I'm sure you've already been looking stuff up, but why doesn't this work?
β
Get the Project files and Utilities at https://unitycodemonkey.com/video.php?v=pk-C_h0WJZs
Let's check out how we can build Game Object Prefabs and Convert them into Entity Prefabs that we can then Instantiate.
Unity DOTS / ECS Tutorials
https://www.youtube.com/playlist?list=PLzDRvYVwl53s40yP5RQXitbT--IRcHqba
Getting Started with ECS
https:/...
It's gonna rule. It's gonna make Unity's stock soar... But why they don't hire people who are sane to write documentation, use cases and simplify the use....
Nope R.
You're the 3rd person to link that
That's actually dated and no longer works.
Basically when you look for youtube tutorials, don't use anything over 1.5 years ago.
Stuff changes rapidly
This is part of the fun... a good 80% of online documentation is useless.
I mean most unity tutorials that I've used worked throughout
though they were more conceptual rather than how to do x
Were they DOTS/ECS tutorials?
nah, but I thought you were talking about just general youtube tutorials
generally youtube tutorials work if not over 4 years old I've found
Only DOTS/ECS doesn't work if its over 1 year old generally.
idk anything about DOTS obviously
Ok, I'm out. Tomorrow I'm going to try and just load scenes of GameObjects that convert to Entities instead of Instantiating. I bet it will work!
ok
also I found this comment
not sure if that helps but don't forget to sort by new
you might find better results
The funny thing is... if I go with this solution, I'll have 10,000s of scenes.
Stop back in a few months. π
what news to look forward to π
lol, will do
Just remember your player controller can be branched at every input
ok
It will be the only thing you keep basically
Other than models n stuff
that get converted
God bless, adios.
adios
@steel pike Eh, I'd like to give a bit of a different point of view. DOTS is made up of Burst, the job system, and ECS, each building on the previous. What GoodNewsJim has been speaking about is specifically ECS, which is basically an engine in and of itself, separate from GameObjects.
However, Burst and the job system is more than production ready, and it's very good. Those are the things you can already use now for the more performance heavy computations. As you said, pathfinding and terrain generation are pretty much the perfect examples of what it can do well. You don't need to create any entities to do such a thing.
why are you trying to add IComponentData to gameobject?
Hybrid Renderer v0.11-pre43 out today π€
i want read changelog but can't find Hybrid Renderer package anywhere
i'm assuming a typo of some kind
Library/PackageCache/com.unity.entities@0.17.0-preview.41/Unity.Scenes/ResolveSceneReferenceSystem.cs(34,16): error CS0246: The type or namespace name 'Words' could not be found (are you missing a using directive or an assembly reference?)
no changelog yet
can't see in package manager, can't find in package list in Unity Documentation. What a stupid mess with visability
Preview 43? Wow, that's quite the jump. Hopefully it has better optimization than currenty.
i thought it was pre42 before?
You'll get used to typing in com.unity.rendering.hybrid into the package manager manually.
The latest was Preview 16 if I'm not mistaken.
Then again, I've been typing the package and versions manually into the package json. Hrm
i know, but 1st i need to read "com.unity.rendering.hybrid" somewhere, and in that case i just want to read changelog π
aren't they internally already at 0.21?
For 2021, the focus is to make Hybrid Renderer ready for shipping applications on a broad range of devices. To help with this, the plan is to establish automated testing for mobile and console platforms.
For fucks sake unity. HR doesnt even work well for PC. Now they're focusing on pumping it out to consoles?
odd they are still updating docs with mention for v1 limitations, imo should just drop it like a hot potato
V1 is surprisingly well optimized. And built in renderer is the most efficient for mobile.
its not in dev and isnt supported going forward, wont receive bugfixes. why even bother? the scripting define should be ENABLE_HYBRID_V1
pretty sure it came out back when entity queries were like using [Inject] on the component struct groups, its ancient
And it was downhill from there
π π π΅ π
is there any way to treat a job as if 'ENABLE_UNITY_COLLECTIONS_CHECKS' was always disabled? DisableSafetyChecks = true is close, but AtomicSafetyHandle access is still checked unless the drop down in the editor is manually disabled
I want a job to always act like that is set to Off, including AtomicSafetyHandle access
any help :v
I'm currently a bit new to dots, I did try getting into it a year or so earlier but it was very buggy and no tutorials were out there at the time, so I left it
Are there any new resources that you guys recommend?
Except for the best practices guide(I've already read through it)
I'm struggling to find a comprehensive documentation for the ECS systems
I found a udemy course but it feels like dots has changed a lot and those aren't the best practices anymore
imo best way to learn is make a simple project, theres not more comprehensive doc than whats in the pinned messages(also id ignore the top dots wiki, its also old). docs have improved in the past year so may want to revisit them
the samples are also a little more encompassing
what really sucks in ECS is the ECB -> https://forum.unity.com/threads/entitycommandbuffer-will-we-ever-see-improvements.1114948/
Ecb is mostly convenience - entitymanager at equivalent sync point is.. fine? Instantiate can take an array of entities and automatically do the patching of references
EM is fine if you create a flat hierarchy. If you create a relation between entities and don't spread it over frames the design starts to break.
Thatβs not been my exp. you may want to give a specific example of what youβre trying to accomplish.
i have a set of entities on a grid which get processed to form a path with a linkedlist, this path then gets translated into an optimized and merged path entity. the linkedlist is inside a dictionary with its own id and doesn't fit into ecs that well. this is all fine but updating paths start to be a problem because i don't have any references from the entity path to the linkedlist.
which would mean i have to store the linkedlist or some form of reference also in ECS, everything stems from the problem that ECB doesn't return a valid entity id and I'm pretty tired of working around it
use BlobAssetReference if you have to reference unchanging managed data
i have fixed my issue from earlier π https://youtu.be/Ab1k7AE_nB8
I fixed the issue that was at the end of the last video. (Rotation on the Root Entity messed with children positions)
Here's the related forum post:
https://forum.unity.com/threads/dots-animation-dynamic-bones-wip.1114852/
ConvertAndInjectGameObject leaves a clone of an Entity and a GameObject. Someone tell me at least one of them has a reference to the other. This is basic design patterns stuff right? I should expect to be able to reference each of them from the other one, or at least the GameObject remembering it, rite? Hey, if it isn't in the official unity code, I could extend a weird system class to do this like convertandinject or something?
A couple of thoughts. Are you sure a NativeArray is slower than your linked list? Then you could simple store an index to the element to update? All instantiating with an ECB does is defer instantiation to a certain sync point. If having valid id's would simplify a bunch of infrastructure for you, why not just instantiate at that sync point with EM where upon it will give you the valid entities?
How do you handle global game states/phases in ecs? Sometimes you have the same entities but different systems should run depending on the situation. Chess for example would require one/multiple systems to select and move its pieces - but only when its your turn.
I was thinking about using system groups and let them handle if their child system should run but this might lead to sorting problems and does not help with systems that need to run in both states but do sth different
I could also enable/disable the system from another system that handles the states/phases but than it would have to know about all the systems it has to toggle
just have another icomponentdata script, and put it in there.
you mean the current state?
but that would mean that each system would be required to have look for this component and read its data before doing anything else
I was thinking about using singleton compoenents so I could use RequireSingleton in a system to decide if it should run
I think it's quite core to the paradigm to in general have a system run, whenever data of a certain pattern exists. Rather than e.g. enabling/disabling systems. In the case of chess pieces, I might have all p1 pieces have a SharedComponent with Player1, and all p2 pieces with a Player2 SharedComponent. Then your system would filter which entities it runs over by filtering on the current player.
The current player could be an ICD on a singleton for instance.
In the case of the chess game I could see how this would work. Maybe a better example for a global state change would be pausing the game. As this should stop interaction with all entities it would make sense to disable the system that handles the mouse raycasts. Adding a SharedComponent to all interactable entities so they arent interactable anymore would be a bit wierd. And you would also have to disable camera movement and e.g. tell the music system to play a different song or turn down volume etc.
If its a state change that effects so many different entities and components it feels weird to attach a component to all of them and having to check for it in each effected system π€
I'd say pausing is kind of worst case because it touches so many systems - I'd be careful of generalising that to 'any global state change'. Your systems should do what they do, based on presence of data. If particles spawn when a spawner exists, add a disabled tag or remove the spawning entity when you don't want it to spawn. Whatever you do, when you pause the music system is not going to magically know it should change track. Depending on how it's built, an EnablePause system could e.g. change the ActiveTrack ICD that the music system uses a DidChange check to observe.
Thats why I thougt about using singleton components for the "global" state so any system could react to it and easily enable/disable via require singleton
If it suits your particular use-case well, then cool. As a general way of managing state? Unlikely to hold as a pattern you can apply everywhere I would guess.
When you convert and inject, Unity allows you to keep legacy Component Objects from the Unity engine that are not yet available in DOTS (i.e. lights, the Shuriken Particle System, the Mechanim Animator, to name a few). When switching to ECS, they become hybrid components by using AddHybridComponent(). They are attached to an hidden gameobject, which is called a companion gameobject. There's an ECS transform system provided by Unity which will keep the companion gameobject transform in sync with the entity. So if you take for example a particle system attached to an authored spaceship engine companion gameobject, it will follow the converted engine entity that you moved from let's say your ECS MovementSystem.
But you're not supposed to consider the link between the companion gameobject and the entity starting from the companion gameobject towards the entity. Rather it's a one-way link from the entity towards the companion gameobject.
Cherry on top, ConvertToEntity component is not recommended as it doesn't get anymore support and will be deprecated in the future. You can still use it if that works for you but it doesn't scale well for a lot of GO/entities. You're supposed to use subscenes at some point later.
with one of the conversion systems I linked you earlier
I would too at first use a singleton state component for each state and RequireForUpdate, but you can read people on the forums arguing against it.
I don't remember if the discussion ended up with a conclusion on a better approach, I need to read it again ^^
I think mostly the concern would be that it scales poorly and that state becomes somewhat implicit. E.g. what happens when you have a 'application lost focus' that you want to behave differently from pause, and so on.
At first I thought it would be a great usecase for SystemGroups as I found out they can decide whether the child systems should run. But then I figured it could lead to problems with sorting as it could require multiple groups per state to use FixedUpdate etc.
Yeah I wouldnt go by using systemgroups for that
Would be nice to have some kind of tags (e.g. attributes) to filter for systems so you could just use GetSystemsWithAttribute or GetSystemsWithTag and toggle them
Like Timboc said, systems are meant to always be there and run
IIRC SystemBase has an Enabled flag but I never used it
i use Enabled with my Debug systems like system which displays grid data.
override void OnCreate() => Enabled = false;
Make me able to activate system when i want to see grid
yeah same I use enabled all the time for debugging
I wish there was an easier way to turn on and off systems though, before run time
Good to know that works well :) Was more for @pulsar jay but I.m curious, is it toggleable at runtime ? I see Unity is using it onUpdate()
You could just disable autocreation and create them as soon as you need them?
but that's more work
and what if I want to create a new scene where I'm creating and testing new systems
at least with gameobjects it's unambiguous and clear what is running, but with systems I have to search the list and find my systems in among all the standard unity systems then figure out how to disable them if they interfere with what I'm currently doing
COuld be relevant to put them in a testing World then ?
I agree about this. Fwiw to mitigate this, the pattern I use for the examples in my asset is [DisableAutoCreation] followed by a monobehaviour that initializes in the scene e.g.:
{
var bobSystem = World.DefaultGameObjectInjectionWorld.GetOrCreateSystem<Example2_BobbingSystem>();
World.DefaultGameObjectInjectionWorld.GetExistingSystem<SimulationSystemGroup>().AddSystemToUpdateList(bobSystem);
}```
interesting π€ I guess I should try something like that, thanks @amber flicker
theres something wrong with dots frustrum culling
basically it doesnt work, or works a little
only removing invisible entities helped
with cpu,gpu and fps
(the ones that had rendermesh)
its like theyre rendered despite being invisible/outside frustrum
of course i had shadows turned off, and lights even
You're using Hybrid Renderer v2 right? And all your render mesh render bounds are set correctly?
this is news to me. are we supposed to use subscenes exclusively then?
well a certain dev alluded to it going away at some point in favor of entire scene conversion, but imo at the glacial rate of things id say theres really no worry of it vanishing without a lot of advance notice. componentsystems and jobcomponentsystems are technically on their way out too but theyve stuck around for a long time and still are not yet marked obsolete.
You should probably switch to V2, V1 is really outdated at this point
I think if you can use subscenes, definitely use them though.
Yes, pretty much. Unless you're doing something really specific
yeah i've been using subscenes for a while now, only using ConvertToEntity for quick testing
theres also ConvertHierarchy
Mr.K, You say: "Rather it's a one-way link from the entity towards the companion gameobject." Is there a way to access this link, because that is all I need to get the reverse link manually. Then I manually destroy the gameObject myself.
Lets say... I have my array of entities. Lets say I have a specific entity say myEntity.... What is the syntax to get the gameObject reference from this myEntity?
I think you should add that to your forum post. In particular HRv2 adds different types of culling. Stick with old stuff, gotta deal with old feature set.
Ok, I got it
Here's what I did: https://hatebin.com/vieqffatpd
It lets you store references to entities you made in monobehavior after you instantiate a gameObject into an Entity. Ok, super cool
It is something that should have taken 6 seconds instead of 6 days, but hey, I'm just happy DOTS/ECS even exists, Unity Stock is going to skyrocket next 2 years.
@remote crater Are you sure that works?
Pretty sure the ENtity provided in the IConvert interface is the conversion entity
NOT the final entity after the subscene loads
try conversionSystem.GetPrimaryEntity or something like that
but also i cant see how that would work if your subscene entities get remapped
eg you load scene 1 with 5 entitys, then scene 2 with another 5, so the 2nd set get remapped so indexs start at 5
You should move where you assign the entity into a normal system, and attach entityRef as a hybrid component in the IConvert
Is there a suggested way to handle input using DOTS? I'm interested in utilizing the newer InputSystem, but I'm having trouble finding examples of how to use it with ECS.
create your .inputactions file using the editor. In the inspector set the class name. Instantiate the class in a system member variable or into a static class, and call enable() on it once. then just reference that instance
inputMaster.Player.HorizontalMovement.ReadValue<Vector2>();
for example
thank you!
What is the optimal way to create an entity in a job and add it as a reference to another component?
Since using an ECB the index will still be -1 until you do Playback()
Will it remap the indices?
It will just have the correct value at playback
Alright, ill try that, thanks.
If you use ecb.CreateEntity/Instantiate and then ecb.SetComponent
Once issue I have with ECBs is that they don't let you fetch overwritten state. I usually work around this by caching it in a hashmap and then running all ECB functions at the end of the job. Is there a better way?
No unfortunately not :/ Been dealing with the same issue with deleting entities that an ECB wants to access after
Yeah, I wish they let you use e.g. EntityCommandBuffer.GetComponent to get the state last state written to the ecb for that entity
Perhaps
That worked, thanks.
Btw, does Entities.ForEach process entities according to their index? Or is that not something that can be relied upon
You mean the ordering?
Yeah
Nah, can't rely on ordering
Also seems like a bit bad design to have
Yep, that's what I mean
Ah right π
I was wondering about having a system that initializes a component to some procedural state, and wondering if I could use a single math.random throughout the Entities.ForEach to initialize the client and server state to the same thing. But I think having a seed / index in the component and using that is cleaner.
Since if the order was consistent the PRNG would yield the same output
It should be, you'd still have to sync the seed
The seed should (hopefully) already be the same, another deterministic algorithm decides it
But how would you make sure they both have the same seed if you don't sync anything? π
It syncs the world seed, and then goes from there. So I guess there is a seed that needs to be synchronized π
Gotcha π
That world seed is then used for everything
Makes sense to me
One thing I really struggle with is converting scriptable object settings classes to be usable in ecs, since these classes are usually abstract
Not sure how to deal with that with structs
Maybe monolithic structs instead of many classes with inheritance could work, but there is still the issues of arrays in configuration objects
If I schedule a Job.WithCode is the correct jobhandle this.Dependency ? (this is inside a SystemBase)
I'm trying to pass position/rotation/velocity via a string. And so far only I have been able to do position successfully: https://hatebin.com/knqmniahaq
RoyCon, 100% works
@remote crater Are you using subscenes or convert and inject?
Roycon, do you need my help? Cuz I no longer need help on this.
What I need help on is this: https://hatebin.com/knqmniahaq TL:DR How do I take one Entity's rotation and velocity and pass it by string then establish it in another Entity?
Hello, i have a question about ECS, or maybe it's c# in general... I want to make an scriptableobject based editor which lets me configure Abilities. Those scriptable objects are basically just components which will added to the entity. And there goes my problem, i don't know how to add the component when i don't know what type of component it is at build time.
public interface IFoo : IComponentData { }
public struct FooHealth : IFoo
{
public float Value;
}
public class FooSO : ScriptableObject
{
public List<IFoo> myFoos;
}
public static class FooManager
{
public static Entity CreateFoo(FooSO scriptableFoo)
{
EntityManager manager = World.DefaultGameObjectInjectionWorld.EntityManager;
Entity entity = manager.CreateEntity();
foreach (var foo in scriptableFoo.myFoos)
{
//How do i do this?
manager.AddComponentData(entity, new foo { });
}
return entity;
}
}
combinish a mesh and adding it to entity renders it in wrong place, anyone knows?
i think it has to do with renderbounds.center but mb not
Quaternion.EulerXYZ (from UnityEngine) and quaternion.EulerXYZ don't perform the rotations in the same order.
For physics velocity you want to look into the PhysicsVelocity component. PhysicsVelocity.Linear and PhysicsVelocity.Angular
Your way of passing values through strings is weird, it is some kind of serialization over the network maybe
Maybe try setting with EulerZXY to keep same order, don't know I don't mess with rotations if I don't have to (they give me headaches).
thelebaron and Bmandk answered, but to add to it, it's explicitly stated in the manual if you wanted an official source
Though I agree "near future" looks not so near π
But yeah that works well so if you're version-locked and/or small project nothing wrong here
Scriptable Objects are not ComponentDatas, they are Object Components, you can't AddComponentData() them.
Did you try setting them as hybrid components ? Or use BlobAssets ? Or mapping known fields to ComponentData types because you know them in advance
Lul
Probably, because the renderbounds don't have to match the shape of the rendered mesh, especially if object is rotated and such
maybe its not even related to it idk
Didnt we talked about that already ? You have cubes in contact, right ? The RenderMesh has a bounds property too, should be more accurate
Ok I might confused with another situation
I'm not trying to add the scriptable object as a component data...
Right π
How to add a rotation constraint on every axis to a PhysicsBody? I've read somewhere that PhysicsJoint might solve this. But it's not clear how should I use it, since it requires two entities. Anyone has an idea?
So the real question was "i don't know how to add the component when i don't know what type of component it is at build time.", sorry read too fast.
You're supposed to know the component type when you write the code, you can use reflection or another hack but ask people here, it's tricky :p
I just can't believe that it is so hard to store component types somewhere and build an entity from that store...
The physics samples show examples if I remember well
Couldn't find anything useful there tbh. Did this hack instead.
private void FreezeRotation(Entity entity) { PhysicsMass physicsMassComponent = EntityManager.GetComponentData<PhysicsMass>(entity); physicsMassComponent.InverseInertia = new float3(0f, 0f, 0f); EntityManager.SetComponentData(entity, physicsMassComponent); }
But I also need to freeze the body on Y direction..
I'm sure one of these methods could help ?
They have a component in the samples
Ooh, this might be it. Thanks a lot man!
they do a bunch of custom implementation with the physics, I guess you'll have to prepare to retro-engineer a bit some of their work
Thanks. What is confusing to me right now, that I have to setup another dummy entity in order to attach the main body into it, so the joint will do it's job. But meanwhile I also need to move the main body via impulse.
Yeah from what I see it looks like you create a joint entity and add a constrained body pair component to it
When you move the main one, the other doesnt follow ?
Well, what I want to achieve is to move the main one via adding impulse, but freeze the rotation and Y axis movement. So if it somehow interacts with the environment, only X and Z values are changed.
Whole purpose of having the other entity to my understanding is to make the joint work. But that other entity should also have PhysicsBody into it and problem will still remain π
I guess I'll stick with the hacky solution for now, and then will take another look at it later.
Oh you want only 1 body. In the samples they do it for single cubes, so you know that will work if you port it to your project :p
Wow thanks. I'll try to find it π
Yeah @karmic basin , saved my day π
ue5 went into early access and theres a preview vid on youtube with some of the new features. they got a full dsp audiograph solution with an actual ui, im sitting here wondering what on earth is going on with dots taking so long in that department(among others). with so much tooling around workflows(not just technically impressive), dots is feeling a bit underwhelming these days.
it's crazy how performant it is but it isn't getting any easier to use & maintain
if I use a persistent nativearray in a start method of a monobehaviour wheres the best place to dispose of it?
I've tried ondisable and ondestroy they didn't work or maybe I don't need to dispose of it π€
You do need to dispose - I would expect OnDestroy to work but it's possible the dispose sentinel gets it wrong
you sure it's not an issue with statics and fast enter play?
So far no ecs on ue5, in fact they are even increasing the modularization. They did remove some of the cruft from their framework but much of it is the same. Audio stuff is amazing though. That's top notch work.
I really want metahuman for unity. Looks so good heh
its hard not to get discouraged about things when epic does some very splashy marketing
so far lumen and nanite seem to work as advertised. I am surprised that nanite doesn't have that many limitations though.
but... people on unreal discord are dumbfounded by the lack of ecs or gameframework overhaul π
grass is always greener on the other side
yeah, all the stuff for Unreal 5 looks amazing
but I could never use it to make a game
its designed for massive teams or persistent people that can use C++ or Blueprints
c++ is my blocker, refuse to use blueprints for the main code
yeah there's no way I could do the games I want in blueprints, or without all the asset store stuff, and the community/google, and this discord to help
is there a reason the physics here would be acting so weird? it acts normally (though very slowly) if i set the gravity to -0.01 instead of -10. the ground is a box shape, the person is a capsule, and everything else is a convex hull if that matters. i only have rendering and physics components on the funky entities
what are you expecting to happen?
im expecting the objects to fall over to a flat face of the collider
here's the colliders
if you just throw in a cube with a physics shape+body on it, does it also do something wierd?
it does seem to snap into place when it hits the ground, but it doesn't spin or fly off
and if you change its collider to a convex hull same thing?
yep
id double check that you dont have a system acting on your entities because those results look very specific
ah yep that was it π€¦ forgot to include entities with only a specific component in a job, so it included everything with a rotation and physics velocity component
thanks!
Can I use Mathf.Approximately in Unity Jobs?
Can't see why you wouldn't be able to. It's a static function and doesn't deal with any reference types.
That's a restriction imposed to allow determinism and thread safety.
https://docs.unity3d.com/Packages/com.unity.jobs@0.8/manual/scheduling_a_job_from_a_job.html
too unsafe, and too risky.
whats the fastest way to toggle hundreds of entities?
I tried destruction/instantiation from Monob
I also tried adding Disabled component (in Monob)
maybe i should do this from within a System
Can you find all entities with one or more queries? Or do you need to check each entity one by one?
i never did it before so idk you mean like adding some filter to ForEach ?
Nearly, if you were to do it in a ForEach, would you add the Disabled to every entity in the ForEach, or do you need to check some variable first?
yeah i need to check their parent
is there some way to use foreach with eg Linked group or children of parent ?
because then i dont need to check parent
as it would be already specified
Would this mean you have to check less entities?
Well to answer you first question, the fastest way is if you use either the EntityManager or ECB and use AddComponent that takes an entity query, that way it will do it once per chunk, instead of once per entity in the chunk(s).
https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/ecs_entity_query.html
you mean to add Disabled component ?
Yeah
oh ok but do you mean to use entity manager from within a system?
That wouldn't matter, it's still gonna take the same amount of time to add component
Adding component can only be done on main thread. So no matter if you schedule with an EntityCommandBuffer or use EntityManager it's still going to take the same amount of time
cause i have fps drops when doing this ```cs
if (galaxyMonos[g].instantiatedScenery[i] == default)
{
Debug.Log("Scenery spawned");
galaxyMonos[g].instantiatedScenery[i] = entityManager.Instantiate(galaxyMonos[g].convertedScenery[i]);
entityManager.AddComponentData(galaxyMonos[g].instantiatedScenery[i], new Parent() { Value = galaxyMonos[g].galaxy });
entityManager.AddComponentData(galaxyMonos[g].instantiatedScenery[i], new LocalToParent());
}
The only thing you can optimize is minimize how many adds you do, or doing it through queries instead of entity by entity
yeah how to do it via queries?
That's the problem, a query will do it for ALL entities that just have a set of components, you can't check anything first.
Here's an example of how you'd do it through a query
As you can see there's no option to say "only do it for entities that also have a parent that is X"
It strictly checks for components, not their actual values.
what about querying parents then accessing its childbuffer inside ForEach
if it is even possible
Yeah you can do that, but then you're going to have to add components for each entity, which might mean 600 add components in a row.
yeah well with GOs toggling the objects enabled/disabled was quite fast
Yeah it's possible it's fast enough. I'd do what you suggested as it's the cleanest alternative (going through the childbuffer)
actually i was testing and
adding disabled component to each entity
was slower than instantiation
of a prefab
that contained these entities
instantation took 0ms
but im somehow getting fps drops cus of it
Looking at the code above, can you include LocalToParent and Parent in the prefab entity? SetComponent is a lot faster than AddComponent. So instead of adding afterwards you just set it
probably yeah but will it eliminate the fps drop
It will definitely speed up the code, not sure by how much but I'd imagine at least 90%
Also, make sure you test in a build, as ECS is magnitudes slower in the editor.
really?
Yeah it's terribly slow in the editor. Mainly because it does a lot of safety checks to warn you about stuff.
is there any performance difference whether i do things from MonoB or from within system
Depends, if all you do is use the EntityManager it's not gonna be different. However if you use System and follow ECS design directions it will be a lot faster.
For instead a ForEach job can run in parallel easily, but setting it up in a MonoB isn't as clean and optimal
i did what you said i think it helped thanks
maybe i was wrong about the fps drop
it could be caused by shaders
Profiler is your friend, you can make a build with profiler enabled to see what's taking time.
Yo, why does collision with convex mesh collider bounce off an object properly, but a sphere collider sticks like a magnet to stuff it hits? I have a video here. Even if you can't answer, it is kinda a fun watch: https://www.youtube.com/watch?v=WQEbY6ntzgo
The MMO update for the game we're developing can be played now: https://store.steampowered.com/app/658480/Starfighter_General/
Meet the ancient of days:Man who's gamed more than anyone who ever lived:150,000hrs www.twitch.tv/goodnewsjim #1World Starcraft&BW&War3&D2hc.Jesus loves you.How may I pray for you?Love's the way.
Proof of me being #1 i...
i dont think thats the right link
The MMO update for the game we're developing can be played now: https://store.steampowered.com/app/658480/Starfighter_General/
Meet the ancient of days:Man who's gamed more than anyone who ever lived:150,000hrs www.twitch.tv/goodnewsjim #1World Starcraft&BW&War3&D2hc.Jesus loves you.How may I pray for you?Love's the way.
Proof of me being #1 i...
My mandatory peek in every few month. I would appreciate it if someone could tell me what has changed in the last few month on the dorts front aside from the fact that DOT's only being supported on the 2020 LTS version of unity?
Not much more from my point of view. They emphasised again that Jobs, Collection and Burst are ready but everything else is preview.
Can't really talk about Animation, Audio or Tiny as I don't follow along but I'd say slow progress ? Maybe Tiny does progress π€·ββοΈ
We're still waiting for a 0.18 release, but it looks like they are further internally (smthg like 0.21 I think ?)
We got a new DOTS Graphics subforum
and uuuuh... that's it ?
Donβt think thereβs been a major update in the last 6 months π
Is it recommended to use in on functions that are passed structs? Or are they small enough that it doesn't really matter? I'm talking about stuff like NativeCollections, Entity, ComponentDataFromEntity<>, BufferFromEntity<> etc
Thanks I expected as much. My hunch that things where way too early when they went public with it in talks seems to materialize
I patiently will wait though given I am so giddy to use it production.
They just made the tiniest of updates
0.17.0-preview.41 -> 0.17.0-preview.42
Anyone has the changelog for entities?
fairly minor
heh this is quite the jump for distance culling (from hybrid package update)
// It was causing the culling system to discard the rendering of entities having a X coordinate approximately less than -32786.
// We could not find anything relying on this number, so the value has been increased to 1 billion```
Anyone checked the source generators out? https://github.com/needle-mirror/com.unity.entities/tree/master/Unity.Entities/SourceGenerators
I guess you need 2021.2 to try them out
grats
is there any keyword if u want to check if entity is null or default?
Entity.Null
oh nice
is there way to return value with ECB.instantiate? e.g.:
Entity ssss = ECB.instantiate();
getting error here
@gusty comet Instantiate returns an entity and also takes an entity as argument
@gusty comet You can save it to a component with ECB.SetComponent/ECB.AddComponent
Then that reference will be correct
save what
you mean to save temporary ecb's entity in its component?
or in other entity
@gusty comet No save the reference of the new entity
but where
like that?
EntityCommandBuffer ecb = m_EndSimulationEcbSystem.CreateCommandBuffer();
galaxyMonos[g].instantiatedScenery[i] = ecb.Instantiate(galaxyMonos[g].convertedScenery[i]);
ecb.SetComponent(galaxyMonos[g].instantiatedScenery[i], new SceneryData() { entity = galaxyMonos[g].instantiatedScenery[i] });
Sure, but you don't have to put it into an array first
But I'm not quite sure why you would need to do this. Couldn't you just have a component on the entity in the first place that you use to identify the entity?
the array reference is not working even if i add it to component later
No, you have to get the reference from the component
Not sure why you want to store it in an array in the first place
anyway, ive implemented ecb but i see no difference in performance
Hey.. I just updated the packages; Collections, Entities, Hybrid etc..
But now I get this error?
Library\PackageCache\com.unity.entities@0.17.0-preview.42\Unity.Scenes\ResolveSceneReferenceSystem.cs(35,16): error CS0246: The type or namespace name 'Words' could not be found
latest collections appears incompatible with other dots stuff, if you roll it back to the second latest do you still get problems?
revert back one of the packages
i think its .Collections
had same issue
try 0.15
@scarlet pasture
@gusty comet Have you also made sure that your jobs are scheduled?
no ive been using ecb from Monobehaviour - does that make it useless?
Uh probably
The reason that you want to use ecb's is that you can use them in a job that can be scheduled
If you aren't even using systems I'm afraid it's going to be hard to help you much
well i wanted to avoid syncpoints caused by entityManager, but maybe ecb called from outside job is instant, like entitymanager, not sure
Hi, I asked a question here recently about handling input in an ECS manner while utilizing the new InputSystem. Would this code be a good way to do it?:
public class InputSystem : SystemBase
{
private InputSys input = new InputSys();
protected override void OnCreate()
{
base.OnCreate();
input.Enable();
}
protected override void OnUpdate()
{
Entities.WithoutBurst().ForEach((ref PlayerInput player) => {
player.Move = input.Player.Move.ReadValue<Vector2>();
player.Look = input.Player.Look.ReadValue<Vector2>();
player.Fire = input.Player.Fire.triggered;
}).Run();
}
}
Asking because I'm unable to use burst/parallelism in this system due to InputSys. I could instead create the InputSys each OnUpdate, but that seemed wasteful (I'm bad at making these kinds of performance judgment calls tho lol, so lmk if I'm wrong please).
Basic thought process is that I'll populate the PlayerInput singleton component each frame, and then be able to use it wherever I want
yeah that is fine
you want writing inputs to be on main thread anyway and not having burst is fine because it is only 1 entity (or a few if you support local mp)
makes sense, tyvm
don't forget to add ordering attribute to your system so it runs before stuff that uses input
yep, just forgot to copy that
[UpdateInGroup(typeof(SimulationSystemGroup), OrderFirst = true)]
thanks !
Silly question, is it possible to edit a Singleton? Or will I need to create a PlayerInput component each frame and call SetSingleton<PlayerInput>() to update it?
Yes you can edit values inside Singleton. They actually are just ComponentDatas you have only 1 instance of
Am I able to do it by directly editing the component given by GetSingleton<PlayerInput>? Or will I need to make the change to the entity provided by GetSingletonEntity<PlayerInput>? I tried the first and it didn't seem to work.
[UpdateInGroup(typeof(SimulationSystemGroup), OrderFirst = true)]
public class InputSystem : SystemBase
{
private InputSys_input = new InputSys();
private Entity _playerInputEntity;
protected override void OnCreate()
{
base.OnCreate();
RequireSingletonForUpdate<PlayerInput>();
_input.Enable();
_playerInputEntity = EntityManager.CreateEntity(typeof(PlayerInput));
SetSingleton(new PlayerInput());
}
protected override void OnUpdate()
{
var playerInput = new PlayerInput
{
Move = _input.Player.Move.ReadValue<Vector2>(),
Look = _input.Player.Look.ReadValue<Vector2>(),
Fire = _input.Player.Fire.triggered
};
EntityManager.SetComponentData(_playerInputEntity, playerInput);
}
}
Am I creating a Singleton correctly here?
If you don't care about overwriting the previously set data you can just call SetSingleton(playerInput) without keeping the reference to your entity
You also don't need the SetSingleton in your OnCreate
Oh great, ok. Yeah I was a bit confused about the Singleton process. So as long as I have only one instance of the PlayerInput component, it will be considered a singleton? I just want to be able to call GetSingleton<PlayerInput>() in other scripts and get that entity/component.
So as long as I have only one instance of the PlayerInput component, it will be considered a singleton? exactly
Would anybody know any good tutorials to get started with dots? I get the general concepts but I need a project for practice
(pls ping me)
Looking at the updated preview package (17preview.42) They seemingly added AddComponentForEntityQuery<T>(EntityQuery); as a method to the EntityCommandBuffer. Anyone happen to have the performance differences between that and AddComponent<T>(EntityQuery);?
Ah. Nevermind: "New EntityCommandBuffer methods that affect a set of entities matching a query. Unlike existing methods, these new methods 'capture' the entities from the query at record time rather than playback time: the array of entities is stored in the command, and then playback of the command affects all entities of the array."
Hey everyone, I was wondering whatβs the current state of ECS/DOTS? I donβt see it on their roadmap except for animations nor I hear news about it from Unity
Did they stop working on ECS?
No
they're working on it
but they're being very uncommunicative on it, and only dropping news sparingly.
@swift musk
how do you call ForEach from Monob
I set a foreach loop in some system, if some Bool = true, then i change system's bool from MonoB
But maybe is there more elegant way
you can have a RequireforUpdate in the OnCreate and then create that entity when you want that system to run and then destroy it when you dont
You shouldn't need to manually call systems from MB's unless you're doing something quite specific, in which case you would have the knowledge on how to do that in the first place.
Because they are called automatically from the world, just like a MonoBehaviour is called by Unity itself.
MonoBehaviour's Update function is somewhat similar to SystemBase OnUpdate
should I make the main menu in ecs as well, or is it just overkill ?
Seems overkill, unless you really want to create ECS driven UI.
well, I would have to anyway for the gameplay
Not really, you can use normal MonoBehaviours with EntityManager, for UI
agree
when it comes to production, right now, any hybrid solution seems to be the best
@gilded glacier I would definitely say no, there is no official UI system for ECS, and it's not too bad to put data from ECS to MonoBehavoiurs
Yeah, pure DOTS is pretty much insanity right now. But it's always nice to try and strive towards it.
no, thanks, I already regret that I put maybe too much of time and energy into learning and understanding, rather than production
@gusty comet You can get the system class from the World and call Update from anywhere
hi all, I was wondering if anyone knew the performance difference between using ECS and using VFX-Graph with VFX-Shader Assets to render meshes in-game. Since VFX Graph is very fast I was considering creating the entire games meshes using it, but if ECS is way more performant I would probably go Convert To Entity route....
So, I've dropped my dots project like half a year ago. Is there an established method to render entities in layers for 2d meshes yet?
I have a question about the entity list view Analysis Profiler... It has a list of Entities, but if you 2x click them, it doesn't zoom to them. How do you zoom to them? I need to know where one is because it is hidden.
@remote crater You cannot. They aren't part of unity's scene view yet.
You can see em in the scene view tho...
Weird, ok, ty
I guess that is coming down the pipeline
They're visible in game and in the grid view you can navigate through
No you can't select em in scene, but they obviously have x,y,z data
so 2x clicking the entity in the debug analysis should have your window focus em
I guess they'll get around to it soon, I figured it out without that tool
Good to know it is impossible to do that basic task, so I will not spend time researching it on the Internet
Welcome to dots lol
What is dots? If we knew, we'd tell you.
Dots is a lot like a box of chocolates
Sometimes the ones you like get eaten, or future versions of the boxes do not even have em in it.
Sometimes you can't even figure out how to eat the chocolate, having some sort of nut shell on it that you can't break.
Some of the chocolates are out of date and are advised not consuming for they will cause you problems in the future.
But the chocolates you do find, they taste oh so good
Definitely UNITY's Stock will soar after a couple games with this get released. Trying to get my MMO out by the 19th of June.
Hi guys i have code like this without entity command buffer. Is it wrong? Will it work? As i understand sync point will be create automatically somewhere ?
protected override void OnUpdate()
{
Entities.ForEach((ref Translation translation) =>
{
// Some stuff here
}).ScheduleParallel();
}
are you going to do some structural changes?
ie add/remove components or spawn/destroy an entity?
if so, yes, there's going to be sync point without ecb
but if, it's just that, and you're only manipulating the data in the components, no need to worry about sync points
@half jay
@deft stump yes, i added ref because planning write data into Translation component for example
Can anybody figure out why this works with CreateEntityQuery but not with GetEntityQuery:
var ecb = CreateCommandBuffer();
//var query = GetEntityQuery(typeof(EventTag));
var query = this.EntityManager.CreateEntityQuery(typeof(EventTag));
ecb.DestroyEntity(query);
Both seem to destroy the entity but the commented line seems to mess with the timing as other systems never get to see the EventTag entity
Afaik the only thing GetEntityQuery does differently is cache the query π€
Is it possible to create subscenes in editor with code
trying to locate this error but kinda cant
ArgumentException: System.InvalidOperationException: Invalid Entity.Null passed.
i think it happens when u try to instantiate entity (or createntity) from entity that is entity.null
I think that happens when you create an entity on a command buffer then assign that entity on a component before playing back the command buffer to assign a real ID.
later when you get the component that entity is still uninitialized on the component
maybe there's multiple causes for the error though, but it sounds familiar to me
It's fine to change the translation there, that's exactly how you would do it properly. You only need to do use ECBs when you want to do structural changes in a scheduled job.
are entities taking computer resources if they appear in Debugger, but if theyre not instantiated?
because i have 12k un-instantiated entities
could lower it to 300
at the cost of having to do the GO conversion more often
okay i checked and seems the answer is yes xD
visible change in fps after adding 100k of uninstantiated entities
@gusty comet What do you mean uninstantiated entities? Do you mean prefabs?
And GO conversion doesn't happen at runtime, so not sure how it happens more often.
i mean this
= GameObjectConversionUtility.ConvertGameObjectHierarchy(
entities made with this are uninstantiated id say as its impossible to interact with them until u instantiate them or maybe im wrong but i dont see them anywhere
@bright sentinel
Oh, I haven't really used that :/
I don't use that neither, but if ConvertGameObjectHierarchy creates a prefab entity , it's "impossible to interact with them until u instantiate" because the Prefab Component filter them out of the queries. If it directly creates an entity, then what I said is irrelevant and I don't know :p
If that's what you meant with I don't see them anywhere
You could see them in debugger or not depending on your LiveLink settings I guess
well they still take computer resources and FPS
so i decided to design code in a way so that i have less of them
But that would be in editor only, doesnt matter for runtime
it's some kind of preview
nah im sure its the same for build, but i can check it
Honestly I'm not even sure we're talking about the same thing, so I don't know if that helps
im only talking about fps drop caused by lot of uninstantiated entities
But conversion really doesn't happen at runtime
And you also shouldn't use the editor for performance benchmarks either
- you should forget about GameObjectConversionUtility.ConvertGameObjectHierarchy especially if you have loads of entities, and switch to subscenes
and I still don't understand what does "lot of uninstantiated entities" refer to
surely authored gameobjects, right ?
relax
why? i can get entity.instantiate to work and take less than 0ms
@gusty comet You mentioned that you can see them in the EntityDebugger. If you click one of them, does it have the Prefab tag?
they probably do idk
Can you check? π
no because i already got rid of them
but theyre converted from a prefab so i guess yeah
why? i can get entity.instantiate to work and take less than 0ms
also i can do that on an entity that contains 50 entities under/inside it and it will work the same
If that's works, that's good. But you also said you have a lot of them and trying to optimize performance. So, just pointing out this from Unity
it will be crazy if they remove GameObjectConversionUtility
and leave Scenes as only way
to load entities
because its very useful system
If it's a small project and you use it sparingly, and that works, no reason to change.
and i doubt i can use scenes in dynamic world
well you can
also like Bmandk said, keep in mind conversion does not happen at runtime
got to go for a drink, I hope I didn't misunderstood most of what you were saying and give irrelevant advice
happy coding
what do you mean?
scene conversion or
gameobjectconversionutility
Conversion does just add the prefab tag, yea. No reason it would have a noticeable affect on performance unless you were eg very short of Ram or smth as they wonβt be processed by any systems.
@gusty comet with your "12k un-instantiated entities" is this 12k unique entities then? all a different archetype?
no
what do you mean by 12k uninstantiated entities impacting your performance?
nah dont worry that issue is alredy solved
is it possible to get the converted entity using just your own code while using the default convert script
or would I have to make my own convert code and muddle with the entites?
I just want to move something, but I need move the entity the gameobject is following, not just the gameobject
I don't use gameobjectconversionutility but yeah scene conversion happens in editor. The final entity representation is serialised to disk, and that's what's loaded at runtime.
It's like an asset if you wish
does tiny work on webgl?
@deft stump yea that's what it's made for
the main use case they're targeting with tiny is facebook ad games
nice
I'm guessing from the name itself
it's much lighter than the regular webgl build right?
yeah
but it's basically new engine
any other libs you wanna use prob won't work and they have some barebones implementations of things but not even real UI support
so making anything in it is a pain
hrmmm sad
PhysicsVelocity not Velocity
ty. I tried that. I must have typoed. God bless.
Oh I know what I did. I forget to change the variable declaration along side it, lolz.
Can anyone explain why I'm having performance spikes on Solver:ParallelSolverJob on android (development build), but no issue in editor (60fps, windows) ?
I'm instantiating ~1000 entities with PhysicsBody and at that particular moment many trigger & collision events occur.
Profiler graph on android is attached.
And here's the same graph, but from windows editor
@quiet swallow Could it just be that android is weeker? as in less CPU power?
But also check that Burst is on, and that saftey checks are all off in the Dev build
Also does a non development build give the same results?
Your point is valid. I just wanted to make sure if I haven't done anything stupid. I haven't disabled the safety checks. How can I disable it? Just disable from Jobs menu and make a new build?
Release build crashes at runtime. Should investigate this issue too π
Honestly im not sure how to confirm they are off in a Build :/
Release mode should definitly have them off
but if thats crashing that dosnt help
ok I'll try to make the release build work. thanks for the help
All good, sorry i cant help more
So I spent about an hour trying to figure out how to get a script to run when my ECS DOTS Entities collide, They collide fine, but I want to apply damage. I reason it is something like a trigger, get data from Entity A/B, and then apply stuff to em.
I just can't find any sample code.
In the Unity Physics Samples code of Unity GitHub, is there an example that uses: Collide Raise Collision Events?
If not, is there any example out there anywhere on the Internet?
@remote crater , maybe not the best way, but here's how I do it: https://pastebin.com/MjPwPvpb
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Is unity doing a open world sample w dots ?
@quiet swallow Are Jobcomponentsystems even used anymore? I thought we used SystemBase now?
I tried a JobComponentSystem sample similar to yours, but it didn't trigger a breakpoint and I couldn't figure out how to do a Debug statement UnityEngine.Debug.Log was throwing errors. Also...
Do you have to attach this script to anything?
Make sure that your colliders and collision responses are setup correctly. And no, you don't have to attach this script to anything. Should be enabled by default, if you don't explicitly disable it.
How can I see if it worked. Will it accept breakpoints? The last one didn't stop inside when I collided.
Debug.Log should work iirc
@quiet swallow It doesn't understand your tags or even my tags...
The type or namespace ObsticleTag could not be found.
Are those IcomponentData and not Tags?
Yes, they're IComponentData with GenerateAuthoringComponent attrubute
cool ty bro
Entities
.ForEach((Entity e, ref TrackLocomotor locomotor) =>
{
if (HasComponent<FlowField>(locomotor.flowFieldEntity))
{
var grid = GetBuffer<Cell>(locomotor.flowFieldEntity);
}).ScheduleParallel();
Is there some way I can get a dynamic buffer inside an Entities.ForEach with ScheduleParallel()? Unity doesn't let me saying that dynamic buffers cannot be written to in parallel, and I don't need to write to it.
@quiet swallow It works very very very well.
You could use GetBufferFromEntity instead? This allows you to specify if it's readonly
You can also change ref TrackLocomotor locomotor to in TrackLocomotor locomotor to specify that component isnt written too
That worked ty π
locomotor is being written to, I just deleted every other line so it wasn't too unreadable
is there a way to create entities from a non unity thread? IE new Thread
I'm pretty sure they can only be created on the main thread whether its directly or through playback form the ecb
Can anyone think of any major conferences where Unity could potentially give and update on ECS?
Particularly interested in the editor compatibility and no addition information has been posted on the forums
can only think of gdc or unite(rip)
Unite rip?
("rest in peace" because of cancelling in person events)
unite wouldve been the place and I miss the keynotes even if it was mostly marketing because at least they were compelled to present something big to drum up interest
Man I need something to get hyped about
"unite now" was a big letdown for dots related things(dont think there was anything outside of physics?)
Ok
anyway its either gdc or bust at this point
Well finger crossed for gdc
im coming to the acceptance that they wont show anything for gdc
Do U know if unity is working on a open world dots sample
well apparently that was the plan, way back in the official roadmap talk they mentioned a large scale streaming demo
dont get your hopes up π₯²
My fear is Unity might decide to show less with the splash epic made
I imagine they wouldnβt want to show off new tech that the competitors has a better solution for
I just need some info haha
Really stuck here
yeah, being left in the dark blows
Is the best/suggested way to handle cameras simply to have a camera focused on a GameObject that follows an entity? (Following this vid but wondering if there is a better way to do it now: https://www.youtube.com/watch?v=JFv49-0vy_8)
π Download the project files from this video: https://tmg.dev/CamFollowEntity π
π¬ Hang out with other ECS Developers: https://tmg.dev/discord π¬
πΆ New to ECS? Start here: https://tmg.dev/StartECS πΆ
π» My Game Development Setup: https://tmg.dev/GameDevRig π»
π See below for time stamps π
Unity Version 2019.3.15
Packages Used
- Entities 0.11
- Un...
how to get value of current amount of entities?
EntityQuery.CalculateEntityCount()
well as of yet, I don't think we have an ECS version of Cinemachine. So yeah...
Has anyone ran into an issue where the Begin/EndFixedStepEntityCommandBufferSystem throw this warning in a dev (Mono) build?
Internal: deleting an allocation that is older than its permitted lifetime of 4 frames
Trying to figure out why the EntityCommandBufferData would exceed its lifetime
@coarse turtle there's prob more than 4 frames in between your fixedstep updates
either due to high framerate or low fixedstep tickrate
Yeah just ran the profiler - was definitely the case π
which should really be fine but for some reason unity decided to make tempjob allocator have a permitted lifetime of max 4 frames and also decided to use that in their entitycommandbuffers
seen forum posts about ppl running into this issue in early 2019 and the response was "we're gonna look into that" and now it's 2021
how do i debug invisible entities (that are invisible in build only)? i checked already for number of entities and its the same in both cases, but in build theyre mostly invisible
Hey, does anyone have a clue why this happens?
https://www.reddit.com/r/Unity3D/comments/nqn0d6/dotsecs_why_does_both_entities_scale_change_in/
is there a way to override material property WITHOUT using shadergraph?
and if possible i'd like to do it within the built-in render pipeline since i do not need any of the other features URP or HDRP provides
is there no GetComponent for ECB?
ECB are systems, not components
Dont know if that works for built-in though π€
I gave up on built-in honestly
It doesnt seem like thats meant for run-time overriding?
without writting and code
No, the doc says that method is abiut overriding per object without writting code
I might still be able modify it with system? No clue, will try later
I don't understand the problem you described. Are you trying to change scale through code ? Did you know or does it help you to know that <Scale> and <NonUniformScale> are different components ?
The problem is that the scale of both cubes is changing when i enter play mode.
You can see that the second cube changes scale even though i never changed it
There's no code involved
you can see that the Local to World scale is 1 as it should be, but the cube is 2 units large in the scene view
this is before enterying play mode and conversion to entities
maybe this illustrates it better
it seems the transform of the first existing cube is just applied to all other cubes for whatever reason
i have this error on dots entities with rendermesh
Mesh '(Clone)': abnormal mesh bounds - most likely it has some invalid vertices (+/-inifinity or NANs) due to errors exporting.
Mesh bounds min=(-71444734465366174004104134656.00, -71350952989382865719805345792.00, -71378276601852749487011790848.00), max=(71355103949521308137948184576.00, 71366687914503787377657380864.00, 71409340328577066013227483136.00). Please make sure the mesh is exported without any errors.
btw this is very suspicious cause im copying bounds from mesh
God.commandBuffer.SetComponent<RenderBounds>(God.galaxies[g].planets[p].entity, new RenderBounds() { Value = instancedMeshes[p].bounds.ToAABB() });
Well, i can't reproduce my problem in a new project either. Must have messed something up then.
seems like this just use MaterialPropertyBlock anyway
maybe i can try doing this myself
or not nvm
yeah this is not runtime
Yup this is not DOTS, wherever you found that code might happen at conversion time
i'm pretty much out of option now
so i guess i'll have to settle with moving the entities to a new chunk with a different material
it's not that bad for my case but would have been nice
Do you guys think its possible to make a Finite State Machine in Dots and then use that with gameobjects?
I'm guessing it is but I'm not sure how to get the data from the gameobjects and whether it would be worth it with the resultant performance hit
I'd have to use Gameobject.find or something like that?
You can just create and execute queries from game objects. You only need a reference to the EntityManager which you can get from the default world
I am currently trying to use singleton entites as states, which works quite well as you can use RequireSingleton in a System which will only update the system if the singleton exists. You only need a way to enforce transitions etc. and to have only one state at once
@pulsar jay yeah that's what I've been doing, that works fine, I'm just curious about the other way, like what if I want all the gameobjects Transform.positions in a SystemBase
is that even viable, I don't its a matter of figuring how much data I have and calculate with the monobehaviours and how much in the Systems I guess
I try to avoid manipulating GOs from Systems. I prefer manipulating entities with systems and poll data from the GO side
But if you really need to there are ways to get their references via conversion I guess
But if you are sure they exist from the start you could also get them once via GameObject.Find or better yet via FindObjectsOfType and then cache them
so you poll the entity data in the monobehaviours but what if you have lots of gameobjects and each one has to poll the data doesn't that effect performance badly
yeah that could be a problem. For now I just use it for stuff like cameras or UI where ther is only one or a few at a time
if I have lots of the same I usually use entities π
so why do you need GOs if they could also be hybrid entities?
yeah I'm using a lot of gameobjects with the Unity Navmesh, I'm trying to figure out how to use that efficiently with dots as there's not really any decent dots pathfinding stuff yet
I did not try pathfinding with dots yet but I thought there was already some dots compatible solution π€
there are a few third party things
there's lots of things in the works but nothing really close to finished, I mainly need one that has working collisions, avoidance between the entities
none of them are ideal for me personally
but doing the navigation in GO world and then transferring the result seems like a really slow solution
that doesnt fit your case: https://github.com/zulfajuniadi/unity-ecs-navmesh ?
that's 3 years old will that even work
"com.unity.entities": "0.0.12-preview.8",
That better? https://openupm.com/packages/com.reese.nav/
"com.unity.entities": "0.17.0-preview.41",
well you might be able to build that on top of it π
I've tried making my own or converting RVO2 and no thanks 
Any idea what's going on here? AtomicSafetyNode has either been corrupted or is being accessed on a job which is not allowed.
and SetBumpSecondaryVersionOnScheduleWrite node is not valid
I'm iterating over a NativeHashmap using ForEach
Is that not allowed inside a job?
I know recently I tried to do this with a NativeList and GetEnumerator() was simply throwing a NotImplementedException
so I'd be wary about foreach

but also- iterating the map inside a job? Is it a parallel job?
Nope
scheduled non-burst job
How am I supposed to iterate over a NativeHashmap then? Use NativeHashmap.ToKeyArray()?
Seems kind of counter intuitive if I want performance
I guess I would write the keys to another native collection and then use that, but it seems very hacky imo
Maybe you'd use the KeyArray
yeah
idk - it's a preview package π
there's a lot of broken/hacky stuff still
ugh sory for the 0.0 link
Yeah but supposedly there's a difference between preview and experimental
damn google
And if the jobsystem is supposed to be production ready soon these kind of things are kind of a major issue
Lets say I am instantiating lasers groups with children of 1,2,3 & 4 into Entities during runtime. How do I add physics shapes and physics bodies to each of the children(individual lasers) of the group.
I hear Entities doesn't even have children at run time, right?
So in my normal mode of gameobjects, I have 4 different prefabs of lasers. Each prefab holds a group of lasers 1/2/3/4. Each laser has a rigid body to collision detect itself while the other up to 3 lasers have their own individual colliders.
If ECS/DOTS had children,
After conversion to entity of a laser group, I could access children by transform.GetChild(x) to place on physics shape/body. But I am unable to get the child of an ECS entity. How do I do that?
Is it possible I make new prefabs with laser having shape/body on them? Cuz that would solve it too.
Thanks,
Jim
Answer: https://forum.unity.com/threads/laser-groups-of-1-2-3-4-how-does-ecs-dots-handle-children.1120471/
So the guy says that entities have buffers, but I do not know the syntax to access such said data.
I was told: There's a buffer called Child with all of an entities children.
What is the syntax to access that buffer from monobehavior when I have EntityManager and the entity I want to get children from?
The Unity Documentation is unclear.
Anyone have example code of accessing a buffer? I have no clue about how to access them when you have an entity and Entity manager.
In your case the buffer would be <Child>
anyone else had its dots build compiling clogged? i remember i had this before, then it randomly fixed after many hours and attempts, and i again have it. it will never end, last time it took 2 hours and didnt finish even though all cpu usage and IO went to 0. usually dots build compiles in just one minute
tried: cleaning entity cache, editor cache, setting scene to dirty and resaving it, properly opening and closing unity, then reseting PC and finally going to playmode before building.
Not seen that in recent memory - did you try deleting your library folder?
just did it
it didnt help unfortunately Lol
Just making sure, you're building with the DOTS build tools right?
maybe cleaning unity folders from appdata would help
yeah . normal build works, dots build stopped working
Okay, yeah then I don't know on the top of my head
it always hangs here https://i.imgur.com/O5R6QSm.png
i ran it many times today, sometimes even for 2h
report it to unity, let them figure it out
as a last resort if you havent tried these things: try building on a different pc(if you have one), try copying only the scripts into a new project(duplicate project settings and package settings obviously), and see if it builds. id still report to unity though
Is there a way for a job to create a native collection that is later reference by another job? For example if I don't know the size of a nativearray yet, or is the only way to use a nativelist?
I assume no, since jobs can only create collections with Allocator.Temp, but maybe there is some way around it
actually copying everything into new project worked
took me only 12 hours to figure it out
edit:
okay that doesnt always work, but if you cancel the second window popup very early, and wait for it to cancel, then it should work fine next time you do this
rookie numbers
i was hoping for productive day today π
its all a matter of perspective
@jaunty herald you can't create an array inside a job that will be used outside of a job
I updated my post with the latest collection version
Why is this required, wouldn't the job have completed anyways since the handle is passed to Schedule()?
I'm pretty sure I schedule multiple jobs in a chain that use the same containers without issue
You mentioned that you don't know the size of your array ahead of time. If that's your issue you have to use DeffedJobArrays.
If you do know the size then you can pass it to multiple jobs, without any issues.
I meant more along the lines of two jobs sharing the pointer to unmanaged memory, and the first job initializing it before the second job reads it
I don't think this is possible
For that you can just use job dependencies. if A intialize and B reads, just make sure B depends on A.
Yeah, but how does A create the collection? The structs are copied by value, and the job is only allowed to create collections using Allocator.Temp
If you're using Entities.ForEach and not manually configuring dependencies, then the dependency order is always top to bottom of your Entities.ForEach.
Yeah that part is impossible. You have to create the collection with TempJob allocator before scheduling A.
e.g.
NativeArray<int> test = default;
Job.WithCode(() =>
{
test = new NativeArray<int>(100, Allocator.TempJob);
}).Schedule();
Job.WithCode(() =>
{
Debug.Log(test.Length);
}).Schedule();
does not work
Yes, that's what I thought. Thanks.
So I guess just use lists or have an upper bound and use an array
Yea and that brings us back to DefferedJobArray, which you still need to allocate ahead of the job, but it's size can change in a job. (So, if you don't know the exact size)
In the example on the page you linked, couldn't you just pass the NativeList to the second job?
When you pass a List to a job, the contents at the time of scheduling are copied. Meaning if it's used on A and B, B won't know that A changed it.
yeah you can do that
Docs: If you tried to pass the list directly to the second job, that job would get the contents of the list at the time you schedule the job and would not see any modifications made to the list by the first job.
So in essence, the actual value behind the index would still be modified, but there's no way of knowing if the size changed.
is this different for NativeHashMaps?
I have a bunch of jobs where I create a hashmap at the beginning and then modify it in jobs, and it all works fine
I've done it before, you just can't allocate it inside a job
Yeah, I don't think the contents are copied, since that kind of defeats the purpose
Aren't nativecollections just the pointer? Although I don't know what happens if a nativelist resizes or something
I assume at least for NativeArray it should work
try the above with a nativelist create and allocate it outside the jobs then add some elements in the first job then see if they appear in the second job
They are, I may have explained poorly but it seems you already realized why it's problematic: I don't know what happens if a nativelist resizes or something TL;DR you can resize a list and have the following job know that, unless you pass it as a DefferedJobArray.
Yea, that makes sense
Thanks for bearing with me
Atleast for NativeHashmaps it does seem to work however π€·
If I'm not mistaken and to further clarify, the metadata of the List is copied, not the actual array bits. So basically the pointer to the memory location of the backing array.
In the game that I am working on, I have an issue with the performance impact of Physics.ProcessReports coming from OnCollisionEnter. However I have a hard time finding out exactly how to optimize this as it is required that collisions can register and mesh deformation happening.
I have been able to reduce the performance impact of mesh deformation by using the Jobs system specifically for modifying the triangles, however I still have to return them and Recalcualte normals, recalculate bounds and bake the new mesh after a mesh deformation has happened.
In the profiler, I am seeing anything between 100-800 KB of garbage generated from the physics collision, and the physics time taking anything from 40-60ms.
Is there a way for me to optimize further by either moving most or all deformation code to the jobs system or generate as little garbage as possible?
Using 2019.4.25f1
Multiplayer with 50 rigidbodies containing a set of very low poly (<20) triangle mesh colliders.
I was trying to set shared component via ECB and got this error. Have anybody faced it?
```Packages\com.unity.entities@0.17.0-preview.41\Unity.Entities\Types\FastEquality.cs(215,13): Burst error BC1051: Invalid managed type found for the field EqualFn of the struct Unity.Entities.FastEquality.TypeInfo.: the type System.Delegate is a managed type and is not supported
Seems like ecb.SetSharedComponent<T> can't be used with burst
Hi team - re: JOBS. Say I have X projectiles that I want to jobify raycasts from, to detect collisions. Do I add each projectile instance to an array and put that into one job, or can I make a job from each individual projectile? Will it make a difference? What's the best practice, sorry for the noob question
@latent oracle You can do both. In the end it comes down to the amount of processing you need to do. It probably does not make much sense to do a singular raycast within a single job and do one job per thing, if that's all you're doing. But at some point it makes sense to split them up into batches. So by default, just keep everything in one job. If you have enough projectiles that need to do the raycast, you can start splitting your jobs into multiple batches using IJobParallelFor that does the hard parts about threading and so on for you. As for the exact breakpoints, that's something you have to test experimentally.
Of course if you do a lot more processing per projectile, you can have very small batches.
OK that makes senes
Thank you
I'll do that
just struggling to make it work per projectile at the moment haha, I'll move it over once I understand how to do the actual raycast. Thanks again man
No worries π Good luck!
How do I get access to material of the RenderMesh or SpriteRenderer component? I want to do a simple fade out effect per entity inside my system.
Probably using a MaterialOverride is the simplest way to achieve a fade out
Thanks!
"MaterialOverride" - this is a new term to me. I'll try to find resources on this
@bright sentinel curious: Do you know if there's a way to jobify anything in Physics.updatebodies? I've got like 30ms of stuff in there.
@latent oracle Is that PhysX? I don't remember. DOTS has their own physics stuff
I haven't touched dots in a while, so is 2020 LTS the way to go? I started already a project with 2021.1 and didn't notice any issues, but I guess they are there just hiding.
if I have an Ecb.ParallelWriter but I want to GetComponent what's my API to do that?