#archived-dots
1 messages ยท Page 55 of 1
So the archetype has some sort of dictionary<Entity,EntityInfo> to map the entity directly to its chunk and its index inside the chunk for acessing it ? ^^ Is there some way to get that info ?
no
it has data about how components are mapped in chunk
as in, what are offsets for each component type
Hmmm... but how does the world actually now in which archetype and in which chunk and which index my entity is located in ?
it has a giant array map
it works sort of like dictionary
dictionary<int,Chunk>
where int is entity index
Ah i see... so i assume its like a jagged array ? For instant acess ? ^^
Actually pretty smart, so component acess based on a entity id is O(1) i assume
Just one lookup to find the chunk/index and another to get the component itself
kind of, yeah
you can look at source of GetComponentData from entity manager to see it for yourself
it is in fact pretty simple and clever
does GhostComponent/GhostField work with shared components?
What pre-release? I was gone for a few days
some packages became pre instead of exp
it is indeed feels more stable
but baking errors are still here
unresolved subscene header
erroring editor
and etc
UntypedDynamicBuffer - the things i need to write
so, it's just byte[] buffer?
damn, I got another fun idea for source generators
if there is an ISystem declared
byte would be a type but sure
basically i just wanted dynamic buffer functionality from DynamicComponentTypeHandle and UnsafeUntypedBufferAccessor
so i just wrapped it
and it doesn't have implemented OnDestroy/OnCreate/OnUpdate/OnStartRunning/OnStopRunning, implement empty methods in other partial declaration
?
this is already done for you
oh
you won't need to have implementations of OnDestroy/OnCreate
as a little birdy told us they finally setup default interface implementations on the ISystem interface
so how would it work?
same as I mentioned or interface won't implement those?
default interface implementations is just a c# feature
public interface ISystem
{
void OnCreate(ref SystemState state) {};
}
you can just define your implementation on the interface
cann someone help when i try to dowload oculus integration this happens
if(HasComponent<Health>(damage.Target))
return true even if damage.Target was destroy (QueryMask give the same result)
what another option I have to check if entity exist without EntityManager?
are you certain it is destroyed already or is the destruction actually happening in a later command buffer
in command buffer
I have separate system for Destroying. In editor it looks like entityInvalid
so SystemA is writing Destroy command to ecb
SystemB is checking HasComponent<Health> (entityToBeDestroyed)
EntityCommandSystem runs and destroys entityToBeDestroyed
SystemB is correctly telling you that Health is still there. the entity is not yet destroyed
You cant rely on what the Editor is showing you here. it shows the state at the end (or beginning im not sure) of each frame
I know how it process in 1.0 version, but I have 0.5.
In 1.0 i'm going to have disable DestroyTag on each entity, and enable it in this system. So, I can add WithNone<DestroyTag> in query.
But for now I wan't add this tag in run time cause sync point
So I got your idea thank you @solemn hollow
object:wrapper_native_000001B790D8A8C0 (intptr,intptr)
Unity.Entities.SystemBaseRegistry:ForwardToManaged (intptr,Unity.Entities.SystemState*,void*) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:363)
Unity.Entities.SystemBaseRegistry:CallForwardingFunction (Unity.Entities.SystemState*,int) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:311)
Unity.Entities.SystemBaseRegistry:CallOnDestroy (Unity.Entities.SystemState*) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:381)
Unity.Entities.World:DestroyAllSystemsAndLogException () (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/World.cs:1011)
Unity.Entities.World:Dispose () (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/World.cs:306)
Unity.Entities.World:DisposeAllWorlds () (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/World.cs:332)
Unity.Entities.DefaultWorldInitialization:DomainUnloadOrPlayModeChangeShutdown () (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/DefaultWorldInitialization.cs:101)```
why is, OnCreate in a system being called on a domain reload destroying the world
it called OnDestroy but invoked OnCreate - it's like all my burst function pointers are getting muddled on domain reload
How do I achieve this desired behavior by using the PhsyicsVelocity component? On main frame, via EM, duration single frame only.
This is what I got with PhysicsVelocity, I suck at math. Is there a utility I can use or can someone point me in the right direction?
Here is my code as-is
private void PlacementProtocol()
{
var player = App.Player;
if (!player.HasSomethingInHand || !player.IsLookingAtSomething)
{
player.SetControlMode(PlayerControlMode.Default);
_ghost.Destroy();
return;
}
var item = player.Inventory.ItemOnHand;
// METHOD: Transform
// EntityManager.RemoveParent(item, _ghost.Transform);
// EntityManager.AddComponent<PhysicsVelocity>(item);
// METHOD: Physics
var itemTransform = GetComponent<LocalToWorld>(item);
EntityManager.RemoveParent(item, itemTransform);
var linearVelocity = _ghost.Position - itemTransform.Position;
EntityManager.AddComponentData(item, new PhysicsVelocity { Linear = linearVelocity});
player.Inventory.DropItem();
player.SetControlMode(PlayerControlMode.Default);
_ghost.Destroy();
}
you are very talented at breaking burst?
im so glad i dont run into those errors. i wouldnt even realize whats happening ๐
i'm going to downgrade to 1.8.1 i swear all this started happening on .2 update
oof im still on 1.7.4
see no errors, but main thread system code is blue, and actually non of my system is bursted. In burst inspector there is no system struct at all, only nested job structs
@solemn hollow I've fixed my problem. My DamageSystem that create destroy request used BeginSimulationEntityCommandBufferSystem
and my Destroy system was use EndSimulationEntityCommandBufferSystem.
If I use BeginSimulationEntityCommandBufferSystem in Destroy System - everything is ok
what?! how do you live without 1.8
and break pointing inside burst
archaic
ah didnt know thats a thing. atm im not writing much ecs code anyways. Graphview UI is giving me a hard time
did you put [BurstCompile] on the struct and methods?
yeah in unity 2022.2 and burst 1.8 you can now put a break point anywhere and if it's in burst, burst will automatically turn itself off in that function allowing you to break point there.
yep
but i prefer my systems to not call oncreate when getting destroyed
ill wait till you deem it safe ๐
the thing is, i didn't even have a world created
also no one else is seeing this jank
i just have a cursed project
Code looks like this
you miss Burstcompile attribute on the Update Method
your OnUpdate doesn't have [BurstCompile]
Wow, I thought it only requires whole struct marked as [BurstCompile]. Ok, thank you!
hi, guys, i have an odd issue think i tried run this code https://pastebin.com/4V6jX9T2 i did a bit of fixing but have an odd issue on line 173 on this code a.k.a "ecb.Instantiate" when i try to Instantiate i do see in it list but it not render at all have idea as why this happened as u see in the image
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
jobs are special with their burst requirement
why?
because i might be doing reflection or reading managed data to setup the system
but yeah elliotc did a really in depth writeup about the burst compile tag
and the magic with jobs etc
oh, yes, I do it in a bunch of systems
is it rendered in game view?
You might miss the Scene View Mode setting : Runtime Mode
Preferences -> Entities
hmm what version are you on?
you know what doesn't make sense
i haven't even entered play mode
so how is it disposing a system that has never been created
i already verified it's not in my editor world
ah yes its there. my settings are just ordered differently.
i am too
honestly ive seen that issue now atleast with 10 different people. That setting should be at Runtime Setting by default IMO
mine was defaulted on runtime
i'm curious if it is defaulted to authoring or if it's just reading from 0.51
maybe its a mac thing then? but that would be weird
i need to create an empty project to just check default state
because yeah, should be runtime
when i upgraded it defaulted to authoring
well people are used to see whats happening ingame in sceneview too
i have a feeling this is also related to open subscenes
so i don't really notice it
ill test it
because I think this value on affects the view with open subscenes?
tell the true i do feel lack of documentation about dots and such hard understand how do stuff
damn i cannot tell the difference. even if my entities wouldnt be rendered if the gameobjects are it would look exactly the same for me
but i remember having some issues when i updated. hmm
i designed my architecture around never having open subscenes
so you got rid of your level designer?
what i've realized is
you can not have open world subscene amounts in the root
i think large subscenes should just be worked on as a scene
just open the scene normally
i dont get your point yet sry
ok it takes like 8min or something to bake megacity
you mean you should be able to directly work in subscenes?
if you make a code change that invalidates your subscene, and the open subscenes were in your working scene
you would be sitting there for 8 min before you can enter game again
every time you made a change
so i think separation of coding and world is the way to go
yes i have a subscene thats bigger than needed.. pain in the ass
so what i have is a prefab with required subscenes - settings, server/client/presentation etc
and then have 2 scenes setup
1 with just the prefab + a development subscene
1 with the prefab + 43298507523094753902487578902345 world subscenes
Sounds like more subscenes than Megacity ๐
megacity is not large
size wise
anyway continuing on, making changes and live baking megacity is also a huge pain
so you don't edit the world in a subscene
you just open the scene up and make edits, the level designers and artists they don't care about live baking
what's the best resource for start learning dots?
https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/DOTS_Guide
this is a broken link.
the manual
or read the stuff down the bottom here
https://github.com/Unity-Technologies/EntityComponentSystemSamples/
If youโre working on a game (or other real-time simulation) that requires the most efficient CPU usage possible, then Unityโs Data Oriented Technology Stack (DOTS) is a great way to get the performance you need. However, to use DOTS successfully, you canโt simply grab the API documentation and dive straight in. Before you begin creating a projec...
i don't think that's a good first start
i guess it does link a lot of good resources though
ya both of these looks like an excellent place to start diving in
depends on if you need to learn DOD too or not
i am mostly interested in understanding the unity way of doing this ๐
linearVelocity = TargetPos - CurrentPos;
that would give you velocity that is meant to move object to target position in one physics step
i would argue small samples never demonstrate great practices
so you recommend lots of small subscenes?
i havent used streaming yet. i guess its game specific how large you want the subscenes
well i think you just need to for the sake of your game
if it's large / open world
otherwise you're just going to load everything into memory
megacity does this well with per subscene hlod
and streaming
never looked into it cause i wanted full random generation with wave function collapse. but thats on hold right now anyways
aww i liked reading about that a year? ago when it was being discussed
was really interesting
was early this summer
well that'd be 2 weeks ago for me ๐
yeah time is weird these days
i had a running version of WFC but the issue was it was way too slow and "undirected".
our tile density is too high to generate fast enough
we would just need to double / tripple the tilesize and its fine
well just write it faster !
anyone done an inventory system in entities yet? i remember seeing discussions about this a while ago on the forums
i've been thinking about it a lot
i was wondering about that. havent seen any inventory systems. i have no usecase for it yet either ^^
here are my thoughts
Assumptions
- Items in world are entities
- Must handle all types of games
- You have slots where items go, certain items can stack
Options for slots
- Slots are entities, referenced from a dynamic buffer
- Slots are dynamic buffer with general meta data
Options for items in slots
- Items in slots are the same entities that would exist in the world)
- Items in slots are custom slot entities
- Items in slots are just data stored in the slot
the question i'm basically trying to figure out is, when an item is in a slot, what should be an entity?
at work we go the full entity approach, slots themselves are entities, items when stored in inventory are just the same entity
but it's been a huge pain but that might be more implementation than design
id add the requirement for itemweights
It gets tricky when you have stacking items, and large stacks of them
One of the flaws of our inventory at work are stacks of items become a single entity so you can no longer track individual item state
Durability is averaged or lost etc
have you considered shared components for this?
No
like a slotID and UnitID as shared component maybe
Few more thoughts first though. The biggest question I have been going back and forward about are
Item slots - should they be entities?
so you sort slots into chunks. nvm single items would take a whole chunk...
Item slot as inventory
Pro
- Versatile you can attach data and do cool things
Cons
- Slower; lookups required to access
- Tiny archetype so 128 limit kind of sucks
- Generally have no logic so does it make sense to be an entity
- State harder to maintain
Then there is the whole, backpacks
How does that play into slots?
this is when a slot is an entity itself and items are entities in a dynamicbuffer on the slotentity right?
well the slot would only hold 1 (stack) of items
yep. just got confused by the first line ^^
i'm leaning against doing slots as inventories
but I am worried I am pigeonholing myself
how do i handle something having 2 separate inventories?!
do I just write this as a layer on top of a single buffer
this is basically been my thought process, layer the logic
Keep a very basic inventory operations on a single buffer
Add, Remove, Swap
Layer application specific logic on top of it
Inventory layout
Multiple inventories
Advanced inventory operations, transfer, slot restrictions, etc
i wouldnt worry about any performance here at all. main considerations should be ease of use
performance consideration for me here is simply avoiding 20,000,000 slot entities
inventory operation performance is not really a consideration
The 1 consideration is inventory operations usually need to run single threaded
So it can bottleneck if game went crazy but I'll deal with that when I get to it
So the other half of this is,
Items in inventory slots, should they still be the underlying item/entity
Or should they be replaced by a simple representation
My current thought process is, both
Keep the existing item entity around to help maintain state, disable it and no longer replicate to clients
And create a simple inventory representation to replicate
Issues -> updating representation with state from item if it changes
Easiest way would be to add a slot reference to the item - should this always exist though? I don't like structural changes.
Nope. I just tried that, same result. I would think it's because of gravity and drag?
So I'd be looking for a utility or formula that would crunch all that out for me? lol
what result?
why not have a Tag "InInventory" that excludes it from those certain systems.
i would also say to keep the item entity itself in the inventory
because that's what we did in our project
and it's a nightmare to maintain
are you sure that at the moment of release your target pofition is correct?
how your drop item looks?
can you elaborate? is it networking issues?
Yes I'm sure. This EntityManager.RemoveParent(item, itemTransform); takes care of that.
public static void RemoveParent(this EntityManager entityManager, Entity entity, float3 newPosition, quaternion newRotation)
{
RemoveParent(entityManager, entity);
entityManager.SetComponentData(entity, new Translation { Value = newPosition });
entityManager.SetComponentData(entity, new Rotation { Value = newRotation });
}
oh and also why does item logic have to be single threaded?
Inventory
try to debug youy update. i have a feeling your velocity getf modified somehow before physics step is played
good thinking. I'll try
also
you might want to use sepsrate comp that will be picked up in fixed step loop
because doing chdnges to physics inside update often causes unwanted behaviour
or use command buffer
yeah, then if that's the case, then in the very same frame I have to set the transform directly because of unparenting, which resets it's position to float3.zero.
ooff, I can't believe I haven't considered that as my first option. ๐คฆ
i hate using parenting for things like that
I hear ya, but I had a terrible time with joints with that because the mount doesn't have a PhysicsVelocity. And when I added, it didn't remain static, regardless if the character root had kinematic (or static) for body type.
wouldn`t it be better to just snap your objects with your own code?
I do that if I need temporary parenting without affecting scsle
guys have odd question when i dots do i make every object in dot or it kinda mix some all covert to dots and some will use normal MonoBehaviour?
Isn't that what I'm doing? Or what you mean?
you use parenting
i mean literal msnual transform modification
exactly the way you need
oh, my apologies, now I see why this would seem like a dumb problem. I forgot to mention that sometimes items have jointed (fixed) objects to it. And if I set the position of the root object, the other ones will start "pulling" it back to compensate for the very drastic joint constraint violation. And it start to do the ecstasy tweark. Even if I scan the item for jointed entities and set their positions, it's the same result. But if I move the root item via physics velocity, doesn't violate the joint constraints and no buggies.
Hence my original question lol
Ok, I figured something out. if I multiply desiredVelocity * math.rcp(deltaTime), the object will snap right away, but it's the momentum afterwards that causes it to shoot forward, so looks like I'll have to throw on a tag and have a system reset velocity to zero and discard.
how often is that loop happening?
branch prediction of that loop will fail alot. maybe try branchless code
No idea what markers are, but if similar to profiler markers. They would not necessarily hit the end for every begin since you jump to loop with continue which might be the issue?
not so much!
What do you mean branchless?
I need to check some conditions and if they are satisfies, add nodes to a list,..
Might want to do
{
_markers[3].End();
continue;
}
im the wrong guy to really explain that in depth. Essentially form a mathematic equation of all your conditions that can be evaluated without the need to branch
unpredictable branching is bad in general. branch misprediction causes pipeline stall and flush IIRC
but no. branches are fine for the most part. id only optimize hot paths which this might have been
as jaws said you probably use the markers wrong
but i havent used them either so not sure
Yes, you are right
Appreciated
@mystic mountain
my wrong
and about nullable types, are they OK to use them in Burst?
_markers[6].Begin();
var neighborIsInCloseList = closeList.Contains(neighborPoint);
_markers[6].End();
_markers[8].Begin();
var neighborIndex = openList.IndexOf(new Node(neighborPoint, 0, 0, 0));
_markers[8].End();
As I had predicted, Contains and IndexOf is the most expensive operation. O(N)
is there anyway to get access to a systembase from a monobehaviour? (planning on running some methods in the systembase from the monobehaviour)
The bottleneck ๐
Is it valuable to store int instead of int3 in struct (Node) because it can cache more data?
but indices should be calculated int -> int3
public struct Node{
public int3 Index;
//...
}
public struct Node{
public int FlattenIndex;
//...
}
use hashmaps, contains and indexOf are linear searches
Yes
openList is priority queue
I have to define a new collection hashmap (check) + priority queue (find min)
hm, why do you need a queue for that? are other results important?
It is path finding
I should find the node with min cost
isn't that just a neighbour check + heuristic?
doesn't make much sense to write to a queue and then evaluate the min cost.
i'm pretty sure some burst optimized a* are floating around for reference
queue?
You mean priority queue? heap
Find min is O(1) why it does not make sense?
Add/Remove O(Log)
๐
Add native hashset for close list
ok, wasn't aware of the priority queue optimization. the way you described it threw me off, so it just optimizes the Contains lookup which sounds reasonable. the same could be done with a NativeList and a HashSet to lookup the F cost. that's not ordered but no astar version i've around does that. not sure why some have it then?
when using SystemAPI.GetComponent<LocalTransform>(WhateverEntity) does it give a reference to the entity's local transform or does it pass it in value only?
that call will acquire it by value
ah, is there anyway to get it by reference then?
yes, var lookup = SystemAPI.GetComponentLookup and then lookup.GetRef
thanks a ton!
this is probably a stupid question, but how do i see what is actually happening in the game view, in the scene view? That probably doesn't make much sense, so basically in my game view i can see my entity, i can press wasd to move it around, but in the scene view the entity is still at 0 0 0...
does scene view maybe show authoring instead of runtime?
i would not know, how could i check?
https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/editor-authoring-runtime.html found this which sounds like it is related to what you are talking about, but it doesnt seem to affect the rendering, how odd
under preferences, entities, there's a drop down
to select whether to see runtime or authoring
oh ok ill check there, thanks!
yup worked, thanks so much!
not really certain which would be faster or easier to work with, so either i'll have entities with a chunk component which will then have a list of entities that belong to the chunk, or instead on every entity have a component saying which chunk they belong to, which do yall think would be faster or easier to work with?
anyone having the editor not respond on script changes with dots? feels like im constantly task killing the editor(current latest version)
its not a 100% of the time thing though, like a few changes here and there and before you know it editor stops responding
I'd definitely be interested to hear more about that
dont know how to trigger it reliably unfortunately
break point @safe lintel when it's stuck and force a break
is it stuck in
AssetDatabasExperimental.ProduceArtifact()
you would make 3 of us then!
GravitonPunch and I both get stuck in here on compile sometimes and unity just hangs
the more i test this, the more i'm thinking it's somewhat related to file locking with
burst, rider, unity and maybe a virus scanner
i'm sure anyone who uses rider and recent burst has seen the rider error due to burst locking files
[pure speculation of course]
but i have not been able to produce a solid repo
trying to convert a Dictionary<int2, Whatever> on a GameObject to be on an IComponentData. According to google i would use a NativeHashMap for this, but unfortunately dots hates nested container types so it is refusing, any workarounds?
edit: nevermind im an idiot, whoops
er set a breakpoint and enter debug mode in rider while unity has stalled?
wondering is there a unity math version of FloorToInt? I've looked around but cant seem to find one so far...
nope - you call floor then cast
ah ok, thanks a ton!
if your numbers are always positive, just casting is sufficient
unfortunately they are not always positive lol
Hi guys, sorry for dummy question, but I don't know to fix this bug. Can you guys help me?
When I try to add movement direction and rotate a entity to the target direction like the attached image, I got this error
InvalidOperationException: The writeable ComponentTypeHandle<Unity.Transforms.LocalTransform> MoveInTargetDirectionJob.JobData.__Unity_Transforms_TransformAspectTypeHandle.m_LocalTransformCth is the same ComponentLookup<Unity.Transforms.LocalTransform> as MoveInTargetDirectionJob.JobData.MovementDirectionLookup, two containers may not be the same (aliasing).
yes
if unity locks up you can still attach a debugger
then you can just go to run -> debugging actions -> break all
and see where it's stuck
issue is a classic aliasing problem - you're passing in both LocalTransform via ComponentLookup and the Aspect
and the aspect is allowed to write
so in theory you could write to the aspect which could modify data you are reading in the ComponentLookup
if you promise unity you won't do this, you can disable the safety to get around it
oh, thank you, I got the problem. So in this case, what are the best practices to do that?
Can I use some kind of element for PropertyInspector that renders a whole struct? (similar to DynamicBuffer element)
KornFlaks had an interesting approach to visualizing blob data.
i'm losing my sanity if i have to write out every field for the blob data ๐
i hope this will be added. not seeing blob data is a total pain
why can't you write a PropertyInspector for the blob?
(like I did for the physics collider)
i'm only aware of writing them field by field. var text = new TextField("MainEffect -> StatChange pointer"); var index = new IntegerField("Index") { value = Target.index }; var statType = new EnumField("StatType", Target.reference->statType); var changeType = new EnumField("changeType", Target.reference->changeType); var value = new FloatField("Value") { value = Target.reference->value };
and i don't want to write, i dunno, 200 of these
under the hood there has to be some form of visual element that is able to render generic structs
as a quick hack you could just give it [Serializable] and draw it via a PropertyField using unity serialization
source generation is exactly for this
btw sir, are you still on beta editor? none of your packages work on released version
No
What packages?
My core package is definitely up to date
I just haven't got around to pushing anything to openupm
If that's what you mean
(honestly forgot I had core on openupm)
Pain because I have to mirror to github
0.9 branch of you're looking at core
yeah, i think that was one
It will be merged to master soon as a 1.0
i kept getting error about namaspace unity.platforms
But 0.9 definitely should work I update as recent as this morning
That doesn't sound like 0.9
That sounds like master
which appar
Which is still on 0.51
Brb 45min let me know if you sort it out
I want min f cost, How do you find it by HashSet? I did not get it?
I have seen priority queue used in A star, it is standard
A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.
SceneManager.onSceneLoaded is not working in 2022.2 it seems
@rotund token Is there any burst compile compatible 2D Array like NativeArray that able to put into struct Component? Currently not really have time to flatten array and test this code changes.
well NativeArray<NativeArray<T>>
but managing it will be as time consuming as flattening I believe
could always try pointers, and create arrays like you would in c, but that also might be more time consuming than flattening
How do you wrap long idiomatic foreaches at a certain column limit?
How do you split them into multiple lines?
Without it being too ugly.
rookie numbers
i have strict ide enforced styling so whatever that did for me is how i layed it out ๐
i think that'd be my longest
and i guess that's how i format it, thanks ide
Hm.
i'm getting these errors setting up a dots 1.0 project:
I'm sure i read something about this but can't find it
why do you update to the exp package version? preview version is the latest one
1.0.0-pre.15
and you should use "ENABLE_TRANSFORM_V1" scripting define symbol while you have not yet implemented Transforms V2
i didn't! i think it's been installed as a dependency
yeah HybridRender has installed it, because i've obviously just hit update to latest it's jumped to exp version:
ah its probably installed by Hybridrenderer. you should remove hybridrenderer and add entities graphics
right yeah
i was upgrading a project from 2021 to 2022 so i think that's where the confusion has come from
is this valid inside a foreach with the new LocalTransform component:
or should i be using WithPosition/WithRotation or some combination of the helpers
none of the links in the Physics upgrade guide work which annoyingly means you have to search around for this information
why not?
new transforms are very simple and self explanatory components
unlike old matrices
helpers are just to help it be easier
yeah the new transforms look good i like it
helpers for forward etc, less painful i think and maybe more analogous to unity Transform
i'm down to 54 errors isn't that wonderful
and a lot of them are related to conversion ๐ญ
We shouldn't be writing to WorldTransform right
it's write only
so nothing is read from it
and any changes are useless
everything but LocalTransform and LocalToWorld are like that
Feels weird iterating over LocalTransform or LTW instead of Translation because it's like a AOS and not a SOA, but I assume Unity does something to allow for it to be cache friendly and SIMD
not really
it's for reducing component size on chunks
32 bytes per matrix basically vs 64
Oh
they mentioned it explicitly in manual
also reduce amount of components
which indeed feels
rn I only need LocalTransform in most places
isntead of Rotation + Translation + LocalToWorld
Does anybody has even the slightest hint how to get Prefab baking to work with Addressables Content Management?
What is it you want?
Upgrade my project from Addressable + Runtime Conveersion with Entities 0.51 to Entities 1.0
runtime conversion is removed
I know. Thats why I am trying to bake the prefabs at build time
so, what is it you don't get? Anything specifically?
There are no docs on content management with prefabs (only subscenes)
because entities are only managed through subscenes
Should be possible with content management. Just thought anybody might have tried it already
Guess I will try to figure it out
It was referred to as Entities Addressables but now it seems to be a dumped down version which is called content management
Is it not possible to wrap over a IJobParallelForDefer? I have a job struct wrapper with 2 internal jobs: GatherJob : IJob and SortJob : IJobParallelForDefer
Whenever I try to instantiate and schedule my SortJob I get errors about Reflection Data not being set up, even if the job struct is completely empty (no fields, nothing in execute). If I wrap over 2 IJob while scheduling GatherJob : IJob and CoolJob : IJob it works just fine.
Sounds like a potential bug to me. Are you referring to the collections package in your assembly?
Not sure what you mean by the collections package? But I suppose so yes.
Basically I have this struct:
struct MyJobWrapper<T>
{
struct GatherJob : IJob { }
struct CoolJob : IJob { }
struct SortJob : IJobParallelForDefer { }
JobHandle Schedule(JobHandle) { }
}
If I schedule SortJob in the Schedule method I get the error about reflection data not being intialized. But if I do any combination of GatherJob and CoolJob everything works as expected.
I've based my code on the examples inside NativeSort.cs
I should also note that this is on ECS 0.51.1-preview.21 as we've still not upgraded.
Not sure what you mean by the collections package? But I suppose so yes.
Do you have a reference toUnity.Collectionsfor your assembly's .asmdef? I ask because we setup JobReflectionData eager creation using an ILPostProcessor and that ILPostProcessor comes from the collections package. This is necessary to avoid making lazy reflection calls during.Schedulewhich would prevent job schedule calls from being used in Burst compiled methods.
Yep there's a ref to Unity.Collections in my asmdef
Which engine version are you using, if you're on 0.51? IJobParallelDefer support for eager job reflection data creation was added later since that job type comes from the engine rather than from the old com.unity.jobs package (which was merged into com.unity.collections)
2021.3.8f1
I believe that is the issue. I'll double check but I'm pretty sure IJobParallelForDefer schedule from bursted code was added in 2022.2
Would this be bursted though? I'm instantiating the wrapper and calling (my) Schedule method in OnUpdate on a SystemBase system. Unless you mean some internal stuff?
Ah I misread your snippet. This seems like a bug. Your wrapper type is generic so we use an ILPostProcessor to figure out what all the different forms of MyJobWrapper<T>.SortJob exist. If it works for IJob and not IJobParallelForDefer either we have a bug or you actually have a [assembly: RegisterGenericJobType(typeof(MyJobWrapper<SomeConcreteType>.CoolJob))] but no matching one for your SortJob
What is the specific error you're getting, and which collections version are you using (I'm guessing 1.4.0)?
Yes 1.4.0, the exact error is:
I don't have any [RegisterGenericJobType] for these jobs, I much prefer to have the generics auto-resolved, hence me using the wrapper pattern. The auto resolve works fine for these IJobs so it's most likely to be specifically related to IJobParallelForDefer
Here, I made a quick minimal repo case: https://gist.github.com/PeppeJ/a2b87561cf0020a029f59f56e3d7fa7d
If you aren't trying to burst compile the schedule calls then you won't need RegisterGenericJobType
Using collections 2.0 on 2022.2 I do not have any issues with your snippet. Seems like a bug that we fixed. I can take a look to see if I have a diff that you can apply locally (if the fix is indeed in collections which I suspect it is)
Just installed and tried the snippet on 2022.2.b10 and ECS 1.0.0-exp.12 and it's working as expected as well. Getting an error about NativeList not being ReadOnly which is what I was expecting to get. If you wouldn't mind checking if there's a diff I would very much appreciate it ๐
Looks like indeed IJobParallelForDefer had a bug in 1.4.0. This is the method to update Unity.Collections\Jobs\IJobParallelForDefer.cs
private static unsafe JobHandle ScheduleInternal<T>(ref T jobData,
int innerloopBatchCount,
void* forEachListPtr,
void *atomicSafetyHandlePtr,
JobHandle dependsOn) where T : struct, IJobParallelForDefer
{
JobParallelForDeferProducer<T>.Initialize(); // <---- Add this line
var reflectionData = JobParallelForDeferProducer<T>.jobReflectionData.Data;
CheckReflectionDataCorrect(reflectionData);
var scheduleParams = new JobsUtility.JobScheduleParameters(UnsafeUtility.AddressOf(ref jobData), reflectionData, dependsOn, ScheduleMode.Parallel);
return JobsUtility.ScheduleParallelForDeferArraySize(ref scheduleParams, innerloopBatchCount, forEachListPtr, atomicSafetyHandlePtr);
}
(note, you'll need to make a copy of the package and then refer to your copy of collections in your manifest.json since the package manager will overwrite any manual updates to downloaded packages)
I'll give it a try
Yeah that seems to have fixed it!
Yep confirmed working ๐ Thanks so much for the help!
When a developer drinks beer and then code
UnsafeUtility.MemCpy
The first argument is destination and the second one is source?!
WTH๐คฃ
I was forced to reimplement an algorithm found somewhere because it had a lot of bugs. one of them is related to UnsafeUtility.MemCpy
and argument order
Yeah it's the same with the memcpy function in C.
And with other functions from the string.h standard library header in C.
And with instructions in Intel syntax x86 assembly.
It does not matter, it does not respect clean code, you go from A to B not the opposite direction
And yet, when you want to copy A to B, you write B = A, not A = B.
LOL
It is formula
but when you define a code (method), you are writing codes not math formula
And yet, b = a; is valid C#.
Actually depends on the language you're using
yes
There is an array of a struct type(Element) and would like to swap some elements in it. Each element keeps its index as well.
Outside, I keep an element of that array in a variable. Because it is value type, when swapping elements of the array and update index field, it does not reflect it, what is your idea?
public struct Element{
//...
public int Index;
}
var el = array[10];
swap element(10) with element(5) and update index field inside
when you read it like destination = source, it's easy to remember
destination, write, return - pretty much always on the left
oh except Func which always confused me
man adding history to my state implementation
ended up being such a pain
logically it's super simple but the whole thing is written with DynamicComponentTypeHandle as to avoid annoyances with generics/burst jobs on implementation
but you solved it?
and yeah, overly generic solutions are really complicated to write
at the end it's worth it though. generic systems are cool
oh i wrote it, writing tests atm
well there are no generics that's the point ๐
you implement just passing component types
basic question but is it possible to do an OR || or and && type conditionals for RequireSingletonForUpdate<>()
use a query requireforupdate
Any == Or
state.RequireForUpdate(SystemAPI.QueryBuilder().WithAny<TestStateBack, TestStateForward>().Build());
I'm in 0.5 so I'm guessing it would be different
same thing
just different syntax
RequireForUpdate(GetEntityQuery( new EntityQueryDesc { Any = new[] { ComponentType.ReadOnly<TestStateBack>(), ComponentType.ReadOnly<TestStateForward>() } }));
something like that from memory
of course, thanks a lot
yeah i know, not generics in that sense. missing the word for your approach ๐
@rustic rain i've updated core master on gitlab with latest (0.10) and I've pushed an update to github with a release tag so should update on openupm in ~30min
I'm out of Unity for now until they fix bug with onSceneLoaded callback ๐
btw, got time to check on your end?
I tested empty project (with only entities package), and this callback just doesn't work
SceneManager.onSceneLoaded
oh yeah i saw you write this yesterday
I just want to be sure it's not smth on my end
just do test
[RuntimeInitializationOnInit(BeforeSceneLoad)] or smth like that and register some debug log callback
public static void Test()
{
SceneManager.sceneLoaded += Test;
SceneManager.LoadScene("Test");
}
private static void Test(Scene arg0, LoadSceneMode arg1)
{
Debug.Log("sceneLoaded");
}```
works fine for me
of course
๐คทโโ๏ธ
hmm i guess it would make sense
i did kind of think your bootstrap was hacky though
but it seems easy enough to work around?
but yeah i can repo your case of
I can't say it's hacky
but why?
I use meant interface
all I do is just create my own components per world
with different stage callbacks
it doesn't play nice with any other library
like what?
you have events inside systems
netcode
I'm not sure, how it's related
it's just internal client only callback
which should be same for every client, no?
if it works for you, it's fine
i personally consider anything that isn't just default initialization kind of hacky
basically i can't just take your systems/libraries and add them to my own project
if i need to have a custom setup then that's a no go for me
i want things to just work
why not though?
because i need your bootstrap
to run your systems
if i don't use your bootstrap can your systems run in my project?
i need to use netcodes ClientServerBootstrap
so i can't use your bootstrap
it's just 1 system with event that called in OnDestroy
therefore i could not use your systems
you have a whole
OnPostCreate OnSceneLoaded thing going on
IInjectWorld
ah, this one is new ๐
Just figuring out approaches and how they look
I could use Default world, or inject through this
OnPost create is also just similiar callback
for systems that implement interface
none of it is required for bootstrap to work
it's just extra functionality to suit my needs
tbh, OnPostCreate is kind of rudimentary ever since CreateAfter attribute was added
it's not about the bootstrap working
it's about the systems working in another project
without your bootstrap
that's all
๐ค
i like systems that will just work in any project
What would be a way to have a callback on World dispose without a system though?
i really dislike walled gardens
I believe it's called OnDestroy
World type doesn't have this member
oh not a system?
no system yeah
what do you mean
foreach (var system in _world.Systems)
{
try
{
if (system is ISceneLoaded post)
{
post.OnSceneLoaded();
}
}
catch (Exception e)
{
Debug.LogException(e);
}
}```
this is running on systems?
i don't care about anything outside of systems
That's just callback that's called on managed systems that implement this interface
That's exactly my point
I use it to obtain MonoB references
I'm not saying there is any issue writing your stuff like this for your project
I'm just saying i hate it because I can't literally copy/paste your system and put it in my project
because it will not work with default entity workflow
that's all
i don't like code that requires custom setup so isn't just modular
But how would you solve a problem
it's fine, this is just why i consider it hacky - most people probably have no issue with it
all my monobehaviour references are done via baking
and components
or just FindObjectOfType
for like the 1 that's the scene
(UI)
{
if (this.root != null)
{
return;
}
var document = Object.FindObjectOfType<UIDocument>();```
this is the only gameobject
i have in my scene
yeah, for me too basically
i'll probably move this to a prefab and initialize at some point
just because i hate FindObjectOfType so much
but for now, it just works
how do you make your OnStartRunning run only after Scene loaded though?
pretty sure onstartrunning only runs after scene load
i don't have a bootstrap at all
๐ค
i also dislike anything that messes around with the default bootstrap, but then again I think unity sort of violate this in their own examples like fps and megacity
(and my opinion really counts for nothing ๐ )
a lot of the time it just comes down to objectives i guess
most people are just writing the game for themselves with no thoughts of future projects, public libraries etc
so it really doesn't matter
either i have done something amazing to completely break unity really badly or there is something really inconsistent about the shutdown sequence when leaving play mode
{
Debug.Log("OnStopRunning");
if (SystemAPI.ManagedAPI.HasSingleton<InputCameraActions>())
{
Debug.Log("Woo");
}
else
{
Debug.Log("WTF...");
}```
the entity is deleted before OnStopRunning is called 50% of the time when leaving play mode
(please note it's not alternating, it got 3 woos in a row then 2 wtfs after this)
My guess is subscenes are being unloaded before the world shuts down, but this is making life cycle management impossible without constant checks...
hi guy have. a question why i get this odd error
it totally is this
SubScene.OnDestroy sometimes gets called before World.Dispose
how do i make this deterministic
hey tertle, do you know how a PropertyField in the context of a PropertyInspector can work? They seem incompatible
i've only looked briefly at it. PropertyField needs a SerializedProperty which I seemingly can't get just from the struct
can entity aspect code be breakpointed? or not because its only used for code gen? or am i just running into a bug?
yeah you'd need to hack stub for it
stub.Value = entityData.blahblah;
public class PropertyStub : ScriptableObject
{
public YourData Value;
}```
no idea how well this will work
it's a huge hack and not sure you should go down this path
thanks, i'll consider trying when i'm out of options ๐
some codegen for blobs in general sounds useful
is this how i'd get thread index inside an IJobEntity ( first time using it today ):
Have you worked with nullable types and value tuples in jobs? Are they OK? performance wise
or define custom struct types
So... I had a StageStartup monobehaviour that I used to create my stage entities, but I thought I had to move it to a baker since I was previously using serialized fields, and now I'm getting "InvalidOperationException: Entity Entity(19:1) doesn't belong to the current authoring component."
How do you guys normally handle this?
is there some code example(pls add address if you know one) - which makes possible to use relay along with netcode for entities like explained in this post / thread : https://forum.unity.com/threads/relay-with-netcode-for-entities-how-to-connect-local-client.1365681/#post-8648016 ?
hi guys i wrote this system https://pastecode.io/s/2768czbx i have 2 question a, why i dont see it loaded (not see it in systems) do i missing something b. will this work i mean will move the entity?
by don't see it you mean don't see it in system window?
not sure, looks fine
b. test it? ๐
initially concerned about that ProtectorAspect though
but it's fine and handled by systemapi, you'd error anyway
any issues should appear as an error
no errors
also this system not loaded but not clear as to why
gezz this hard cookie
Btw how are the command buffers architectured ?
Do they just "record" plain commands and playing them back after each other ?
Or are they basically simulating a shadow entity world with their own archetypes and stuff ?
Hmmm thanks, isnt that extremely slow ? Atleast it sounds like that ^^
I could imagine that the operations will also execute after another and not being batched.
So :
- Add "Ai"
- Add "Velocity"
Would first make the entity to the ai archetype and then to the velocity & ai one.
This could be batched and it would make sense to move to velocity&ai archetype directly
well yeah, commandbuffers are often the slowest part of operations
but the slowest part is what it does more than the playback itself
structural changes are slow and should be avoided
Alright thanks ^^
However, i hope that unity probably reworks them to be "smarter" to batch such changes
it's pretty hard to batch the commands without introducing another write that is then memcopied to a chunk. what i rather want is multithreaded ecb
but that's also in the realm of near impossibility
order is required here
and entitymanager provides batch operations already if you wnat to do lots of work fast
I'm on 2022.2 and it appears that incremental build feature is not working. It always does a clean build. Is there a way to enable it?
at very least ECB could introduce batched commands
query commands for example
last time I checked
it didn't
is there anyway to make sure a gameobject gets baked into an entity before a certain systembase's OnCreate() happens?
do you mean more, ensure your subscene loads before OnCreate()?
the short answer is not really
you'd have to use an approach of deferring partial system creation until after the subscenes are loaded
i have no clue, currently i have 1 entity with a bunch of info my systembase needs once at the beginning ish sort of time
i suppose i could check once a frame to see if the entity exists yet and once it does then treat OnUpdate() like usual?
RequireForUpdate<T> does that
In Oncreate
ooh ok, ill look into that thanks!
can i make it be required for other methods aswell or just OnUpdate()?
it is requirement for update
OnStartRunning is called during update
if previous update cycle, this system was not updated
ok fascinating, im not quite sure what that means, but ill mess around with it and see if i can get something working, thanks a ton!
is there any page for that on the manual, as both google and the docs search function are not pulling anything up?
I don't remember one
ah unfortunate, got any examples of how to use it then that you know of?
OnCreate() { RequireForUpdate<MyGameSettings>()}
or if in ISystem
state.RequireForUpdate<MyGameSettings>();
ok good, then in the update i can set a bool to be true, and then in all my other methods check if the bool is false and return if it is, thanks so much!
ok problem is that now i need something to run once, but only if the thing exists, i could always check the bool, and then have a counter for how many times it has ran, and only do it on the first 1, but is there perhaps a better way?
your update won't run until game settings exists
so i'm not sure what you mean by other methods
i have a few methods in this systembase that are used by other systembases sometimes
i do have a way to make it so no system onupdate will run until your subscene is loaded
because i personally dislike having all these requireforupdates and checks
i barely use OnUpdate as it is so it isnt a hassle for me currently
with subscenes if you do parenting like you would with gameobjects does it automatically workout how to do the parenting in the entity form, or does it just undo all parenting?
it will bake with parenting
ooh awesome, thanks for the info!
is there an entity version of the camera yet?
Any idea in what system, Physics world already setup physics bodies and their velocities, but hasn't done anything with them yet?
https://twitter.com/adamjcmyhill/status/1089038151295750144?lang=en found this from 2019, but apart from that nothing, how unusual
Hi guys, Do you know why my entity prefab has a component with type ICleanupComponentData, after it is instantiated, that component disappears?
Hello there,
- I am having trouble properly understanding the open/closed state of subscene, mainly, I don't understand the streaming part where
When a subscene is closed, Unity streams in the contents of the baked scene. On my side, when a scene is closed, nothing appears at all. - Then, I am trying to understand how to properly dynamically load scenes with ECS. Let's say I want to go from SceneA to SceneB, I load the scene the old way, using
SceneManager.LoadScene. But the SubSceneB (Subscene of SceneB) is closed when doing that. Thus leading to my stuff from there not appearing.
looks like bug in baking phase
such components are meant to be runtime only
do you have graphics package?
no, I add ICleanupComponentData to prefab entity in runtime, I already check in the editor, prefab have that component, but when instantiate it, that component disappears. I try to change that component to IComponentData, it worked normally
yes
that's intended
ICleanupComponentData can only be added
it will not be instantiated or serialized
oh really, why you know that, I don't see this information mentioned in the document. Anyway thank you bro
it has worked this way since it was first implemented 4? years ago
it is clearly left out in code when serializing/moving worlds/instantiating
will this behaviour change at some point? who knows
oh, so I have to add this kind of component after it's instantiated, right?
it's been brought up multiple times so you aren't the first person to run into this
yes
I don't think I do. I'll have a look asap. This is in charge of rendering directly from ECS without using gameobjects ?
the original implementation of this was as a reactive component on an entity
if you want some history, 2018: https://forum.unity.com/threads/statecomponent-reactive-system.534122/#post-3520939
yes
I will look that way. Thank you
thank a lot, let me dig into it
hi all say dose anyone knows what this odd error it happened when i start unity pre-release or sometimes i just let it idle or update the assets happening
it has no stock so not sure what make out of it
do you have a catch in a job?
also go have a look at normal console not console pro
yeah
thats in burst
you can't use catch in burst
burst only supports try/finally not catch
exceptions are crashes in burst
ok... odd
one more question i have hard time understand if i want within a job get all entities so i can change their transform how i do that?
simpliest of jobs would look something like
[BurstCompile]
private partial struct MoveJob : IJobEntity
{
private void Execute(ref TransformAspect transform)
{
transform.LocalPosition += new float3(1,0,0);
}
}```
just move everything along the x
1 unit per frame
you don't have any code that requires try catch block anyway here
ya i removed it it just seems odd that all
i kinda do this project learn the dots
so it fun to be wrong:)
i c
Burst code can be better than C++ code, it's good stuff
that part is questionable though
but it is indeed easier to use within Managed C# environment
rather than compiling some C++ separately and loading extern methods
I'm repeating what I've been taught in a course taught by people in the DOTS team ยฏ_(ใ)_/ยฏ
have quick question i got this code https://paste.ofcode.org/iH3zu24krdrLxxAVey9swd i try make all the created entities orbit an object now my issue it look like the system never been added to system and i try understand what i have missed
People would certainly flatter their own product ๐
Not wrong, but there was also never a claim that it's necessarily often or with typical code.
It's probably reasonable to say that you can make Burst code that outperforms equivalent C++ code.
Part of that claim will come from the fact that the compiler can make certain assumptions for optimisation given the rather tight constraints/rules. Also SIMD with the math library. But to get the most out of it you have to know what you're doing.
Doesn't make the statement less true
DOTS is more performant than C++ in the sense that it provide a set of programming paradigms that allow to trivially produce machine code that is :
- Thread safe and fully parallelizable by default.
- SIMD accelerated by default
While the same can be achieved with C++, the amount of programming work required in non-trivial, real world scenarios is several orders of magnitude higher.
yep DOTS is so great even an idiot like me can code super fast multithreaded code relatively easily
[Solved]
Hi, I'm doing something a little bit unusual compared to what Unity is promoting and I got stuck for what should be normally intuitive.
- I'm manually creating
Prefabentities for my character (I'm avoiding Bakers). - I have successfully created some prefabs for my character entities.
- But I got stuck at the spawn system where I need to query for any entity that has a
Prefabcomponent. - The query is always empty no matter what.
What's a reasonable way of storing frequently changing data that belongs to a group of entities (same archetype)?
Using shared components is a little funky b/c of chunk fragmentation + the fact that updating shared components can only be done through the main thread or an ecb
store an index to that data
and store it somewhere you can access for your application
one way - blobs
but it's rather heavy, for small data
I used to store blobs per entity to store read-only shared data between entities until unmanaged shared components came out
@rustic rain is tertles package up to date?
Then I realized unmanaged shared components are pretty difficult to update with an entityquery
yeah
it always is on gitlab he said
0.9 repo
ah damn i think its not working for me anymore cause im still on Transforms V1
v2 feels good after new changes
nouniform scale
and etc
allthough it's a bit borked I think
i just have other problems than transfering to V2 atm
i tried to switch but instantly ran into problems with transform lookups
hi guys i get this error "System.ArgumentException: Key: {0} is not present in the NativeParallelHashMap.
This Exception was thrown from a job compiled with Burst, which has limited exception support.
#3 Unity.Jobs.IJobExtensions.JobStruct`1<Unity.Entities.Editor.HierarchyNodes.BuildExpandedNodes>.Execute" what dose this means? how i can fix it?
Sounds like you are trying to access the first element of an empty NativeParallelHashMap which is empty
but from where it coming for the stock not lead any of my code
i dont think it got a stock what u see it what i have
@rotund token would you mind handling transformV1? its only a problem in 2 files.
looks like a UI bug in the editor
there's plenty of those around ๐
ya i have some how guess i also get crash unity alot ๐
also fun
but found work around
What's the equivalent of LocalToParent at transform v2?
LocalTransform
hi guys if anyone can help out -> https://answers.unity.com/questions/1932990/issue-with-unity-ecs-adding-system.html kinda need help badly
Unity is the ultimate game development platform. Use Unity to build high-quality 3D and 2D games, deploy them across mobile, desktop, VR/AR, consoles or the Web, and connect with loyal and enthusiastic players and customers.
What's the equivalent of CompositeScale at transform v2?
You should take a look at the upgrade guide: https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/upgrade-guide.html
There is no exact replacement I think
you should see a warning that your ProtectorMovement System is not in the same group as the spawner system. either add [UpdateInGroup(typeof(InitializationSystemGroup))] to ProtectorMovement or remove the [UpdateAfter(typeof(InstantiateProtectorSpawner))]
but i am not sure if that will fix all your problems. i suspect there is more going on. is there no error in console?
i wise there were
it run but without it
and the control is clean but for stuff that i add when i create the objects
I would try copying a simple unity example system into the project and see if it runs
Or even just an empty ISystem
i will create empty ISystem just for kicks
ok the empty works
i remove the upadte in group as well so why that system not in the list
ok. fun fact if i do this code https://paste.ofcode.org/ZqUKcJ8BkPJKCsEMnLzaPa the empty system also not included in systems
I have the Entity.Graphics package in the end, that's was not my issue. If somebody have another cue
I guess the hidden question is : How to have a (edit: loaded) closed subscene actually render
is it rendering in game view but not in scene view?
hmm it should render automatically. What do you have in your subscene that you want to render?
right now, I simplified my subscene, I have only a Plane with a Mesh Renderer
What kind of material on the plane?
from which render pipeline? I don't think entities work with standard shaders. Only urp/hdrp shaders that support dots instancing
The default URP/Lit should work
Also, are any errors getting logged? If it is a shader issue, it should log to the console if an invalid shader is being used
I have a Warning The referenced script on this Behaviour (Game Object '<null>') is missing! without further information.
I am using URP-HighFidelity pipeline settings
Am I to assume that the local rotations of all joints follow this same principle as legacy as referenced here: https://docs.unity3d.com/2022.2/Documentation/Manual/Joints.html ?
Because I have my offsets all setup based on world object space, and I create joints based on that. But for some of them they rotate 180 in opposite direction. I assume it's because the X,Y,Z axis for joints don't follow the X,Y,Z axis of the traditional unity world/scene space?
If so, can someone please help me with what additional calculation I need to make to convert the object world space to joint local space?
I started back from scratch, just tell me that I am not crazy and that what I expect is normal.
"A Cube in a subscene is supposed to be seen at runtime weather the scene is openned or closed"
say any one have idea why if i write system like this i don't see the system in systems window and not even activated (this confirm by i add later debug line never trigger) https://paste.ofcode.org/ZqUKcJ8BkPJKCsEMnLzaPa
Hey sorry I stepped away from my pc for a bit. But yes, a closed (but loaded) subscene should still render.
Haha I just removed support
i dont mean you add support for it back. just define out the 2 files which throw errors. but nvm if you dont want to. was just a little annoying today cause i had to delete the library folder multiple times
That's weird. Havok docs is 1.0: https://docs.unity3d.com/Packages/com.havok.physics@1.0/manual/
But when I add url com.havok.physics it installs 0.51 instead. Is it not released yet? If it is, where can I get it?
do you have unity pro? Havok is only available in pro as of 1.0
Oh, I see.
How are you pulling the library? Upm?
But yeah I can wrap those files
I conditionally compile a bunch of stuff for netcode physics already
I removed support because I didn't expect many on pre to still use v1
is leak detection ever going to work again... =\
considering most employees went on a vscation...
well 1.0 was release a while ago now
and i personally don't think it should have been released with broken leak detection
safety is a the fundamental pillar that dots was built upon and it's a huge regression over 0.51
from gitlab with package manager
i swear to god everything in unity is crashing me these days
Obtained 78 stack frames
0x00007ff666112bc1 (Unity) YGRoundToPixelGrid
0x00007ff6661132e3 (Unity) YGNodeCalculateLayout
0x00007ff664e178ee (Unity) Native_CUSTOM_YGNodeCalculateLayout
0x000001b5b80fc87c (Mono JIT Code) (wrapper managed-to-native) UnityEngine.Yoga.Native:YGNodeCalculateLayout (intptr,single,single,UnityEngine.Yoga.YogaDirection)
0x000001b5b80fc473 (Mono JIT Code) UnityEngine.Yoga.YogaNode:CalculateLayout (single,single)
0x000001b5b80fb6d3 (Mono JIT Code) UnityEngine.UIElements.UIRLayoutUpdater:Update ()```
i'm just stress testing entering/exiting play mode over and over
and i've had probably 7 different crashes
i'll push an update to master soon then~
i'm just testing a controversial change i've added to core
public static class EditorWorldSafeCleanup
{
static EditorWorldSafeCleanup()
{
Application.quitting += OnQuit;
}
private static void OnQuit()
{
var playerLoop = PlayerLoop.GetCurrentPlayerLoop();
foreach (var w in World.s_AllWorlds)
{
ScriptBehaviourUpdateOrder.RemoveWorldFromPlayerLoop(w, ref playerLoop);
}
PlayerLoop.SetPlayerLoop(playerLoop);
World.DisposeAllWorlds();
}
}```
this
i noticed a couple of days ago exiting play mode is very nondeterministic
half the time the world shuts down before subscene unload, the other half subscenes shutdown first removing their entities
pushing something like this to core is kind of against the principle of the library though
a way to opt in would be nice. but cleanup is something i lack atm so id take it
it should make no difference to users
my first attempt i was just calling
DefaultWorldInitialization.DomainUnloadOrPlayModeChangeShutdown();
which is all unity does from a secret monobehaviour
{
public bool IsActive;
public void OnEnable()
{
if (!IsActive)
return;
IsActive = false;
DestroyImmediate(gameObject);
}
public void OnDisable()
{
if (IsActive)
DefaultWorldInitialization.DomainUnloadOrPlayModeChangeShutdown();
}
}```
this is how they cleanup stuff
the issue is just that this OnDisable somethings executes before sometimes executes after OnDisable of SubScene.cs
it also has a forced execution order of
It is private and hidden, but has executionOrder: 10000 in the meta file,
so should update after everything but for whatever reason, doesn't?
so i just want to make it consistent
basically i just want consistency and determinism
subscenes unloading before world was destroying me OnStopRunning code
which had singletons to cleanup half the time only
and was causing a very obscure crash from input events not being unsubscribed
Is there a way to invert [RequireMatchingQueriesForUpdate]
It'd be nice to have an initializer system run only when some necessary things aren't spawned yuet
afaik the method also takes a query. that query can have an exclude
talking about RequiresForUpdate
but i handle initializers usually with a singleton. in your case, when the singleton exists, disable the system
https://docs.unity3d.com/2022.2/Documentation/ScriptReference/Application-quitting.html
i just read up about application quitting cause i had something in the back of my mind about it. IOS behave differently. not sure if it matters atm
this is an editor only script
"when the singleton exists, disable the system" Oh okay, thats cool. Thanks man.
ah. now im wondering what the difference to EditorApplication.playModeStateChanged would be
i've wrapped it for now in BL_GAME as it's probably only needed if you use my game framework (not public)
ExitingPlayMode probably similar
but timings are weird
i needed to force an AssetDatabase refresh before entering playmode to get all codegened classes loaded just in time. there those weird timings were important. cause "PlayModeStateChange.ExitingEditMode" happens before any unity scripts related to starting the playmode are running.
It look liked it happenned when I moved from
"com.unity.entities.graphics": "1.0.0-exp.12",```
to
``` "com.unity.entities": "1.0.0-pre.15",
"com.unity.entities.graphics": "1.0.0-pre.15",```
idk why really though
i was wondering - is there any performance benefit to accessing ( readonly ) data in a blob as opposed to a dynamic buffer
say for example i have animation data that is accessed every frame inside some jobs
would that data be better stored on a blob or a buffer
if the buffer is in the chunk it's probably faster
if all entities in the chunk were using the same blob or a mix of the same blobs and the buffer wasn't in the chunk
blob probably faster
i wouldn't really worry too much about this though
blob can save a lot of memory
but just use what makes sense
animation data is usually quite large, right? so a chunk DB would probably don't fit much anyway. when the DB is outside the chunk access is comparable to blobs. though blobs win because they have slightly less overhead. it's minuscule though
thanks yeah that's useful information, makes sense
in one case i have anim data that is obviously quite long, currently a blob storing multiple animations, each storing arrays of pos/rot values
in another case i have a blob storing unit/weapon/stuff data that is used for spawning - just structs containing health/strength/weaponid/ etc
@solemn hollow gitlab updated with V1 support, also noticed I had pushed a bunch of conditional stuff that broke builds so fixed that
also updated upm because of those broken build issues
master
would have only been an issue in 0.10
works! thanks a lot
necro bump?
there's no native version
the graphics package does support 'converting' a hybrid version
but it's just the regular camera though
ah ok, thanks for the info!
UnityEngine.StackTraceUtility:ExtractStackTrace ()
Unity.Collections.Memory/Unmanaged/Array:Resize (void*,long,long,Unity.Collections.AllocatorManager/AllocatorHandle,long,int) (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/Memory.cs:89)
Unity.Collections.Memory/Unmanaged/Array:Resize<byte> (byte*,long,long,Unity.Collections.AllocatorManager/AllocatorHandle) (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/Memory.cs:96)
Unity.Collections.Memory/Unmanaged:Free<byte> (byte*,Unity.Collections.AllocatorManager/AllocatorHandle) (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/Memory.cs:41)
Unity.Collections.RewindableAllocator/MemoryBlock:Dispose () (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/RewindableAllocator.cs:93)
Unity.Collections.RewindableAllocator:Dispose () (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/RewindableAllocator.cs:233)
Unity.Collections.DoubleRewindableAllocators:Dispose () (at Library/PackageCache/com.unity.collections@2.1.0-pre.6/Unity.Collections/DoubleRewindableAllocators.cs:94)
Unity.Entities.ComponentSystemGroup:DestroyRateGroupAllocators () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/ComponentSystemGroup.cs:708)
Unity.Entities.ComponentSystemGroup:OnDestroy () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/ComponentSystemGroup.cs:123)
Unity.Entities.ComponentSystemBase:OnDestroy_Internal () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/ComponentSystemBase.cs:306)
Unity.Entities.World:DestroyAllSystemsAndLogException () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/World.cs:1007)```
i am extremely good at breaking things ๐
or DOTS is easily breakable
wondering, is it possible to do entity queries in a monobehaviour?
yes, just get an EntityManager from a world
ok thanks!
any advice on how to avoid containers may not be the same (aliasing) errors when creating jobs with aspects that reference LocalTransform?
you can't avoid it because it's inherently unsafe unless you can promise you aren't writing / reading to same transform
and if you can promise what you are doing is safe, then you just have to turn off safety on the container
Do queries iterate backwards over entities and their components ? Is that possible ?
Or how is it possible that we can query and destroy entities at the same time ? Normally backwards iteration is being used for such cases.
maybe i am missing something basic with how the dependencies are set up?
@rotund token any idea how a system in DefaultWorld could call OnCreate when i am never hitting play?
that's the issue i'm having!
i have no idea
it's being called from OnDestroy
Editor world is disposed, and for some reason 1 of the System.OnDestroy() is calling System.OnCreate() - on a completely different system
it only happens with burst on
burst function pointers seem to be scrambled
ill check if i can see from where its called
i wiped my library, still happened
i wiped it again last night, it hasn't happened today...
im sorry its not ๐ฆ
i have a lazy hacky way to generate a concrete system class from an instance of a system. it was supposed to be used runtime only but now i create a system in editor. thats what called OnCreate
booo
This Exception was thrown from a function compiled with Burst, which has limited exception support.
...
Shattered.Game.States.OptionsStateSystem.__codegen__OnCreate(System.IntPtr self, System.IntPtr state) -> void_aef4d46f9ec6d18a03913cfa3cd76414 from Shattered.Game, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.burst@1.8.2/.Runtime/unknown/unknown:0)
object:wrapper_native_000001B790D8A8C0 (intptr,intptr)
Unity.Entities.SystemBaseRegistry:ForwardToManaged (intptr,Unity.Entities.SystemState*,void*) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:363)
Unity.Entities.SystemBaseRegistry:CallForwardingFunction (Unity.Entities.SystemState*,int) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:311)
Unity.Entities.SystemBaseRegistry:CallOnDestroy (Unity.Entities.SystemState*) (at I:/Documents/BovineLabs/com.bovinelabs.shattered/Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/SystemBaseRegistry.cs:381)```
is whats happening for me
SystemBaseRegistry:CallOnDestroy -> OptionsStateSystem.__codegen__OnCreate
yes you showed the other day
i can attribute at least 30% of my crashes in last 2 days to dx12
so i've downgraded that...
have you seen that behaviour for Isystem and Systembase?
the Oncreate OnDestroy swap
only seen it on isystem
and only burst compiled methods
and it doesn't happen if burst is off
explains why ive never seen it
i dont think anyone has seen it
- i doubt everyone is running bursted ISystem yet
- I use OnDestroy rather sparingly not sure how others use it
sry might be a stupid question but cant burst skip compiling it if its empty?
if i see it again i might try remove the burst compile from ondestroy and see what happens
im not certain what happens to empty methods
it still has to be compiled to something
because the function pointer is being called from mono
ah i see
maybe they have a default empty do nothing loop back
i avoid putting burst compile on empty methods simply because even if it doesn't add overhead at runtime, it's still 1 more thing burst has to check to compile at least
and i can't imagine that is great for iteration performance
Does anyone know if a VR build using latest DOTs its currently possible , or is it not supported right now?
they do get compiled
they appear in burst debugger
even more reason not to burst compile them if they aren't just stubs
I just discovered you're not supposed to use a dynamicBuffer in jobs. This is a trivial matter that I could use a hand wavy solution to: https://pastebin.com/SDRRtPT6
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I had a dynamicBuffer of entities to ignore collision with, but that is not cromulent... What is a better way to hold an array of entities to ignore collision with?
dynamic buffers are burst compatible
From that thread it says not to use dynamic buffers in Jobs
I was getting a [writeonly] error
4 year old thread
There are things from a couple of months ago that are outdated. Things from years ago should not be considered gospel truth ๐
Alright... Then I wonder what is going on if it ain't happy with [WriteOnly]. The system isn't critical, just sometimes you shoot yourself with your own laser for now.
Is it worth converting int fields to short or byte in struct types (Burst)? or int3 to int (Flatten indices)
if you store them on components - it is kind of worth
the smaller component - the higher chunk capacity
but there's still cap
Yes, I get/read them. They are stored in an array
com.unity.platforms is not deprecated with the latest Entities 1.0, it's just that the Build Settings menu can now also be used for simple cases, right?
Also, I could make my own Build Configuration component to programmatically set the application version using git describe, right?
it is
Oh.
Huh, weird, created a new project, installed entities/graphics/physics, but entities won't render in an open subscene, did I miss some changes to this I somehow accidentally did up until now?