#archived-dots
1 messages · Page 159 of 1
the jobs system is tested thourouly, if anything some of your inputs are undefined or something
So, I found this line to be the culprit as of now, does anyone know why the commented out line (inside a job system) causes a big crash? Literally just that line
@icy kestrel maybe an IndexOutOfRange exception? your currentItemCount may be bigger than it was supposed to be (thus causing the crash)
When removing the line and debugging the statement, I find that currentItemCount = 0 and items.Length = 25600. item also seems valid each time. I don't really see any errors here
My sort up procedure seems like it has to be the issue here since it involves a while true loop. Could this relate to my code above freezing? But this did work before outside of a Job System.
You can compact that by inverting the if and breaking immediately
//Inside while
if(item.CompareTo(parentItem) <= 0))
break;
//other stuff
What's the settings for the job? Without burst? .Run()?
How do you run it?
This is where it runs from, and without Burst atm but I would like to use it.
Oh ok, should I look at converting everything to native stuff so I can do that sort of thing? It means no Heap which increased my performance a lot
As always, it depends.
It might not be worth it on account of complexity of code, debuggability, readability, etc, especially if changing away from it improved perf
Ok I'll focus on trying to fix the issue at hand for now then, do you have any ideas? I'm completely lost xd
Start by giving the while a safeguard
Which realistically speaking means turning it into a for running for like 1000 (or some other big number - estimate it to be a bit bigger than you ever expect it to run
that should stop it from running infinitely
And just to check, start with a low number, 10 perhaps, and increase it 10x each time
I converted it to a for loop with 10 iterations and it still freezes and crashes
Might be Swap that breaks? Does it do an array set?
Could be some trouble with array index of out of bounds and no exception from job
it crashed as in freezes? or closes @icy kestrel
Brings my CPU to 100% and I have to force close Unity
Sounds like a deadlock
How are they caused?
something looping forever
freezes, yup
or something waiting on a thing to finish, that never finishes
Ah yeah, but I don't have any loops left i dont think xd
maybe its your compareTo, if that always returns > 0 you loop forever?
I mean, that while(true) up there looks very likely
Yeah they are all for loops now
What does the updated code look like?
Shall I just send a paste bin with everythiing in it?
maybe your CompareTo is broken?
mine is this
public bool IsMoreEfficient(Node obj) {
var CostA = gCost + hCost;
var CostB = obj.gCost + obj.hCost;
if (CostA == CostB) { return hCost < obj.hCost; }
return CostA <= CostB;
}
this all needs to be rewritten as a native container i think?
Just wondering, why write your own sort instead of the NativeArray Sort extension?
Just converting now my old A* algorithm which came from an old tutorial^
I can't seem to find where my compareTo comes from
it depends on what T is
try searching on your IHeapItem<T> implementation
(probably the Node : IHeapItem..
try replacing it with mine 😛
yours should be returning -1, 0, or 1
public int CompareTo(Node nodeToCompare) {
if (nodeToCompare.fCost == fCost) {
if (nodeToCompare.hCost == hCost) { return 0; }
return nodeToCompare.hCost > hCost ? -1 : 1;
}
return nodeToCompare.fCost > fCost ? -1 : 1;
}
I can't find the while loop in your posted script @icy kestrel
The for loops were the while loops^
and removing them fixed the freezing, right?
No xd
well good to know xD
how often do you request for pathfinding.Execute() ?
you gotta be careful in dots and async
because you can easily flood new threads and freeze your machine even with MonoBehaviour.Update()
is it easy to try requesting once per like half a second or so?
(or just on Awake())
I have called it just once but will be ever 0.2s eventually
just once freezes it, huh xD
Yep
idk add an conditional exit there
int xxxx = 0;
while (openSet.Count > 0) {
if (++xxxx > 1000000) {
Debug.Log("Breaking coz of this");
break;
}
...
Ok ill try that
Got an interesting result from that
Still freezing, but my CPU is down to 0%
Won't come back tho
probs waiting on the job 😛
void Start() {
PathRequest pr = studentComponents[i].studentStateManager.GetPathRequest(studentComponents[i].studentUnit.OnPathFound);
PathFindingJob pathFindingJob = new PathFindingJob
{
_pathStart = pr.pathStart,
_pathEnd = pr.pathEnd,
_canClimb = pr.canClimb,
_success = studentComponents[i].studentStateManager.success,
_path = studentComponents[i].studentStateManager.curPath,
};
pathFindingJob.Schedule();
pathFindingJob.Complete();
}
yeah no idea 🤷♂️ sorry
you can only send native containers and blittable types to jobs, ofc it'll crash if you send managed types..
Am I doing that?
I don't know, I don't see the types of your variable; but you said you didn't know about that so I assume you did
pathstart is v2, pathend is v2, canclimb is bool, success is nativearray<bool>, curpath is native list<float2>
it seems to be my memory that sky rockets rather than my cpu now
If I complete 1 job, then afterwards complete the job agaiin on different data, my game does not freeze. Any ideas why it doesn't work in parallel?
Sorry for the super basic question, but is RenderMesh unique in it's behaviour as a component?
Hmm, am I just missing an include that isn't a default or something?
Oh, yep
using Unity.Rendering;
I just assumed all the "defaults" would work out of the box - didn't even think of that for some reason.
The new compareto method hasn't seemed to have changed anything
There's just something anti-parellel going on and idk what
@icy kestrel is that link above still the version you're using, cause its got managed stuff in it like Vector2[] waypoints = new Vector2[0]; and List<Node> path = new List<Node>(); and new HashSet<Node>() im suprised it even compiles. You also cant use foreach unless you have a struct with foreach(ref whatever construction.
It is yeah, I thought I could use any temporary variables I needed, oops. Am I not able to use my Heap too?
Is the GameObjectConversionSystem only available at the start of the program?
Can I somehow access it on runtime to add prefabs etc
I think you can use
GameObjectConversionUtility.ConvertGameObjectHierarchy
or maybe other methods within the GameObjectConversionUtility class
Alright thanks
GameObjectConversionUtility.CreateConversionWorld would be really useful but sadly it's internal
@icy kestrel if its got class on it then you can't use it. External static methods that live on a class can be called from within the job, but anything passed in or created within has to be a struct. This is pretty old now but might help https://github.com/jeffvella/UnityAStarNavigation/blob/master/Assets/Plugins/Navigation/BurstAStarPathFinder.cs
Ok thanks
Does anyone know if theres a way to get around the whole "you need a class with the same name as your file" restriction? I want multiple component definitions in the same file, like real bad
Not sure what you mean. I thought with ECS stuff the script filenames could be named whatever.
I did notice however that I was getting that error when there were compiler errors present though. It seemed to treat my ECS component as if it were a monobehaviour and gave that error until the compiler error was solved for some reason. Kind of hard to describe, and probably not your issue, haha.
try adding a component that isnt named the same thing as the filename to an object in the editor real quick and report back
I have multiple IComponentData implementations in the same class without an issue,
but with monobehaviours that doesn't work
yeah, theyre allowed in the same file, but you cant attach them in the editor
kk I'll give it a shot
@tight blade https://www.loom.com/share/0e38a0f122ab40f0a0d62222c602871b I'm not the most competent programmer so I may be misunderstanding you, but maybe this is relevant
okay now go to "add component" and add that component
maybe you can drag it onto it, Im not sure. thats actually a reasonable possibility, but you definitely cant get them in the "add component" search bar
yeah, I hadnt actually thought of dragging and dropping, so thats a good enough workaround for me!
oh wait, no it doesnt
Make sure your system is referring to it correctly by the updated name or whatever as well
because if there are multiple components in the file, what would I be attaching by dragging it on?
yeah no, it just doesn't work.
Hmm a component can hold more than one piece of data
Im saying the thing thats impossible is adding a component from the editor that isnt named the same as the file
like multiple pieces of data or additional components?
multiple structs
right
so make public struct AComp: IComponentData {} and public struct BComp: IComponentData {} and then add either one in the editor
Yeah I tried it like this and it only picks up the first struct
Tried with and without the multiple [GenerateAuthoringComponent]s,
It works, but only seems to register the first struct. No access to others.
Is there a specific reason to not just put multiple pieces of data inside one component? Trying to keep things modular?
they get attached to different entities
the same archetype wouldnt necessarily have both
and there is a semantic difference
between which ones have either
Ah. Maybe it'll come in an update, haha. This stuff seems to be changing all the time.
yeah, I imagine so
I can't even figure out how to change materials and there's no tutorials on that, so you're way ahead of me, hahaha.
i just figured if anybody knew an annotation or something to opt into the add component menu that bypassed the filenaming restriction, it'd be somebody here
its not a huge deal
There are people here who are far more knowledgeable than I would be so ... have hope, haha.
again, I appreciate the effort to sanity check me, though
No worries!
I give back where I can within my limited capacity since I ask a zillion questions. Seems fair.
yeah, I hear that
does anyone happen to know, if I make a new NativeArray<int>(100, Allocator.Temp) is that initialized with zeros?
or is it uninitialized and undefined
id guess it would be zeroes
arrays are not cleared afaik; would take too much time
also @ocean cloud be carefull with ConvertGameObjectHierarchy
it will create a new ConversionWorld on each call, so you want to call it really really few times
looks like its an option, btw:
what you can do is put everything you want converted under a parent empty go, so that you only do that call once
tho you'll need to use the GO names as identifiers for the entities and use the conversion flag AssignName; you'll also need to skip one frame/create a new ParentSystem right after the system that's calling ConvertGOH because the only way to get those entities is via the root entity's childs
(you might be able to get a LinkedEntityGroup in the root entity, not sure if one was created when I did it)
but the LinkedEntityGroup will link every entity in that hierarchy, not only the real "top" ones, so it's up to you how to want to deal with it
arrays are not cleared afaik; would take too much time
@zinc plinth
the default constructor does clear
same as regular C# otherwise you could get unexpected behavior
i think you'd only not clear if you 100% know you're gonna assign each value before accessing
why would you access before assigning 
that's undefined behavior in every unmanaged memory languages
plenty of times where you'd be fine with the default value instead of looping and assigning each value first
Guys, I know you probably get this question a lot. but is there any up to date tutorial about making a complete game with dots? not just simulating large number of characters on screen moving? I've stumbled upon some recently but they were using some older versions of the Entities package
This is the closest I've found that is fairly up to date.
Finding good up to date tutorials on ECS is pretty painful at the moment, haha. Lots of weird crap about 100,000,000 blocks, no tutorials on how to change a material on an entity.
havent checked but its 1 month so quite recent, maybe you can learn some stuff, i wanted to watch but never had the time
part 3 was recently published i think, should be more info in their youtube channel
My strategy is searching YouTube and sorting by upload date.
@tardy spoke docs will help you more than any tutorial for this
@zinc plinth Yeah I've been looking at them - I think. Are there more than official ones than this? https://docs.unity3d.com/Packages/com.unity.entities@0.11/manual/ecs_components.html
@tardy spoke thanks, I think I ill check out this course for now
for anything rendering related you want to search threough the hybrid renderer docs
not the entities package
Pretty spartan manual for the hybrid renderer as well at the moment, though
they show animating a material's properties, but no example of replacing a material. Might not be possible?
Might need to reinstantiate with a matching entity with the different material or something
@opaque ledge thanks for pointing out that YouTube video, I'm watching it now
@rough crown I haven't checked this out yet, but I hear the new "visual scripter" is a good way to learn some ECS stuff since you can view the code it generates. I would imagine the code it generates would be fairly current if it's been updated recently.
lol, is there a system thats supposed to be updating WorldToLocal? I just naively add it to my entity and it just stays float4x4(0) forever
@tight blade yea one of the ones that's in TransformSystemGroup
yeah no I see it.. something weirds happening here
@tight blade yours isn't showing up like that?
Those are auto converted GO's to entities
As to whether they're actually updating I'd have to move one and check, but I think they are
there should be an EndFrameWorldToLocalSystem but you need both a LTW and a WTL component for it to run
yeah. something subtler and stranger is going on. They definitely show in the inspector as having updated values, but I have a breakpoint in my system, and, even though they hit the query, they are float4x4(0) at the time the system runs. Might have screwed something up with my job dependencies
ugh, thats so weird. Whatever, I guess I'll just do the matrix invert myself for now until I figure that out.
you mean LocalToWorld ? never heard of WorldToLocal before
btw does anyone know if a sync point only completes jobs in that world, or across all of unity/every world?
i would guess only that world but it's not the first time unity does weird things
nvm seems it is only per world thank goodness
@opaque ledge WorldToLocal is just an Inverse of LocalToWorld for transforming world positions into local space
@tight blade is that a joke or are you serious? Because if that exists, that would be handy for my project, haha.
https://www.youtube.com/watch?v=FwNMUCqKsz4&feature=youtu.be
hmm? What no, its totally a thing. I mean I'm having trouble with it at the moment but yeah its a thing
its the inverse of the LocalToWorld matrix, calculated at the end of every frame
Yeah @tardy spoke I don't have the context behind what you're solving, but yeah conceptually you seem to replicating the notion of converting worldspace coordinates into player local coordinates
I guess it wouldn't be difficult even just to invert the regular localToWorld, but it'd be handy if it's already in there, haha.
Ah, solving float rounding errors on on extremely large unity maps is the application.
yeah, my use case is also efficiency. I calculate each entity (of a certain type) in the space of each other entity. So there are overlaps, and if any other systems use the wtl, i wouldnt want to duplicate that effort. matrix inverses are not exactly cheap
errrgh god, does anyone know of a way to recursively disable unsafePtrRestriction? its getting thrown when I try to use my EntityQuery.CopyFromComponentDataArray
its not letting me do it though. God I hate the EntityQuery API so much
ugh. okay I finally cobled together the correct sequence of ad hoc job structs to safely dispose of this array after copying back to the Archetype
well, apparently it just doesnt allow you to use the WorldToLocal component that they calculate, because of course it doesnt.
@tight blade is your system order set up correctly?
I mean I think they calculate it at the end of the frame, I'm just surprised that I don't get the values from the previous frame when mine updates
They must calculate it then reset it back to 0 specifically to foil this operation
that'd be weird as the only place they're using it is WTLsystem
but yea you should at least get value from previous frame
hmm is there any way to hook entities with gizmos? I'd like to debug something visually and draw cubes as a quick implementation 🤔
If you figure out the answer please report back, @coarse turtle . I havent been doing DOTS (or Unity or C#) for long, and that's been on my wishlist
theres a 3rd party asset called Aline @coarse turtle for job compatible gizmos
oh neat - i remember someone posted a screenshot of something, I'll take a look, thnx @safe lintel
yeah simple test with an arrow at every transform, works a treat https://gfycat.com/snappybadbooby
every translation should i say
oh neat, I think this will be great to implement in my own physics engine 🙂
dat fps tho
it will create a new ConversionWorld on each call, so you want to call it really really few times
@zinc plinth Thanks for the info! That is what I need, I need to add prefabs only at a scene transition
Wait so every call ConvertGameObjectHierarchy in one frame will create & destroy the system each call?
*world, and yes
Yikes, I called that tens of times at scene load atm lol
So by your method, the way to get the converted entities (child of the root GO) is by their name?
Although the root entity is a clean way to clear the prefabs, that's for sure
first system: create your root go and instantiate everything you want to convert as childs of it
parentSystem [UpdateAfter(FirstSystem)]
secondSystem [UpdateAfter(MyParentSystem)]: get childs of root entity, check their names
and make sure that you remove LinkedEntityGroup from the root entity before you destroy it
otherwise you'll destroy everything
alright I'll try, by parent system you mean those built-in systems in TransformSystemGroup right? just for getting that Child buffer component data from the root entity
why's 5argon's blog down at this moment 😫
you can create new ParentSystems whereever you like; they will setup the parent and children components; you just do it bvy creating a class extending ParentSystem
ah alright, thanks
when CGOH gets executed the children relationship isn't set, so if you don't want to wait a whole frame you have to create that system
I am trying to use a native array of componentdata(from entity query) in scheduleparallel() jobs, how do i do so?
if the answer is blob asset, how do i convert a native array to blob asset>
query.ToComponentDataArray<T>(Allocator.TempJob);
@hollow sorrel so many things influence the editor framerate, one of which being reverting to factory layout 🙂
hah fair
yeah you can use it, but you have to remove safety restrictions on bounds
before ScheduleParallel, you have to do .WithParallelRestriction(bounds) or something like that, i forgot the method's name now
WithNativeDisableParallelForRestriction(myvar) — permits multiple threads to access the same writable native container. Parallel access is only safe when each thread only accesses its own, unique range of elements in the container. If more than one thread accesses the same element a race condition is created in which the timing of the access changes the result. See NativeDisableParallelForRestriction.
so basicly if im only reading from it, nothing bad will happen?
If you know that they don't use the same indices it's fine.
If they use the same indices, and it's purely readonly, it's fine
But if they use the same indices, and some write and some read... hoo boy, that's gonna be fun debugging
thank you
here is a silly question, how do i have a refference to a Ibufferarray of ibufferelement in a Icomponentdata
it would only be readonly
Where are those interfaces from?
Do you mean the Dynamic Buffers?
Note that you're disposing that bounds array before the job is done
Not asking for the same bounds array
As in IBufferElementData under another entity
Without using get buffer as it is not multithread, and not performant
id like to help but i don't understand the question :S
Yeah
Been scratching my head
Basically, how to have and handle a reference to a dynamic array
does the array have to be attached to an entity? fixed size or must be able to grow? should it be accessible from Foreach args?
basically, it is a Dynamic Buffer made with IBufferElementData, ECS build these DB with IBED automatically,
you can access them just like regular IComponentData in the Entities.Foreach((here) =>)
but what i want is a reference to it
The reference to the DynamicBuffer is the entity to which the buffer belongs
the problem is that i want to read it from another Entities
like Foreach(() => {access another entity"s buffer})
readonly
Try GetBufferFromEntity<IBufferElementData>(), that gives you an array like access to dynamic buffers of other entities
You can pass true as an argument to get a readonly variant
wait, i can use this with schedueparalell?
You probably have to force disable some safety to use it in ScheduleParallel
I don't use ScheduleParallel very often
ok
it says nothing about is it ok to use with scheduleparallel
guess this is the problem with unity preview
instruction unclear
Try it out and see if something breaks
Short question: Is there any good example for how to efficiently perform a Point distance query in unity.physics? should I look into the EntityComponentSamples or does anyone know a good example for it?
will do
I assume CollisionWorld.CalculateDistance has a synchronous execution, but does it use jobs internally?
No, but you can call it from a job
There's a little text about Cast Performance inside the physics docs under Collision queries
ah, thanks,
so currently I just call it in an OnUpdate method within a class extending SystemBase.
I was reading just above this section "Cast Performance" up until now, read the section now too, but I'm still not sure,
could I simply put this into a regular IJob struct?
here is the relevant part of the current code
(I think the job would just be responsible for filling the nativeList then)
// https://docs.unity3d.com/Packages/com.unity.physics@0.4/manual/collision_queries.html
var physicsWorldSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem<BuildPhysicsWorld>();
var collisionWorld = physicsWorldSystem.PhysicsWorld.CollisionWorld;
var pointDistanceInput = new PointDistanceInput
{
Filter = playerHitFilter,
MaxDistance = playerColliderRadius,
Position = queryWorldOriginPoint
};
if (collisionWorld.CalculateDistance(pointDistanceInput, ref allHitsTemp))
{
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;
int hitLength = allHitsTemp.Length;
for (int i = 0; i < hitLength; i++)
{
var hitInfo = allHitsTemp[i];
Debug.Log($"Player query has hit collider {hitInfo.ColliderKey.Value} with distance {hitInfo.Distance}");
// Checking if we have the right object?
if (entityManager.HasComponent<EnemyComponentData>(hitInfo.Entity))
{
Debug.Log($"Player was hit by enemy");
}
}
}
I just got an advice that I could use a regular For(Each) job and query all the static colliders that way, but that's probably more inefficient than letting unity handle the broadphase properly.
I'll try performance of the current code and check if there needs to be an optimization, if so, maybe I'll represent the player as regular dynamic collider in the physics world then, I think that might require less manual work to setup
with 750 entities to query for my point overlap check, it takes 0.8ms, I think that's a great performance for now, even though it would probably be better, so maybe I'll revisit it later 🙂
0.8 ms is a massive amount of time
oh okay,
probably will try out different things then (the 750 entities are also only sphere colliders)
I don't suppose anyone knows how I move an entity between different worlds?
no idea, but could you simply make a copy maybe, like?
entityManagerOtherWorld.Instantiate(entityThisWorld);
This would work
and then maybe delete the entity in the old world if necessary
is in a subscene world so I guess I can get the entitymanager from that world and then copy to the default world 🤔
I'm using a gameobjectconversionsystem also so I have to the use the DSTEntityManager
I'm guessing that just works the same
I'm not sure at which point the convert method is actually executed, but maybe you could get the subscene world as static variable somewhere and use that within your conversion method?
to copy the entity over?
yeah I think I get it, thanks a lot
I'm sure things used to be simpler, entity's were created in the default world before
I'm just diving into ecs for a simple task at the moment, but I see that a lot of approaches will be deprecated starting with 2020.1, like JobComponentSystem jobs being replaced with regular entity queries and such,
but I think I'll wait a bit and see what changes they make before I try to extensively use it
It has been working for me pretty well so far though, especially the job system part
Is there anyway to use lists and multidimensional arrays with unity jobs
i tried it and it seems to be giving me an error
Im using unitys job system to generate the meshes of terrain chunks in parallel however i keep getting the error 'GenerateChunkMeshJob.Vertices is not a value type. Job structs may not contain any reference types.'
This is the code for the job: https://pastebin.com/XEcaDWu5
This is the code for the execution of the job: https://pastebin.com/r2H36LFs
Basically, the chunks that need to be updated get sent to a queue. The update chunks method should then execute the jobs in parallel for the chunks in the queue. How do i fix the error?
ive tried importing a library for creating native lists and flattening the 3d array but its not working too well for me
Vertices is not a value type. Job structs may not contain any reference types.' you need to use only unmanaged things
what does that mean?
it means you can't use List<T> or anything[] because they are managed types (classes)
Isn't it something along the lines of "blittable data only" inside jobs or whatnot.
how do i get around this?
I believe there are replacements for list that can operate inside of jobs called "NativeList", etc, but I could again, be wrong there.
i believe you can, with some hackery, pin a managed object and use reflection to get access to an underlying array (like in the case of a list) but i think you'd only consider that if you don't have control over the list (like its something internal to unity core)
Make sure you use the Unity.Collections namespace
yea i did but i still cant seem to use it
@scenic kayak if you're activity learning DOTS I recommend watching how this guy does things. It's recent and it's pretty enlightening compared to a lot of videos on DOTS. @opaque ledge showed me this.
I'm not really sure what you mean by, can't seem to use it
as in i cant access it
when i type NativeList<Vector3> there is red line saying it doesnt exist
if that makes sense
Are you using assembly definitions in your project?
i have no idea what that is
This is an odd question but do you have all the correct packages for DOTS?
im just using the job system
well this should work
Vector3 is not blittable
use Unity.Mathematics stuff
so float3
also tf is that declaration
Damn... I said that then deleted it because I barely know anything. Should've went with my gut. 😛
your announcing a type, not making a constructor call.....
Get rid of the ()
actually nvm Vector3 is blittable, it's a struct 
i already imported mathematics and jobs
but Unity.Mathematics gets vectorized by burst, so use it instead
Im assuming by default importing in Jobs also imports Collections
it's been a while since I looked at the package manager dependencies 🤔
I always install the "dots editor", it has all the dependencies we need kinda
also it might be the IDE complaining if it didn't load the .csproj properly
I always get problems if I start rider before unity with packages not getting recognized
same for vim/vscode
i think i need to include an assembly in order to use native list
thanks for all the help :)
you shouldn't have to do an,ything appart from having Unity.Collections installed and starting your ide once unity is fully launched in project
Hey people. What's the correct way to use a Raycast or CastCollider in the Entities.ForEach job without getting Dependencies error bullshit?
What's a good way of off loading jobs into multiple frames? I have 1000 pathfinding job requests every now and then and I'd like it so I don't need all 1000 from the frame I call it. Any suggestions?
@willow plaza this is a screenshot from a course I have on Udemy, dunno if it'll help.
@tardy spoke thanks! I'll give it a try.
It's this course if you're wondering https://www.udemy.com/course/unitydotsfundamentals/
hmmm... so they have actually a separate struct that does all the raycasting...
but maybe what I need is the UpdateAfter EndFramePhysicsSystem...
I'll see if I can grab a screenshot of it @willow plaza
There's the struct for reference
thanks. I see they basically do the same as me, except in a separate struct. I think it's the update order that is the issue after all.
Yeah, the guy doing the tutorial mentions that it's like a potential rough edge on DOTS that may be smoothed out that you have to specify that order "tag" not sure what [this is called], haha. Vid is from like 6 months ago, but I think it's still pretty current.
Some of the other people here can likely help if you post the code up. Some experts around for sure.
Yeah, well, I really don't need a raycast in this case.
Perfect! Problem solved. 😄
This is a pretty naive question, but what is something you could with "EntityQuery" that you couldn't just do in a typical entity forEach system loop?
bulk add/remove operations on all matching entities
you could do it in a foreach with ECB one at a time, but query version just changes the archetype
Ah, okay, cool. 😄
Hey everyone (I will ask here too since it's related), is anyone using a beta or alpha version of Unity right now? If so, do you have any DOTS packages in your project?
If you don't, could you take 2s and check something for me (I'm looking at if I need to report a bug or not).
With the preview packages enabled, just check if you are able to find the Entities package in the package manager.
thanks :x
That would be a pretty big bug. Don't think they could've missed it...
it's not a bug
it's intended (not saying i agree with it)
@knotty radish tl;dr you have to add the package manually now
Wat
wow thats a big change
Thanks @hollow sorrel, don't know how I missed that thread/blogpost. I wish they did something just like the preview packages with a toggle.
I will watch that thread and wait for the new solution they will implement :(
yea it's easy to miss hidden in a relatively unused corner of the forums
i guess the intention for the change is to prevent people from stumbling on it but that's already the point of the preview package toggle so dunno why they went this far
kinda defeats the point of a package manager
i think there are a growing amount of people who stumble into entities and try to use it then like bounce off it and think its representative of the final product
so i kinda get where they are coming with this
I feel like it's because a lot of relatively new Unity users try to use those preview packages and then flood the forums with questions about "missing features" or "why is not working with my old unity version"
i dont think its just the new users 😅
While most of other devs know what "preview" or "experimental" means
There is a lot of people crying (for nothing) these days be it around packages or Unity updates
Like when they see a version saying "verified" or "LTS" they will say it's not stable enough or it's missing features and at the same time they don't understand why an experimental/preview package may have some bugs
Anyway I won't start a meaningless debate here :P
Thanks for info and happy coding!
That's a bad UX choice. They should've just changed the name to experimental packages if they want to discourage use, or even more harsh "unstable packages".
And ECS isn't that bad. I suck and I'm figuring it out slowly. I would say entering the current javascript ecosystem is a lot more difficult.
maybe they should call the preview / experimental stuff unsafe, surely there would be no mistaking it could be a rough ride 😉
Yeah, exactly. Unsafe would be fine.
If I have to manually enter the packages in the manifest does that mean I have to manually check for updates and paste over it each time? :\
they should have big bold warning letters in red
but at least keep them in the package manager that's what its great for after all
Just have it when you select it it pops up and says "do you expect this to be a representation of the finished feature?" and if you click yes it deletes Unity from your hard drive
Not to mention that change breaks ALL ECS tutorials that showed getting the packages from the package manager, which is all of them.
there's no way I'm going to figure out how to edit the manifest or get them from github or whatever
Oh, it's easy.
for you maybe 
lol ill show you, one sec
if you can use dots, you can edit the manifest 🙂
In your project, open that
And just manually paste the package in. They'll likely give you the package name on the forums or wherever they're releasing this.
That's essentially how the package manager works, it adds and removes lines from there and then your system reads it and is like "ah, I need this stuff". So it's like you're editing which packages you have installed "directly" kinda.
and it'll detect changes you make. if you delete a package from there and run your project, it'll remove it.
potentially a problem is if it also hides dependency packages that need to be updated if you have a conflict, it can be done by manually checking out the registry site(ie https://packages.unity.com/com.unity.animation) and figuring out those dependencies yourself but its gonna make resolving issues a lot more of a pain in the ass if they really crack down hard on hiding preview packages
I don't know it seems pretty complicated to me 
Like so
actually let me check something
It appears to enable it inside unity as well which is nice for updating purposes
Still pretty painful though, if I start another project and have to get the DOTS packages I'm not sure exactly how i'd go about it without the package manager to round them up.
@safe lintel after it's entered into the manifest I think you can view it in package manager to view dependencies, no?
yeah it just adds unnecessary complexity
Agreed
should but its useful to know that site exists to view stuff that isnt shown or mentioned at all
Yeah, hmm
I wonder if they'll end up changing it back, because I don't think feedback from people who don't really understand experimental packages is worse than 5,000 people now asking how to add packages that they saw being added in tutorials
I think they are just renaming them though to make them clearer, so they will return to the package manager at some point hopefully
That's possible. And probable really. I'm sure they have UX people on staff that would obviously recommend against this move unless it was for really good reasons.
should but its useful to know that site exists to view stuff that isnt shown or mentioned at all
I miss bintray :(
It seems like in DOTS they have a great system so far for simple entity mass creation/mass manipulation. I hope they can simplify the syntax for physics collisions etc to be a little less verbose, though, haha.
they need the feedback of people like us to improve it
I would be they're working on that and just haven't got around to it yet.
Most the moves they make seem to be in the right direction
and there's going to be less people using it if its not in the package manager
That is true
the two big issues remaining seem to be subscenes and animation
the guy who was working on a subscene demo was saying a month or so ago in here that they break pretty hard with crazy load times when you start to use a lot of them, so maybe they're rethinking it.
for animation i'm yet to see anything that even remotely resembles a solution, the animation package has been getting updated but there are no demos at all on how to use it.
seems like the experimental animation preview subforum(jeez all these names are becoming a mouthful, like universal renderpipeline asset renderfeature) has devs from the anim team to respond to things, they mentioned refactoring rootmotion as something that could be delaying a samples update
but there was an update that had some changes around rootmotion and not sure if that was it or just one part of an ongoing thing as there havent been updates
anyway its kinda disappointing that of all the new systems, you get the most dev responses from the non unity team at havok
lmao
thing is there's just so damn stuff they want to focus on at the same time that progress feels super slow on everything
I dont suppose anyone knows how I get the EntityManager from another world?
I'm trying to use this method EntityManager.MoveEntitiesFrom()
Step 1: Get the other world
Step 2: World.EntityManager
ok good point I've got to find the world first 👍
Usually you'd capture a reference when you make it... are you using the physics world or something?
its a subscene world
To or from the subscene world?
And what world is the other one? The main world?
I'm moving an entity from the subscene world to the default world
for what reason? I ask because livelink basically does this
I'm trying to use a gameobjectconversionsystem to create convert some scriptableobjects into entity's
I've created an entity in that system and it creates it in the subscene world, I'm sure it didn't used to be that way, or maybe I'm confused
hmm.. my suspicion is that livelink settings have confused what's going on for you
Doesn't that have both an entitymanager and dstEntityManager?
I know you get that with some of the conversion options.
(and it's easy to get confused about)
yeah it has a dstentitymanager
yes - though fyi neither of those are the editor world
The destination entity manager is the world it ends up in ^.^
Should be the correct world at runtime?
nope I use the ordinary entitymanager and it doesn't appear to work at all
in case it helps explain... when subscene's open there are 3 worlds involved - 1. 'Converted Scene: Subscene', 2.'GameObject -> Entity Conversion Subscene' and 3.'EditorWorld' - 2 is where the conversion happens, 1 is where the resulting entities are copied to (so 2 always appears empty basically). When you have Livelink enabled then the entities in 1 are also copied to 3.
ok this is confusing, it appears its in a shadow conversion scene 
entityManager is for a temporary world - changes to the specific entity should take effect, but changes to other entities should be with the dstEntitymanager
Not sure how adding new entities plays into that - from what Timboc says it should work either way?
in the case of converting entityManager refers to 2 and dstEntityManager refers to 1
so maybe I should enable livelink?
it might make it less confusing but I'm not sure really helps with your issue
my guess is you don't need to move your entities
its not confusing at all 
ok I'll try with and presume the data is there and see how it works, thanks
you know the entity debugger has a world drop-down right? so you can see what entities exist in those subscene worlds
yeah that's how I found the shadow world 
so hopefully you don't have to presume anything 😬 - lmk if you have specific questions
no worries will do, thanks
anyone happen to have a simple systems editor window? both entity debugger and the system window (from editor package) only show worlds that use the default playerloop and for some reason heavily depends on it
just gonna make one but if someone already has one that'd be coo'
sorry, not had a need for something like that yet
@pliant pike In this: (In Open subscene) this timeline shows ScriptableObject being inspected. When e.g. SO value changed, conversion runs, livelink patches corresponding entities in conversion world to editor world which the timeline preview then updates at edit-time. Few issues related to timings of when things happen and still bugs to squash but it can kinda all work.
yea front end to the tween library I've been working on
ho so it's not public
will be a paid asset on the store that I hope somebody buys 🥴
serialized animations supporting relative values, works with hybrid & pure, custom monobehaviours or icd's etc
that's cool I did not know you could do that
is there any common mistake that could lead to the render meshes disappearing at the start of my game ?
im doing a minecraft like game and rendering with one mesh per chunk, and basically everything is fine as long as i keep my render distance to 3, but at 4 (sometimes 5) all the meshes appear for like a frame before disappearing right after that
I may have a clue but im not sure
so to render something i have to use the RenderBounds component somewhere, and i dont remember if I have to set the Center attribute to coordinates in the world or relative coordinates (and if so relative to what ?)
i can't seem to find this info
here's my frame debug info in case that's useful
and in the entity debugger i can see that the mesh are going missing, with no error message in the console
this does not happen below a certain render distance
Im a little confused on how to use jobs in my code. This should create a chunk generation job for each chunk object in the queue but im not getting the results i want
i just want to make sure that im creating the jobs correctly before i look into the logic side of things
https://pastebin.com/ixHtuDE9 this is the code where the jobs should be created
That code looks different from regular jobs scheduling in so many ways... I'm not even sure you get back any results from the job and you also schedule and complete them one by one, so it's basically the same as executing them on the main thread...
Is there an alternative to Vector3.ClampMagnitude for float3?
HI all, I'm looking for any tips regarding conversion of code into the jobs system. In my case, I'm looking to take my chunk loading code and distribute it across cores through the jobs system. Any help would be greatly appreciated
to use data in jobs, the data should be in structs, but unity has its native collections like nativelist and native array that you can use in jobs too,
I think I just looked here https://docs.unity3d.com/Manual/JobSystem.html
and basically, you could either set up your data structure to fit as input for a job, or you can use regular multithreading with plain c# threads
the benefit is that you don't need to have all data as structs, can utilize static variables etc., but most unity api methods are still not allowed to be called from anywhere except the main thread
it would also be possible to make an instruction queue, if methods need to be executed in the main thread, you could use a queue for tasks that the other thread can fill, and a regular monobehaviour in the main thread can poll the content each frame and execute it
math.clamp works for float3 too, but not sure how that behaves compared to clampMagnitude,
but an implementation would probably just be:
public static float3 ClampMagnitude(this float3 vector, float maxMagnitude)
{
float sqrLength = math.lengthsq(vector);
if (sqrLength < math.mul(maxMagnitude, maxMagnitude))
{
return vector;
}
return math.normalize(vector) * maxMagnitude;
}
math.clamp works for float3 too, but not sure how that behaves compared to clampMagnitude,
but an implementation would probably just be:public static float3 ClampMagnitude(this float3 vector, float maxMagnitude) { float sqrLength = math.lengthsq(vector); if (sqrLength < math.mul(maxMagnitude, maxMagnitude)) { return vector; } return math.normalize(vector) * maxMagnitude; }
@minor sluice yeah, I ended up writing my own utils method. Hoped there was one in the Mathematics library...
I haven't looked deep enough into the math code, but by checking the available methods, I didn't really see anything related to it
so not sure
Yeah, I just scrolled through all the available methods and classes in Mathematics myself. There's nothing similar to clampMagnitude.
I wonder how much faster clampmag would be than just calling .normalize in burst code or if it's even faster at all
yeah, I wonder if my if check above would even be faster than just doing something like math.normalize(vector) * math.min(math.length(vector), maxMagnitude);
probably doesn't make much difference - math lib is certainly missing some handy extensions that they seem resistant to adding
is it possible to add force to physics bodies in a bursted job?
you could just operate on the PhysicsVelocity componentData as one example, so I think yes
the docs also have an example of how to apply an impulse here:
https://docs.unity3d.com/Packages/com.unity.physics@0.4/manual/interacting_with_bodies.html
Anyone has a clue how to lock rotation of the physics body on a certain axis?
Similar to how you can do with regular rigidbody.
Should I just reset the angular velocity?
How are you making the entity?
If you're making it by authoring, there is a component for that
I am. Is there a component that locks rotation?
I did some deep profiling tests and got this, is this slow for the physics?
so in my game there seems like a big default overhead for running the regular physics systems
With only 24 entities in the scene, with deep profiling, following happens:
StepPhysicsWorld.Update takes 2.88ms
BuildPhysicsWorld takes 0.63 ms
.PlayerEnemyCollisionSystem (ICollisonEventsJob) takes 0.12 ms.
With 760 entities in the scene, deep profiling:
StepPhysicsWorld.Update takes around 2.9-3.2ms
BuildPhysicsWorld takes 0.62 - 0.71 ms
PlayerEnemyCollisionSystem takes 0.11-0.13 ms.
StepPhysicsWorld takes 5 ms to update for me. I was starting to think I'm doing something wrong... I only have like 4 dynamic bodies and the rest are static...
And I don't really do anything with them. Only changing their velocity.
sadly very normal - good news is unity are working on optimising jobs and scheduling but no eta
I haven't touched physics yet but my assumption is the majority of that overhead is scheduling - you'll be able to do a lot of 'physics' before that number goes up.
this is partly what happens atm when you have a bunch of systems - I can't get my chain of systems to run much less than 1ms working on only a single entity - https://forum.unity.com/threads/request-scheduleauto-dep-chunkthreshold.870163/#post-5938118
So it's better to pack more work in each system instead of having multiple systems?
there might be some value in that, though I wouldn't worry that much - afaik this is high priority for Unity atm and hopefully it should get much faster
ah, thanks for the inputs! I was thinking I did something wrong too,
I might just use the overlap query instead.
there is a slight overhead in scheduling jobs, but it is usually rather miniscule, and you can also chain job dependencies/handles together for continuous parallel execution - so that they execute in order (I think?)
Generally disable the job debugger when profiling or even better make a build
Build physics world takes 0.3 ms for me with a rather complex setup
Yes good time to remind to only look at numbers in build - 0.3ms is quicker than I saw before - that’s great
Main thread or total time?
@willow plaza the solution I've seen for locking rotation is to set the mass.InverseInertia to 0 on the required axes
Main. I always see heavy drops in performance when going above 4 worker threads in release builds.
@pliant pike thanks! I'll give it a try.
I shall try a build, for sure, thx
Good point- 3900x here - doesn’t always help
It seems like if I have both custom authoring script and unity's authoring like PhysicsBody, The latter overrides any related components that I add in my custom script... How would I go around that?
trying to add PhysicsMass component with certain values, but it's getting overriden...
Maybe you can write a GameObjectConversionSystem which runs at the end
to set the values
there are different update groups you can run those conversion systems in (I believe there's an GameObjectAfterConversionGroup attribute which runs as the last step in the conversion pipeline)
I think you have to keep updating the values, the example I've seen they have them in the job where your moving the character
Definitely feels a bit naughty if physicsbody overrides component values that it doesn't expose fields for... think I'd do what psuong suggests myself and create a component that runs conversion in the GameObjectAfterConversionGroup group
I think you have to keep updating the values, the example I've seen they have them in the job where your moving the character
@pliant pike Ah. I thought it was a const parameter like mass or something.
@coarse turtle I'll try the GameObjectConversionSystem way and see if the value changes. Thanks!
Interesting more of a design question/debate -
Has anyone solved any issues in DOTS that are not obviously suited to DOTS, such as a dialog or quest system? How would you structure that at a high level if you had to do it?
I think @opaque ledge has implemented a quest system before
generally I think with quest systems - on a simple scale, you keep track of an index and increment it if it's linear quest
so A -> B -> C -> Goal
Yeah, I don't actually need to create one at the moment - was just curious on your ideas to expand my knowledge of the application of ECS. Hard for me to imagine how to do that at the moment, haha.
but for things like graph/tree based quests that are not always linear, well the way I end up going about it is, design the data structure first, if the design of the quest can allow me to map a graph into an array, then I can jump around the array by setting the index i want to access.
And based on the index, probably some condition check to see if you've completed the task, and jump to the next index with the next objective.
ecs is a great fit for something like that but I guess likely take a while to setup. Once going though, just add an 'active' tag to a quest and all your map and dialogue systems update accordingly - all that lovely dod-ness
Yeah, that was my thinking. High initial front end investment (which realistically is just kind of how ECS works) for massive scalability later
Yeah it's just hard to imagine having one NPC "talking" using ECS through the use of systems and forEach loops. I'm sure it's possible and there are probably some fairly eloquent solutions once you see them.
Very cool, thanks for the input by the way. I'll start thinking about it as I'll probably have to make one in a bit.
imo hard things (oop or dod) are almost always timing - when does one piece of dialogue become active, skipping, having transition time etc
on a tangent, thinking about this I'm suddenly really keen to make a market scene where you can hear all the conversations and interrupt any of them up at any point 🧐 😅
That's really interesting
I'm not aware of any game that's done making it important to wait for a natural break in speech to talk to an npc for example.. must not get distracted
I was going to do an experiment in my VR game down the road - Oculus Quest has built in functionality to talk to up to 8 other people wearing Oculus quest VR headsets. I was going to make it just auto connect to whoever is nearby in the game, hahah. So it's like you can just walk up to anyone and talk to 'em, just like real life. Of course you'll get a bunch of trolls and stuff and it's probably not going to be "allowed" on the app store if you have that, but I just thought it'd be interesting.
Haha, well I design a lot of products and you'd have to consider kind of not only "the job to be done", but particularly in video games, "is this fun?"
bit like rec-room?
LOL do they do that? Awesome
I think they do some amplitude based on distance but it's basically whoever's in the lobby and you can selectively mute
I would be concerned that waiting for NPC's to stop talking in order to talk to them may not be "fun", hahah
Oh yeah, totally, that's exactly what the idea was.
not waiting for them to finish per-se - just like the idea of different moods/reactions based on what point you interrupt
Yeah, I was thinking that
but you know what might even be more "fun" for the player is they halt their conversation naturally in order to talk to you
Like if they went "oh hang on a second my friend Bob is here" (you're bob) that would be neat
Cause it strokes your ego and makes you feel important and it's realistic. If I ask someone to go slay a dragon for me, I'm going to pretty curious if they did it when they come back.
Of course then you can't do a "rudeness" meter thing that alters mood, haha.
remember, as usual, that you dont need to stuff everything into the ecs
a quest system really isnt something that is perf minded at all, or that works well in iteration. Just having the quest system as its own "normal" C# classes will likely work better
(btw ecs actually works damn well on rpgs, due to the scale of stuff, and the need to save the state of everything)
a world like skyrim has a few hundred npcs
True, true
but quests... they really dont fit directly into entities. So just having something like a entity for a quest, and then that has a component that points to a normal C# class will likely work better
Yeah, like maybe entities for figuring out which quest(s) are active, but just write the quest objects themselves as some sort of monobehaviour system?
does anyone know if addressables are able to be loaded in GameObjectConversionSystems?
I have a feeling they might not be because I think those systems are run in editor mode
Question: entityInQueryIndex in Entities.ForEach can be named wathever I want, right?
ForEach((Entity entity, int entityInQueryIndex,
edit - sorry thought you said cant, i dont think it can be named anything other than entityInQueryIndex unless i am misremembering
hmm 2020.2 a18 change note Kernel: Reduce main thread overhead of creating job reflection data.
there are a couple of them for the entirety of 2020.2
Kernel: IJobFor.Schedule (Scheduled as single job) no longer has any unnecessary parallel for access restrictions.
Kernel: Reduce job system overhead on Mac
Kernel: Reduce main thread overhead of creating job reflection data.
Kernel: Refactoring in memory label code which resulting in lowering generated code size.
Kernel: Small optimisation for low-level atomic queue container used by the JobQueue
Let's say I fill a native array of RaycastHit in one job, complete the job and capture the array in a ForEach. How would I know which element corresponds to which entity? The indexes might not be the same, right?
var raycastResults = new NativeArray<RaycastHit>( rayCount, Allocator.TempJob );
var raycastJobHandle = PhysicsUtil.ScheduleBatchRayCast( physicsWorld.CollisionWorld, raycastInputs, raycastResults );
raycastJobHandle.Complete();
Entities.ForEach((Entity entity, int entityInQueryIndex, ref NavAgent agent) =>
{
//would that work?
raycastResults[entityInQueryIndex]
}
never personally used PhysicsUtil.ScheduleBatchRayCast sorry
ah, that's a custom method I wrote it.
the question is more about passing native arrays between the jobs
oh the index
if they have different query, there's no guarantee they will be ordered the same way, right?
pretty much
So how would you go about it usually?
if i want to calculate some temp data per entity in one job and access it in another
is it worth creating a component for that?
what is ScheduleBatchRayCast doing?
basically casts ray from each agent down to find the closest collision surface
and fills the results in raycastResults
why not raycast in a regular foreach?
its unclear what entity query you are using for your raycasting
it's a different query from the next job. I've just seen that in the Unity.Physics docs as a way to make fast raycasts in a batch.
but I guess I can just make individual raycasts in the main job...
Cast Performance
The above code all calls into Unity Physics through normal C#. That is fine, will work, but is not necessarily the most optimal solution. To get really good performance from the casts and other queries you should do them from within a Burst compiled job. That way the code within the Unity Physics for the cast can also make use of Burst. If you are already in a Burst job, just call as normal, otherwise you will need to create a simple Job to do it for you. Since it is a threaded job, try to batch a few together too and wait some time later for results instead of straight away.
Jobs can only be created in classes that inherit from JobComponentSystem. Here are the necessary namespaces for the following examples:
I think I misread it first
I thought that I have to do it as a separate job.
If I call this method in a bursted job it should work and be fast, right?:
public static Entity Raycast( float3 RayFrom, float3 RayTo )
{
var physicsWorldSystem = World.DefaultGameObjectInjectionWorld.GetExistingSystem<Unity.Physics.Systems.BuildPhysicsWorld>();
var collisionWorld = physicsWorldSystem.PhysicsWorld.CollisionWorld;
RaycastInput input = new RaycastInput()
{
Start = RayFrom,
End = RayTo,
Filter = new CollisionFilter()
{
BelongsTo = ~0u,
CollidesWith = ~0u, // all 1s, so all layers, collide with everything
GroupIndex = 0
}
};
RaycastHit hit = new RaycastHit();
bool haveHit = collisionWorld.CastRay( input, out hit );
if (haveHit)
{
// see hit.Position
// see hit.SurfaceNormal
Entity e = physicsWorldSystem.PhysicsWorld.Bodies[hit.RigidBodyIndex].Entity;
return e;
}
return Entity.Null;
}
you shouldnt be getting your systems per raycast call, that should be cached in the system itself or at the most before the job itself
so I can't all that method in Entities.ForEach?
just need to reorganize that a bit(pressed enter too soon)
Let me explain properly:
I have a system that changes entities velocity each frame so that they keep on moving towards certain waypoints. However, sometimes it makes them go up in the air, because the next waypoint is on the hill for example. In these cases I want to avoid the entities from flying through the air, so I wanted to make raycasts down to the ground. Then I can reset entities y position to the raycast hit position.
Are you aware of the constraints in which burst and the job system operate?
more or less, yes.
public class MyPhysicsSystem: SystemBase{
BuildPhysicsWorld buildPhysicsWorld;
void OnCreate(){
buildPhysicsWorld = World.GetExistingSystem<BuildPhysicsWorld>();
}
void OnUpdate(){
var job = new RaycastJob{
CollisionWorld = buildPhysicsWorld.PhysicsWorld.CollisionWorld;
};
}
//Inside your job
struct RaycastJob : IJobChunk
{
public CollisionWorld CollisionWorld;
public void Execute(){
Raycast(etc)
}
public static Entity Raycast( float3 RayFrom, float3 RayTo ){etc}
}
}
you can't use reference types or access unity api.
just meant you should be restructuring when you get your systems instead of doing it every time you raycast per entity(which I am not even sure of what happens if you were to try from inside a job thread)
I didn't post my system code though... Ah well, I did a little part of it.
The job system should error out.
We don't need to know your system code if you already use managed types inside the method that you want to use inside your system
But I don't use managed types!
BuildPhysicsWorld is a class
Ah I see.
I didn't have a good look at method...
I just copied it from the physics docs ><
There should be better samples there, let me look
There's only one about batched raycasts, huh.
You generally just want to cache the collisionWorld which you get from the BuildPhysicsWorld above your Entities.ForEach and than perform your casts just as thelebaron illustrated
Yeah. I just wanted to create a static utils method, but with how it works, it seems like I'll need to pass tons of stuff into it...
hmmm
would that work if called from a job?
public static bool Raycast(CollisionWorld world, float3 RayFrom, float3 RayTo, out RaycastHit hit )
{
RaycastInput input = new RaycastInput()
{
Start = RayFrom,
End = RayTo,
Filter = new CollisionFilter()
{
BelongsTo = ~0u,
CollidesWith = ~0u, // all 1s, so all layers, collide with everything
GroupIndex = 0
}
};
return world.CastRay( input, out hit );
}
alright, I guess I'll settle with that 😄
@safe lintel @north bay thanks for bearing with my stupidity 😄
dots is really hardcore level difficulty with little to no up to date examples. At least not complex ones that show how to tie stuff together...
aaaaand the raycast doesn't seem to work. My skeletons are still walking through the air.😑
@willow plaza https://www.youtube.com/watch?v=JkiJoAufH9A&t=197s
Woops, ignore the "time" that that video starts at, but that series gets pretty advanced and shows a lot about tying stuff together
Also is this how you guys are getting your systems to run only one time? Just add a finshed tag?
@tardy spoke ooooh! Thanks a lot!
been a while since we got new packages 😭
@willow plaza no problem, @opaque ledge showed it to me. As far as I can tell it's pretty much the only recent resource like that that currently exists, hahaha. Someone actually making something that isn't just 10,000 f***ing boxes rotating.
yeah btw alex, thats how its done in "ECS" way
Cool, just making sure I wasn't missing an explicit function or something for doing that
I take there must be some things you can do with EntityCommandBuffer that can't be done by running a system with .WithStructuralChanges().Run(); ?
Or is WithStructuralChanges the "new" way of doing that?
WithStructralChange creates a sync point, while entity command buffer 'stores' your structral changes and played back later at the frame, the less sync point you have the better
there is a page about this in entities manual
Ah gotcha. Not the same thing.
Right, I think I read about that. I'll have to review!
WithStructuralChanges i believe forces every job to complete beforehand while Run only does the jobs in the dependency chain. the docs mention that using an ecb to queue your changes directly after using .run is faster if you can structure your changes this way
i think WithStructralChanges makes it not run in burst as well, so that's a big reason not to do it unless you have to.
So go with ECB's by default. Gotcha
Otherwise it'll call sync points just for that function instead of lining them up with other functions for efficiency
Heyo
Anyone here got any clue what's happening with the Scale component?
I'm trying to scale up a sprite (quad with a material, in reality)
But when I do so it makes the movement of the sprite really weird
I have a simple chase system. Entities acted upon by this system take a target position, orient themselves along their forward vector, and slowly rotate towards their target. It's nothing special, but for some reason if I do anything to the scale they move as if they don't know where the target is at all, completely random, they just pick a direction and go towards it.
TL;DR : I want to scale something but it makes things not go the way they should.
Sometimes they just... stop moving whatsoever.
Any scale other than simply the default one, that is 1f either bricks the moving mechanism or makes them not move at all.
do you have some sort of hierarchy that is affected when you change the scale?
I don't think so. It's a pure ECS entity, and I'm only acting on the entity itself.
It's not parented to anything.
Nor does it have any children
I could share the code if you wanted to take a closer look
if you do something simple like use Debug.Log(localToWorld.Position) before and after scaling it, is it the same?
I hate this LocalToWorld component, it always caused unecessary trouble.
First time it used to scale when I wanted to rotate my object, now it does this.
I'll do so in a sec
I'll let you know
localtoworld is really just the sum of your translation rotation and scale(if one exists)
It's the same position
apparently.
Yeah, I know that that is what LTW is, but something is just off when you're working with it.
The problem is the movement itself.
changes might be deferred a frame unless you explicitly update before the transform system works, or you might get certain results overridden given overlapping
anyway doesnt sound like ltw is your problem
No, it really is. It's the only thing that really makes this not work.
Here's my script, for instance:
Entities.ForEach((ref LocalToWorld ltw, ref SimpleFollowerComponent sfc) =>
{
float offset = math.PI / 2;
float3 dir = sfc.target - ltw.Position;
dir = math.normalize(dir);
float angle = math.atan2(dir.y, dir.x);
quaternion rot = math.slerp(ltw.Rotation, quaternion.AxisAngle(new float3(0f, 0f, 1f), angle - offset), sfc.rotFactor * sfc.rot);
float3 pos = math.lerp(ltw.Position, ltw.Position + ltw.Up * sfc.speed, sfc.speedFactor);
ltw = new LocalToWorld
{
Value = float4x4.TRS(
pos,
rot,
new float3(1f)
)
};
}).ScheduleParallel();
This is in the OnUpdate override
This works.
If I, however, instead of writing new float3(1f) for the scale component, I write sfc.scale which is a simple uniform float3, it stops working.
The movement becomes... strange.
It's not doing what it is meant to do.
I only skimmed the above so sorry if this doesn’t help but are you aware that any non uniform scale will replace the Scale component with a NonUniformScale component?
Yeah, but it's an uniform scale I'm performing.
And not only that, non uniform scales just make my entities not move at all.
sorry yea, just looked at that code and it sounds odd. I'm fairly sure Scale isn't what you expect in the LTW though - if you set a Rotation, Translation & Scale then read ltw.Rotation etc after the TransformSystem has run I don't think they're the same. Like the Scale is after the rotation transformation or something? Not sure if it could be related to that - generally I prefer to avoid direct Ltw manipulation if possible
Is there a way to have a 'OnTriggerEnter' event with ITriggerEventsJob?
ok my package manager did not pick up that there was another package outside of 0.8.0.preview.1 so unless you needed to restart the editor to pick up the change, consider me officially on the I-hate-the-new-package-hidden-thing
it will be interesting to see how they spin it, because they've spent the past year touting the merits of dots, but now they're basically saying don't use it.
i didnt even notice that the blog post is back from june
the blog lately is full of what feels like ads, doesnt feel like a good place for actual news or interesting stuff anymore
ok after reverting the package back it does pick it up. on a side note the new package seems bugged, my inspector not showing entity data when an entity is clicked?
and yeah i think this is a bad decision to kind of put the genie back in the bottle
i dont really get what changed, it seems like they started to seriously try to tie up the major loose ends - the render pipeline, subscenes and animation. Things to make an actual game rather than just a 100k spinning cubes and now they're like 'woah woah' hold on there lets reign it back.
im sorta against the whole slowing dev down to just two "tech streams" a year, I want my bleeding edge tech 😉
the naming convention is probably what I think should change, for just about all their versions
i was talking to the test manager in Copenhagen last year at the dinner event, and i was explaining how my biggest frustration was that none of the package work together; suggested they let us somehow report a combination of packages that function together. He was enthusiastic, then nothing happened. :S
i gotta believe part of it is like being in a monolithic bureaucracy, even one as cool as unity, to get certain things done you either gotta know someone high up the chain or wait a while for it to filter through
your idea could be that guy's passion project and hes fighting tooth and nail against deaf ears 😅
yeah, maybe he tried, ill assume he did 😄
i know how it goes though, i saw joachim there too, but i didnt have the nerve to start up a conversation and give him my feedback, hes a rockstar and all that
or maybe not deaf ears but the guy above him thinks a, b and c need to happen in order for that to work
ah so this should be the lesson, approach joachim directly with the idea so at least you know it got through to the highest order(i would imagine)
damn I think I'm pretty behind on packages after reading how packages are now hidden 🤔
its a pretty big company now, they're listed as 2000+ employees
seems like it just went into effect recently though
also if a mod is reading, might be worth stickying a link to that thread, with it being required reading to do anything in dots
ok new dots editor package doesnt appear to work with the latest alpha editor
I just realized that DOTS editor package exists
But seems like Entity Debugger window has already more features than both the Entities and Systems window? I don't get it
@prisma anchor I think this YouTube tutorial covers triggering on collisions in ECS. https://www.youtube.com/watch?v=KwwHvH3GZsQ
well dots editor shows stuff like hierarchies and its much nicer to look at. basically a proper rewrite of the old debugger
oh man new dots editor update?
One of the major fixes was allowing the support of non-default worlds for the Entities window. 😱
i started on my own editor window because of this literally one day ago
glad they prioritized this feature, didn't seem like they would from reading the forum posts
ok new dots editor package doesnt appear to work with the latest alpha editor
@safe lintel
dunno if it's the same issue but the UIToolkit preview package has same issue, rolling back to a15 fixes it (and is what they recommended for now)
i'll check if this works on a15 in a couple mins
what's the issue you're getting? i'm getting a nullref at EntityHierarchyDiffSystem.Register but i'm not sure if that's because of unity or because of my custom world setup
nvm this is something weird, i can't find it in the files and error is pointing to 0.8.0 in library packagecache, but i don't even have that folder since it's 0.8.1 now
alright i deleted library and restarted and seems to work now on a15
although clicking entities doesn't show them in inspector, is it supposed to?
it works witth the latest beta if you want to try it there
but yeah nothing in inspector on the latest alpha
ah
systems schedule still doesn't support custom worlds and doesn't seem like it will from reading posts again
fuckit i'll do it myself
what unity version?
newest
beta? alpha?
could you screenshot your package manager
I'm reopening the project in .4f1, just a sec
what's .4f1? You ,mean 2019.4.4f1?
yes
didnt work tho
I added the hybrid renderer whish supposedly added burst and entities and other stuff according to the ECS Samples page
click the Hybrid renderer and take a screenshot
why does it not show dependencies? oO
is setting under advanced i think
Right
they hiding that too now
It'd help if you post the details of the error.
Assets\EntityComponentSystemSamples-master\EntityComponentSystemSamples-master\ECSSamples\Assets\Advanced\GridPath.Tests\CartesianGridOnCubeShortestPathTests.cs(5,22): error CS0234: The type or namespace name 'Tests' does not exist in the namespace 'Unity.Entities' (are you missing an assembly reference?)
Library\PackageCache\com.unity.2d.animation@3.2.3\Runtime\TransformAccessJob.cs(196,62): error CS1061: 'NativeHashMap<int, TransformAccessJob.TransformData>' does not contain a definition for 'Length' and no accessible extension method 'Length' accepting a first argument of type 'NativeHashMap<int, TransformAccessJob.TransformData>' could be found (are you missing a using directive or an assembly reference?)
The 2D animation package doesn't support newer collections releases
0.9.0 removed .Length, and it doesn't have an update to support it, so you have to use 0.8
Anyone else has a problem with VS not giving autocomplete options for IComponentData components?
For example, you'd expect autocomplete options to pop up, but they don't:
should be fixed in one of the more recent vs updates
@hollow sorrel thanks! That seems to have fixed it.
A question about debugging jobs. I understand that I can't put debug.Log in jobs unless they're run on the main thread, but what about breakpoints? And what is the common way to debug in dots?
Switch to .Run() and use Debug.Log or breakpoints, or check the input and output data (aka copious amounts of Debug.Log).
So there's no way to Debug it when it's executed on another thread?
You cannot directly debug it while it is on a different thread, as far as I'm aware. Hence, debugging on the main thread (a good case for some automated tests of your methods, hm?) or debugging the inpouts and outputs (white box testing as if you have a black box)
I see. I just hoped there's a way without changing the job to run on main thread every time.
Ehh, better than debugging JS in browser
guess so
Another general-ish question.
I was "disabling" gameObjects that were say 50 meters away from the character in my game previously before using DOTS/ECS. I had 100% opaque fog so you couldn't see anything further than that.
With DOTS/ECS, is there any "disabling" (besides deleting) of entities, and would it have any sort of similar benefit? Save on rendering time or something? Would it just be disabling and re-enabling the mesh renderer components?
I guess the question is, since my game map is 20 km big, are there any obvious DOTS/ECS optimizations that would typically be used for entities far away from the player/out of the player's view?
For that, I'd recommend go for the Subscene workflow.
Do you just mean tossing all the GO's under a sub-scene so it all converts to entities automatically?
Oh, right, you mean like the megacity demo with the live subscene loading. Gotcha.
you can add a disabled component and it will cause the entity to be excluded from queries, unless those queries are set explicitly to show disabled. there's one like that specifically for rendering too but i forget what it is.
Disablerendering i think
Very cool
I remember reading it doesn't
but don't quote me on that, that may be old news
o
I remember reading the staticbatchrender group once which can you can write your own frustum culler
It's odd because the game camera isn't really in the entity world so I have no idea how they interact
Hmm, something to look into
yea, but if you're interested in writing your own, IJobParallelForFilter is a nice job extension to append or remove elements from a collection 🙂
Excellent. I have no idea what i'll need because my early experiments I was CPU bound and not GPU bound on oculus quest with the 20km world
I recently implemented it for a VR game and works nicely for frustum culling
I'm running into the same issues for the quest right now but for half a km
:/
Nice! These things give me hope, haha. The oculus quest is a real donkey of a processor compared to any regular computer or even modern cell phone, haha.
What's taking up so much CPU on your game?
Well I'm not CPU bound luckily - I'm graphics bound
Right. I ended up literally going vertex colors, no textures, no lighting, LOL
Yea - I don't have that liberty atm lol
Yeah, if I was not able to do that, I don't even know where to start
What kind of graphics do you need?
https://youtu.be/JUiO64KbAHA <-- this is handy
The introduction of mobile AR means the arrival of more accessible devices, and for developers, a broader range of consumers to target. The good news is that you're "already ready." A stable of universal techniques and best practices can help reduce draw calls and maximize per...
Well I think right now it's more me trying to argue against using certain graphical features
I ran into a disaster on my initial builds. I didn't realize stacked cameras in Unity are basically a death sentence to VR performance, haha
Like realtime lighting on the quest? wasn't sure how it'd be possible untethered - but this might be a bit off topic from dots 😅
Hmm, what's the performance boost tethered?
Yeah, dunno where this conversation would go normally, maybe move it to #🥽┃virtual-reality ?
I'm interested in it because I can't bake a 20km light map... at least I think I can't
Kind of forget, I'll need to take a look into it - there are still things I need to do in the project since I only jumped on not too long ago
Totally. Just starting mine as well. Keep me posted on any interesting performance findings, and i'll do the same? Haha
sure
👍
I have a question regarding player controls in a DOTS environment, should I control my player and the model using DOTS and are there any tutorials on this?
I checked some easy one where he literally just let unity convert the player space ship into an entity, but my player is gonna be a bit more complex with a lot of animation and so on.
@cursive cosmos https://www.youtube.com/watch?v=JkiJoAufH9A
@tardy spoke will take a look!
if you want animation your options are somewhat limited, with dots animation itself being very very work in progress and outdated samples
@cursive cosmos I just made a player controller system as well, pretty much based on that tutorial (except mine is FPS) but broken out into separate components/systems, want me to make a quick overview vid for you?
Also a trivial question for someone more familiar with DOTs - I'm trying to duplicate the same gameObject into two different entities. I tried this naive approach - along with breaking it out into two separate monobehaviours, which seems to just only convert once as well.
Is there a similar function to IConvertGameObjectToEntity for converting multiple entites? Or some common OOP workaround to have two identical members in a class (which is a pretty strange thing to even be attempting to do, granted)?
I could duplicate the gameObject and put one script on each, but that seems... really dumb, haha.
Ah, I think "GameObjectConversionUtility" might be what I'm looking for.
@tardy spoke I will just make my own, thanks anyways 😄
No worries 😎
Ah, perfect. Found an example on the ECS git repo. Don't know how I missed these.
about the culling stuff
there's culling with the hybrid renderer currently
you set WorldMeshRenderBounds, and add a PerInstanceCullingTag to your entity
also seems like lod groups gets converted from go aswell :o
cool good to know - I haven't played with hybrid renderer lately
@safe lintel Are you saying you can't trigger animations on entities that well currently?
Should I maybe focus making all the different world objects in DOTS and just keep the characters and moving 3D models in normal unity?
Is it even possible to interact with a entity as a normal game objects...I need to research way more on this, have been so busy making 3D models.
wait, you just add PerInstanceCullingTag to your entity and they will be culled automatically ? @zinc plinth
oh, that isnt added auto ? well thanks anyway, actually implemented culling on my own, but i guess using Unity's culling will better 😄
I had it already set on converted entities with mesh filter/renderer
@cursive cosmos this is the repo for animation https://github.com/Unity-Technologies/Unity.Animation.Samples but its 5 months out of date, with little to no communication from the devs. you might find it useful, but I personally havent had a whole lot of success in dissecting it
i'm starting to reconsider how i parse input, right now all my button inputs have 3 bools: down, up and "held down"
however i'm having a hard time thinking of when i actually had to use up and held down states, since that can just be tracked by the thing that consumes that input if needed
does it make sense to only store 1 bool that says a button was pressed or not pressed? anyone else do it this way?
also this is dots related because i'm going from input that's tracked every render frame to a system that sets input components but only at 60fps so if i were to track input directly there then inputs would go missing
I personally have issues with managing input and whether its more than 60fps so 🤷
@safe lintel just tried and got hybrid renderer v2 installed with URP 9 preview .35 on an Imac, so if you're on a mac, there may be some hope. Unity 2020.1.0b16
And if you're not familiar with URP gotta enable by creating pipeline asset then assign it's default "lit" material or similar to everything, otherwise it compiles and runs but nothing but gizmos display, haha. Oh, and assign the pipeline in the graphics section of the project settings.
one thing you can do with the new input system which is pretty cool - block copy the input state into a component each frame, which is close to free (especially if you locked the archetype and used a direct ptr). Then have a bunch of helper methods that check if a button is down or whatever by reading specific offsets. I was working on it for a while then got distracted by other shiny things :S
But... if you want to catch taps, double-taps, detect swipes, drag-drop, multi-touch, or bound actions etc then things get far more complicated i imagine.
I like that this is a picture from the actual ECS documentation.
It should be the official ECS logo.
if one thing that I love about Unity.Entities.Transform is RotationPivotTranslation
because you literally can't do that in GO without a empty parent GO
@tardy spoke among other things, doesnt support more than one light 😉
what's rotationpivottranslation?
when does an Entity (index + version) change in the lifetime of the entity itself ? 
Can anyone explain why my pathfinding algorithm spits out this error when passing 8 iterations of neighbour checking. And help with any mistakes you see I've made as I'm going to try convert this into a job once it works. https://hatebin.com/mfezvdbeck (bbl, i rly appreciate the help)
@icy kestrel the error seems to be thrown on draw Gizmos in Jgrid class. Line 87.
You're trying to access the native array there after it has been disposed.
I'd assume it's because of the last method. Where you allocate a new native list right in the method.
After some googling, it seems like allocator.temp is only allocating memory for 1 frame. At the end of the frame the allocation is disposed. So, if you cache reference to that list and try to access it on the next frame, you'll obviously get the error that you get.
@safe lintel lol just one light eh? I'll have to make sure it's a bright one then.
Here's more on temp allocation:
Allocator.Temp - intended to be used for the scope of the current function (ultra-fast allocation/deallocation, can be allocated within a job kernel I think but shouldn't be returned or passed on). Will start throwing warnings if it lives more than 1 frame.
might need to be disposing those temp allocations, cant remember for sure
I'm sure I'm just missing something simple, but why does it hate my blobAssetStore so much? 🤔
"The BlobAssetReference is not valid. Likely it has already been unloaded or released."
you're using it within a using statement.
wait I have an example code somewhere, on blobasset creation using Iconvert
@tardy spoke use this as reference.
I remember seeing unite video where they shown dots physics debugger. Is it a thing yet? How would I access it?
Something like this I guess:
Or are these just regular Debug.DrawLine/Ray?
and mesh gizmos
or was it with the Havok physics only? 🤔
There isn't much info about physics hit collectors is there?
@willow plaza not sure about this specific screenshot (presumably you can find it in one of the examples), but there is a PhysicsDebugDisplayAuthoring that lets you enable different debug flags.
Note: You only need one in your scene, not one per entity.
I've tried it out, but I didn't see any difference =/
perhaps because I was using convert and inject for most of my converted GO
Hmmm I haven't tried it in forever. But it for sure used to work in like entities 0.4.x for debugging bodies.
It shouldn't matter how you convert and/or inject/destroy them.
I'd assume that it pulls data straight from the components.
I mean, I was able to see the collider outlines with or without that script...
So I didn't really understand what it was for. I must admit I didn't play too much with it's settings though.
But for things like raycasts and collider casts, I have to implement my own debugging, right?
would be nice if there was something like that by default...
I'd also like to understand the native collections more. For example, what I see a lot in jobs is passing native lists by ref. I understand it is to avoid copying the whole list and it's elements? Would it still work if I just pass it regularly? Would it be less performant? What should I be careful about when passing collections around. For example from a static method that is being called by a job. In that case, can I allocate the list inside the static method? Can I still pass it by ref if I do so, or will it get deallocated when the method returns?
So many questions and so little answers online ><
Also, when I allocate a native list, I don't have to specify it's size, right? In this regard it works as a regular list?
afaik, NativeList is just a wrapper around a pointer (with some safe guard) this is why it works with bursted jobs, since its passed by pointer its automatically passed by ref, you cant pass it 'regularly',
afaik you should be able to create native collections inside static methods inside bursted jobs with no problem, you are creating a native collection INSIDE job make sure you allocate with .Temp, if you are PASSING a native collection to a job then make you you allocate with .TempJob
Yeah native list grows but when you exceed size a new block of memory is allocated with some size(squared size i think, so i heard) and your old list will be copied to this new block, which mean performance loss
I see.
If a list is passed by a pointer, then why do I need the ref keyword?
I see it in physics queries for example:
public bool CalculateDistance( PointDistanceInput input, ref NativeList<DistanceHit> allHits );
Is it so that I can pass in my own list?
why wouldn't the query create a new list then? Because it doesn't know for how long to allocate it?
by list you mean nativelist right ? its better to say nativelist because they are different 😄
yeah, native list.
about they are being passed with ref, i think both are the same, whatever they are passed by ref or not, but perhaps they do 'ref' to explicity show that this method writes to NativeList
but perhaps someone with more knowledge can explain better
I see. Well, thanks for your explanations. Now I understand it a bit more.
Thanks, @willow plaza that solved it! One more issue I'm getting is that "OnApplicationQuit" is being called before my final frame of "OnGizmosDraw". Because of this, when using gizmos, I get an error at the end where the nativearray has been disposed. How can I check that a native array exists before drawing gizmos? Just an annoying error 😆
Check if it's null or compare array.IsCreated
Indicates that the NativeArray has an allocated memory buffer.
Something like:
//Short circuit
if (array?.IsCreated != true) return;
//Do stuff
Not equals true so that null also causes the return.
@deft stump thanks for pointing me in the right direction! Found a CodeMonkey video tutorial on blob assets as well which I'm using to decipher what's going on there.
From what I read:
Blob assets cannot be modified once created. Instead, you must create a new blob asset, update any references to the old one and then dispose of it.
I think this may not be what I'm looking for - depending on what that means.
Basically I'm trying to duplicate my game world two times from one gameObject, keeping the colliders on one copy, and stripping them from the other copy. The copy of the game world with no colliders is used for "display" only, and moves inversely to the player controller, so the player remains at 0,0,0 world origin. The other world is static and the player moves in it regularly, colliding with physics objects regularly, etc.
I'm thinking if I use blob assets to store the copies then I won't be able to move the display world inversely to the player's controls, since the blob is just immutable data for reference only? Is that correct? Am I misunderstanding immutable in this sense? Would translation/movement components be "on top" of the blob, or would they require changing some (immutable) data within the blob in some way, which would break the functionality?
Anyone have any ideas on what the correct tool for this use case would be, if not storing the worlds in a blob?
A naive solution like duplicating the world gameObject with a monobehaviour and simply using IConvertGameObjectToEntity on each comes to mind, haha.
Also to develop a deeper understanding of how Unity ECS is working internally, would I be better just trying to increase my knowledge of C# members or should I start doing some experiments with something lower level, like C++?
I don't think learning C++ will help you understand ECS better, just learning using and reading about ECS will help you understand it better
I'm sure you could get a lot out of c++ (pointers, comfortable with unsafe etc) but the usefulness-for-effort might not be that high
Yeah, the lack of documentation in parts of ECS is a killer for noobs like me, haha. I'm in no hurry to get my project done or anything, so it's no big deal. Though I am interested in figuring out a bit about what's going on under the hood.
It would also be nice if ECS wasn't wrapped in an OO construct, but I doubt Unity could change that even if they wanted to.
Thanks for the advice @pliant pike / @amber flicker . Appreciate it!
there is a book about DOTS, I dont know if it would be any help
Data-Oriented Design
Does anyone have any experience with making a "Heap" (binary tree) inside a jobsystem or does it manage memory and is not possible?
What's the best or least setup effort way to make sure that if an entity is destroyed, all entities that all child entities (entities having a Parent component pointing to this) are destroyed too?
put a linked entity group on the entity you're destroying
@pliant pike all of the resources made for DOTS are super useful... for about a week. 🙂
yeah I know what you mean especially at the rate ECS changes
but that's what you get for using something thats in beta
Oh, this is on DOD in general. IE functional programming, no?
thx! how does this group differ from a child component? I guess that it can have more than 1 lined entity? (haven't heard about this group yet)
what would you do with a heap?
yeah that book is fundamental dots stuff
the only thing I took away from that is...
"Think of DOD as a database"
Oh weird, yeah, I'm just reading through some of it now. It actually is about video game implementations of DOD concepts... what a strangely titled book for the content, haha.
I'm a marketing director by day so I think this guy could like 10X his sales by just adding "for video game programmers" to the end of "Data-Oriented Design", hahahah.
you can use DOD concepts in other fields
omg it's Unity based also
hahahah
That title is sooooo bad
Yeah, this is cool. Would be a lot more practical if it was actually on DOTS, I think it's more just generalized theory around DOD, which is still cool and super useful.
if you're talking about that book it's not unity based
it's definitely more generalized
but really helpful
also DOTS != data oriented design
and not same as functional programming
DOTS = unity's tech stack, DOD = programming paradigm
just to clear things up
but yea i'd prob say that book is required reading if you're starting with ecs, it's the one thing that really helps the theory click
@hollow sorrel in some of the code examples in the book they say "in Unity" specifically, which I thought was interesting.
ah it might have some references to it, no actual unity code tho
No, looked somewhat like psuedo code
i don't even know if the author ever used unity
which is fine, it's a general concept
and still applies to unity's implementation
Yeah, it's actually useful it is somewhat related to Unity
Interesting the ECS system is not a "Unity" thing but just another programming concept, haha. I learned that today.
it never was.
Unity just "repopularized" it
People were experimenting with it nearly a decade ago in various game engines, which is kind of cool to think about.
yea i think a lot of ppl have the misconception that unity invented ecs and data oriented design
I think Unity's marketing team made sure of that. I would, haha.
It makes it seem like cutting edge tech and like you're super geniuses.
= more programmers on your platform.
= more programmers on your platform.
then they realize that it's not coming out until 2021
:lul:
Should we be concerned with Unity backing off the advertising and accessibility of ECS?
Was there ever an "official" explanation for that? We're not just learning stuff they're going to remove, right? Hahahah
yea same with burst, it's marketed as this super amazing high tech thing that makes your game's code way faster than anyone else could ever make and a supercool invention
when it's basically just using clang to compile your code with a couple unity specific things
if you were using regular C++ and used clang to compile you'd get about the same results as burst
same with jobs system too
They probably just watch this channel all day and they're like "Ok, so like 10 people use this, and it's costing us 30 million dollars to develop... and the one named Alex doesn't even understand it."
Oh, like making the packages harder to access/install
I think you have to add them to your manifest manually now instead of being able to get them through the package manager or something? Or maybe they just removed them from package manager for pre-2020.1 or something
Not really, they did say they're going to add a new category in the package manager to better categorize Preview or Experimental versions.
or was that just the visual scripting package that did that?
Ah, so it's just a technical reason. Great, haha.
It'll be interesting to see if Unreal engine responds to Unity ECS. They're probably waiting to see what the adoption is like.
I doubt they will
There's not many games that "need" it... it's just cool.
I mean the lower battery usage on mobile and stuff is nice.
i think what also helps is that unity's gameobject+monobehaviour+mono compiler combination is really slow in comparison to every other modern engine or even just .net core, so all they have to do is bring things "up to par" and they can claim everything is 100x faster so people get the impression it's the fastest thing there is
which is fine, i'm really happy unity came up with these systems, ECS and burst are great, i just think a lot of people will have misconceptions
Truly large scale multiplayer games benefit I guess
Haha @hollow sorrel that's kind of interesting. Great marketing spin as well. It's 13X faster because our current stuff is 10X slower than it should be, hahaha.
yea exactly
... well, realistically, is it not the fastest thing there is right now for mainstream game engines? Like can Unreal run a 100,000 unit game demo like the Unity stuff?
Like it may not be 13X faster, but is it not at least faster than something designed in a different paradigm, even if that paradigm is well executed
dunno about unreal but i've seen some benchmarks of rust + an ecs lib like Legion that seems to be an order of magnitude faster, maybe even more