#archived-dots
1 messages ยท Page 155 of 1
our code didn't change at all before/after the update
If no I guess it's definitely bug with latest Havoc jobs changes
it could be either havok/physic or uecs .11
uecs .11 no
if you tell me that .11 is fine, then it's surely havok/phusics
you know anything about the fallback allocation btw? regardless this problem
My profiler was from this
you know anything about the fallback allocation btw? regardless this problem
in this case or?
(https://youtu.be/n_5RGdF7Doo?t=690 is what I was thinking of fyi if you hadn't seen it)
In this case it's not about fallback allocations I think (not directly and not In meaning how I see that)
Case of fallback allocations which I meant was about Temp allocator behaviour inside jobs when not enough space in preallocated memory and it fallback to slower allocation path
I have been told that it happens when the temp and temp job buffers are full
which I find also VERY strange
and even if it's right, how can I have bigger buffers?
how can I at least debug the memory
nothing strange for me, I mean this is expected, they speedup memory allocations in this case by preallocating some buffers and then excluding allocations and just reuse that memory ๐ Faster allocation is not allocate at all ๐ But when not enough - they fallback and allocate new memory
well
the Temp and Tempjob buffers make a lot of sense for games
I would have done the same thing myself, but since UECS has one..
however if the size is not configurable it;'s a problem
as well as if I don't know what;s taking so much in them
a lot of native containers rely on those buffers
I use tempjob 108 times in our project ๐
but a LOT of them come from physic ecs
If you use them with these allocators ๐ In our game we allocate once and reuse it inside jobs ๐ I mean allocating inside job - rare case for us
^I know that's just an example but none of those look like particularly runtime usages? Not to say there aren't any.
This two articles will be good for understanding how Temp allocator implemented ๐
understanding how it works is not my problem though
my problem is that the size of the pool should be user configurable
I will double check for temp inside jobs, it's surely the first thing to check. I remember one actually
but it's not necessary
it we use it it's because we may think it's better to use Temp instead of TempJob
which I start to think it's not the case
@scarlet inlet would I need to iterate over each chunk of the group on the main thread and then make an inner loop iterating over the entities in parallel?
if you need SystemBase.ForEach you won't need to do that
ForEach will take care of everything
like in the code I wrote above (which is burstified and in jobs if I remember it right)
the only bad part in my code is the .Complete()
but it's a burstified schedule parallel
I am unsure which of the components is the shared component in your case
in the image you can see I ask Unity to give me ALL the UECSSveltoGroupID shared components and then I use each of them in the ForEach using the WithSharedComponentFilter
ah yes now I got what you mean, yes, the iteration of the groups is done in the mainthread
but that is an acceptable overhead
I see. But then I could access the data of the sharedcomponent on the main thread an hand it into the foreach I guess
yes I guess that's right
ok thx I will try that
just remember that in my case I use them really just to group different entities according their shared component value
yeah I see. but I guess it totally makes sense to iterate over the grids and then push this data into the enitity loop
I dont know how I would model the Tile <-> Grid relationship with ECS otherwise
@scarlet inlet your example isnt jobified is it?
I see. I am still using JobComponentSystem. From what I red just now it seems like SystemBase is about to replace the JobComponentSystem
that happened long time ago ๐
tho difference between those 2 pretty low
instead of jobhandle parameter you use Dependency property, and SystemBase has Get/Set/HasComponent methods to reduce code boilerplate
Yep this is two "new" tabs Systems\Entities
You can find post on forum about this functionality
It's replacement for EntityDebugger eventually
But not earlier than they will have parity in functionality
Cool thanks
mypackage\Runtime\EntitySender.cs(16,66): error CS0246: The type or namespace name 'GameObjectConversionSystem' could not be found (are you missing a using directive or an assembly reference?)
Why am I still getting these reference errors when I have already included the GUIDs and package dependencies in my package? ๐
Unity.Entities.Hybrid
To expand on that for future reference: A lot of the packages add things to higher-namespaces than their package name would imply.
To find out where a method class, or struct actually lies, you can consider what it does and which package it may come from. In this case, for example, it has to do with conversion, which is a Hybrid concept.
You can also google the class/struct with full namespace + package manual (here: Unity.Entities.GameObjectConversionSystem IIRC)
Are entities able to access singleton instances in their OnUpdate method? I'm playing with an RVO2 implementation, and it uses a Simulator.Instance (Non MonoBehaviour if that matters) to move game agents around. I'd like to try it out with DOTS. Is this a no-go? Google isn't helping me out much, and I'm very new to DOTS, so it would take quite a while to try it out myself, and I'd never know if I just messed up my implementation or if this is simply not possible.
Thanks
Entities don't have OnUpdate, systems do. But yes, systems can access statics in OnUpdate. If you want to use something in a lambda (Job.WithCode or Entities.ForEach) you need to grab it locally inside OnUpdate, though:
class SomeSystem : SystemBase {
private int _someCounter;
private static object SomeSingletonAccessor; //pretend full implementation
void OnUpdate() {
//Local references/values
var localCounter = _someCounter;
var localSingleton = SomeSingletonAccessor;
var localSomeOtherStaticThing = OtherStaticObject.OtherThing;
//Lambdas (note that these generally don't like reference types, ie classes
Entities.ForEach(/*...*/);
Job.WithCode(/*...*/);
//Can also use static methods freely within both here and lambdas
//Careful with what state said methods change, though
}
}
I would like to point out that there is a concept of singleton data, which is more correct in DOTS - a static field on a system would be shared between any and all worlds!
https://gametorrahod.com/ecs-singleton-data/
Oh wow, ok thanks for the detailed reply. I wasn't sure if I could even try that. I'm still not sure if mutiple jobs reading/writing to the class via the singleton methods will cause any issues though. Do you know anything about that?
I found that article trying to search for the answer to my earlier question. Seemed relevant but wasn't sure it answered it. I'll check it out. Thanks
I think the safety system will stop you from using the singleton methods in jobs, but also be aware that it sounds like you're doing something rather antipattern here.
Consider formulating what you're trying to accomplish and simply asking here how to do it in a correct-to-DOTS way.
That makes sense. I figured that was the case, but wasn't sure if Unity had some sort of magic going on behind the scenes to make it possible. This is definitely against what DOTS seems to be about, but it would have been a quick workaround to try it out. Thanks for the replies!
I did test out simply calling one method of the singleton in a job, and it didn't seem to complain, so it's still a possibility. I'll give it a go later. Thanks again
If you do .Run, more things are safe than if you do .Schedule or .ScheduleParallel.
.ScheduleParallel means you'll (potentially) have multiple versions of that very same job running multithreaded, which can get all sorts of hairy if you use stateful static methods
Looks like I'll need to do a lot more research to make this happen. Long term backburner project, sounds like haha. I was just following CodeMonkey's tutorial on RTS Unity selection with ECS. Googled local obstacle avoidance (so units avoid colliding into eachother like StarCraft 2) and found a very nice working unity project under apache 2.0 license. I was wondering how much of a nightmare it might be to combine the two. Looking through the RVO2 code, I don't see any sort of states though, so it might not be too terrible. If I modified it to ECS though, in order to use it I'd have to document any/all changes to it due to the license (I think) which sounds nightmarish
.Run = Run on main thread, now
.Schedule = schedule to run on a worker thread
.ScheduleParallel = Schedule to run parallel on potentially many worker threads
Yeah, I'd definitely want it to be scheduled Parallel if I was going to do it
That means any mutation is potentailly really bad
Yeah that makes sense. Looks like there's a lot to learn on the subject. Thanks again
doesn't .ScheduleParallel run on multiple worker thread if your Entities.ForEach covers multiple chunks?
1 thread = 1 chunk?
Yes, hence why potentially many
Docs says:
ScheduleParallel()-- schedules the work to be done in parallel using the C# Job system. Each parallel job instance processes at least one chunk of entities at a time. In other words, if all the selected entities are in the same chunk, then only one job instance is spawned.
@scarlet inlet congratulations on being added to ext-dots ๐
@tawdry tree thank you for your response here: https://discordapp.com/channels/489222168727519232/497874303463850004/727415415549984798
However, I ran into the same problem again with the type 'InputActions'. I am already referencing Unity.InputSystem, and just like with Unity.Entities.GameObjectConversionSystem, I googled it and could find nothing regarding which assembly definition file it uses. This is just confusing.
That sounds like the input package, am I right?
yes it belongs to Unity.InputSystem
just like GameObjectConversionSystem belonged to Unity.Entities, with no reference to Unity.Entities.Hybrid
but I only have these 3 options for input assemblies
I haven't used the input system package with AsmDefs, so not sure
If the Unity.InputSystem assembly isn't correct...
What's those dependencies for?
I don't understand why we have both these dependencies and asmdefs. It seems so redundant.
what do you mean?
It's a local package I'm developing ๐
Ah. The package info and AsmDefs are completely separate, though - the package dependencies are the other packages that must be installed in order for that one to work. The package can (and most official ones do!) have multiple AsmDefs, for example one for code and one for tests, or however you yourself split your code.
Okay
The only solution I can come up with would be to interact with that particular package one outside a defined assembly.
You might want some use-specific DOTS "interfaces" for the input system anyway
It sounds weird that it doesn't work with the InputSystem reference, though
Doesn't it generate some files for you? Double-check where those lie
what files?
@wary ibex You speaking about InputAction class?
Do you have using UnityEngine.InputSystem; in place where you want to use InputAction ?
hey guys. What is the best way in your opinion to have a hashmap on a component? My actual problem is to create a NetworkedEntityManager, in which i can link my netIDs with Ecs entities. I was going to use a singleton with a component and a hashmap, but it doesn't seem to be allowed
UnsafeHashMap<int, Entity>?
You can put those onto components, but you'll need to manually dispose those structures when you're done using them
oh can i, let me try that. I was trying to use NativeHashMap
seems to be pretty much the same as a NativeHashMap, is there a real difference?
NativeHashMaps use UnsafeHashMaps internally
the major difference between the two is that NativeHashMap has a disposal sentinel check so you can see whether or not there is a mem leak easily in the console
good stuff, thanks a bunch
What is the best way to destroy all the entities I created? I was instantiating converted prefabs and atteched a shared component to it. Then I used a query for that shared component to destroy the entities.
But I get this: DestroyEntity(EntityQuery query) is destroying entity Entity(214:1) which contains a LinkedEntityGroup and the entity Entity(224:1) in that group is not included in the query. If you want to destroy entities using a query all linked entities must be contained in the query..
sounds like you'll have to make sure all of your linked entity group have a common component and include them in the query through it. I may be wrong but i think LinkedEntityGroup is from prefabs with children, and ideally the destroy method would be able to also destroy the children ๐ฆ
This thread also suggests its impossible to destroy linkedentitygroups: https://forum.unity.com/threads/how-to-destroy-all-linked-entities.714890/
Thats a bit impractical at least ๐ค
i believe when i encoutnered the issue before i had to iterate though each child via the component and remove them individually
would be great if unity could do that by default
would be interesting how unity handles this case with subscenes
I guess they should have the same problem
How do i check if a entity has a "type" ( The Type-Class) attached ? So instead of manager.HasCOmponent<Health>(entity)... a check with a type... any ideas ?
@stone osprey what do you mean by has a type?
Instead of .HasComponent<Health>(entity) .HasComponent(entity, typeof(Health))
is this possible ?
its possible with some hackery
if you get the typeInfo (which i think u can do in jobs now) or know the typeIndex
you can then write the index to an existing ArchetypeChunkComponentType for example, and call its exists method
I wonder if you could do it through a systembase extension method? maybe not
is there a reason for you to do that Genar ?
if you are thinking of assigning a type to a variable and do .HasComponent(entity, typeof(variableName)) that wont work with Burst, since dynamic stuff isnt allowed
Thanks ! That should already help ๐ Im working on a reactive system... one for burst and jobs and one for single threaded activities... Some of those callbacks should only run if the entity has certain other components attached... HealthReactiveSystem.RegisterAddListener((...) -> {}, typeof(Player)) this callback should only run if a health component was added but theres already a player component attached to the entity
Such systems are great for ui stuff... or for client/server communication or for asynchron stuff
I took a look at the SceneSystem.UnloadScene method but I cannot quite comprehend what they are doing in there to destroy all entities ๐ค
OOP worse than DOP/DOT ?
@blazing igloo Not that flexible and performant
OOP is great for applications that dont change their structure that often... DOD is great for things that change often and consist of data only ( Composition over inheritence e.g. )... Not "easier" just different... you need a lot of boilerplate code, but once you have the base its pretty easy to add new features ( Chicken + Fire = Fire Chicken ) with a couple of lines
also while you are here
Is it better to make a lot of scripts and organize stuff by their function or make fewer scripts
which is better for performance
A lot of scripts ( Each one spezialized on one certain thing ) > huge scripts managing all
Well atleast for organisation... not sure about performance
But it shouldnt have a huge impact at all
I should clarify I am not doing DOD im using old scripting
So it doesn't matter?
Then why am I getting 50fps on my mobile game that barely has anything in it
Well it does... but not that much as far as i know... you probably shouldnt use the update method in every single script
pretty sure I wrote efficiant code
Oh that has many reasons... you should profile your project... could be update methods, rendering, too many polygons etc.
Yep, its pretty simple... it shows you what in your project is draining your performance
Cool like Task Manager?
Nah like this : https://prnt.sc/t989l8
Okej thanks
I red that DestroyEntity(NativeArray) can destroy the LinkedEntities but DestoryEntity(EntityQuery) will not
Is there a way to create a NativeArray from a Query?
maybe not for a few years at the current rate
it would need to get ready first
which Unity estimated year ago to be somewhat production ready by ~2022
and it's not looking like it's happening by that
and even when that's done, majority of the users will not use it
so... maybe never, or in 10 years, who knows
Can someone remind me how to do profile sample thingie for bursted jobs ?
first time i need it ๐ i have a job that takes 230 ms in bursted job, i am thinking sorting array does that
What could cause objects just disappearing/entities not being rendered once the scene starts?
I just copied demo files from one project to another, ensuring I had all the packages. I get no errors, and I can see the objects in the scene view, but once I hit play it's all gone. I can see entities and components in entity debugger though
Not remembering to offset the camera on z on updates
And that's #archived-dots of which I know nothing about... Still, the cause usually render getting clipped by near plane of the camera.
Even when everything is gone from scene view?
Do they use the wrong world space coordinate as a center?
can you check DOTS -> Live Link Mode ?
should be SceneView : Live Game State
i thinl
yeah make it Live Game State, maybe it will work
unfortunately it didn't :/
๐ฆ
thanks though
well only think i can think of is hybrid renderer package, but you already said you had the packages so not really sure
no idea what's the difference between the 2 projects to be causing this
so you can see your entities in edit mode but they dissapear when you go play mode ?
yeah
and they are active because I can see them in the entity debugger, they're just invisible
I'll try reinstalling the hybrid renderer but I doubt that'll do anything. I already trying deleting Library folder & restarting many times
Can someone remind me how to do profile sample thingie for bursted jobs ?
@opaque ledge The ProfilerMarker api?
hey. What's the expected behaviour when calling EntityManager.AddBuffer twice?
calling that 3 times, end up with a buffer of length 6
It will just silently return internally on second Add and all other AddBuffer, as under hood it using EntityDataAccess* -> AddComponent which in turn check that component already exist
do you agree the result above is weird then?
First of all I don't see all your code
Second is you using Child buffer (Unity built-in from transform systems) I suppose?
The issue might very well come from my code, I'm trying my best to check that and couldn't figure it out, wanted to check the expected behaviour before getting in deeper.
Yes I'm adding child entities to a parent for the transform system
are they maybe auto added by some other system on some condition?
Child buffer involved in parent system of course as it's used by them, moreover is ISystemStateBufferElementData not just IBufferElementData which means it tracked a bit differently. I'm 100% sure problem in your code. Describe what you trying to do, I'll help you. When and where you adding buffer. entity to which you adding buffer created from code or by conversion workflow etc.
thanks. Entity is spawned from a system directly, from an ecs prefab, in a non burst code simply using the EntityManager. I'm doing the above code right after instantiation, and have no other reference to Child in my code.
And show inspector of this entity (from EntityDebugger selected entity)
if i remove the above two lines, it seems like Childs are still created (I'm adding Parent and LocalToParent to to child entity, maybe that's the reason).
but weirdly enough, if i only use the first line, it seems ok and i end up with 3
ParentSystem tracks changes of chunks with Parent\Child
For building hierarchy you only need add Parent to your childs
m_NewParentsGroup will handle that and will add child buffer
This is the reason of Child is ISystemStateBufferElementData
As parent system responsible for that buffer and only this system tracks adding\removing this state buffer
ok, so Parent + LocalToParent will do just fine in all cases?
Parent, LocalToWorld, LocalToParent
yep OK, understood
Then it runs chain of jobs on change filters
collect unique parents and "fix" missing childs
That's all "magic"
great stuff thanks
Still kind of a mystery why it was not producing 6 childs with the first line of code only
i would have expected 9 actually
As it's state this is the reason why you don't see Child buffer first frame after conversion
ic
Ok lets figuring that out. You have system yes?
sure
actually its called on update when i receive a snapshot from a game server, for an entity that doesn't exist already
Ok, anyway, you creating that entity AND immediately add Child buffer? You already have Parent,LocalToParent ar add it right after Child?
correct
in that case 3, on the same parent entity which already exists
and basically this is called 3 time in a row, in the same update call, for 3 child of one entity already spawned (same parentEcsEntity)
in a basic foreach loop, no jobs, no burst
a simple cube, with no parent of children
and basically this is called 3 time in a row, in the same update call, for 3 child of one entity already spawned (same parentEcsEntity)
@eager jungle thus your parent should have these 3 childs right?
Like this
Right?
absolutely
Can you now comment second if statement and show me EntityDebugger inspector for that parent cube?
Show it ๐
I'm interested in other components too
with commented if(_parentSynchEna....
it is
which means not this code adding entities to buffer at all as you haven't here Add now ๐
And about parentEcsEntity, which you told is just root cube then it shouldn't have Parent ๐
And as I see
as it's the same name as childs
SmallCubeClient
hmm let me try to follow you
And hierarchy please
@coarse turtle yeah, but i think i figured it out thanks
Of opened prefab
No need hierarchy
I see that it's one entity itself in LinkedEntityGroup
Yep I see that from EntityDebugger
Prefab itself - good
Now question where this prefab also used
And what is more important
Are you sure you by accident using one of created childs
by overriding your prefab value
stored on Scriptable with Client/Server prefab pair, which is then converted to prefab entity using conversionSystem.GetPrimaryEntity
Are you sure you by accident using one of created childs
by overriding your prefab value
can you explicit that?
parentSrcEntity
where it involved
As problem exactly with this prefab
Not with prefab itself
but with how you storing (writing) in that field and where
parentEcsEntity is something that i get via a hashmap
As problem not in code snippet from above
where i save all the already instantiated networked entities
just to be clear, what would you expect ?
- when commented out , the instance should not have Parent?
- when commented out, should still show 3 and not 6?
Native Array sorting takes too much time D:
sorting 1000 entities
i guess i have to find a workaround
@eager jungle just to be clear, what would you expect ?
- when commented out , the instance should not have Parent?
- when commented out, should still show 3 and not 6?
Nothing yet as I still don't saw where and how you instantiating and storing parentEcsEntity
Which is core of evil
If your parentEcsEntity it's the same simple cube with nothing, to which you adding new childs - with commented buffer if(_parentSynchEna.... I expect it will be without parent (if it's root entity in your case) and no Child buffer at all
why no Child? isn't it supposed to be added automatically because of children referencing it as we discussed above?
with commented buffer
if(_parentSynchEna....
Why it should if we not adding anything?
geez, you wanted me to comment out the entire thing xD
i just removed the condition!
yea i get it now!
will give you results in a minute, meanwhile, do you know why it has a Parent:Null?
Also what is netEntity? I suppose some component which is key in hashmap of you client\server prefabs?
If so - how you calculate hash code as it can be problem if you getting parentEcsEntity from this hash map
That's good then we returned to what I told before - parentEcsEntity is root of evil
Also what is netEntity? I suppose some component which is key in hashmap of you client\server prefabs?
If so - how you calculate hash code as it can be problem if you getting parentEcsEntity from this hash map
Also what is netEntity? I suppose some component which is key in hashmap of you client\server prefabs?
If so - how you calculate hash code as it can be problem if you getting parentEcsEntity from this hash map
that's correct, it is a simple index. Actually im using the server side unity ecs entity index as the "network id"
hashcode = return index
simple int right?
correct
And server entities persistent, and not destroying? ๐
As Index can represent not one entity through entities lifecycle, as after destroying this entity and creating some other entity at some point you will have entity with the same Index but different version ๐
not destroyed
That's good then problem only in getting parentEcsEntity from networkedEntities
As you see in your code snippet
your networkedEntities stores all entities (including childs)
yes
And side question do you have some unparenting\destroying of these entities? or it's only this hash map and Adding?
no weird things tbh, instantiate, add buffers/components, add to hash map
And one last thing - var prefab
you just get it from SO right?
I mean convert - store to SO - get from SO?
But yeah it's irrelevant
SO array on an authoring, declare all prefabs, GetPrimaryEntity, everything stored in a singleton
maybe weird question, but im kind of loosing track. What do you think is the problem again? can we summarize ? :p
Well my advice then - debug your networkedEntities->parentEcsEntity as problem somewhere around that which cause this weird thing as parentEcsEntity messing up and starting to have Parent (but definitely shouldn't), as I haven't all your code context I can't say much at this point and it's up to you ๐ But you can be sure snippet above it's not the root of problem but result of messing parentEcsEntity ๐
parentEcsEntity having a parent, i think i just found the reason why, and it was simply because i commented out the if line only, it was expected behaviour in that specific case so no worries
if that's what's bothering you, i think its fine
now concerning that
Put Debug.Log(11111) under your if(_parentSynchEna.... it will appear in console 3 times right?
yea ofc, first thing i tried ^^
would you expect 3 or 6 in the buf after your code? because basically what is happening is that i have this log saying 3 at the time of spawn, but 6 (or3 sometimes it seems) in the buf in the inspector
My code above (last screenshot you reposted) show 3 and 3 in buffer as expected
This is why I still bothered by parentEcsEntity
put
if(EntityManager.HasComponent<Child>(parentEcsEntity))
Debug.Log("WTF?!");
before if(_parentSynchEna....
I mean your if(shouldSpawn)is inside loop I guess then this WTF should only throw 2 times as at first call we haven't child buffer yet
i think i get it, give me one sec
and this loop called in one frame?
that's what im checking
seems like it
UnityEngine.Debug.Log($"tick:{UnityEngine.Time.frameCount} parent:{parentEcsEntity} child:{ecsEntity} len={EntityManager.AddBuffer<Child>(parentEcsEntity).Length}");
same frame count
for all 3
"WTF?!" appeared 2 times?
Yes that's good
One last thing
Put Debug.Break(); after whole loop
when all childs added
EntityDebugger will show you 6 entities on Child buffer? And in Console you'll see only these 3 messages? (excluding WTF?!)
yes ๐
Nope
It's involved only on instantiation\destroying
and we saw in your prefab it has only itself as it haven't child's (prefab itself)
yep
can you try to delay the parent creation by one frame before the 3 loop ?
on my end, its done in another system as well, if that can make a difference
ok i checked, so
SystemA runs first on frame N, and instanciate parent
SystemB runs second on frame N as well (same frame), and runs the 3 loop
result is 6 in buffer
thats a good thing for both of us i guess xD
Add PreviousParent to your parentEcsEntity
And you stop looking 6
with your code snippet
just AddComponent<PreviousParent>
yes because blocking the add from the unity systems running on the query you show earlier, right?
Well reason for that is
it first checking what I sent you before
and as adding Child in this way - not intended as it tracked automatically
And then how it works:
You adding 3 entities
Then TransformSystem see new Parents without PreviousParent
why is it 3 in your sample? is it because you're adding the 3 entities in the same system the parent is being instantiated?
Well I'm a bit sleeping and my mind can do the tricks with me ๐ PreviousParent wouldn't solve that...
i mean, if we agree thats its just a side effect of systemstates and that the actual fix is to simply not create the Child buffer, then im good
great
And this is why it messing up as you adding it by yourself but Unity system still add same childs again
that's good enough of an answer for me, i thank you a lot for your help
and time spent
Np, there was not much help as I was tired ๐
just curious, you from?
Russia
super late indeed
02.00 AM
west russia then^^
well cheers from france, 1am here. Thanks again, I'll wrap up with the fix and stop working... xD
PreviousParent will solve IF you put parent to it ๐
Then you'll cheat ParentSystem
Well all as I desribed
You adding 3 child's
it adds 3 entities
then ParentSystem adds them again
But it call RemoveFromParent from PreviousParent
And remove only if != Entity.Null
And if you add your parent
It will remove childs and then add them again ๐
THis is if you WANT do weird things from above ๐
When you doing that as intended - just Parent and LocalToParent
It will work the same out of box without any stuff from last messages ๐
spaghetti, but understood! I don't want to do weird things, but I think we're both just trying to understand why the weird stuff is indeed weird even we don't want to do it ๐
Well, I knew that before ๐ but it was so long time ago and I completely forgot why we shouldn't add Child and I just used Parent from the time being (as, well, why I shouldn't do it wrong if I know how do it right) this is why it takes so many time (with tiredness in addition) ๐
thats absolutely fine, thanks @storm ravine
So many posts and DOTS versions went through me after all these years of DOTS existence, my mind starts filter unnecessary knowledge as I'm not interested in them anymore when we have right approach ๐
i understand. One quick question, are you aware when 0.12 is supposed to be released?
waiting on the fixed simulation group for physics
Don't asked that from DOTS team, can't tell more
k
what's the diference between the Parent & PreviousParent components ?
[WriteGroup(typeof(LocalToWorld))]
public struct Parent : IComponentData
{
public Entity Value;
}
[Serializable]
public struct PreviousParent : ISystemStateComponentData
{
public Entity Value;
}``` so we always need both or ?
@zinc plinth You shouldnt need to touch PreviousParent
its managed by the transform systems
ye I saw it gets added by some transform system
will be added/updated/removed by those
System state components are usually meant to be used and controlled just by their systems (usually 1 system)
also, in the case of a child, I just need LocalToParent and not LocalToWorld right ?
yea adding converting go to already created entities
just trying to find my code that does it
rewriting most of it ๐
yea so i add these:
em.AddComponent<LocalToParent>(combatEntity);
em.AddComponent<Translation>(combatEntity);
em.AddComponent<Rotation>(combatEntity);```
and i add Parent
and then finally on the parent entity
i update the LinkedEntityGroup
i dont update the child buffer... not sure if i should
LocalToWorld, Translation & Rotation already are already present tho
how bad is it to be reading a native list length using its unsafe pointer?
im trying to make some debugging tools to show me the sizes of a bunch of native lists im using
mainly to see if the list is filling up and exploding
what's the diference between the Parent & PreviousParent components ?
@zinc plinth Purpose ofPreviousParentis removing child entity fromChildbuffer ofPreviousParententity when you changingParentcomponent on that child. Like You haveA- some entity andB- child ofA, B hasParent-AandPreviousParent-A, then you changingParentofB(which equalA) toCnow yourBis:Parent-C,PreviousParent-A.ParentSystemhandleParentchanges and removesBfromAChildbuffer byPreviousParentand addsBtoCChildbuffer byParent(LocalToParentandLocalToWorldalso here but for simplicity I just not mention them)
how bad is it to be reading a native list length using its unsafe pointer?
@ocean tundra by UnsafeList* -> Length ?
@storm ravine Yup exactly that
Nothing bad as NativeList.Length property is exactly m_ListData->Length where m_ListData is UnsafeList*
also doing the same for capacity
but the native list length has that threading safty check thing
all i want for this tool is to see the lists filling up and if they are expanding
which it seems to be doing fine atm
but the native list length has that threading safty check thing
@ocean tundra of course as this is difference why we have NativeList instead of just UnsafeList ๐
if you want to use pointer exactly then all safety checks up to you ๐
sweet
will see what happens then
i dont mind if im reading old values by a frame or 2
? By pointer you'll get always current values in memory no matter you store this pointer 5 or 10 frames ago, values will be the same as in current frame ๐ (if address not changed of course, which wouldn't change in case of UnsafeList* itself (only internal buffers changes) if you not disposing that and just use NativeList as usual)
what if job x is adding things into that list, and then over on my main thread im reading from it would it be a old value?
what if job x is adding things into that list, and then over on my main thread im reading from it would it be a old value?
@ocean tundra if job running at the same time - it will be race condition
Which mean you don't know that you will get ๐
well will see what happens
i guess another idea is to record the list sizes from a job into a native array and then use that to display the numbers
Because the thread scheduling algorithm (not jobs but threads itself) can swap between threads at any time, you donโt know the order in which the threads will attempt to access the shared data. Therefore, the result of the change in data is dependent on the thread scheduling algorithm, i.e. both threads are โracingโ to access/change the data.
And it even can lead to crash depends on data as it will produce "random" things in memory ๐
well that really dosnt sound good
Yes as you not mentioned in your initial question that you want do that Length check from pointer for concurrent work ๐
Just accessing UnsafeList*->Length (and other) in non-concurrent context - absolutely fine, in concurrent - become a race condition ๐
sweet
This is why we have all these safety checks, multithreading itself has atomics etc. ๐
ill leave it as is for now but in a day or 2 swap it to have a "reader" job that gathers the sizes of my lists
Eizen what do you think of native array sorting ? it just takes too much time, i am sorting 1k struct and each takes 0.5 ms and i have 2k entities running this sort, am i doing something wrong or should i try to find a workaround
i find native array sort forum topic, everyone says its sort performance is good, but definitely not in my case D:
@opaque ledge Theres a sort overload that allows you to only sort x part of the list
Any ideas why I have a project that's simply not rendering any entities? As soon as the game starts, the entities are gone from game view and scene view
(I can still find them in the entity debugger)
@wary ibex do you have hybrid renderer?
I have the package installed yes
I have the package installed yes
@wary ibex Entities created from code or conversion?
both.
If from code you should have LocalToWorld, RenderMesh, RenderBounds
i find native array sort forum topic, everyone says its sort performance is good, but definitely not in my case D:
@opaque ledge which one? With DreamingImLatios answer?
This same code worked in another project so I think it's something to do with settings, but I dont know what
This same code worked in another project so I think it's something to do with settings, but I dont know what
@wary ibex Are you sure HybridRenderer package installed properly? Show mainfest\PackageManager
yeah
@storm ravine
Show inspector for any your entitty which should be rendered (from EntityDebugger)
Eizen what do you think of native array sorting ? it just takes too much time, i am sorting 1k struct and each takes 0.5 ms and i have 2k entities running this sort, am i doing something wrong or should i try to find a workaround
@opaque ledge well 2k here is "wrong" thing ๐ In meaning of this sort is fast for low count, for big amount of data (2k is big in context of this sorting, as this sorter not scales well by design of algorithm) you should implement different sort algorithm ๐
hmm alright, are you aware any open source DOTS sort algorithm ?
They not DOTS related tbh, you can try to implement similar to Dreaming - radix sort
i am only sorting 1k btw, 2k entities doing this sorting, but i guess its still low performance
ah alright, maybe i can find it on forums
i am only sorting 1k btw, 2k entities doing this sorting, but i guess its still low performance
@opaque ledge You mean every entity from 2k entities call sort for 1k lists ??
yeah, each of 2k entity doing a sort of a dynamic buffer of size 1k
@storm ravine
@wary ibex GPU instancing checkbox enabled on material?
so i guess i am sorting 2m elements in total ๐
yeah its a threat management, where spaceship tries to calculate which enemy ship they should target
Naive way ๐
You should implement space portioning algorithm, Spatial Grid at least
@storm ravine yes it's enabled
Or better - octree
yeah, didnt know sort could be a problem ๐ buffer has ALL the enemy ships whetever they are in range or not, i will most likely try to split the buffer
this is the difference between the project that doesnt work and the one that does
Left haven't WorldRenderBounds, but it should be added by RenderBounds automatically
๐ค
This entity from conversion or from code?
from code, but the same happens when I convert from the script (ConvertToEntity)
maybe its something about using Hybrid renderer v1 or v2 ?
Both projects are using v1 I think since the editor is 2019.4
HR version not relative here
I can try just pasting all project settings and see if it works I guess
Show me EntityDebugger itself
with systems list and worlds dropdown
And\Or Systems\Entities windows
You're using networking?
not now
Then why your world is empty ๐
Yes and this is correct one
This is the answer why it's not rendered as there is no systems which will render, add required components etc.
I thought those were included in scripts?
Left one has networking systems already right one - haven't
Show worlds dropdown for not working project
that's probably because I installed the netcode package
I think you'll see Server\Client worlds
you're right, server/client worlds are populated and default world is empty
And in this case you should configure Ghosts, Prefabs mapping for them etc ๐
how can I change the world I'm viewing in the scene view?
It's not how it works ๐
okay
You see all of them, but only system relative to rendering and depends on components set decide to render it or not
And in case of networking - your authorings should be configured properly
ok, thanks
I wasn't aware the netcode package would just break the project like that. I'll get rid of it for now then
netcode package is kinda source of all evil, many tears were shed because of it D:
There's no explanation for it. It's just stupid to ship a package that suddenly changes everything in the project and you can't even select a world to view
So for every little scene I need to make sure all ghost authoring components are set up? That's just ridiculous. From the point of view that sometimes I just want a client-only scene to test stuff, and not use networking
There's no explanation for it. It's just stupid to ship a package that suddenly changes everything in the project and you can't even select a world to view
@wary ibex I take it that you are very new to DOTS in general
There's been huge changes throughout the previews
There's no explanation for it. It's just stupid to ship a package that suddenly changes everything in the project and you can't even select a world to view
@wary ibex it's preview ๐ That's all ๐This require strong knowledge and reverse engineering and guarantee nothing, they're here not for production or casual usage, they're here for tracking how they grow\evolve, like backstage ticket๐
They basically have freedom to change everything without thinking twice as long as there is no actual release
Fair enough
they always have been stable about Entities package tho, there was no 'breaking' change i think, MAYBE except one time where they moved from entity query to IJobForEach
Unity probably can hide everything and just do what they want and how they see that and will get less rage in process, BUT in the end it will be better as package will be much closer to what users want and not what Unity think users want
but i guess its not the same with netcode or animations packages
except one time where they moved from entity query to IJobForEach
@opaque ledge are you sure this sentence correct? ๐
tbh not really, i wasnt there but sounds like a 'big' change to me ๐
i will put a "maybe" in there ๐
I mean they not moved from EntityQuery to IJobForEach ๐ As they just different things, maybe you mean deprecating IJobForEach and moving to Entities.ForEach? ๐
wasnt EntityQuery first way to iterate over entities for their data just like we do with ForEach now ?
EntityQuery works the same as it worked always (with minor changes)
yeah but while it still has useful its not the 'main' way to do ECS stuff right ? Entities.ForEach is the main way now
it's simplest way ๐
As less boilerplate
And all depends on case of course
as IJobChunk or even manual chunks iteration sometimes will be faster than ForEach as you operating on chunk level and has access to them, which is impossible in ForEach body itself (but chunk version of lambda in their mind)
ah yeah, there is also IJobChunk ๐ i never used it tbh
you might be thinking of the ComponentSystem -> JobSystem -> SystemBase migration
along with all the ways you used to be able to iterate back in the early days. JobForEach<T> etc
hmm, well i guess i must be remembering incorrectly, i remember watching Joachim's video in 2018 where he introduced EntityQuery, i thought that was the only way to iterate over entities back when, oh well ๐คท
when i started learning ECS (tried to at least) IJobForEach was the thing, never did any entity query
entity querys are basically a filter
still very important and used throughout the framework
the fuck
getting a segfault on UnloadAssetBundle on 2020.1.13b when I stop the game 
feels like loading & using asset bundles in system is really not a good combo
ok so the real bug seems to be that ConvertToEntity will make the editor crash if it's inside an asset that's being built into an asset bundle ???
why tho
guess I'll just add the component at runtime for now..
nvm it's 2 bugs --'
both ConvertToEntity crashes the editor if in an assetbundle, and I'm getting a segfault on UnloadAssetBundle(native code) when I stop the game within editor (idk how to reproduce 2nd one)
hope 19.4 is more stable..
@zinc plinth I'd stick with 2020.x for DOTS because.. https://forum.unity.com/threads/moving-dots-to-2020-1.910931/
if you go to 2019.4, you'll be stuck with DOTS packages available today and will not get any updates anymore
it'd be nice for my editor not to crash every 5 seconds on native code then --'
I already knew about 2020.1 & dots, but I can't just wait and pray that it'll be fixed in the next beta
if it's even fixed before 2020.1 comes out
and we're 1 month past the middle of the year with it still not out with no date announced
it's probably going to come out very late of the year
I'd be really surprised if it's out before september at this point..
I'll give it a november
next year, it'll be 1 tech release and 1 lts release.
and the year after that, it'll just be lts release every year
:lul:
oh, Burst 1.4
## [Burst 1.4.0-preview.1] - 2020-06-25
### Added
- Experimental support for tvOS
- Add intrinsics support for `AtomicSafetyHandle.NewStaticSafetyId<T>`
- A new option `[BurstCompile(DisableSafetyChecks = true)]` that allows per job or function-pointer disabling of safety checks. This allows users to have blessed code run fast always.
- Improve Editor experience by scheduling compilation immediately after assemblies are changed, instead of waiting until Play Mode is entered.
- Improved our aliasing detection to allow `DynamicBuffer` structs to be easily vectorizable.
- Added a compiler warning for any use of throwing an exception from a method **not guarded by** `[Conditional("ENABLE_UNITY_COLLECTIONS_CHECKS")]`. Since exceptions in Burst are only supported in the editor, this provides a useful warning to users who may be relying on try/catch behaviors for control-flow which is not supported in final game builds.
- Burst compilation status is now displayed in the Background Tasks window in Unity 2020.1 and above (click the spinner in the bottom-right of the Editor to open this window).
- Upgraded Burst to use LLVM Version 10.0.0 by default, bringing the latest optimization improvements from the LLVM project.
- Add support for try/finally and using/foreach for IDisposable patterns.
- Add `BurstCompiler.IsEnabled` API.
### Changed
- Made the compiler better at constant-folding complex static readonly constructors.
- Bursted DOTS Runtime Jobs are now decorated with `[NativePInvokeCallback]` instead of `[MonoPInvokeCallback]` which could generate callback wrappers which could cause native code to inadvertently interop with the managed VM.
- The Burst menu-item `Safety Checks` has been changed to a modal choice of `Off`, `On`, and `Force On`. `Force On` will overwrite any user job or function-pointer with `DisableSafetyChecks = true`. To avoid users falling into the consistent trap of having `Safety Checks` set to `Off`, any reload of the Editor will issue a warning telling the user that `Safety Checks` have been reset to `On`.
- Use platform provided memory intrinsics for iOS, tvOS, WASM, and console platforms.
- Updated Cross Compilation Tooling To LLVM 10
- The command line option `--burst-disable-compilation` is now disabling entirely Burst, including the AppDomain.
### Fixed
- Fixed incorrect struct layout for certain configurations of explicit-layout structs with overlapping fields
- Fixes a caching issue where stale cached libraries may have been used if a project was copied to a different folder, or Unity was upgraded to a newer version
- Burst will now error if a `cpblk` was used to copy into a `[ReadOnly]` parameter or field.
- Fixed a bug where the mm256_cvtepi32_ps intrinsic would crash the compiler.
- Fixed a bug with constant expressions that could cause a compile-time hang.
- Debug symbols are now output when using the native toolchain on mac.
- Sleef fallback to scalar float for WASM.
- ABI struct ret/by val for trivial aggregates for WASM is now respected.
- Fixed a bug with float/double vector constructors of `Unity.Mathematics` that take half or half vector parameters.
- Debug information for anonymous structs could be created partially multiple times for the same type.
- Filter symbol warnings to prevent them reaching logs.- Fixed an issue where UNITY_DOTSPLAYER builds not building for NET_DOTS would be unable to compile do to references to UnityEngine.
- Fixed handling of conversion from signed integer to pointer which caused issues as discovered by Zuntatos on the forums.
- Allow to call `[BurstCompile]` functions from other `[BurstCompile]` functions
- IntPtr.Size now correctly returns int32 size (rather than UInt64) - fixes an assert.
- Burst package has been upgraded popup could fire erroneously under shutdown conditions.
- Fixed an issue preventing player builds to succeed when burst compilation is disabled.
- Debug symbols for function names on some platforms are no longer hashes.
- Job Entry point symbols should now reflect the job name and type rather than a hash in callstacks/native profilers
- Job entry points without symbols now use the Execute location rather than pointing to unknown/unknown
- Dwarf symbols from multiple modules (e.g. multithreaded AOT compilation) now have correct compilation unit information.
### Known Issues
- Output of `Debug.Log` is temporarily disabled in Burst Function Pointers/Jobs to avoid a deadlock on a domain reload. A fix for the Unity editor is being developed.
'blessed code' ๐คฃ ๐คฉ
this is nice:
- Improve Editor experience by scheduling compilation immediately after assemblies are changed, instead of waiting until Play Mode is entered.
it probably still locks the editor though
if they can do it without locking, it would be pretty sweet
that background status thing does imply it wouldn't lock.. so will need to test
debug log being out temporarily is kinda bummer
as additional note, I got this on fresh project with new DOTS Editor: https://forum.unity.com/threads/solved-issues-with-dots-editor-package.887056/
I feel that Unity should have some api check tool so they could actually fix this with some messagebox popup if people install package that requires different setting
you shouldn't need to decipher it yourself
they do this for example when you load SRPs with player set to gamma instead of linear, would like to see similar thing for the scripting api level
@dull copper removing support from 19.4 means that LTS users wont be able to use ECS at all...
yes
well, they are not removing the support from existing packages, more like only supporting 2020.x for the upcoming updates
2019.4 LTS has never been final target for ECS
I do get it will suck but then again, since DOTS still evolves a lot, locking things to 2019.4 API would just slow them even more
testing first time this new entities view... first thing I test on it sucks already ๐
I hope I can somehow set the field name, instead of getting "Entity (2:2)" for it
it does use gameobject name with empty gameobject converted
and there is only one entity here
old Entity Debugger shows the name properly:
so.. wonder what's up with that
it also doesn't show anything for the first frame (unlike the old one)
what do you mean by that?
select pause then press play
yup. the entities view suck
I just use the debugger, coz I got used to it plus, I see the chunk structure
oh I get it
also, the name got fixed after I once went to play mode and back ๐
I'd really love to have this entity view though
it's cool to have easy to navigate hierarchy
another thing that kinda sucks is that when you select something in the entities tab, it doesn't actually keep selection "selected" in the entities tab
inspector keeps showing it tho
would be nice to have it show that as long as the inspector is still used for the selection
regular scene hierarchy works like this
lol... C:\Unity\Graphics\com.unity.render-pipelines.core\Runtime\AssemblyInfo.cs(4,8): error CS1029: #error: 'Core SRP 10.0.0 or newer with Hybrid Renderer V2 requires at least version 0.6.0 of com.unity.rendering.hybrid'
oh well, I tried
this is from trying Hybird 0.5.4 with bleeding edge SRP from github on latest 2020.2 alpha
kinda awesome how they put that note even tho its not 'publicly' released
after bypassing the error, I get this: A Hybrid Renderer V2 batch is using the shader "Hidden/Internal-Loading", but the shader is either not compatible with Hybrid Renderer V2, is missing the DOTS_INSTANCING_ON variant, or there is a problem with the DOTS_INSTANCING_ON variant.
nothing renders on hybrid 0.5.4 atm, probably because they changed something here
I mean, while using bleeding edge HDRP
should still work on older versions
Does it make sense to find an entity by specific component values? E.g. find entity which has a TilePos value of Vector2Int(3,5)?
"com.unity.rendering.hybrid": "0.7.0-preview.8",```
0.6.0 is so last season already
and here we are stuck with 0.5.2-preview.4
0.6+ requirement is basically from this commit: https://github.com/Unity-Technologies/Graphics/commit/343341f6ea0874ed87479da3884554e36f976961
ah it actually works on bleeding edge HDRP after I revert that commit
when are the next srp packages arriving, feels like ive been stuck on 9.0 preview for like forever, and hybrid rendererv2 hasnt really gotten a significant update in a while either.
@safe lintel my educated guess on the SRPs would be at least month+ still
9.x will remain always in preview and 10.x will be the official release for 2020.2
but both of these are under heavy activity atm as they keep patching the major SG change
so, I wouldn't expect 10.x release any time soon, 9.x is more likely because it's preview and they can afford previews breaking things more than stable releases
the number is more or less inconsequential, just wondering aloud when some sort of update will arrive. considering previous large versions have received more incremental package releases makes the current situation kinda strange
yeah I wouldn't hold my breath waiting for these any time soon
ive been using a custom shader for all my urp stuff, its kinda simple but still not shadergraph based. im just wary of a humongous package update between universal and hybrid, vs getting regular incremental updates that make it easier to update alongside. ah cest la vie
meanwhile, here's few weeks old hdrp from git that should work with Hybrid 0.5.2 and 2020.2.0a15: https://github.com/0lento/Graphics/tree/a15-staging
there's a16 coming up any moment now so will do one for it as well with more recent SRP
doing custom srp shaders will be PITA to maintain
I've done that in past
never again
my brain seizes up trying to keep track of hdrp's changes on top of dots, universal is all i can muster
universal so far seems simple enough? im nowhere near being a shader guru either
what for you need those custom shaders?
if you can use custom function node in SG, you save yourself a ton of headache
half lambert light shading on models, and linear light falloff as well as the option for vertex jitter
ah, well, I'll shut up then ๐
im dreading what changes i need to make for proper v2 compatibility though, my project goes pink with v2 and latest alpha+packages but it does that in a blank project too so ๐
pretty sure you need custom SRP now, like that a15 branch I just linked
but you also need git lfs to clone it as all Graphics repo forks require it
I'm currently trying to test if virtual texturing has any chance of working with hybrid renderer but they've also totally changed the VT workflow since I last tried it
still trying to figure this out
that being said, I doubt it works
would just be glorious if you could combine dots streaming and virtual texturing as you could just get the game running asap without much loading time
wonder if that sample(battle royale esque thing?) will feature vt at all
seems like the right kind of demo to feature it, streaming subscenes, huge scale
well, at first glance, VT does seem to work with hybrid
does the new math package use radians for trig methods?
should
ok ty
does dots subscenes use asset bundles somehow?
I'm getting this error while trying to build with DOTS subscene and virtual texturing on one shader graph:
Material 'Shader Graphs_New Shader Graph' was built for an AssetBundle while it contains a Texture Stacks. Texture Stacks can not be part of an AssetBundle.
asset bundle is not assigned on that SG
from VT doc: AssetBundles are not supported, including Adressables and Live Link.
AssetBundles are not supported, including Adressables and Live Link. that doesn't even make sense lol, addressables and live link are not asset bundles - ESL maybe...
hmmm, I fiddled with build setup and now it built
I don't think I had live link enabled tho
well, the VT SG didn't work on build for dots subscene/hybrid rendering: A Hybrid Renderer V2 batch is using a pass from the shader "Shader Graphs/New Shader Graph", which is not SRP batcher compatible. Only SRP batcher compatible passes are supported with the Hybrid Renderer.
interesting, the batcher apparently was causing the psychedelic issues last year, so is there solution to disable it?
you can disable it via code or through debug menus
but I'd really need to have it to have any kind of decent perf
this test I'm doing is for more open world game setup, so would need it to work
it's kinda weird it does work in the editor though
I also did try that without dots subscene but it really seems like it fails because of hybrid rendering pass
it's also totally possible it's just not compatible enough with the old hybrid renderer
it also doesn't show anything for the first frame (unlike the old one)
@amber flicker it does show things in editor already though if you have things on dots subscene(?)
I just realized that it does display stuff from regular scenes as well once you hit play, unlike the old dots editor
like, all converted entities show up in the entities tab regardless if they come from dots subscene or regular scene
but then again, I guess this should have been obvious to me as it's not really substitute for the conversion preview but rather entity debugger
i've been trying to update my project today and it seems like the current hybrid/editor configuration is buggy as hell, they're probably gearing everything at this point to the next release version.
hybrid is kinda tricky as they haven't released in a while: a) new hybrid b) new srp packages
I got hybrid 0.5.2 running here on bleeding edge SRP with just released 2020.2.0a16, but this could have some extra bugs as they've probably assumed you'd only use this with the latest hybrid which isn't out for us
for example, as soon as i put a shape in a subscene (like a default gameObject sphere or cylinder) and hit play, it crashes the editor, and the .dmp says its a divide by zero exception :S
using the latest packages + alpha crashes every time entering play mode with hybridv2 enabled in player scripting settings, that is in a new plank project
oh good, at least its not just me then. I've been going through my project trying to figure out which part of it caused the issue.
only tested with universal though, not sure about hdrp
also this is just latest by the pm, not github
there's actually new 9.x preview today on the PM
for URP and HDRP that is
didn't see that one coming
no hybrid update yet tho
So what is the official release date for DOTS?
Also has anyone heard any good books in pipeline?
and rest can be super sketchy :p
but even when DOTS is officially released all the supporting bits wont be done
Things like animations, sounds, vfx
I mean, actual entities has been pretty solid in terms of not being super buggy most of the way throughout previews
they've changed the workflow a lot and api has gone through gazillion changes
if stuff wouldn't crash on the version they tell us to be on to get updates it would be a damn good first step
but we still don't know if the workflow we have now is what we'll get on entities 1.0
oh yea definitely, the core DOTS is so nice to use
core is basically the thing that will be on 1.0, Unity has not even said they'll release anything else but entites package this year
rest of the DOTS is currently estimated to be ready by 2022
@zinc plinth Yea my project jumps around in stability, ive found that spending the time to cleanup when you stop playing has made it WAY more stable
and that's not some figure I threw from my hat, it's from their original dots roadmap
I've spent the last 10 hours getting native code crashes on 2020.1; being saltier than the dead sea would be an understatement rn
dam that sucks
I just fucking want an asset management system that automatically build it's stuff; but apparently that's too hard
are you talking about subscenes?
AssetBundle straight doesn't work on 2020.1 with ecs ; Addressables doesn't want to build from an assetpostprocessor
is it supposed to be compatible?
why wouldn't it be
every time I've asked about DOTS support from Addressables guys they've said they will get to it at some point
so I totally assumed it's not compatible
I have no issues with addressables and DOTS
I didn't even get to that point with Addressables lol
but i do runtime convert them after loading
im guessing your trying to pre convert?
I just want automatic asset packing builds ;-;
I don't want to have to manually build it, because we all know we'll forget to do it at some point and wonder why things go haywire or don't work
that's all I'm trying to get lol
you mean building the addressables?
yea
im unsure about the 'new' build system
need to upgrade to that
just looking for my script now
so i made a menu item to trigger my build
and its also called via my build server
private static void DoBuild(string[] scenes, string[] scriptingDefines, BuildOptions options,
string fileName)
{
BuildPlayerOptions buildPlayerOptions = new BuildPlayerOptions();
buildPlayerOptions.scenes = scenes;
buildPlayerOptions.locationPathName = fileName;
buildPlayerOptions.target = BuildTarget.StandaloneWindows64;
buildPlayerOptions.options = options;
buildPlayerOptions.extraScriptingDefines = scriptingDefines;
BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions);
}```
then you can add bits like
AddressableAssetSettings.CleanPlayerContent(
AddressableAssetSettingsDefaultObject.Settings.ActivePlayerDataBuilder);
AddressableAssetSettings.BuildPlayerContent();```
that's to create a standalone build isn't it ? not done within/for editor ?
The built system in the Platfroms package looks great to me but I only find it by accident as there is no real documentation on it
yea its to make a standalone
ha
I thought you meant like something that triggers before everything else when you hit "play" ^^'
why would you need that?
to make sure that my packed assets are up to date
if your using addressables in editor you shouldnt use packed mode
I thought you meant like something that triggers before everything else when you hit "play" ^^'
@zinc plinth that would be really useful. I was looking for sth like that for a long time
holdup; what's the default behavior of Addressables in editor ?
its simulated
you have to manually build it don't you ?
you dont have to built to use them in editor

i think you must have that last option picked
which is great for debugging
but only right at the end before you release a build
I didn't, but I had no idea what the behavior was because the docs are really not that clear
https://i.imgur.com/OZMu4Ng.png it was selected too >.>
urggggggg
๐
don't know if I should cry, scream, or knock myself unconscious on my desk 
The tagline of DOTS: The Movie
when using IConvertGameObjectToEntity whats the right way to get all entities
like all the children and their children
i thought a linked entity group but gives me a exception saying its not added
Not sure, but I remember that LinkedEntityGroup doesn't get added when in a subscene.
i am just starting to use subscenes
(src: https://gametorrahod.com/game-object-conversion-and-subscene/)
good read overall
thats unexpected
theres a conversionSystem.GetEntities gona try that
also whats that attribute we should be using for sub scene conversion stuff?
Let me know if you find something that works, I was gonna do something similar, because I want to pluck certain bodyparts from my models, so that I can easily get the "hand" or whatever of a unit when I need to cast a spell.
so looks like get entities is only for the object that gets passed in
not children
looks like a child buffer is added
but you would need to recursively process those
Maybe you can dig around in that method and see what it does
or even just use the linkedentityhgroup it'll produce for you
which should be a flat list of all children of all depths
i did see that
yea now it has that buffer
but i dont think i can see it
yea that code just configures it to be added
dosnt add it right then
oh well in this specific case i dont have children
so not too bad ๐
now how do i load a subscene into a world
How are we to get the Hash of a subscene to load it?
when using IConvertGameObjectToEntity whats the right way to get all entities
@ocean tundra do you really need all entities?
You could maybe also do the reverse approach. Add a little IConvertGameObjectToEntity on the children and then use GetPrimaryEntity to add some data to the root/primary entity.
https://forum.unity.com/threads/finding-child-entity-during-gameobject-conversion.843826/
So how do we load subscenes, I have this:
var sceneId = sceneSystem.GetSceneGUID("CoreGameAssets_SubScene");
_loadSceneEntity = sceneSystem.LoadSceneAsync(sceneId);
but it needs some sort of catalog data and crashes as its null
theres meant to be a 'catalog.bin' in my streaming assets folder
Curse these subscenes
yeah, i never used them
Hey guys. I'm working on a system that i need to specify and make use of generics. It seems like Entities queries & jobs using <T> are not allowed. What is my best alternative?
Can anybody help me finding a specific entity by component value? It seems I can only filter by shared component values
@eager jungle Code gen is the best way
or you can use Jobs directly, so no Entities foreach or Jobs WithCode
personally i have a mix of both
Tons of code gened systems but i also have started writing jobs using generics
@pulsar jay Yea thats right, depending on how often the lookup value changes I would have a 'find' system that loops over every findable entity and puts it into a native hash map and then use that for lookup
@ocean tundra how would I tell that system what to find? Would I have to create an entity with a special component "findvithvalue" or is there any better way to pass information like that to a system?
it wont be a generic system, what is the entity your trying to find?
it is basically an object on a grid. It has a cell position and I am trying to find the object on cell (5,3) for example
I am still unsure if I should have an additional data structure for that
before ecs i was using a dictionary
there are a ton of ways to do that with DOTS and which is best is super hard to tell
my advice is pick a way and then get it working, if you have performance issues then look at the different approachs
thanks @ocean tundra . Any good starting point for codegen?
Now the 'ways' :P
- A 'tile' entity, has a shared component for easy lookup of its tile pos, and has a dynamic buffer of entities. the lookup entities add/remove themselfs from the tile entity
- A native muti hashmap, key is the tile pos, value is the entities, again 'findable' entities add/remove themselfs
those are the simple ones
ive seen people doing things like quad trees ect
and thats more around a RTS FOW as thats what im planning on doing
if you dont have many things in 1 tile pos then a normal native hashmap would work
@eager jungle Yup, lookup tt templates, thats what i use
and i use them in preprocessor mode
so first you write the tt template, then you pre process it in Visual Studio or rider, then from unity i have a scriptable object that will execute the template and pass it some data. That SO also has the File write code that takes the string text and puts it into a file
I thought about the shared components. I guess it is not that efficient if I only have single to a few objects per cell position. Its even designed to use layers so there should only ever be 1 object per layer per cell
I guess the native hasmap is the way to go then. I was about to ask if there is a DOTS alternative to dictionaries anyway ๐
yea theres a bunch of awesome native collections
they cant go on a entity tho
so you expose them from a system
So they need to be a static member of a system?
and you also lose out on the magic ECS dependency management, so if you have Job A writing to List A and then Job B reading you need to handle the job dependencies yourself
not a static member, but a public one
and not a property, a public field
ah so I can get the system by "GetOrCreateSystem" and then set the values?
yup
have the system that 'owns' the collection be the only one writing to it if you can
makes things clearer
alright thanks
Right now DOTS land feels more and more like Workaround land for me ๐
haha yea, it takes a bit
but once it 'clicks' its amazing
but dont think of the native collections as workarounds they are a core part of DOTS
The core part of ECS seems to be iteration over linear 1D data structures. Games usually are 2-3 dimensional however. It seems to me this clashes every time I try to do sth. spatial with ECS.
yea they could do with some more spatial bits somehow, but i find i dont spend much time on spatial problems
admittingly my major problem will probably be FOW and i havnt started that yet
FOW?
Was just about to say that its a good problem for the GPU to handle
yea but i need it for networking
but networking will make it a bit more complicated
yeah I know the trouble ๐
as @ocean tundra says there are many ways - additional things that may affect your decision: 1) Number of tiles, 2) Frequency tiles/overall size changes, 3) Regular tasks (data access patterns) you will want to do - i.e. checking neighbours
I feel I have a lot of spatial problems to solve. And the most obvious example is collision detection. The whole Havoc and Unity physics talks at unity also felt a bit like workarounds. It was like "we just copy all the stuff into native buffers do our stuff and thatn copy it back"
yea but its fast
have you seen any of ther performance posts? theres probably some on you tube now
yeah I have seen the impressive performance improvements
maybe its just my programming habit that I feel I have to strictly follow a pattern... ๐ค
i think its more about learning the new patterns
It is probably more difficult than it should be to both a) implement these common spatial lookups and b) not do everything ecs once you start ๐
all this struct and ref stuff, not using properties really threw me through a loop
im so used to them from a enterprise software background
also e.g. CDFE myTiles[associatedTileEntity] can do a lot of heavy lifting without necessarily making 'the most performant' backing data structure imo
yea and don't get hung up on writing the most performant either, you will get stuck for days, already with ECS + Jobs + Burst your way faster
Get it going then come back when you have 20k entities and it isnt performing well
I am not even trying to make it performant atm ๐ Its more about redundancy I guess (keeping track of several lists representing the same map)
@amber flicker whats a CDFE?
Component Data From Entity
So you mean maintaining a tile list on a single entity?
Ah I see it gives me a list of all entities with that component. Didnt know that. Thx
it's what sits behind as e.g. 'GetComponent' in SystemBase - if you're not generally using them that will definitely make your life a bit easier but it's not a cure-all
Thanks for all the help with navigating the DOTS jungle ๐ I will see how far I get with these new tools
np - we all go through the same pains - just keep framing it around the data
if you frequently want to know about a tiles neighbours for example then adding a buffer to every entity with e.g. the 8 neighbours entities means you can easily use CDFE to find properties for a neighbouring tile
(if your tiles are mostly static / created once) - you wouldn't want to do that every frame
yeah right now I am mostly concerned about map building e.g. changing multiple tiles at once etc. It might be a good idea to have that buffer
I am still wondering if I should have cellposition as shared component data as @ocean tundra proposed as it my be interesting to get units on a specific cell later on
SCDs are good provided you're not overly fragmenting your entities. i.e. you don't want to iterate those entities frequently. If you had many e.g. 10,000+ tiles and every frame you updated that tile's resources or something, you'd want to be iterating the resources independently of the entities otherwise you'd be iterating over 10,000 chunks. Not necessarily a big deal - just something to be aware of.
Yeah thats why I didnt meke CellPos a shared component yet as I was afraid it would fragment the data into many nearly empty chunks with only a few entities
I will be watching the Boids Presentation again and see if this helps me decide which way to go: https://www.youtube.com/watch?v=p65Yt20pw0g&feature=youtu.be&t=1446
March 23, 1:00pm (San Francisco) - Mike Acton demonstrates best practices for component design to achieve a high degree of parallelism, minimum synchronization, and high performance. He focuses on data layout and uses common examples in games (e.g. spatial queries, logic updat...
Unity staff reply on Virtual Texturing and hybrid v2: Hybrid renderer v2 should already work with 2020.2.a and we are backporting a fix to 2020.1 now.
@ocean tundra for objects on grid : I have a buffer of my tile entities inside the grid object, and I translate 2d coords to 1d (requires known and finite size), and inside the tile entity I have a component thzt has the object entity
Nowhere in thzt I have shared component
Having shared components for tile pos would murder the chunks sydtem5
Grid entity *
@zinc plinth yeah that works well for finite grids. In my case it is sparse though
Yikes
I guess a nativemultihashmap might work in my case in a similar way
I have read somewhere that its faster than having a int2 as a key
I guess thats also why its used in the boids demo
The only way to iterate values for a key in this is Next
Which is good if you do only sequencial
But if 'ot thzt' s horrible
If I need a tile in an exact position I could fetch it from the multihashmap with x,y coodrinates
If I want to do sth sequentially I could just run a system over all cellPos components
But I am still unsure where the hashmap should be stored. I could either put it onto a separate entity (like the grid in your case) or store it in a system like proposed before
Having it in a system would mean you can only have one, and isn't the best practice to put thzt kind of data there in my opinion
And if you don't use int2 as a key but int you'll have to Next through the whole values until you find what you want
You can benchmark it it's fairly easy to test, but I'm pretty sure what's going to win
yeah I guess it would be easy enough to exchange one for the other
I am more concerned about where to put that data structure. The possibility of multiple grids seems to rule out storing it in a system as it would be limited to one hasmap as you mentioned
Having a component on the grid which stores the hashmap just felt like the 'classic' gameObject way of doing things
I haven't noticed "Convert To Entity (Stop)" before
is this some thing to make conversion ignore certain GO's?
in which case it should be (Ignore) I guess
ah, this probably explains why I had issues with VT and hybrid v2 yesterday when I tried it: 9-preview will only work with 2020.1. We'll need to backport a fix first. It might take a few more weeks for everything to land in 2020.2.aX and hdrp 10 that allows you to use hybrid v2.
I have manually merged their fixes for HDRP 10.x but if it requires editor side fix, it totally explains why it failed for me
If I want to 'select' certain objects (e.g Tiles or Units) to do some other stuff with them later. How would I handle that? I am thinking of having a system to select certain units in an area and then have other systems e.g. to move it or to attack sth. I would need a list to share between these systems. Should I communicate all of this via entites? I could imagine having an entity with a selectionrectangle component created when selecting with the mouse which triggers the selection system which in turn adds a selection component to the entity containing the resulting list of selected units
Another solution would be to add a tag component to the selected entities. But how would I tell the move system when or if to start moving the units. Having a MoveTag component?
Another solution would be to add a tag component to the selected entities. But how would I tell the move system when or if to start moving the units. Having a MoveTag component?
yes. for me that's what i did. just add tags if I want a specific group of entities to be affected by a system
@dull copper if you put convert to entity stop on a go that's a child of a go getting converted, it will make that go and all it's childrens not be converted
it's to "stop" the conversion chain
thx will try the tags
ah yes, that makes sense
I was thinking it as ignore but it does affect the child too
so I guess stop makes sense
Is it possible to get acess to the components of another entity inside a scheduled entities.foreach query ?
Entities.ForEach(() => EntityManager.GetComponentData<...>(id); }.Schedule(); ?
Damn... i need to set up a child-parent relation and the childs need to insert themselves into the parent :/ Hoped i could do it like this
Theres GetBufferFromEntity in case that anyone has similar problems
Is there sth like GetComponentInParent for entities?
If I click on a tile the raycast will hit the child entities collider component so I will have to find the parent entity to change the whole tile
there's a new update on burst.
ah., preview.2
@deft stump could it be that the update broke the GameObjectConversionUtility?
1.4.0-preview.1 spammed a lot of errors for me
I just added the physics package and it seems it also updated the burst compiler
must be a hotfix
and now I get this error: "No sharedMesh assigned to Unity.Physics.MeshCollider on Path_Pillar_Prefab"
Hey, maybe a stupid question, but with SystemBase, Entity.ForEach and the ScheduleParallel, is the IJob interface still used or is it considered "legacy"? I am a bit confused with all the DOTS versions and I just want to be sure I am not misunderstanding something
yeah its still used
but there is also Job.WithCode(), you can use that if you want to get advantage of local variables
Damn ok thanks, I am having a tough time understanding the difference between an Entity.ForEach and an IJob that you schedule
Installing the physics package really breaks my prefab conversion. Not sure if this is because of the physics package or the bust dependency
Entity.ForEach creates IJobChunk in background, its a 'special' job that runs on chunks, Entity.ForEach is something you should do if you are doing ECS(Entity) stuff, such as reading a component on an entity or write to it etc, IJob is for.. everything else ๐ IJob is not related to ECS, you can use jobs(such as IJob and IJobParallelFor) in monobehaviours as well
in what kind of way Peaj ?
