#archived-dots
1 messages · Page 214 of 1
called scale
check out the transfrom system doc, it lists all the components that make up a transform in ECS
as there Scale and CompositScale or sonething
already tried that...but as im loading from a sube, i hope it would have such thing. even tried with rendermesh.bounds, but unable so far
ps: have u ever messed with [DisableAutoCreation] ?
also read the conversion workflow, in some cases it wont add componets
eg when scale = 1 1 1
and yea i use it tons for my networking
@ocean tundra Thanks ^^ even if it cant live without another entity ? Thats why i thought it might be not the best idea to have an entity here... Is there any downside if i still go with the "Item is no entity" approach ? That way the json produced would look much clearer and would make more sense ^^ It also reduces the references between entities which is always a plus.
nothing wrong with references between entities
and if the referece is in a different component your foreachs can not run if a item isnt 'attached' to a parent
by my tests, seems [DisableAutoCreation] is not invoking OnCreate neither OnUpdate.
World.GetOrCreateSystem<SystemA>(); creates but it doesn't start running/invoking the OnUpdate function each frame. i guess it's because is not added as part of a systemgroup or something.
are u able to make them start working (ie: Onupdate being invoked by engine)? do i have to schedule a new job or something similar?
Alright ^^ is there anything wrong with the "Item in inventory is no entity" approach ? I often hear people arguing between "Everything is an entity" and "Not everything should be one".
@stone osprey both aproches will work, what is easier for you?
the main downside i can think of is you cant really schedule paraell on a dynamic buffer, but thats only going to be a issue if you have 2000+ items
And i actually have the feeling that both are right
Well actually the "Item in inventory is not an entity" approach works "better" for me... its easier to implement. Probably not that performant, but it makes the persistence part easier ^^ Ahhh... im just gonna play around, if i dont like one of them i still can switch pretty easily to the other one 😄
@night venture Yup thats right and how its meant to work
Look up DefaultWorldInitialization or something similar in the entities package
basicly manually creating a system is a 3 step process
World.Create... = gives you a system
UpdateSystemGroup.Add = adds the system to be updated
UpsateSystemGroup.Sort = does the update before/after stuff
has this to be done within ICustomBootstrap ?
nope
UpdateSystemGroup probably changed in latest versions. im unable to find it so far, but this fight won't last too much 😛
sorry you need to find the group you want your system part of
like when you use UpdateInGroup(typeof(....))
usually the simulationupdategroup
SimulationSystemGroup ?
probably
FYI:
ComponentSystemGroup systemGroup =World.GetOrCreateSystem<SimulationSystemGroup>();
systemGroup.AddSystemToUpdateList(World.GetOrCreateSystem<CarSystem>());
you should sort too
that way if you ever add a system that needs to update before/after carsystem it will work
but also for general systems i wouldnt manually create them 😛
all this came to set job dependencies...
when moved the initialization code from OnStartRunning (can be invoked if the system is disabled(eg: pause) to OnCreate, as systems are run in parallel, it started failing
your initializeation logic should just be a normal system with code in onupdate
using singletons to control execution flows
oncreates are for creating data eg native containers
do you really think the MAP should be created OnUpdate? it doesnt make sense, as it's static
maybe for loading resources too, but really for messing with entities
i do
i would have a custom UpdateGroup
please, elaborate. Although I agree with the dots approach, not everything is a system, hence it doesn't make sense to create the map within OnUpdate and use singletons...
something like MapGenerationUpdate Group, that contains a bunch of systems doing the map generation/loading stuff
I would have some sort of Singleton (IsLoading, IsDoneLoading) ect to feed data to a loading screen and to disable any gameplay systems
im assuming im creating a fixed size procedural map
thats overkilling for a tile map
in the case of inifinate (eg minecraft) it would be a bit different
actually, a 10x10 map
maybe, you dont need the system group, but the IsDoneLoading singleton would still work
please, be aware im a @student and prefer doing little steps and iterations to improve and learn, rather that building the game spenting month designing 😛
and means your no longer manually messing with system creation
which is something to adviod
I truly don't think the expected way is having all those system, each one checking if game has finished task A to properly run taskB, instead of having a call at the end of taskA to run taskB.
at least, for such simple test-games like this...
that still, doesn't solve the issue. I'm not talking about data, neither objects...I'm talking about game initialization.
PS: Scale doesn't work, as its only a float to change all xyz. I'm interested to change Y only
read the transform system doc
for scale and rotation there are additional more complex types
and the whole system works optionally on the different bits
NonUniformScale 😉
yea thats it
Oh i heard OOP vs DOP
How complete is DOTS in regards to basic/core functionality? Is it still incomplete or just unpolished?
Actually data oriented programming is also kinda object oriented 🙂
@rugged totem Run, run far away 😛
Its ready if you like doing things yourself, but all the nice stuff a game needs is still missing
Animations, sounds, all the awesome unity features are not there yet
Or you go with a hybrid approach... which i use mainly.
ECS for data and flows.
GameObjects for visuals/audio/animations only
Actually works better than expected
yea thats the way if you want things to work and finish something
its what i should do 😛
incomplete. seems audio, for example, is less than a draft. anyway, here we are...xD
^^ if you wanna finish something... my indecision in questions like "Is an Item an Entity or not" or "Is this [insert feature] a component, a data structure or probably something else" literally costs me weeks or months xD so the speedup from using an hybrid approach is wasted right here
Yea doing the same, simulation is fully ECS the rest is using standard gameobjects
and you both @stone osprey @north bay , for your initialization/systems sequencing...handle it using "isLoaded" or with [DisableAutoCreation] ?
I actually have no initialisation systems ^^ So i cant say anything about that, sorry...
...and if a system needs another one as a dependency?
Mine do not need any other systems as a dependency ^^ I mostly have all my Entities.ForEachs grouped by features in the same system. And if not, i code them using queues or whatever that their order does not matter at all
Or i use the CommandBufferSystems
between systems?
Is there a good way to convert NativeArray to BlobArray?
i dont know any way
i usually have to loop over my source data and manually create all the blob array items
as you need to use that blob builder thing
hmmm....i need some algorithm help.
consider my map is 10x10 and a car spawning on left side must choose a random destination, EXCEPT one next to them (on left side).
cars would use A*
how could I make car set a random location except those close to them?...
should i iterate first on tiles to remove closer than 1 from the list of potential destinations, and then, choose one randomly?
are u able to think a system which does not involve O(n) ?
would tagging closer spawn/destroy tiles with a common tag be as equally bad as killing a cat?
@night venture Could always just choose 2 random coordinates, and if they don't fit your constraints, just choose two new ones
With 98 possible destinations out of 100 (assuming you also can't choose the same one), you would have 2% chance to have to rerun the RNG once
within a loop? that's what im doing, but is like killing a cat, dont you think?
I mean, it seems like the fastest solution given that the chance to hit an illegal node is so low
I was asking 'cause perhaps someone already got a brilliant idea, like find entities of type X that match a certain criteria. ie: the same as asking about how to get components having specific attribute value=X
You could also just first randomize which row you're on. If you don't hit the car's current row, just randomize the column as well. Otherwise, just choose a random number between the other tiles you're not on
unless someone comes with a brilliant idea, ill embrace that 2% you mentioned 😛
I have a single NativeArray I'm using across two different jobs. (ReadWrite in both jobs)
NativeArray<FluidBuffer> buffers;
I schedule the two jobs, with the second one depending on the results of the first.
UpdateFlow flowJob = new UpdateFlow(buffers);
var flowHandle = flowJob.Schedule(buffers.Length, 1);
UpdateContent contentJob = new UpdateContent(buffers);
var contentJobHandle = contentJob.Schedule(buffers.Length, 1, flowHandle);
contentJobHandle.Complete();
This works completely fine. However, I would like to change the NativeArray to a NativeList, so that I can add elements to it from the main thread. However, if I change to a NativeList, I get this error when I try to use the NativeList in this way:
InvalidOperationException: The previously scheduled job UpdateFlow writes to the Unity.Collections.NativeList`1[SadnessMonday.DiscIndustries.Fluids.FluidBuffer] UpdateFlow.buffers. You must call JobHandle.Complete() on the job UpdateFlow, before you can read from the Unity.Collections.NativeList`1[SadnessMonday.DiscIndustries.Fluids.FluidBuffer] safely.```Despite the fact that I am not changing the actual jobs themselves. They still treat the NativeList as a NativeArray. The do not add or remove elements from the list, and in fact only have a NativeArray reference to it.
Is there any way to bypass this error? I want to use a NativeList so I can add elements to the list on the main thread between runs of the job. But I don't need the list functionality for the job execution itself.
If you use the first jobhandle as a dependency when you schedule second one, it will be happy ?
I already am doing that
And it is not a problem when the array is created as an array
but when it is created as a list, I get the error
Can I somehow pinky promise the safety system that I will not be modifying the length of the list?
Continue to treat them as a NativeArray in your jobs - assign them via NativeList.AsNativeArray
I am still treating them as a NativeArray in the jobs
public struct UpdateFlow : IJobParallelFor {
[NativeDisableParallelForRestriction]
public NativeArray<FluidBuffer> buffers;
public UpdateFlow(NativeArray<FluidBuffer> buffers) {
this.buffers = buffers;
}```
I am relying on the implicit conversion between NativeList and NativeArray in the constructor
Odd, that should work.
Changing the site where I create the jobs like this I still get the error:
UpdateFlow flowJob = new UpdateFlow(buffers.AsArray());
var flowHandle = flowJob.Schedule(buffers.Length, 1);
UpdateContent contentJob = new UpdateContent(buffers.AsArray());
var contentJobHandle = contentJob.Schedule(buffers.Length, 1, flowHandle);```
I also Tried AsDeferredArray()
even though I don't think that fits my use case
also doesn't work
I feel like the safety system wants to protect me from adding or removing list elements
which makes sense - but I'm not doing it 😦
Yeah, I use the same pattern with DynamicBuffers with no issue. Could be a bug, I would make a post on the Unity forums and see if one of the Unity devs has any input 😦
Ok thanks
https://forum.unity.com/threads/using-a-nativelist-as-a-nativearray-across-jobs-is-generating-an-error.1091566/
Here's the forum post, in case you're interested at all
so i make changes to the velocity of a gameobj during jobs with NativeArray<Vector3>. i update the gameobj at the end of the update loop like so
for (int i = 0; i < number; i++) {
if (VelocitiesArray[i].magnitude > maxVelocity) {
VelocitiesArray[i] = VelocitiesArray[i].normalized * maxVelocity;
}
var obj = goList[i];
obj.transform.up += VelocitiesArray[i];
obj.transform.position += VelocitiesArray[i] * Time.deltaTime;
goList[i] = obj;
}
i can see that the rotation of the gameobj and the positon changes based on the velocity array. Then in the beginning of the update loop i change my velocity array based on the obj transform:
// init arrays
Transform[] TransformTemp = new Transform[number];
BoidsPositionArray = new NativeArray<Vector3>(number, Allocator.TempJob);
VelocitiesArray = new NativeArray<Vector3>(number, Allocator.TempJob);
// INIT ---------------------------------------------------------------------------------------------------------------------------------------------------
for (int i = 0; i < number; ++i) {
var obj = goList[i]; // ref to current gameobject
TransformTemp[i] = obj.transform; // for TransformAccessArray
BoidsPositionArray[i] = obj.transform.position;
VelocitiesArray[i] = obj.transform.forward * maxVelocity; // change start velocity HERE
}
TransformAccessArray = new TransformAccessArray(TransformTemp); // so far so good
problem is that the gameobjs rotation resets each frame
this is important for an object avoidance behavior, rn my objs are all stuck on a rotation loop and wobble across the floor
am i doing something wrong with accessing the native array?
Looks like you're accessing the values correctly in the native array
okay thank you
the deadline is tomorrow, so if you have any ideas what else might be the problem please go for it^^'
if it's wobbling you might want to check your velocities, maybe the heading is incorrect when you're moving the boids
i need a bit of help
check it on a single thread and verify that it's correct, then you can multithread it
has anyone done the doomcraft lesson thing?
okay i'll check that, thanks
Assets\WanderingAI.cs(34,25): error CS0103: The name '_fireball' does not exist in the current context
this is the error message i keep getting
how do i format my code for discord?
{
public float speed = 3.0f;
public float obstacleRange = 5.0f;
private bool _alive;
// Start is called before the first frame update
void Start()
{
_alive = true;
}
// Update is called once per frame
void Update()
{
if (_alive)
{
transform.Translate(0, 0, speed * Time.deltaTime);
Ray ray = new Ray(transform.position, transform.forward);
RaycastHit hit;
if (Physics.SphereCast(ray, 0.75f, out hit))
{
GameObject hitObject = hit.transform.gameObject;
if (hitObject.GetComponent<PlayerCharacter>())
{
if(_fireball == null)
{
_fireball = Instantiate(fireballPrefab) as GameObject;
_fireball.transform.position = transform.TransformPoint(Vector3.forward * 1.5f);
_fireball.transform.rotation = transform.rotation;
}
}
else if (hit.distance < obstacleRange)
{
float angle = Random.Range(-100, 100);
transform.Rotate(0, angle, 0);
}
}
}
}
public void SetAlive (bool alive)
{
_alive = alive;
}
}```
@amber spindle What has this got to do with DOTS? i think your in the wrong place
I figured out the problem! It was silly. It was just because I was reading.Length from the array on the main thread after scheduling the first job
All I had to do was cache the length of the list in an int before scheduling the job and use that.
Haha, awesome! 😄 Gotta love DOTS for making you think of how every tiny little part of your code interacts - I've spent many an hour chasing down similar forehead-slappers 😄
Yeah the safety system is pretty nifty
I just copied the cube Netcode example into a 2020 LTS project and it is not working, and in fact gives me job temp alloc errors... perhaps I am missing osmething
Damn... i think im gonna implement my items as entities instead.
Just realized that they should execute different actions... like when a player clicks on them inside the inventory or when they are equiped etc... so i think its better to have them as seperate entities instead of structs.
Might be interesting to some
that is an interesting post...
"Future releases of Entities will not be compatible with Unity 2021 until the end of the year at the earliest." wow
"I will leave the thread open for questions, but please understand that this is the information we can share at this point in time."
They are really holding their cards close to their chests lately...
what means by entities based package? "Entities" itself and ...?
maybe hybrid renderer?
I guess Entities and the packages dependent on it like netcode, physics, animation and the hybrid renderer dunno if I missed something
Can it be that render features for 2D URP, which i so waiting for, will be available in 2021 and not in 2020? I don't really know how features migrating between versions
hmm damn
Thanks Script !
"Future releases of Entities will not be compatible with Unity 2021 until the end of the year at the earliest" is sure a hard one 😭
Not that I need 2021, but seeing so much hassle to deploy updates is not good news
That means no Deffered or Forward+ renderers until at least end of the year :/
maybe on the alphas but not on the official 🤔
perhaps they are saying this in anticipation for entities .18 release?
it was oddly worded mostly saying 2021.1 but not mentioning 2021.2 also does this mean the 2022 alpha is around the corner?
If they're already saying 'not before the end of the year'... surely that means 2023ish?
i asked how 2021.2 factors into it and got this ominous response
We will expand on this specific point in the next posting we make on DOTS releases.
did you see my question? unsure if they deliberately avoided answering or misunderstood the q
sounds deliberate, much like how mine is super vague 😆
With the way package management works from 2021.1, we have to have different ways of delivering Entities packages to our users. What on earth does this mean
I thought the same thing ^
Perhaps they're limited in not being able to have more than Entities 0.99 before RC? 😬
It sounds to me like we won't be able to use the package manager anymore or something, like we'll just be getting a big zip file
Or more likely one file per package I guess
Can some give me a high lvl explanation on why
Well... Entities released are about quarterly now - not a stretch to imagine they just ship a new version of Entities with each Unity . release?
I read Martin post but I’m not sure why a change is needed
What driving this , why not just stick to what there
@amber flicker does that mean we can’t use interim version
Of unity
Not sure I understand - it sounds like we'll be able to keep using 2020LTS with entities. Though you have to imagine that the Entities team is only working on >2020 Unity versions at this point.
My take? Trying different approaches to deal with the fact 100's of teams are working on different aspects of the engine and users are having a very frustrating time trying to find a working combination. Where the only real fix is to change less or magically have the work further along I guess.
Isn’t this essentially removing ECS from the tech stream
Until the end of the year, that's what it sounds like yes. Which is a bit odd since it's a 180 from previous releases where they always seemed to target the cutting edge, or a couple versions behind that at least
I feel down about this
Eh, not worth getting too worried about it until there's more info. I'm mostly just frustrated that this is the first bit of communication we get about dots in months and it's all very vague and confusing
Yea your right , will just wait and see
especially since from 2018 onwards ECS as integral part of DOTS has been pushed very hard for publicity sake, but now it is the first major preview package that is incompatible with new unity tech releases
wait you cannot use entites with the new unity versions?
I mean it is okay as long as you aren't using 2021 I guess
but you can use entities 0.17, just not newer
they are saying newer versions of entities not compatible
How does this affect tiny
So only 0.17- is supported in 2020. 0.18 MUST be supported by something
Since Tiny depends on ECS I would guess it means you're locked to 2020
yea they didnt say what 0.18 works on
whats the point in them even releasing it if it wont run somewhere :/
I took it to mean .18 and all future versions will be locked to 2020 for the foreseeable future
But it seems that the package manager is the main kinda issue
So maybe some sort of bundle we can download?
yea that will make sense, 2020 i mean
Or a custom editor? 🤔
sorry actually maybe a custom version drop
But I mean, it would be insane if 0.18 is now stuck to 2020
What about in 3 years?
Then it's still on 2020...
that would have solved this by then
Well then why not just solve it now?
no way they can leave DOTS on 2020 forever
what is dots
Right, that's why I'm thinking a custom editor or smth
Like a fork of the current editor
yea that makes sense too
hmmm
@keen yoke see the pinned messages
oki
i expect it will be a yearish tho
:)
they wont want to be updating/releasing a custom version all the time
Maybe it's just a way to really differentiate ECS that's in preview from non-DOTS preview stuff
dont they have that expermental tag in package manager for that?
Well obviously that wasn't enough since the Entities package was still removed
maybe its the DOTS changes are now requiring core unity changes, which for some reasion they cant make it combatabile with old MBs
yea
wish they would be a bit more vocal about things, like a small technical paragraph about WHY they are doing this
maybe its as simple as supporting changing unity versions is just taking too much time
Well that would just be shooting themselves in the foot
true
It should all have been package .. with SRP shipping with editor and ECS potentials locked to 2020 it going to be extremely difficult to get a working combination of the editor
I’ve digging through my notes trying to reason what I need where
i though that the SRP shipping with editor thing was still a package, but its basicly a 'default' package?
I’m not sure about that, I was under the impression is part of core
dam that feels like a step back
I hope I’m wrong
maybe release a compatible editor only to their big customers paying a lot of money. thats what the cynical side of me thinks
nah lol
I can imagine internally a disagreement between entities and packman teams 😄
something going on
"you keep breaking our packages! We're leaving!"
lol
like an advanced alpha 😆 hell they got one of the unity teams making custom dots demo ports for em
I read the package manager changes blog post, but I can't see what about it would be the reason to need a new delivery method...
"With the way package management works from 2021.1, we have to have different ways of delivering Entities packages"
that's such a curious thing to say
I also remember a guy saying, quite a while ago now, that .18 was coming soon, so my bet is package manager changes have been the hold up, and not necessarily significant changes to entities...
I hope I'm wrong, I want tag enable/disable 😄
yea i dont understand that line either, i dont understand how the current/new package management changes will effect DOTS
its already hidden, and a manual Add Package (with the full annoying package name) to add it
it seemed to me just a renaming of things
this bit is interesting too "but please understand that this is the information we can share at this point in time. "
why cant they share more???
maybe some sort of business deal? like microsoft being interested in DOTS for the general C# stack?
I reckon they're just tired of saying something too early and then getting shit for it later
i mean it wouldnt surprise me if a big enough company wanted to pay for a bit of a timed exclusive for the tech, first to market or something
though the bungling of the rollout for this would make it seem like its just more mismanagement
i guess just wait and see
out of interest, what 2021+ features will we be missing?
Theres the URP Deferred feature, anything else?
not sure what its called but incremental build caching thing to reduce build times
uitk being compatible with subscenes
Oh is UI Toolkit with Subscenes like an Object component attached to the entity?
i dont really know why it breaks subscenes, only that it does (in 2020.x)
just the presence of the two packages together make subscenes not work, dont need any code that references either thing
oh 🤔
there is some of the c# 9 feature set
I was looking forward to this:
public static bool IsLetterOrSeparator(this char c) =>
c is (>= 'a' and <= 'z') or (>= 'A' and <= 'Z') or '.' or ',';
also this
WeatherStation station = new() { Location = "Seattle, WA" };
o - that's cool
and this too
public WeatherForecast ForecastFor(DateTime forecastDate, WeatherForecastOptions options)
{
}
var forecast = station.ForecastFor(DateTime.Now.AddDays(2), new());
released in alpha 11
when i last saw it about a month ago it was just for some internal Unity tools
I think i remember reading that they're trying to aim for .net 6 to be able to fully support c# lang features
any idea if roslyn (update) + source generators are included?
im generating a ton of code for my networking tech, currently i just put it out in the users Unity project
but source generators give me a bit more flexability with it
This was the release note point from alpha 11
Scripting: Updated C# language version to 9.0 for compilation and IDE's
We will support a subset of the language features from:
https://docs.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-9
These is the features that we support:
Pattern matching enhancements
Function pointers
Target-typed new expressions
Static anonymous functions
Target-typed conditional expressions
Extension GetEnumerator support for foreach loops
Lambda discard parameters
Attributes on local functions
New features for partial methods.
the for compilation and IDE's looks promising
https://forum.unity.com/threads/unity-c-8-support.663757/page-8#post-6997319 hmm neat looks like unsafe delegate pointers can work with a few workarounds 👀
Is that related to c# 9 function pointers?
Function pointers provide an easy syntax to access the IL opcodes ldftn and calli. You can declare function pointers using new delegate* syntax. A delegate* type is a pointer type. Invoking the delegate* type uses calli, in contrast to a delegate that uses callvirt on the Invoke() method. Syntactically, the invocations are identical. Function pointer invocation uses the managed calling convention. You add the unmanaged keyword after the delegate* syntax to declare that you want the unmanaged calling convention. Other calling conventions can be specified using attributes on the delegate* declaration. For more information, see Unsafe code and pointer types.
this stuff is a little too deep for me...
and what does this all imply? delegates with burst or something?
Yea I imagine delegates with burst
we have that tho
yeah through FunctionPointer<T>
i guess this is native instead tho
can I put a delegate pointer on an IComponentData? I have no use case, I'm just thinking it sounds wild lol
Is it blittable?
i havnt tried but it is a sturct
wondering if anyone can give me some thoughts...
I have blocks. They can be destroyed. When I destroy a block, I'm just hiding it via the shader and temporarily disabling it's collider. It regenerates and re-appears late.
When it's gone, I want to replace it with a more dynamic destructable box
so we can go pew pew and it gets destroyed..., and slowly regenerates
if I pew pew too many blocks at once, I will have many destroyed bits, so lots of little cubes for rendering and collisions, and thinking how best to handle this...
Preferable is to have the little cubes have damage values too and visually displayed by changing colour, some glowy red hot effect kinda thing...
but this is not 'manadatory'
so I thought... ok, OctTree?
start with big boxes and end up with small boxes at lowest grain?
could go with instantiate and destroy block entities of various sizes...
or... could go with voxel mesh generation based on the octree structure... I don't really need to worry about 'block types' like typical voxel generation...
but updating meshes all the time with lots of destruction happening all the time...?
could do some kind of 4x4x4 64 block grouping and have the shader disable individual blocks. Overdraw though?
I go think more 😐
Honestly this is outside the realm of DOTS and more into compute shaders dynamically generating meshes.
✔️ Works in 2020.1 ➕ 2020.2 ➕ 2020.3
🩹 Fixes:
► Make sure your source mesh has read/write enabled in it's asset importer inspector.
Compute Shaders are scripts that run on the GPU! They're very powerful, allowing you to leverage the GPU's unique abilities and generate meshes to draw procedurally. There's not a lot of information on using them, ...
It will require dots physics, and also with entities and burst, options like individual cubes, and small voxel mesh chunks in burst are available
I actually did not think about compute shaders
"Simple" guide with a shader that adds a vertex in the center of every triangle, reconnects all the vertices, and extends the center vertex in a sinusoidal pattern inside and out.
I will consider this option too
Physics works basically on meshes. The most performance consuming part will be the communication between GPU and CPU where meshes are transferred back and forth. However, that is negligible compared to the shear power that a GPU can offer in parallel generation.
hmm it might not require dots phyiscs...
Theoredically, there are plenty of research papers on GPU side physics calculation. Although if you get that working, you too might be in the position for your own PhD.
haha
Aim for the sky. The worst that can happen is a university offering you a position in their computing department.
if I don't need the mesh back for physics, can I avoid pulling it back to cpu?
Definitely. That's the main bonus of compute shaders. Generate dynamic meshes in compute shaders then have regular shaders read the mesh data and display on screen.
Extremely performant. Main issue is the very sensitive Unity side rendering calls.
Large amount of boiler plate and low level rendering systems. Cant really help there but follow that youtube link.
Actually no, GPU physics is not too hard. https://www.reddit.com/r/Unity3D/comments/7ppldz/physics_simulation_on_gpu_with_compute_shader_in/
That's just a basic example of 2d physics. 3d is just extending that into a third dimension.
ah well I'm using unity physics so I don't think I'm gonna split up a bit onto GPU
but I don't think I need a mesh collider for my boxes 🙂
Yea, good luck. Start exploring more ways to subdivide cubes. Basically you'll end up at compute shaders or very close it.
hah yeah well I started with thinking octrees
but still, ends up with creating/destroying many little boxes...
which I wouldn't dream of in a non dots world...
DOTS definitely is not intending for trees. Any sort of nesting, no way.
you can still do it, you just don't benefit from cache coherency etc much
DOTS is basically how far you can go with making everything fit into a one dimensional array.
lol, well, to a degree yes, but you can still use other things when you need to
Do everything per entity, per index, per data. Basically a CPU shader.
haha yes
In fact, if I remember correctly, that's how they recommend you write DOTS code. Pretend it's a much more flexable frag shader where the pixels being iterated over are entities.
So no loops, no if else, no conditionals beyond inline ?: code.
yes, but they always fall back to, "it always depends on your use case"
just depends on where your hot spots are
Yea, that's unity. Burst is magic though. Everything about DOTS is a simple question: can it be shoved through the burst compiler?
Anyways, I got to get back to work. I'm burning through my free time (procrastinating on homework, the usual) and I need to figure out how dots netcode works.
So can I think of it this way?
Using DOTS at a basic level gives me at least a performance boost of Nx where N is the number of CPU cores. But that's the lower bound. If I can also structure things to take maximum advantage of SIMD and cache coherency and all that good stuff then you really open up the throttle
I wouldn't agree with your opening statement. That's depending on how well you can multithread your code. But ECS does make it easier to jobify if you're following ECS design patterns.
Those design patterns will also lend themselves to playing nice with the cache, and if you do it right a lot will be burstable too
with that combination, you can have really great performance
SIMD you can get in very particular situations
or also hopefully more situations without realizing lol
I have helped a couple of people convert some clunky unoptimised MB hot spots into bursted jobs
for the first guy, he got 100x speedup lol, it was so perfect for job bursting and he didn't realise
the second guy, got a 15-16x speedup on his hotspot
neither of those cases used ECS though, so you can still get great gains with just jobs and burst
and neither of those cases was really thinking hard about the data, more like "how can we get this to run in a burstable job" 😄
Maybe because burst and job are production ready it somehow lock ECS to that verified editor version, idk I’m really trying to figure this out for my own sanity.
Want to see some show off videos I just posted a few minutes ago to show off new tech? :
&
I'm so excited. I got my world builders on. ECS/DOTS is a huge huge technology. Unity's stock will soar!!! And then when people see their cores help the game performance, people will but computers with more cores. Within 7 years, expect 1024 cores. So we get 10-1000x as many objects today. In 7 years, this figure will probably be 1000x-1,000,000x what we have now.
Enjoy the future of gaming.
If you like what you saw, please sub for more. It helps me. It may help you, but I make no promises!
You can also come to like the only positive zone of the Internet I know: www.twitch.tv/goodnewsjim The Bro Zone Layer.
Temporary offer for anyone of any skill level: Can someone contact me to promote my game? www.starfightergeneral.com I'll gi...
If you like what you saw, please sub for more. It helps me. It may help you, but I make no promises!
You can also come to like the only positive zone of the Internet I know: www.twitch.tv/goodnewsjim The Bro Zone Layer.
Temporary offer for anyone of any skill level: Can someone contact me to promote my game? www.starfightergeneral.com I'll gi...
Hi Guys!
I use ConvertAndDestroy mode in my conversion.
For some reason, Authorings are still adding to the entity. Why this is happening?
@remote crater you're underselling. You said 30fps but you: 1. are not in a build. 2. Have the scene view open. (3. did you disable the usual like safety checks and jobs debugger etc?)
But you're overselling the future 1,000x to 1,000,000x in 7 years lol
using System.Runtime.CompilerServices;
//...
public class Klass
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Calc1( float a, float b ) => math.abs( a - b );
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static float Calc2( float a, float b ) => math.fmod( a , b ) - math.pow( a, b );
static void Run()
{
Method( Calc1 );
Method( Calc2 );
}
static void Method( Func<float,float,float> execute = null )
{
for( var i = 0; i < 10000000; ++i )
{
float result = execute( math.atan( i ) , math.sin( i ) );
}
}
}
trying to understand method In-lining
would this example be a good practice ? i want to avoid making 2 Run functions that use Calc1 and Calc2 , not sure how efficient this way of doing this
My concern is about passing the inlined method as an argument : Method( Calc1 );
UnloadTime: 2.379400 ms
NullReferenceException: Object reference not set to an instance of an object
at Unity.Scenes.ResourceCatalogData.GetGUIDFromPath (System.String path) [0x00096] in <6d6849833010407eaf68aacfba8931a1>:0
at Unity.Scenes.SceneSystem.GetSceneGUID (System.String scenePath) [0x0000b] in <6d6849833010407eaf68aacfba8931a1>:0
at Unity.Scenes.GameObjectSceneUtility.AddGameObjectSceneReferences () [0x00034] in <6d6849833010407eaf68aacfba8931a1>:0
** at Unity.Entities.AutomaticWorldBootstrap.Initialize () [0x0000c] in <666db234fd54498496918391b0314900>:0 **
some dots stuff resulting in error in build
You built from platforms package or legacy way ?
ctrl+b
your subscene might not be in the build
okay i saw scene that's why but yeah probs missing entity stuff in your build
sometimes it looks like it works, but there are missing pieces
entities related stuff
that didn't exist when they built the first build pipeline
You can use entities packages from MB
you can access EntityManager, thus your worlds, entities, create queries, and so on
You deleted your questions, all solved then ?
No, I have unity physics package and it displays in entity debugger but my character falls through it
character is MonoBehaviour/GO
Does the character use Unity's dots physics or does it use the MonoBehaviour physics 🤔
character has normal mesh collider monobehaviour
Entity has mesh collider too and convertToEntity
idk how supported dots physics conversion is, been a while since I had used it. But I'd probably check the collision layers
do i need physics body script?
i hope it will work with monobehaviours collisions
They're 2 different systems - they're wont communicate with each other
so you should either pick dots physics or monobehaviour physics
Well if you are converting your gameobject to an entity and it has all of the appropriate components
my project is a hybrid so i need both entities and GOs to have collisions
then you're likely using dots physics
no thats not the case
so you're not converting them - or linking the gameobject to an entity
the world is entities and player is not entity
well to kind of support both gameobjects and entities - you can take a look at companion conversion
your gameobjects will still convert to an entity, but you will still have the gameobject representation
it'll be all entity driven tho, so you will be using dots physics if anything
https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/hybrid_component.html?q=companion look at the Companion GameObjects section
are you completely sure that i need it to make this work?
Well you can only pick 1 physics system as your way to resolve collisions
so you either pick monobehaviours or dots
if you are okay with having your gameobjects be entities driven, then companion workflow may work for you and you will be doing most of your game logic in entities
if you absolutely need things to be monobehaviour driven - then you may have a more difficult time trying to interface things with entities (might need to reconsider your approach)
e.g. you can have your character continue to use the SkinnedMeshRenderer + Animator using the companion workflow (if you don't want to dive into the dots animation package) but have it use dots physics to resolve collisions
The point was you need to pick a physics system. Either gameobjects or dots physics. The two can't interact with eachother
Hey. Enabling hybrid v2 on unity 2020.3.3f1 (hdrp) triggers ArgumentException: Kernel 'CopyKernel' not found. in SpareUploader.cs. Any idea how to fix that?
hello, I have some questions about the job system (without dots) - is this channel optimal for them or should I ask in #archived-code-general ?
Jobs is part of dots so it's fine to ask here
ok great! 1.) can I use coroutines in the job system or should I think of a job as a sort-of coroutine ?
its not possible for me to recode player controller in dots though
theres way too much MONO only stuff eg IK or custom scripts
As psuong said you need to reconsider your approach. The two physics systems cannot interact.
Coroutines only work on the main thread, so they're a bit of a different thing
You can use coroutines and jobs together in some ways but you just need to remember that coroutines are main thread only, and jobs have a lot of restrictions on what can be passed into them
ok understood
- can you please point me to some resource that can help me move an object towards a position ?
That question is probably a better fit for #archived-code-general or #💻┃code-beginner
oh sorry, I think I formulated the question incorrectly, the thing I meant was : how to move an object towards a position using the job system
It's a bit too broad, maybe if you show what you've tried or give a more clear picture of what you're trying to do
say I have a cube; I want to move that cube towards (for example) another cube, the movement should be linear
I guess my question would be why do you need the job system for that
im moving a lot of objects and I dont really want to get into dots
Okay but moving a cube to a position really has nothing to do with dots. There's plenty of resources online on how to do that or you can ask in one the other channels. Or are you just confused about the syntax of how to schedule a job?
the latter
Did you read the manual pages? https://docs.unity3d.com/Manual/JobSystemCreatingJobs.html
What about them isn't clear?
ok this didnt show up for me before lol - for some reason I got a 404 error when trying to look at this before
anyways thanks for you help, Ill check it out!
No worries, feel free to come back if you run into trouble with the implementation
sure thing 🙂
what do you guys think about having whole world and environment made by dots, but when player gets close, you create invisible objects with colliders in place of entities (but no renderer) ?this way u can have monobehaviour collisions and ecs-rendered world lol
of course you can kill colliders when you get further
mesh colliders on invisible GOs can get their mesh reference from entities too
and you can do pooling of these GOs
in my case, id also syns these GOs positions with entities positions every frame
but it wouldnt be really costy at all cause there would be prob no more than like 10 at one time
if you can avoid monobehaviours Id avoid any kind of switching in between
well no i cannot but i think this solution is gold
@gusty comet if it works it works
but imo i'd have ecs be the source of all logic, and only use gameobjects for rendering
so transfer of positions would be ecs -> gameobject
in your case if you wanted to move objects in ecs, it'd be like ecs -> gameobject -> ecs which can cause lots of bugs
the gameobjects are not syncing back to ecs
ecs is moving everything
gameobjects are just copying position and mesh from entities (mesh only for collision not rendering)
I just find it a hassle to have any real interaction between the two in a way that goes beyond interaction or ui. I do use animators for my characters and navmeshagents but I want to drop them asap.
oh i misunderstood then, thought you were using gameobject physics too
i think it depends on what you use those collisions for then
yeah i collide player with them
what in particular do you rely on gameobjects for anyway?
because player cannot collide with entities
so i will pool gameobject based colliders
how do you collide player without syncing positions back to ecs
player is not entity
player MB collides with colliders that are GO-based
GO-colliders inherit mesh (for meshcollider) and position/rotation from entities
why in particular do you have go colliders
just curious about your needs for monobehaviours
cause entity cant collide with GO and most of my game is in GO
if you are adapting an existing project to use ecs I guess it makes more sense, but it sounds a little like these colliders would be static? and in my mind good candidates for being actual entities but its still not a lot of information
well you cant collide player's GO with environment entity colliders
Oh fuck
I think this might be the beginning of the end.
Welp, time to convert my entire logic to IJobParallelFor and IJobParallelForTransform.
Time to roll my own ECS format.
It's been nice knowing DOTS these past few months and years but it's being lowered slowly into the grave now.
I think it’s fine
I honestly think ECS dev are feeling the pain of working in a non stable unity and maybe want to lock the ECS to lts version , I mean noting worse that debugging issues not relating to your current work
This is 200% just my speculation
What ever the reason I did not sleep well
True. Whenever some bug internally from Unity pops up, it's such a pain to find a fix. Like that tempJob allocation error that appears if the game view is not vsync'ed.
Honestly, I'm actually relieved that this post came down. My projects rely heavily on multiple camera and camera layering in HDRP so I'm sticking with the Alpha pipeline.
That means I should no longer care about DOTS. Unity themselves are cutting the support.
I’m in a similar boat
Years ago, back when DOTS was basically Burst and IJob, I rolled my own ECS system using a fuck ton of NativeArrays and custom containers. The boilerplate was real.
Gotta dust off those old codes and reimplement it. Maybe I was onto something back then.
I don’t think ECS is going anywhere
Actually, I wouldnt be surprised if a community version of Entities based solely on a collection of NativeArrays in MonoBehavior appears. Just for those using it for data management.
Burst and IJobParallelFor isnt going anywhere. Unity sunk a metric ton of money into that and is being rolled out everywhere. DOTS, hrm. A lot more murky.
Did they mention ECS and GDC ?
In the forum post? No. Just a declaration that future Entities packages will not be supported on 2021.1 and newer. Only 2020 LTS.
I cant think of a package that was continued to be developed beyond life support that remained in LTS. Last time something like this happened was UNet, and we all know what happened to that.
RIP UNet, but we got Mirror out of that slow death so maybe net positive?
wym
rolling to grave
Make your own entity component system. A bunch of native arrays, one for each "component" aka struct. The indices for the arrays would be the "entity". A set of native arrays all with corresponding indices/entities will be a "chunk". Instead of Entities.ForEach (which is a glorified IJobEntitiesForEach/IJobEntitiesChunk) you go straight down to the root IJobParallelFor and use the NativeArrays as ComponentDataHandles.
The only part from Entities package I'll miss will the the DynamicBuffers. Theres no easy equivalent in the base Job and Container package other than fixed size Buffer lists (RingBuffers and FixedLists).
Actually, when you think about it, I think DynamicBuffers are just FixedLists.
The real sad part is that we'll never be able to fully burst the job creation process now that Entities is dead. Hopefully the newer Burst versions and calling bursted functions in managed code might be ported to the job system.
but why?
Why what?
2021 is already out of alpha. 2021.1 is no longer supported.
oh im on lts lol (2020)
It still works but bug reports and potentially breaking changes will no longer be fixed.
so no updates till end of year
nah no way im gonna make my own entity system lol
just stay at 2020 version
hey guys, question.. let's say i have 20000 moving capsules and I want to act on the collision of each of them (with themselves or other objects)
doing this with ICollisionEventsJob proved to be not enough in terms of performance.. also I assume I have to use Physics Bodies and Physics Shapes in this regard, what implementation would be best to handle this many collision events?
And probably beyond. Yea, my projects go heavy on the HDRP shader side and multiple cameras. I really cant afford to lag behind and then upgrade all my shaders when Unity eventually pushes the entities version to whatever is the current version at the time of release. I dont even use hybrid renderer. I manually sync my entities with game object transforms. So annoying.
Do you still need physics like actual collision and physics bouncing off other objects or are you using these collisions as triggers?
they can be triggers, my action is destroying them on collision
If it's the latter, you can then divide your region where the capsules are at into separate grids then calculating the distances between the centers of each entity to trigger "collisions" without the overhead of physics.
Ah, destruction, there's your problem.
There really isn't any performant way currently to rapidly remove meshes from rendering in parallel, other than creating your own render pipeline that then takes a compute buffer that toggles the rendering state of meshes.
currently, im using one collision jobs to add collided entities to a NativeArray followed by a regular job that iterates over it and uses ecb to destroy them
Yeaaaaaa, no. That's a bad idea. If you're using a regular job, might as well turn off burst and modify the entity's state directly using the EntityManager. ECB is another overhead ruining performance.
how do i access the entity tho inside a CollisionJob?
it doesn't know how to destroy entities, the job can recieve only IComponentData
You can have an entity inside a IComponentData.
i have the entity itself, i just cant access any managers to destroy it within that scope
or am i missing something
Entitymanager is not faster than an ECB. Even in the documentation they recommend using an ECB instead of the entitymanager whenever possible
private struct CollisionJob : ICollisionEventsJob
{
public void Execute(CollisionEvent collisionEvent)
{
//Destroy collisionEvent.EntityA
}
}
this is what i cant figure out how to do basically
You can pass an ECB into your job and destroy them directly. Or if you're adding them all to a native array, you can use the batch operations to destroy them all at once
That should be very fast
well.. I'm not 100% on that @zenith wyvern - I think for simple ops there's definitely a cost of queuing the commands before executing .. esp if you're careful to use an existing sync point. Plus I don't think you can e.g. bulk instantiate with ecb's yet which is quite a bit faster via EM.
but surely destroying them within the collisionjob if possible is the quickest way, instead of managing a nativearray?
Something like this:
private struct CollisionJob : ICollisionEventsJob
{
public EntityCommandBuffer ECB; // Dont remember the exact type.
public void Execute (CollisionEvent collisionEvent)
{
ECB.Destroy(collisionEvent.EntityA); // Or something. Dont have the parameters of collision event
}
} ```
not if you cause a sync point every time a collision happens
Then in the creation/queue of the job, you pass in ECB from the main thread. Dont know about performance, might still be shit.
If it's a ton of entities at once batch operations would be faster, meaning adding them all to an array and using DestroyEntity on the array
If you need performance, and thats what it sounds like with 20k entities, you'll need to customize the render pipeline. In fact, you probably need to do it outside DOTS entirely and use a ComputeShader. I believe the world positions of meshes can be obtained in a shader then use that to compute collision events and then selectively render meshes inside a compute shader.
didnt come across batchoperations yet, should i look in the unityphysics sample project?
There's also an ECB version
rendering is still okay, about 7ms for 20k capsules using the legacy shader
ill check it
regarding actually moving the capsules, would you say this way is the most performant?
protected override void OnUpdate()
{
Translation playerBase = GameConstants.Instance.PlayerBasePosition;
float deltaTime = Time.DeltaTime;
Entities
.WithAll<AttackerComponent>()
.ForEach(
(ref AttackerComponent attacker, ref Translation attackerPos) =>
{
float step = attacker.speed * deltaTime;
attackerPos.Value = Vector3.MoveTowards(attackerPos.Value,
new Vector3(playerBase.Value.x,
attackerPos.Value.y, playerBase.Value.z), step);
}
)
.ScheduleParallel();
}
(they are all moving towards the PlayerBasePosition)
Ouch, vector3. Nope. Use Float3 and math.MoveTowards.
If it exists, just recreate it if it doesnt.
I don't think there's an equivalent in the new math library
I mean, isnt it just lerp?
hmmm looks like no equivalent for MoveTowards out of the box
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
Why doesnt package pages not have their dependencies listed. I have to recreate my manifest file again to remove entities and slot in basic Burst and I dont know what's automatically included.
should manage from here, thanks for your help guys much appreciated
"com.unity.burst": "1.5.1",
"com.unity.jobs": "0.8.0-preview.23",
"com.unity.collections": "0.15.0-preview.21",```
Back to the basics. It's like I time traveled back to 2018.
Has anyone figured out how to launch 2021.2.0a12 or 2021.2.0a11 without the GUI error? Has anyone been able to build a standalone windows in 2021.2.0a10 I think it complained about platforms.
@robust scaffold you escalated so fast 😅 let's wait a little the next announcement to clarify things before giving up ?
I really hope it's because DOTS is branching too much and they cant keep it along the legacy editor
Alpha is no longer supported in DOTS. You'll need to downgrade to 2020 LTS or join me in Burst basics.
this or a really bad packages management server-side
As I said earlier, last time something like this happened was UNet. And where is UNet now?
Jump off the train before it falls off the cliff. Entities is dead. Long live Burst + Jobs.
I'm gonna have nightmares :/
remember the days when we were just waiting for that supposed dots blog post? 💩
well they said they will fix things at the end of year
unity's vague time estimates are hard to believe
kinda funy how they wrecked one of their most important features tho
Unity just has to open their mouths and properly communicate for once. But they rather make the most abstract forum thread and answer three questions and go radio silent right after that so everyone can interpret whatever they want into it again.
I still don’t think ECS is going away, it proven too powerful
I highly doubt that they are going to throw the last years of development away while still releasing .18? That wouldn't make any sense to me
Have they given a date for .18
Unity doesn't give dates, it stresses them out to much 🙃
hey guys, i'm experiencing a race condition between collisions and destroying entities.. so a collision happens twice before the actual destroy happens..
this is the code
{
Ecb.DestroyEntity(entityA);
}
so a collision manages to happen twice for entityA before it's actually destroyed
The entity is destoried when the ECB is played
what ECB did you pick? maybe try a different one
World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>().CreateCommandBuffer()
Try EndFixedStepSimulationEntityCommandBufferSystem the FixedSimulationSystemGroup can/will run multiple times a frame
😦 I was hoping to wake up and see some more info from Unity about this crazyness no updating thing
Unfortunately they have a history of releasing vague and confusing info then disappearing for a while, like what happened when they were going to remove the scriptable render pipelines from github
i know, i just keep hoping they would have learnt by now
there are definitly some teams inside Unity that have, eg the post about the .net update. SOOO many questions answered
yeah, some teams are super communicative, others kind of dont exist outside of what is thrown out there as the end product
with something so public they should make every dev in all of unity have to spend 1 hour a week on the fourms/discord. imagine all the info/questions we could get answered
Remember when we actually had a dots dev in this discord answering questions?
what!!! that must have been before my time
Yea it's been some time
they removed their posts
hope they didn't get in trouble for being the one unity dev that communicates
😦 thats so sad
That's just strange to be honest
yeah he was great. wonder if theres some sort of gag order on communication?
Who did? Topher’s still got msgs here I think?
i didn't wanna use names but his msg history used to go further back
sorry for the noob questions guys but is there a way to disable an entity rather than destroy it altogether? looking for a cheaper way
i'm currently looking at the Disabled component but can't find use cases for it
You just add the Disabled component and that entity will be ignored by all systems/queries unless they specifically look for disabled entities
That includes the renderer
@crude sierra There is also DisableRendering if you dont want to disable the entity completly
nice good to know
is there a way to disable collisions only as well?
PhysicsExclude might work
will check it, thanks
Should DynamicBuffer be faster than UnsafeList if I use little amount of entities? Can't choose which one to use for storing mesh data
Is your mesh data expected to change ever? It'll be better to use BlobAssets (readonly arrays) for massive arrays. Otherwise, DynamicBuffers are fixed sized lists on entities. UnsafeLists are typical dynamic sized lists but wreck your cpu cache access when used.
Since dynamic buffers are basically FixedLists I believe in the background, I think they have a maximum size of 4086 or something bytes.
So about 1000 floats.
The data is going to be changed a lot. Afaik DynamicBuffers can be resized.
I think they have a maximum size of 4086 or something bytes
I somehow sure they don't since I've used it with more than 1000 floats.
If you'll be using more than 1000 floats in a single list, might as well use a NativeArray/List, skip the entities.
You mean using stateful systems? That's an idea 🤔
KornFlaks — Today at 3:37 PM
Alpha is no longer supported in DOTS. You'll need to downgrade to 2020 LTS or join me in Burst basics.
For real?
Cuz my code won't downgrade to that.
Can I just wait it out til a future version?
I've seen people say they are using 2021 without issues, but official word from unity is that only 2020 is supported/will work in the future
For a while
yeah im also on 2021.2 with almost every dots package
funny cos it almost felt like smooth sailing, almost everything working perfectly
I have a finished game that won't make a standalone.
At least you guys are telling me I have to fudge updating/downgrading my project over and over until I find the right version.
That is helpful.
Gonna take a lot of loading bars with my 17 gig project. Takes about an hour to check a version.
But what is a programmer than patient?
I just downgraded my current project to 2020, it wasn't to bad, the hybrid renderer broke and a script couldn't find its dependencies
Which one is fixed update lol
Bloody hell I wish Unity would say something already, people are already writing ECS eulogies
yea i know
It’s not dead
IKR
Dealing with a lot of stress here , I’m like 7 coffees in checking the dam thread every 5min
I mean just say it not dead so I can carry on w life here
haha yea, i know, i too keep checking it
ive put wayy too much time into ECS and even tho i 'know' unity wont drop it, i still want to know for sure
their track record is unfortuanlly not good enough
Yea I’ve spend so many 1-3am learning it hoping to get a leg up
The fuck, hahahahaha
It would be a blow for sure
I tried downgrading my working alpha build, here are two dif versions, maybe similar errors: https://crystalfighter.com/code/3.png https://crystalfighter.com/code/4.png It isn't fun having a working Action MMORPG engine ready to play in but not being able to publish.
The thread on the compatibility is as hilarious as it is terrifying.
Dont downgrade then. Downgrading requires you opening up an entirely new project then manually copying over the scripts one by one to check if it works.
When I saw you typing @remote crater I really thought it was going to be good news
I know i shouldnt read it, just wait for more info, 😛
I was wondering if you guys had advice on where to go? I could really just wait for alpha 13, 11 &12 don't work
Yea, but it's just the usual names on the forum coming out one by one and saying it's dead or it's not dead. It's very entertaining.
Maybe try .09
If Entities works, stick with it. If it doesnt, hrm. That's a problem if your code is heavily built with entities.
The game 100% works in editor when hit rn
When I hit compile, it has a different version for windowws
From the errors, it just looks like Entity package isnt being imported.
Only ECS/DOTS part, the actual gameobject mode plays fine
Check your package list. Is Entities on it?
So maybe mess with my mainfest, ty
Yea, copy this in: "com.unity.entities": "0.17.0-preview.41",. I think. I wrote that out by hand.
yah, for some reason it mauled my maifest.json
If you want stability with DOTS, you'll need to go all the way back to 2020 LTS. Or if you read through the doomsayers on the forums, drop Entities all together and somehow go it alone and make your own ECS.
Its awesome tho, everything does what I want. I have a working game. I just need to hit publish for standalone on different platforms.
MAYBE! That's what I do, maybe I standalone not on windows!
I have pc parts coming in the mail for Linux.
Wait, are you using Platforms build?
I think someone said I have to have WIndows platforms or some junk
Dont use the built in, use platforms.
What is platfoirms?
Yea. "com.unity.platforms.windows" Dont remember the version so you'll have to add it in via package manager and git.
That doesn't work I think
I already tried that, new errors. I'll try again if downgrading doesn't work
TY
It will work. Trust me. I've been typing out manual git links to package manager for countless dead projects. Use that and build using platforms.
Nope, there's a new asset that platforms brings that you then click build on.
like a menu item?
Yea.
It shows up in the inspector. I dont have a project using platforms right now though.
Lots of great info to run with here. Thank you all very much. Remember anyone who helped me, if I end up making millions, track me down and ask for manilla envelopes 🙂
all g g, you helped enough already
Heh, nah. I dont take money for programming as a hobby. All my projects are open source and the very little donations I get go to my local childrens hospital as charity.
So if you have any spare cash, go donate it to charity.
you got it bro, and may God bless you for helping brothers and sisters of humanity!
Good night guys. If anyone gets a tip of what I should do from here, let me know. I used Universal Windows Platform: https://www.crystalfighter.com/code/5.png And here is what happened when I 2x click the .exe: https://studio.youtube.com/video/8DtrSMyxPXI/edit How do I fix those errors that won't let me standalone run, or ideas of where to go. Take care and God bless.
Share your videos with friends, family, and the world.
Your video link doesnt work, dont link to your studio but instead directly to the youtube vid. Or just screenshot the error message.
Is there any info or package about using particles in dots?
@remote crater Don't ever use the legacy builds with DOTS, use the new build asset. All explained here: https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/install_setup.html#standalone-builds
so install com.unity.platforms, plus additional platform packages com.unity.platforms.X, com.unity.platforms.Y, then create the build ASSET, click on it from your project folder, and build from the inspector only
just noticed scale is a single float not a float3/vector3
pooledColliders[0].localScale = entityManager.GetComponentData<Scale>(closestEntity).Value;
how do you get scale in localScale format (vector3/float3)
theres only one Value in Scale
oh theres NonUniformScale
yeah and at least 1 other one IIRC
but will my GOs have it? they were converted with ConvertToEntity
Your GO no
your entities yes
the transform matrix is computed differently based on which combination of these components are present when the system runs
Last time I checked though, I had a hard time having the system take into account scales and pivots :/
@remote crater
ok thanks man
@remote crater
i heard that Ecb is faster than entity manager mb i should change
does anyone have a reference or can explain how to use C# Events/Actions with Jobs?
basically i'm trying to implement a HealhSystem that has a method called TakeDamage, which is invoked by an event caused from another system, so I got
private void TakeDamage(object sender, Entity entity)
{
var ecb = m_EndSimulationEcbSystem.CreateCommandBuffer();
var healthComps = GetComponentDataFromEntity<HealthComponent>();
ecb.SetComponent(entity, new HealthComponent
{
Health = healthComps[entity].Health - 1,
ShouldDestroyOnDeath = healthComps[entity].ShouldDestroyOnDeath
});
}
but using this I get an error
InvalidOperationException: The ComponentDataFromEntity<HealthComponent> has been declared as [WriteOnly] in the job, but you are reading from it.
collidersLTWs[i].transform.position = collidersLTWs[i].localToWorld.Position;
interesting, this wont work every frame in MBs cause localToWorld is a struct. so I would have to GetComponentData every frame.
and ref keyword didnt work unfortunately, any advice? how to use reference to localToWorld, or make entities expose some values so i dont have to getcomponentdata all the time, and instead cache the component?
maybe i can set MB variables from inside a System, to avoid getcomponentdata calls
Our High Performance C# (HPC#) compiler technology, Burst, just keeps getting better. That’s why we want to unpack some major improvements made in the most recent version, Burst 1.5. In this post, we’ll take you through the headline features and their benefits, so you can make the most of Burst in your projects. Arm Neon […]
Afaik you can't use C# delegates with jobs.or burst. But you can use burst FunctionPointer
is Rotation worldrotation and Translation localposition?
i think translation is local and rotation is world
@gusty comet they're both local
if you want world pos/rot you get them from LocalToWorld
im sure rotation is world , i did read that on forum, and it also works in world manner
not sure why that would be the case, that sounds more like a bug if it is?
ok fine maybe youre right
anyway do you know answer to this?
Entities.ForEach((ref GalaxyData galaxyData, ref Translation translation, ref Rotation rotation, in Entity galaxy) =>
{
galaxyData.elapsedTime += galaxyData.positionStep;
translation.Value = new float3(Mathf.Cos(galaxyData.elapsedTime) * galaxyData.orbitRadius, Mathf.Sin(galaxyData.elapsedTime) * galaxyData.orbitRadius, 0f);
rotation.Value = quaternion.Euler(galaxyData.rotationStep * galaxyData.elapsedTime);
if (galaxy.Index == closestGalaxy.Index)
{
DynamicBuffer<Child> childBuffer = GetBuffer<Child>(galaxy);
for (int i = 0; i < childBuffer.Length; i++)
{
// this only extracts entity from loop i think so you cant supply entity
GetComponentDataFromEntity<Translation>(childBuffer[i]);
its great that u can use GetBuffer without entity manager inside ForEach
but i cant kinda get component data of child
i mean i could use entity manager but i heard it blocks threads
not sure
thanks, will check it out
Maybe have a closestGalaxyPosition component if that's what you're only interested in in the end would be faster.
too add to my statement I made earlier where I said my project was fine when I downgraded earlier, it wasn't, it broke everything 
yeah I'd advise against doing it if you can
to be honest im having issues with filtering closest entity.
i tried to calculate disitance but it wont let me write to variables outside ForEach
dully noted, thanks, and good luck
did you try capturing with a native container (even if one var it's okay) declared before the lambda ? Then in the lambda you can work with it, and get it back after the job as executed
or .Run() if you don't need a job and it would be okay because main thread
native array?
//OnUpdate()
// native container outside the scope of the lambda
NativeArray<T> valueContainer = new NativeArray<T>([...]);
Entities
.ForEach(([...])) =>
{
valueContainer[0] = [...]; // write to container inside lambda
})
.Schedule();
// back outside of lambda scope, valueContainer has been mutated
wow it can write
to native stuff, thanks
one question though, it doesnt let me add float3 to native array float3 type
yeah the job will access to the container memory, even on another thread
🙂
Keep in mind if you check distance only once per frame, or even only a few times, you might as well just keep it simple with a .Run() instead of scheduling
unless you have hundreds of galaxies
i check distance every second, but once i find closest Entity, i write data eg pos/rot every frame
i have hundreds yeah
so i can check distance with .Run()
but i still need to write pos to native array in Schedule()
btw i assume theres no alternatives for nativearray for single values eg float quaternion?
There is one for single values called NativeReference<T>
ooooh nice
so empty DataComponent is a tag, that you use to query entities?
So i had some fun looking at the generated burst code, wondering if anyone has a clue as to why something like
return new float4(x / a, y / a, z / a, w / a);
generates the vcvtdq2ps instruction which converts a double word integer to packed floating point.
vs doing something like this:
return float4(x, y, z, w) / a;
doesn't generate that instruction (bottom picture).
InvalidOperationException: The previously scheduled job GalaxySystem:OnUpdate_LambdaJob1 writes to the Unity.Collections.NativeReference
1[Unity.Mathematics.float3] OnUpdate_LambdaJob1.JobData.positionNR. You must call JobHandle.Complete() on the job GalaxySystem:OnUpdate_LambdaJob1, before you can read from the Unity.Collections.NativeReference1[Unity.Mathematics.float3] safely.
is there any workaround to this?
Ensure the first job that uses the native container is passed as a dependency to the second job
container in warning is used by only one ForEach
Can you show the code?
NativeReference<int> closestIndex = new NativeReference<int>(Allocator.TempJob);
NativeReference<float3> positionNR = new NativeReference<float3>(Allocator.TempJob);
NativeReference<Quaternion> rotationNR = new NativeReference<Quaternion>(Allocator.TempJob);
Entities.ForEach((ref GalaxyData galaxyData, ref Translation translation, ref Rotation rotation, in Entity galaxy) =>
{
galaxyData.elapsedTime += galaxyData.positionStep;
translation.Value = new float3(Mathf.Cos(galaxyData.elapsedTime) * galaxyData.orbitRadius, Mathf.Sin(galaxyData.elapsedTime) * galaxyData.orbitRadius, 0f);
rotation.Value = quaternion.Euler(galaxyData.rotationStep * galaxyData.elapsedTime);
if (galaxy.Index == closestIndex.Value)
{
positionNR.Value = translation.Value;
rotationNR.Value = rotation.Value;
}
}).Schedule();
God.position = positionNR.Value;
God.rotation = rotationNR.Value;
God is static class
Oh, it's because you're passing your container into a job then immediately trying to read it on the main thread
Think about what's happening there - you schedule a job, then before the job has even had a chance to run you're trying to read the results
So you'll have to force complete your job or rethink how you're reading the data
is there something like OnComplete for jobs
Or just change it to .Run instead of .Schedule
So it runs immediately on the main thread
no that will defeat the purpose of using dots
In which case you wouldn't need the native containers
Like I said you'll have to rethink how you're reading your data then. If you want to use monobehaviors in dots you should be using hybrid components, although that still wouldn't help you here. Trying to use monobehaviors is always going to make it very hard to utilize dots effectively
You can also try double buffering your position and rotation values by keeping a copy of the previously known processed data. So you schedule your jobs and at the start of the next frame, you read the data into your monobehaviour.
but yeah definitely agree with Sark here, interfacing MonoBehaviours with DOTS has always been a point of contention. Easier to just pick one side that handles the game logic and utilize gameobjects for other things - whether it's rendering or something else
So you schedule your jobs and at the start of the next frame, you read the data into your monobehaviour.
how would you do that? i noticed native containers cannot be class variables so they can be only used during OnUpdate
make a persistent container or allocate a pointer
struct SomeJob : IJob {
// Choose one option or the other on implementation
// Option A:
[NativeDisableUnsafePtrRestriction]
public T* data; // where T is some blittable data type of your choosing
// Option B:
public NativeReference<T> dataContainer; // Allocated with persistent allocation in OnCreate or something
public void Execute() {
*data = some_value;
dataContainer.Value = some_value;
}
}
// In OnUpdate()
your_monobehavior_or_class.value = *data;
var job = new SomeJob {
data = some_external_pointer, created in OnCreate()
dataContainer = a_native_reference_allocated
}.Schedule();
you can still do it for ForEach lambdas, just takes a bit more writing.
you'll need to copy class variables into a local variable
i kinda get an error if i try to access native container that was not made in OnUpdate
You'll probably need
T* data; // class variable
// OnUpdate
T* copiedPtr = data;
Entities.ForEach((...) => {
// Use copiedPtr here
}).WithDisableUnsafePtrRestriction(copiedPtr).Schedule();
even if persistent
depends on whatever your error message is
but if it's complaining about lambdas can only work with local variables, then just make a copy of the container
yea just be careful with native containers - they're structs so you're not copying all of the reference exactly
ohh so im not copying reference
the pointer internally will be copied (so it points to the same data) but properties like Length might be manipulated on a shallow level
Quick design question...
Lets say i wanna make my player teleport to a mob, once that mob was clicked.
I could either do something like : Mob-Entity{ OnClickTeleportTo{ position}, OnClickTeleportToThisEntity } where OnClickTeleportToThisEntity injects the entities position into OnClickTeleport. And OnClickTeleport simply teleports the clickers ( The Player ) to that position.
Or i could choose another way like this : Mob-Entity{ OnClickTeleportToClicked } where i specialise a component for this task instead of "composing" components to achieve the same.
What way would you choose ? Does it even make sense to split such features into multiple components ? 😮
tbh I'd probably just start basic - click on mob, get position, pass position to another job and move entities all in the same system
So in that case... its the second example i posted... a OnClickTeleportToClicked component with its system to do that ^^ Is there any advantage if i go with the first example ? I actually just think its more complicated...
idk, I tend to start with large fat systems instead of splitting it up too much (mainly cause I'm lazy)
Alright, thanks 🙂
Hope there's someone who can answer this one:
Already implemented ITriggerEventsJob/ICollisionEventsJob, and I'm able to detect and handle collisions between my entities (or better said, their physical bodies).
However, I was expecting some "filtering" to match the entities involved in the collision, but it doesn't to work like that.
I was expecting my methods to be invoked when entities with componentA and B (for example) collide, but instead both TriggerEventJob and CollisionEventJob get fired when any entity collides with another, and inside the method I have to manually handle events based on type.
Is that the expected way?
Assuming that would be the expected way...should I have a general system to handle collisions which tags entities as colliding and then handle those with their respective systems? (eg: carCollisionSystem, bulletCollisionSystem, doorCollisionSystem...) Is that the expected way?
will the entities use different chunk if mesh is different? (assuming all the components are the same type)
hmm that seems not the case according to inspector
If you have two entities with RenderMeshes and they both have a different mesh they will be in different chunks
Because RenderMesh is a shared component
ohh i see
according to docs structural changes cause syncpoints. what about reading data with EntityManager (eg GetComponentData/GetBuffer) ? is it also causing Syncpoint
I think in lambdas those get translated to GetComponentDataFromEntity and GetBufferDataFromEntity calls - you can verify in the DOTS -> DOTS Compiler -> Open Inspector
oh according to tests theres no frame drop with 100 GetComponentData calls per frame
(its also a bit faster than GetComponent)
100 is fairly negligable. Try 10,000 to get a noticeable drop.
I love this post
https://forum.unity.com/threads/unity-tech-where-is-the-simple-bridge-between-monobehaviours-and-ecs.823485/
Thank you KornFlaks, this is the video: https://youtu.be/8DtrSMyxPXI
If you like what you saw, please sub for more. It helps me. It may help you, but I make no promises!
You can also come to like the only positive zone of the Internet I know: www.twitch.tv/goodnewsjim The Bro Zone Layer.
Temporary offer for anyone of any skill level: Can someone contact me to promote my game? www.starfightergeneral.com I'll gi...
This is the build: https://www.crystalfighter.com/code/5.png
I tried to use Windows Platform Universal to compile, but when I tried to run .exe it had errors, shown in video.
I'm sorry for such question. I get dependency error for code below.
protected override void OnUpdate()
{
var ecb = _ecbSystem.CreateCommandBuffer();
var linkedEntityGroup_BFE = GetBufferFromEntity<LinkedEntityGroup>(true);
Entities
.WithAll<Disabled>()
.WithAll<SpawnedEntityDisableSyncTag>()
.WithNone<OnDisableEventDoneTag>()
.ForEach((in LastSpawned lastSpawned) =>
{
if(lastSpawned.entity == Entity.Null)
return;
if(linkedEntityGroup_BFE.HasComponent(lastSpawned.entity))
{
var linkeEntityGroup = linkedEntityGroup_BFE[lastSpawned.entity];
for(int i = 0; i < linkeEntityGroup.Length; i++)
ecb.AddComponent<Disabled>(linkeEntityGroup[i].Value);
}
else
ecb.AddComponent<Disabled>(lastSpawned.entity);
})
.Schedule();
}
Error in console:
ArgumentException: The previously scheduled job DisableSpawnedEntitySyncSystem:OnUpdate_LambdaJob0 writes to the Unity.Entities.EntityCommandBuffer OnUpdate_LambdaJob0.JobData.ecb. You must call JobHandle.Complete() on the job DisableSpawnedEntitySyncSystem:OnUpdate_LambdaJob0, before you can write to the Unity.Entities.EntityCommandBuffer safely.
What i try to achieve is to reproduce EntityManager.SetEnabled(bool) but with EntityCommandBuffer. And in this particular case with i want to:
when spawner is disabled disable entity which was spawned by it
Short answer call AddJobHandleForProducer at the end of your update where you pass Dependency as the parameter.
Long answer:
The problem in the snippet that you sent is that the ecbSystem is not aware that your systems job is running.
It will try to play back the command buffer that you create with CreateCommandBuffer once it updates. But since your job is still running the JobDebugger will yell at you that you cannot write and read to the entity command buffer from two sources at the same time.
To fix that you call AddJobHandleForProducer which makes the EntityCommandBufferSystem complete your job before playing back the buffer.
oh, yes. I completely forgot about this AddJobHandleForProducer. I'm sorry, too much time working with main thread 🙂 Thank you!
what if theres lot of chunks?
is the performance still better than on GOs?
i have 30 now but i may have even hundreds
@gusty comet Chunks of how many entities?
the more entities you can fit in a single chunk the better performance will be
but even the worst case (1 chunk with 1 entity) should be faster then GOs
also theres advice to break apart bigger entities, so instead of 1 huge player entity you make a bunch of smaller ones (Player, PlayerStats, PlayerInventory, PlayerSkill1....)
that way you have smaller entities which means more will fit in a single chunk
(ps player is a bad example as most games will only have a few (or 1) players)
my entities would be mostly the same but they have rendermesh
one chunk has like 2-20 entities
ok so each unique render mesh moves things to its own chunk
yeah thats what they said
so 20 different tree models = 20 chunks
yes
cool
kinda bad
i havent added trees yet
now that i think of it, i may even have thousands of chunks
later in the development
and also if your using schedule vs schedule parallel
yeah thats the diff
yea a game with 1000s of unique models probably is very possiable these days
but also that sounds like a future issue 😛 worrying about something that may not happen, also by the time you get to that Unity/Dots/Hybrid renderer should have had a few updates, and hopfully will handle that even better
na never used it sorry, my use of hybrid gameobjects is almost NA
yes
URP or HDRP?
yea i think v2 requires URP or HDRP
yes i changed to urp for v2
which means you would need to remake your shaders
but failed to edit shaders
which is a whole pain
not sure theres a good soultion
can you remake the shaders in shader graph?
LOL no way
i mean code editing
i fixed some errors
but didnt fix what i assume to be final error
i know but shader graph def supports URP/HDRP and Hybrid renderer
custom code shaders also support
yea but theres extra ytou have todo to support hybrid renderer
where with shader graph its a checkbox
I think all that checkbox does is the equivalent of adding the shader feature/compile flag for the shader lol
yea i dont know what it actually does 😛
Difference between Schedule() and ScheduleParallel()?
basilcy schedule is 'single threaded'
schedule will process each chunk of entities all on 1 backgrould 'thread'
ScheduleParallel will break up the chunks to be processed in DIFFERENT threads
ScheduleParallel has a bit more complexity to using it
- in smaller cases is actually slower
eg using a command buffer, you need to use the Parallel version in ScheduleParallel
which means you need the entityInQueryIndex
and same for other native collections
its the sort of thing thats only noticable with LOTS of ScheduleParallel
nono im sure if it would be noticeable but my gpu keeps my fps at 240
and i think its main thread cost
in either case
the are working on reducing the main thread costs of Schedule and ScheduleParallel
maybe 0.17 had some of those fixes already
Don't use this build menu anymore with DOTS. Refer to my previous messages where I tagged you.
From here #archived-dots message
hey guys, is there a sample project or docs for using DrawMeshInstancedIndirect with ECS?
suprisingly I'm actually doing something like that right now
I actually just got it working lol
i cant use pointers in unity
Well, what's the error?
i think its just vsc
You can use pointers. Enable unsafe code in the project settings under Player or Editor, forgot which one. Not entirely recommended because it ruins the whole point of safety checks that DOTS has built in.
I mean, you can do it. If you really need to. Like re-implementing the IJobMultiHashMapXX jobs. Those must use pointers to internal buffers but otherwise it's recommended you find a way to do it without pointers.
@crude sierra the general idea, is you can query all the local to world positions of your entities and set up the ComputeBuffer args. For the ComputeBuffer args:
// Initialization
ComputeBuffer xformBuffer = new ComputeBuffer(max_count_of_positions, sizeof(float4x4));
someMaterial.SetBuffer("VariableName", xformBuffer);
// In an update loop
xformBuffer.SetData(matrices, 0, matrices.Length, matrices.Length);
Graphics.DrawMeshInstancedIndirect(mesh, 0, material, bounds, argsBuffer, ...);
In your vertex pass, you can reference the correct matrix by passing in the instanceID as a parameter. You use this instead of unity_ObjectToWorld instead.
you need to allocate data, usually through a malloc call. Look at UnsafeUtility.Malloc (which is what unity uses)
interesting, but you cant attach this rendering to non-shaders right?
wdym? ultimately you'll need a shader
is there any way to see current syncpoints?
did you do your test with shadergraph? i also was investigating some drawmeshinstancedindirect example from the manual but was too lazy to try to port the shader code to urp
No, I just wrote the shader myself. tbh I didn't know shader graph supported StructuredBuffers
what if im just rendering default capsules with legacy shaders?
well the legacy shaders won't work with Indirect, because they don't have a StructuredBuffer variable
also, I couldn't understand how rendering it from code aligns with lets say EntityManager.Instantiate()
do you instantiate the entity without renderer, and assign it via code?
This is my URP equivalent for the vertex pass. A lot of my inputs are in their separate files
thanks gonna give it another go
when you instantiate an entity, it creates a copy of the entity and whatever is associated with it. So if your entity has a LocalToWorld component, you get an entity with that component. You can then add a sort of "Rendering" like component to it via code
most common way is to add converttoentity component to scene objects
yes yes i'm aware of that, but assuming I want to use DrawInstanced I can't use Unity's default Mesh Renderer in my prefabs right?
basically my questions is where is the line with
EntityManager.AddComponent<MeshRenderer>()
Like that line specifically or an equivalent?
i'm missing the link between the entity and how it's rendered
For something like hybrid renderer v2, I don't remember all of the components you need, but typically the conversion workflow will do something like EntityManager.AddSharedComponentData(entity, new RenderMesh { ... });
RenderMesh will contain mesh data and shadow casting options so hybrid renderer can render it. But I have little experience in using that.
so the actual DrawInstancedIndirect happens within the shader code?
DrawInstancedIndirect is just a regular UnityEngine API call - so what I did was just write my own renderer, cause I'm not using Hybrid
in pseudocode this is what I did
// In SystemBase
var query = GetEntityQuery(typeof(LocalToWorld));
// In update
var ltws = query.ToComponentDataArray<LocalToWorld>();
// Set up the compute buffers
computeBuffer.SetData("_Matrices", ltws);
// Use DrawMeshInstancedIndirect to draw all the meshes
Graphics.DrawMeshInstancedInDirect(...);
Can you do that from a non-main thread?
not that I know of, I'm just calling it from the main thread
and that is instead of having a Mesh Renderer component attached to your entities
i think i understand
thanks!
might be possible if you plugin a different native renderer? I haven't tried that yet.
@crude sierra https://docs.unity3d.com/Packages/com.unity.rendering.hybrid@0.11/manual/runtime-entity-creation.html workflow/api for creating entities that get rendered in dots in case you havent seen it(regarding your addcomponent question)
will def check it out, thanks
I'm optimizing terrain picking. At a super high level, I'd like to do something like this:
if(chunk.ExpensiveCollisionCheck())
collisionList.Add(stuff);
}).ScheduleParallel()
Complete()
foreach(stuff in collisionList)
...```
What's the best approach here if I want to maintain parallel scheduling *and* variable-length output of said scheduled work? NativeMultiHashMap?
Note that I can't parallelize after Complete(), as some calculations require e.g. all collision data to be sorted first
Yes that's "expected", at least that works good enough like that atm. Like the first time I talked to you about it, that's how Unity built it for now, and it can seem a little hacky sometimes. So yes you have to check that entityA and B fulfil you requirements, in your case make queries and check .HasComponent(entityA) and/or B
For your second question, I guess you could have a "collect" job as a first pass, but I would keep every logic seperate (avoiding a big triage system with let's say a lot of switch statements - if I understand well what you mean)
in regards to that, I literally did whats written almost identically, and getting this error:
The previously scheduled job EnemySpawnerSystem:SpawnEntitiesJob writes to the Unity.Entities.EntityCommandBuffer SpawnEntitiesJob.ecb. You must call JobHandle.Complete() on the job EnemySpawnerSystem:SpawnEntitiesJob, before you can write to the Unity.Entities.EntityCommandBuffer safely.
I feel like some of that doc is outdated tho because of the API to create entity command buffers
ive not tried using ecb's with sharedcomponents so not sure
okay, does anyone know the musthave components when creating an entity?
I'm getting this error:
A component with type:{0} has not been added to the entity.
When I try my standalone.exe it says: The code execution cannon proceed because MSVCP140_APP.dll was not found. Resinstalling the program may fix this problem, same for: VCRUNTIME140_1_APP.dll, and VCRUNTIME140_APP.dll I was told to use the Universal Windows Platform because the normal windows compile does not work for DOTS.
Any clues?
Its the worst feeling when you thought you crossed the finishline, but there is one brick wall there you didn't expect
Didnt know that the normal windows compile dosnt work 😦
but yea with DOTS it always feels like theres another wall 😛
when i first ever built stuff it was fine in editor and the builds worked, but was exploding cause i was using a class based componet (which contained another class ect)
was very annoying
new version a13!
Maybe this one loads to editor unlike 11 & 12, and then compiles to standalone unlike a10. So you're saying there's a chance.
well i wouldnt put too much hope in it
support for Entities is locking at 2020 lts
for at least a year
😦
have you tried 2020?
😦
I just gotta get a standalone
Its a finished MMO with 2 new hyper technology DOTS and New school MMO networking
minus some levels built
hmmm well your going to be in a very odd place going foward, as future updates will likely be locked at 2020 lts. If you can get a build working you should NEVER change any of those versions 😛 no unity update, no ecs update
infact i would version lock the entire project, dont update any packages :/
Ok, so I still get the error I get in a11 and a12 in a13: Library\PackageCache\com.unity.platforms@0.10.0-preview.10\Editor\Unity.InternalAPIEditorBridge.012\EditorGUIBridge.cs(15,45): error CS0426: The type name 'HyperLinkClickedEventArgs' does not exist in the type 'EditorGUILayout'
Has anyone ever fixed that? It is just one error.
@remote crater i would think your best bet is to copy platforms into a local package, and then try to fix that error
is it only happening during build?
I tried to remove all platform segments out of /packages/manifest.json
and /packages/packages-lock.json
it hapens on convert a10 to a13
it completely changes my manifest too, removing entities n stuff
Are there any tutorials on the DOTS sample? Or Unity Learn documentation?
Enter the Boss Room support is pretty good, anything like that for the shooter project?
yes
Let me link
Lots of youtubers do stuff
Search dots ecs unity
but filter last month or last year
I meant more official Unity tutorials, I googled and saw some stuff that looked OK
I thought maybe it was hidden away in a secluded tropical github repo somewhere
github with physics n stuff yah
name is liek
EntityComponentSystemSamples-master
I meant specifically for this project: https://github.com/Unity-Technologies/DOTSSample
Thats it, 6 ish hours over 2 days of trying unity different versions and configurations to no avail. Maybe A14 will let me update.
title?
You should stick with 2020 LTS, as per unity announcement...
they are not supporting 2021 until next year, or so they say for now