#archived-dots
1 messages Β· Page 274 of 1
no, checks are not it. done without any
burst with checks
in a huge code base like mine safety checks are massive performance drain but for a very focused test it's not such a big deal. at least it doesn't skew the results that massively
unlikely that it's checks
regular c# arrays and lists have a lot of checks built-in, yet they're much faster
Well, I'm still writing out a build even though I know it's wasted time. I have done this a 100 times by now. I know that managed usage of NativeContainers is slower than managed built in containers like List, Dictionary. I'm intersted in the why. If you don't know, no problem, I'm just not interested in guessing games.
some pretty pictures. gotta say, it helps somewhat. still, even in best case it's 2 times worse than burst. it doesn't correlate with my last test but that was for something very different. this only tests for read/write speed
oh the labels are gone from top to bottom: build_il2cpp, build_mono, editor
burst stays the same in every case. pretty great because it has the same speed in editor
You can't turn off safety
You can only turn off safety in burst jobs in editor, outside of burst safety is always on in editor
yeah, I realized π still a pretty huge gap left that I can't explain
question1: why the massive overhead of unbursted scheduling. question2: why the massive difference in il2cpp and mono
Il2cpp is much faster than mono
Just in general. For basic math operations it's not even that much slower than burst.
yeah, i mean the tests say so. I'm still confused what mono screws up this much, this is for nativestream reading and nativelist adding.
there's not much to screw up honestly. it's very simple code
do you know if any marshalling is going on for managed code? isn't there some copying back involved?
Don't know sorry. Mono just compiles everything much slower
Pretty old test now but you can see how poorly it performs in just maths - whereas il2cpp can keep up on occasion
i can't find this post anymore where joachimg basically explained why unmanaged bursted jobs are so fast π¦
on the troubleshooting section for jobs it says that you cannot modify nativearrays directly, but isn't this example still modifying a nativearray?
// Job adding two floating point values together
public struct MyJob : IJob
{
public float a;
public float b;
public NativeArray<float> result;
public void Execute()
{
result[0] = a + b;
}
}
huh? can you post where it says that?
Donβt try to update NativeContainer contents
Due to the lack of ref returns, it is not possible to directly change the content of a NativeContainer. For example, nativeArray[0]++; is the same as writing var temp = nativeArray[0]; temp++; which does not update the value in nativeArray.Instead, you must copy the data from the index into a local temporary copy, modify that copy, and save it back, like so:
https://docs.unity3d.com/Manual/JobSystemTroubleshooting.html
pretty sure it means something else. yeah, it's just saying you have to write it back and that it's not enough when you just modify the struct return value like var c = result[0]; c++;
but when I use result[0]++ it does update
I dunno, it's a weird example. result[0]++ is actually translated into result[0] = result[0] + 1; π€·ββοΈ
maybe they fixed it by now, doc could be pretty old and out of date
even worse when it's wrong and it actually increments π
Check this out, https://forum.unity.com/threads/when-would-one-use-ownerpredictedsendtype-in-ghostcomponentattribute.1260704/
Why does the DOTS sample game's character controller code do both collider casts and collider distance calculations? Is it only because the character colliders can rotate?
Wait no, ColliderCastInput takes start and end positions instead of a RigidTransform, but it also takes an orientation quaternion
collider cast and distance are 2 different things that provide different data though
I don't understand when to use which for a character controller/what for
take a look at result data they return
Ok, CalculateDistance really sweeps in all directions it seems
Red ray: from Translation.Value to Translation.Value + velocity
Blue rays: from DistanceHit.Position to DistanceHit.Position + DistanceHit.Distance * DistanceHit.Normal
I just discovered that Debug.Break() exists
Yeah just donβt assume it will pause exactly at the place you put it. Debug.Break sends a signal to the editor to pause when the frame has completed its cycle.
if i destroy child entity should i remove it from Child Buffer myself?
Ok my character controller works perfectly fine and I only use CollisionWorld.CastCollider(ColliderCastInput, out ColliderCastHit)
Well it works perfectly fine when the player is interpolated
When it's owner-predicted, it jitters, mostly when falling onto the ground
That's a large prediction error for a client that should have no network latency
Have you tested it? Curious whether TRS system already cleans it up for us
My character controller when the player ghost is interpolated: perfect.
My character controller when the player ghost is owner-predicted:
I don't get it
i have weird results. if i destroy child entity then create new child and after that Root entity in ChildBuffer has two same new created entities
I guess it'd be better to remove entity from buffer
I fixed it by turning my PlayerInput IComponentData into a NetCodeDisableCommandCodeGen-annotated ICommandData and adding this code at the end of the Entities.ForEach job in my PlayerMovementSystem:
controller.Tick++;
controllers.AddCommandData(controller);
Basically, I now keep track of the player's velocity and other controller state for the last 64 ticks and it fixed my broken prediction
Ok nvm it did not fix it, I had forgotten to switch back the default ghost mode from interpolated to owner-predicted in my player prefab
Wait now it works again
What
Ok no it doesn't work
.
Well it fixed the jitter but it didn't fix the collision bugs
I don't understand how switching the default ghost type from interpolated to owner-predicted can create collision bugs
Hi everyone! I'm trying to create a simple character controller using the Unity Physics package but my lack of DOTS knowledge is showing.
I'm using ModifyNarrowphaseContacts from the examples as a base to test the normals against the slopeLimit but I then assign the normals to a variable inside IContactsJob but I have no idea how to read it outside of the job
I tried creating a struct but it didn't work
I'm trying to create a simple character controller
If you manage to make one that works perfectly with owner-predicted Netcode for Entities ghosts, tell me
Usually to read data from outside of a job you pass a native container into the job, fill it inside, then read it after the job is complete
what character controller are you using? I'm pretty sure any bugs with jumping have to do with slight inaccuracies when the isGrounded state is calculated. I remember having troubles with this and KCM
is IJobFor not supported yet in ISystem?? (0,0): Burst error BC1059: Method `Unity.Jobs.IJobForExtensions.ForJobStruct`1<T>.Execute(ref T, System.IntPtr, System.IntPtr, ref Unity.Jobs.LowLevel.Unsafe.JobRanges, int)` is being compiled as a function pointer, but both it and its declaring class `Unity.Jobs.IJobForExtensions.ForJobStruct`1` are missing the [BurstCompile] attribute. To fix this error, add the [BurstCompile] attribute to `Unity.Jobs.IJobForExtensions.ForJobStruct`1<T>.Execute(ref T, System.IntPtr, System.IntPtr, ref Unity.Jobs.LowLevel.Unsafe.JobRanges, int)` and `Unity.Jobs.IJobForExtensions.ForJobStruct`1`. ```0,0): Burst error BC1054: Unable to resolve type T. Reason: Unknown.
at Unity.Jobs.IJobForExtensions.ForJobStruct1<T>.Execute(ref T jobData, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, ref Unity.Jobs.LowLevel.Unsafe.JobRanges ranges, int jobIndex) at Unity.Jobs.IJobForExtensions.ForJobStruct1<NZSpellCasting.Code.TestSystems.NativeStreamPerformanceTestBuildISystem.TestJob_NativeStreamCopyToArrayBurst>.Initialize()
at Unity.Jobs.IJobForExtensions.Schedule(NZSpellCasting.Code.TestSystems.NativeStreamPerformanceTestBuildISystem.TestJob_NativeStreamCopyToArrayBurst jobData, int arrayLength, Unity.Jobs.JobHandle dependency)
at NZSpellCasting.Code.TestSystems.NativeStreamPerformanceTestBuildISystem.OnUpdate(NZSpellCasting.Code.TestSystems.NativeStreamPerformanceTestBuildISystem* this, ref Unity.Entities.SystemState state) (at```
it's indeed not supported. got to use IJobBurstSchedulable/IJobParallelForBurstSchedulable instead.
the same job (50k iterations) in SystemBase (scheduled) takes 4.71ms, in ISystem scheduled 4.31ms, running on main thread in ISystem 3.6ms!
what's also pretty crazy, a scheduled job with a NativeList.ParallelWriter AddNoResize takes 14ms and just a NativeList Add takes 4.7ms. Even when there's atomic operations. Just from 1 thread I don't quite understand the huge performance drop
yeah
i dunno, weird, I assumed it makes no difference that's why I let it slide in the perf test
made sure there are no errors. same result: only difference is one uses ParallelWriter and the other doesn't. same job otherwise, both are single scheduled
it makes 0 difference in my project where I only have a 128 iteration and use AddRange. (well it sure does make a difference but marginal, I can't measure it)
Interlocked (Increment) isn't particularly fast
https://docs.microsoft.com/en-us/windows/win32/dxtecharts/lockless-programming?redirectedfrom=MSDN
seems to take like 90 cycles on a multicore cpu (this was a while ago though, might be worse with modern high core count cpus)
My own
@rotund token sir. Do you happen to know whether it's possible with UI toolkit?
Basically, I use that entity selection feature in gameplay for selection purpose as Player.
And I need to somehow disable that code execution in case cursor was over UI element.
yes sec
they implemented it the same way as old UI
EventSystem.current.IsPointerOverGameObject()
need to use the new InputSystemUIInputModule replacement
it might only be ones that can take input
ui toolkit has this event pass through
i wrote this extension ages ago
/// <param name="element"> The element that blocks. </param>
public static void BlockInputEvents(this VisualElement element)
{
element.RegisterCallback<MouseDownEvent>(StopPropagation);
element.RegisterCallback<MouseUpEvent>(StopPropagation);
element.RegisterCallback<KeyDownEvent>(StopPropagation);
element.RegisterCallback<KeyUpEvent>(StopPropagation);
}```
not sure if it's still required or there's a better way
{
e.StopPropagation();
}```
not certain this is needed anymore, just try it out
but yeah if you're images aren't blocking input, try that
anyway got to run (sleep) gl
Thanks sir, gn
Ok I'm giving up on client-side prediction, I can't afford to waste more time on getting it to work as this is a school project I have to present this Friday.
This works almost perfectly. Sometimes, seemingly only when moving diagonally against a wall, the player refuses to move in the non-wall-facing direction (he doesn't move at all), and you have to move backwards to this direction to fix it.
I still don't understand what the point of CollisionWorld.CalculateDistance() for character controllers is because I ended up not using it
stupid question but can I not do this inside a an IJobParallelFor NativeQueue<CellData> indicesToCheck = new NativeQueue<CellData>(Allocator.Temp);
I'm getting some kind of infinite loop or something I'm guessing it may be using a singlequeue for multiple threads?
could you elaborate?
that's the sum of it to really I do this inside a parrallel job public void Execute(int index) { NativeQueue<CellData> indicesToCheck = new NativeQueue<CellData>(Allocator.Temp);
and my cpu's end up at 99 percent and Unity not responding
I'm guessing its not exactly that it may be the way I'm using Enque and Deque if its a single queue shared between all the threads
are you certain it locks on init of queue?
not entirely, I'm pretty sure its something to do with queue I've reduced the code and put in returns that don't return
ok its definitely the nativqueue I just reduced it to the declaration and I get the warning The container does not support parallel writing. Please use a more suitable container type.
that's annoying I never got that warning before it must be a bug
Has anyone ran into the issue where you install Unity.Collections, I am using it in the script, I can use NativeArray but NativeList can't be found?
are you using assembly definitions in your project?
in 2021 i installed hybrid and idk what to do cuz i keep running into errors with all these outdated guides
it's useful to get how much penetration you ended up inside the collider at step +1 , so you can push back out the body
You can't use DOTS in unity 2021, try latest 2020.3
I don't understand what has happened to parallel jobs that I can't use lists or queues or anything in them anymore?
I just want each thread to have its own unique list but I can't even seem to do that with nativelist a fixedlist probably an unsafelist π
Are there known problems with NativeHashSet?
I've spend so much time profiling my algorithm, but it turns out that if NativeHashSet is allocated with too big of a size, operations with it become insanely expensive
neh mind I've got a list working, you have to declare and initialize it in the code execute
that seems odd. size shouldn't really matter for sets/dictionaries
indeed
(unless you have a poor hash and a lot of collisions)
but i have them proofs
what operations in particular
the problem with it's not the size
it's capacity
I've initialized hash set with ~10000 as first argument, but only used like 1/100th of capacity and it performed muuuch worse, than if I intialize it with capacity of 0
the algorithm is quite complex, I can't pinpoint the particular operation. I may try a more synthetic test to check
but difference between those values is algorithm taking 0.1 ms and 2 ms on exactly the same data set
oh thats a lot less surprising to me
you're memory is randomly spread over 20,000 elements in buckets
rather than 200 elements next to each other in memory
hashset capacity is defines how many buckets it will create?
ouch
yeah, should have seen that in that case
buckets is 2*capacity
yeah, my bad really, needed to stop and think for a second
seriously? that big of a difference with such a low amount? I never got that results. hm
isn't this more about allocation time than bucket reading?
but it's doing the opposite
if you pre allocate a giant set you aren't doing any allocations when adding
if you don't allocate you are doing constant allocations
that's true but we'd have to compare a constant 10k allocation against a 1 allocation and maybe 6(?) reallocs when the final length is around 100. maybe he's allocating the 10k * chunkSize times? I just never had this massive increase with a large capacity is what I'm arguing for.
bucket lookup with huge capacity is surely a factor, with 10k it just doesn't range from 0.1 to 2ms but I'd need to know what the actual operation is. thing is I have 100k containsKey and adds in less than 2ms
It it still true in 0.50 that for implementing events (e.g. taking damage) a polling system where entities have a component that is iterated over each frame and checked for damage, is faster than a reactive system where an entity is created that contains the event data and is then handled by a system?
hmm depends
I assume it depends on the amount of entities? I have no idea how "costly" iterating over a large amount of entities with an early return in case no "work" needs to be done is vs creating entities with tags.
I guess adding tags to large entities is always a bad idea since it would move them to a different archetype?
scheduling is costly
iterations itself usually aren't
Yeah but it's very hard to gauge how costly they are vs just creating entities
well creating entities is always costly
Scheduling is as well π
guess how costly it'll be if you will Schedule AND create entities
In either case the creation or "addition" of data is happening in a separate job that runs regardless, this isn't in addition to that
E.g. some system deals damage, another applies that
I'd rather suggest using buffer for that
My question is whether the second system should just iterate over all entities or if the first system should create "event" entities
In either case you schedule twice, possible less in the second case if there are no event entities to process (I assume this is cheaper than scheduling)
That's what I'm currently doing. Entities have a "damage buffer" that is iterated over each frame and checked for entries. My question is if this is better or worse than using event entities
I guess it also really depends on the amount of entities vs how often these events occur
https://bit.ly/3sKGagG - Game Architecture Course
http://unity3d.group - Join the Group (facebook)
https://www.youtube.com/channel/UCX_b3NNQN5bzExm-22-NVVg/join - Join the Channel
00:00 - Intro & What's coming with DOTS/ETC
34:10 - Q&A
literally just came here to share this same thing, just watching now
Hi, I am trying to develop a game using dots but I don't know how the UI should be implemented. I created a UI that derives from MonoBehaviour using the UI Builder but I don't find a way of changing the data by using entities systems. Does somebody have an idea ?
https://youtu.be/KwwHvH3GZsQ?t=2973
There he creates a link to the ECS data to update the UI data, that would be my idea.
Ok ty i'm going to watch the video
error SGJE0009: Alter.Terrain.MeshRetrievalJob contains non-value type fields.
What do I do then?
public partial struct MeshRetrievalJob : IJobEntity
{
public Mesh[] Meshes;
// ReSharper disable once UnusedMember.Global
public void Execute([EntityInQueryIndex] int entityIndex, in RenderMesh renderMesh)
{
Meshes[entityIndex] = renderMesh.mesh;
}
}
protected override void OnUpdate()
{
var ecb = _ecbSystem.CreateCommandBuffer().AsParallelWriter();
var numChunksToGenerateMesh = _chunksToGenerateMeshQuery.CalculateEntityCount();
var meshDataArray = Mesh.AllocateWritableMeshData(numChunksToGenerateMesh);
new TerrainChunkMeshGenerationJob
{
EntityCommandWriter = ecb,
MeshDataArray = meshDataArray,
VertexLayout = _vertexLayout,
}.ScheduleParallel(_chunksToGenerateMeshQuery);
var meshes = new Mesh[numChunksToGenerateMesh];
new MeshRetrievalJob
{
Meshes = meshes,
}.Run(_chunksToGenerateMeshQuery);
Mesh.ApplyAndDisposeWritableMeshData(meshDataArray, meshes);
_ecbSystem.AddJobHandleForProducer(Dependency);
}
I can't have a Mesh[] field in my MeshRetrievalJob
And as far as I know I can't pass an existing EntityQuery to Entities.ForEach()
So do I go back to writing a call to Entities.ForEach() that replicates my _chunksToGenerateMeshQuery by querying the same components?
Feels like a hack
There's an advanced API for meshes that allows to create them in jobs
I haven't tried it though
Yeah that's what I'm using
You can see it in the snippet I posted:
var meshDataArray = Mesh.AllocateWritableMeshData(numChunksToGenerateMesh);
Mesh.ApplyAndDisposeWritableMeshData(meshDataArray, meshes);
The problem is retrieving the managed/non-value (class instance) Mesh objects contained in the RenderMesh components
Since Mesh is a non-value type, I can't put an array of them as a field in a job struct
why do you even need to attach meshes to entities?
if you need array
you can collect data in Native collections
and just grab it in your second job
Native collections provided by Unity.Collections only accept struct types as element types
hm, true
Mesh is a class
don't you have reference to meshes before hand though?
How?
meshDataArray that, no?
They're MeshData values, not Mesh objects
They must be applied to Mesh objects
Hence this:
Mesh.ApplyAndDisposeWritableMeshData(meshDataArray, meshes);
I don't suppose anyone knows how to get this working Unity.Burst.CompilerServices.Loop.ExpectVectorized();
according to my ide its not even in the namespace
and I presume I just have to add this to to the top of the file #define UNITY_BURST_EXPERIMENTAL_LOOP_INTRINSICS
?!?!?!?!?!!?
public class AlterBootstrap : ClientServerBootstrap
{
public override bool Initialize(string defaultWorldName)
{
AutoConnectPort = 42126;
UnityEngine.Debug.Log($"{RequestedPlayType}");
Why?!
Whyyyyyyyy
Do I have to manually add UNITY_CLIENT to scripting defines in my build configuration?
Hello. I am launching a humble foundation towards my space mmo today using DOTS/ECS, thank you all for the past year of help. I have one possibly final question. I'm adding this to an entity, but I am not sure how to check if it may already exist: DynamicBuffer<ItemDropBufferElement> dyn = em.AddBuffer<ItemDropBufferElement>(e);
By testing if it already exists, I can see if there is data I need to preserve, and not overwrite it.
Thanks again for a wonderful year of help. There's a lot of hate on the internet lately, but the spirit of helping has never stopped as long as I've been on it since 1994. I was told it goes further back from the boss at the lab. He says he was there when some of the big guys weren't big and silicon valley first started up. Everyone wanted to help and share info.
AddBuffer returns existing if it already exists
Any juice in there or the same old same old?
I need to make object pooling in my dots project with the ability to retrieve cached entities from inside a scheduled (burstable) job. Can someone give me a boilerplate pattern or a resource I can look at it?
entities don't need pooling
you can just keep archetype
mostly same
for that matter
Is there a way for my external ide debugger to debug logic inside ForEach jobs?
It seems to be ignoring those breakpoints. But any breakpoints outside it catches and takes it step by step, but doesn't go into the ForEach logic.
A small update if you're curious - there is also a foreach loop over this hashset in the algorithm, so it's probably the biggest sink - I assume it needs to look into everybucket and see that there is nothing there on each foreach
ah, yeah that might be costly. do you use a method, enumerator or how do you iterate?
foreach (var item in hashSet)
is that looped once or multiple times per frame?
loooots of times per frame
ok yeah, that kills it then π why have a hashset when you iterate so much?
cause I also need to quickly check existance much more often )
disable burst and it should work
and quick removal by item, instead of by index
I don't get it π Anyway, as long as the hashset stays relatively small it's okay but that algorithm does not scale well. brute force iteration is a total perf killer. Might be even better off building a second hashmap
well, I need to be able to remove an item from a collection quickly, by item value
In list it's linear, in hashset it's O(1)
you can make a list and hash the key+value to get the index
it's possible, not sure if would give me actual benefits over iterating over the HashSet
is it a nativemultihashmap then? not a hashset?
hashset/map removal only works really great if you know the key. otherwise it's like a bad O(nΒ²)
but I know the key
it's the int I put there and when something happens I know the key I need to remove
I'm not iterating over it to delete things from it
ok, so the iteration is for another part?
{
if (otherthing)
{
hashset.add(x)
}
else
{
hashset.Remove(x)
}
}
else
{
foreach(item in hashset)
{
.....
}
}
in all this inside another loop
what is item in your context? hashset only implements bool as TValue
NativeHashSet<int>
I have an array of things, during the course of the algorithm some things in that array become "active" for algorithm, so I put their indices into that hashset when algorithm needs to iterate over active items it iterates over hashset and get the item by index. If item becomes "inactive" its index gets removed from the HashSet
is this per entity?
I think an additional list that saves the index/keys you want to iterate on is the most performant solution. a hashset is pretty good to not being forced to use Contains in a list (which is really slow) but for the iteration itself a hashset is not that great because it uses ceilpow2(capacity) for the bucket array which is iterated fully in the foreach
The algo itself doesn't work on entities - the data is already preprocessed, but the scale of it is pretty big, I'm currently testing on the array of 20k+ elements
it's hard to tell how many items in the hashsetitself at any given time though
as it's very inputdata dependant
i will try that approach too, as it's basically an exercise in optimization for me
already went to vectorized structures, but would it would be nice if i get a bit of performance out of that too
but actually my biggest timewaste right now is sorting
is there a sense in trying to insert sorted to some collection?
not really looking forward to implementing some kind of binary tree without at least a hint that it may be faster
Has anyone had trouble getting a subscene to load in a standalone build? I am using a BuildConfiguration. I've never had this problem before. I tried including the subscene in the SceneList of the BuildConfiguration but that did not solve the problem. Neither did deleting the Library folder
Thank you. This is great.
It didn't work. I ticked OFF "Burst->Enable Compilation" and ran the debugger and it didn't stop at the breakpoint within ForEach loop. Any other suggestions?
Have you actually got it to work?
Make sure it ain
t parallel processing
and your runs have
RUN().WithoutBurst
End of for each looks like this: }).WithoutBurst().Run();
Yup, that's exactly what I got.
You getting breakpoints outside of dots/ecs
?
cuz sometimes you need to rehook the visual studio
Make sure you get a breakpoint JUST before the foreach
do a UnityEngine.Debug.Log("YO!");
just before your for each
see if you get that
Also one more thing
if nothing qualifies for the for each
Yeah breakpoints outside ForEach work.
say no entities have those components, it won't run
So strip it down just to Entity e
And I confirmed that the Job runs in the Relationship panel.
Ok.
Yo, anyway of printing anything out of a parallel thread?
UnityEngine.Debug.Log isn't getting me anything but an error message. Jason, remember sometimes Debug messages are almost as good as a breakpoint.
If you cant get your break, try spamming debug messages.
They're harder to read in dots/ecs but they give some info
Yeah thatβs my plan B, but the logic inside is a bit complex and needs to run every frame with nested iterations, so Iβm trying to see if I can look at it live step by step first.
Hi, I wondered what is the best way to implement a kind of fps hud for players using dots and netcode. Does somebody already did something similar ? I can't find any tutorials online.
Take a script that implemented an fps hud in a normal unity project, add it to your dots project! What more does it need?
I made a UI with UI Toolkit using VIsualElements, but i can't find a way of modifying for example the length of a VisualElement using a System. Also, I am not familiar with multiplayer implementations. I tried to check the documentation about UIDocument and I don't know what to attach to my player IComponentData in order to add an UI for each players
I'm not sure about 0.50, but in 0.17 there were a bunch of issues when using UIToolkit/UIElements/whatever its called that isn't standard uGUI, something to do with subscenes.
Most people are using standard uGUI (usually as a singleton with convert and inject) then just accessing it via a singleton entity query.
Ok thank you, i'll try it with the standard uGUI
Also here is an example of what I'm doing to show an "interact" prompt to a user in netcode, it might help.
thanks, it will definitely help me
yeah, that's how I usually debug foreach loops
not sure why it wouldn't work for you
@rotund tokensir. Regarding input actions and UI again:
Do you have separate actions or one for all for mouse clicks?
Cause the moment I tried to switch it all into 1 input action (for this thing you suggested with disabling input if cursor over UI) I realised I used different action maps for same mouse click action.
Do you have separate actions or one for all for mouse clicks
I have different ones
each state in game has it's own map/actions
i have a common input struct as well
with info like, cursor position, raycast from camera, isoverUI, etc
that each of my states can use
yeah, cur mouse position is also general for all
but it's click that I'm interetsed in
and essentially: how you disable input for other maps
in case it's over game object
Doesn't that StopSmth method only disables current inputAction?
i only have 1 action map enabled at a time (well not true, i have a tiny common one but for the most part its true)
it doesn't stop any input action
it just means the UI has consumed it
so it'll be considered over UI
ahem
then I don't quite get logic behind
So I have actions: select entity and UI click.
Both have been attached to mouse click
I need to not run select entity in case UI click happened succesfully on UI element
{
var camera = this.EntityManager.GetComponentObject<Camera>(this.GetSingletonEntity<Camera>());
this.inputCommon.ViewPoint = ((float3)camera.ScreenToViewportPoint((Vector2)this.inputCommon.ScreenPoint)).xy;
this.inputCommon.InViewPort = new Rect(0, 0, 1, 1).Contains(this.inputCommon.ViewPoint);
this.inputCommon.InputOverUI = EventSystem.current.IsPointerOverGameObject();```
i write my state to a component
and i just use it in my logic
for when it shouldn't pass through UI
{
if (!this.InputBuild.Destroy.Down || this.InputCommon.InputOverUI)
{
return;
}```
that said reading this i might change the part where i write to my
this.InputBuild.Destroy.Down
to also take into account the inputoverui
I dont the system using this should care, should be handled by my input state system
totally missed that 2022.1 is officially released by now. quite the pain that the next entities release only targets 2021.3
Guys : I'm starting a new project, and I'm not sure if I should stick to unity "normal" workflow or start a DOTS project. I'm aiming to create a Backrooms type game (procedural maze in short) so that why I though about DOTS. The thing is that if I go to DOTS, there is no UI, Foot IK... I'm feeling like DOTS is not really integrated to unity packages and etc
am I wrong or not ? I feel like DOTS require x20 more effort
well kind of
there are no built in solutions for anything
UI elements though works fine with dots
pretty sure uGUI will work fine too
if I use DOTS, would I be able to have a mix between gameobjects and entities ?
or is it a bad thing
well yeah, you can
hybrid approach is totally fine
allthough I personally find it pain in the ass
I learnt how to create my own meshes and draw stuff without game objects just to avoid doing hybrid xD
yeah, game objects exist fine along dots
it's just that
these are 2 separate worlds
and bridge between them is somewhat painful
accessing game objects from ECS is relatively simple
accessing ECS from game objects is pain
so far I use game objects only for UI/event system/ certain data containers (launch options)
I see ok
Oh ok
@unique shard ask all you want here, it's totally fine
ok imma watch it then ty ;)
and can I import unity packages or are they not DOTS compatible ?
should work fine
ECS in DOTS is just different world
that doesn't cooperate with game object world
and runs on it's own
I am confused sir. How does it work for you?
For me IsPointerOvergameObject() always returns false. I read on forum that it only works with UI toolkit in 2021
hmm not sure, pretty sure this was working last i tested
but i have not been working in my game project much as 2020.3 stuff is annoying me
just working in my standalone libraries
I should add I do remember having issues with this and I might have changed something to fix it
But I can't remember, will have to check tomorrow
Really?
(0,0): Burst error BC1021: Creating a managed object `System.Void System.Func`2<Unity.Mathematics.float3,System.Int32>::.ctor(System.Object,System.IntPtr)` is not supported
Why doesn't Unity just let us write C++ instead?
How do I pass a heuristic function to my pathfinding function?
Is that what you're looking for?
https://docs.unity3d.com/Packages/com.unity.burst@1.3/api/Unity.Burst.FunctionPointer-1.html
It ended up working. It was weird, if I disabled burst it didnβt, but enabled it did lol.
Probably but how do I get an IntPtr from a function?
I suggest to look at burst manual
I never tried doing anything fancy with burst myself
but I remember seeing something about it in manual
Has anyone had trouble getting a subscene to load in a standalone build? I am using a BuildConfiguration.
I've never had this problem before. I tried including the subscene in the SceneList of the BuildConfiguration, with and without Auto Load, but that did not solve the problem. Neither did deleting the Library folder. Neither did deleting the SceneDependencyCache folder. (Well, including the SubScene in the build config with auto load did load the subscene but the references seemed to be broken). Making a new subscene also did not work
You haven't really said what's breaking or the error
Is dots at this point compatible with the 2021 LTS version?
nah, gotta wait for 0.51
welp, some ppl were expecting it several weeks ago xD
I personally can't wait for it
2020 is so bad with UI toolkit
I just want production ready dots, with proper 2d rendering capabilities, as well as editor ui for dots stuff
there's already debugging ui
which is good
That is not good in my book.
Ideally dots would have the same workflow as game objects have.
welp, I wouldn't expect it any earlier than 2025 xD
Yeah I won't either.
I still maintain that they went public with dots too early because they feared the competition
and shot themselves in the foot in the process
I just hope they dont abandon it half baked like so many other features
doubt they will
dots is getting hugely integrated into Unity
even certain game object components are jobified and bursted
Native containers are getting their own overloads for methods that usually accept normal IList
I love ECS for its design pattern mostly, which is why its so hugely frustrating for me.
Since the ECS pattern makes so much more sense to me.
I find OOP just obfuscates issues instead of solving them most of the time.
Like the issue of shared state, quite often it still shares the same if not more state, but just obfuscates it under piles of abstraction.
And to this day nobody could conclusively explain to me where the boundaries of components in unity should be drawn.
Which makes it all the more frustrating.
Mea culpa. The meshes (e.g. trees) don't load, and the character controller doesn't work. The error is a GetSingleton error, saying there are no entities that match, which I assumed was happening because the subscene didn't load. By adding the subscene to the BuildConfig with autoload, the meshes (e.g. trees) do load, but the GetSingleton error persists (and the character controller is still broken, since it relies on the GetSingleton call). There are no issues in play mode in the editor
Maybe autoloading the subscene via the build config creates a new world. I was using World.All[0] but maybe it's World.All[1] now
did you add singleton as requirment for update?
This removes the error but the character controller is still broken. There are no errors in the log. Moving on from this for now. Thank you for replying
Subscenes load async
It can take multiple frames for a subscene to load
You can not guarantee anything in them will be loaded while your world updates (unless you choose it to be that way)
It's not happening in editor because you're probably just starting in the scene with a subscene it's already loaded in memory etc
does anyone remember where to find the source generated partial systems & IJobEntity structs? π€
Sir?
Temp folder
yeah doesnt seem to work in 2020.3
Feels bad
hmm. okay so, say I had like an entity with a navmesh agent, transform, model, etc. But then I wanted to remove everything but the transform from the entity, and then add those components back later. Like, if I walked away from the entity, it would unload everything but its position, so then when I came back I could re-give it a mesh and all that. How would I do this without structural changes? I could technically just keep all that around in memory but that's wasteful since I'm not using it
Modifying archetype of entities is always structural change
yeah, but how could I approach it a different way then
If you don't want to remove list of entities
You could use disable tag for your system
maybe decouple the part I need to remove from the part I want to keep, and then have them linked?
Kind of like disable rendering tag works for rendering
But all the meshes and stuff are still kept in memory, then
It's an option if you often remove add set if components
Or when adding those components is painful
As in restoring data per entity and etx
Also, does entity collision still work with terrains
If not then I can't use it yet
Can Translation.Value be relative to a parent whereas LocalToWorld.Position will always be absolute?
What is the source generation for systembase actually needed for?
/home/overmighty/projects/alter/Alter/Assets/Scripts/Alter/Characters/Pathfinding.cs(88,9): Burst error BC1063: Unsupported parameter `ref Unity.Collections.NativeList`1<Unity.Mathematics.float3>` `path` in function `Alter.Characters.Pathfinding.FindPath(ref Unity.Mathematics.float3 start, ref Unity.Mathematics.float3 end, ref Unity.Collections.NativeList`1<Unity.Mathematics.float3> path)`: Field `NativeList`1.m_DisposeSentinel` of type `Unity.Collections.LowLevel.Unsafe.DisposeSentinel` is not blittable. When compiling a method for use as a function pointer, only blittable types can be used in the method signature, including parameters and return type. To fix this issue, replace the non-blittable type with a blittable type. Blittable types include: void, byte, sbyte, short, ushort, int, uint, long, ulong, float, double, UIntPtr, IntPtr, pointers, and blittable structs (i.e. structs containing only blittable types). Alternatively, use a pointer - `Unity.Collections.NativeList`1<Unity.Mathematics.float3>*` - instead of ref - `ref Unity.Collections.NativeList`1<Unity.Mathematics.float3>` - for this struct parameter.
While compiling job: System.Void Alter.Characters.Pathfinding::FindPath(Unity.Mathematics.float3&,Unity.Mathematics.float3&,Unity.Collections.NativeList`1<Unity.Mathematics.float3>&)
at /home/overmighty/projects/alter/Alter/Assets/Scripts/Alter/Characters/Pathfinding.cs:line 88
Really?
I can't pass NativeLists to Burst-compiled functions?
Doesn't m_DisposeSentinel only exist when safety checks are enabled?
You can if you add in, ref, or out to the parameter declaration, effectively turning them into pointers
Why?
The system Alter.Characters.PathfindingSystem reads Unity.Transforms.LocalToWorld via PathfindingSystem:PathfindingSystem_LambdaJob_0_Job but that type was not assigned to the Dependency property. To ensure correct behavior of other systems, the job or a dependency must be assigned to the Dependency property before returning from the OnUpdate method.
protected override void OnUpdate()
{
using var players = _playerQuery.ToEntityArray(Allocator.TempJob);
if (players.Length <= 0)
{
return;
}
var tick = _serverSimulationSystemGroup.ServerTick;
var localToWorlds = GetComponentDataFromEntity<LocalToWorld>(true);
Dependency = Entities
.WithReadOnly(players)
.WithReadOnly(localToWorlds)
.WithAll<NpcTag>()
.ForEach((Entity entity, ref DynamicBuffer<PlayerInput> inputs, in LocalToWorld localToWorld) =>
{
// ...
})
.Schedule(Dependency);
}
Appending Dependency.Complete() to OnUpdate()'s body fixed it, I don't know why
that's a sync point
try to remove all Dependencies
leave it as void method
oh
I remember
you are using Entity type
without type handle
this is causing dependencies to break
lemme remember how I fixed it
welp
I transformed it into IJobEntityBatch
and used type handle
xD
ComponentTypeHandle?
EntityTypeHandle
Are entities able to collide with terrains?
Is there a quick way to turn off rendering of all entities at once or do I need to do it by hand?
Launching my MMO foundation patch in the next 2 hours or so, wooo, a good milestone after 5000-7000 hours dev depending on metrix
I think I can entity query this, but none of my systembases work until later when the DOTS/ECS segment of my game starts. Is there a way to force a systembase refresh even if the .foreach ain't happenin?
Maybe just a foreach of all entities, disable every time seen, slap in a list for later enabling, yah that should do it
[AlwaysUpdateSystem]
EntityManager.AddComponet<disable rendering>(query).
Very fast
So, nobody knows?
it's a pretty vague question
physic coliders collide with other physic colliders
if you give your terrain a mesh collider and your entity a box collider
they will collide
if your question is about terrain colliders i do not believe they are currently supported (though there is a type in the backedn)
you need to use a mesh collider
Q2 2022 is getting frighteningly close to its end 
Does ecs interact with audiosource yet or?
wdym with 'interact'? if you're asking if you can have ecs audio sources: no
we expecting 1.0 around this time or?
more like 0.51
Yo, I'm releasing a patch to my game today, and I forget the trick about assets when using the build pipeline. Is there some folders from Unity I need to copy with my release for data?
I want to go live bad.
Can someone help me?
My #UNITY3d DOTS/ECS game only plays in editor and not in standalone
I do not use subscenes
Backedn?
Any info on how to do these managed components?
https://docs.unity3d.com/Packages/com.unity.entities@0.50/api/Unity.Entities.EntityManager.html
public class CharacterAnimationComponentAuthoring : UnityEngine.MonoBehaviour, IConvertGameObjectToEntity
{
public void Convert(Entity entity, EntityManager dstManager, GameObjectConversionSystem conversionSystem)
{
dstManager.AddComponentObject(entity, new AudioSource());
What you do with it is up to you. But this creates a Companion Link and an AudioSource object in your scene that always follows your entity.
wait what. What other components will work like that?
the way, so it creates companion link automatically
I also wonder how to query through such components
after adding
Last time I tried to help you you ridiculed me, so figure it out yourself.
π€
That's interesting, did not know it'd work like that. Any advantage of this over just putting the audio source on the game object though? I believe it'd still convert to the same companion object.
As far as the advantage goes, you wont have any in terms of performance as far as I know, but if you have a Fireball Entity with a ParticleEffect and a crackling sound effect AudioSource added through the AddComponentObject, you don't have to sync the position and rotation of your GameObject with the Entity. It's just convenient for moving Entities. The problem with AudioSource is that you can't have thousands of them, so with many Fireballs you would need another system. You can add loads of normal components this way so you wont have to manage that all yourself. I'm still trying to find the limitation script I read somewhere, will post it if I find it again. For example, a TrailRenderer is not allowed, but a LineRenderer is IIRC.
I believe it'd still convert to the same companion object. Not sure what you mean by that, as far as I know you need to code your own companion object for all the components that you can not use on entities.
Ah how have you used writegroups? I've been a bit curious about its use case for a while but haven't found a need yet π€
I believe it'd still convert to the same companion object. Not sure what you mean by that, as far as I know you need to code your own companion object for all the components that you can not use on entities.
supported companion objects can be converted automatically (but audio source isn't one of them). what you've seen to done is 'convert' objects that aren't actually supported and it works which is super interesting as i did not expect it to work.
when I posted that above, I thought audiosource was one of the supported ones but it appears like it isn't looking at the list.
ideally i'm wanting to put them on everything
i really want to build a super ecs modable library
Can you post the list you mentioned? I'm wondering if that was the one I read. I'm quite sure AudioSource was one of them.
Well I searched for a while now, couldn't find the list I was looking for. Somewhere in the source code there was a list of things that were allowed as components.
What entities persist through scene loads/unloads?
I think it's more of a matter whether world persists
When does a world not persist?
I don't quite remember what is default
I'm making the main menu for my game and I'm not sure how to properly handle the button for connecting to a server and switching to the game scene
But I remember there was an option to not unload world upon scene change
you probably can do everything within one scene
you can load/unload subscenes freely while keeping entities that belong to world untouched
Do I load subscenes just like I would load regular scenes with SceneSystem.LoadSceneAsync?
yeah
or you can do it in low level API
as in
literally just create entity with subscene component
and tag to load
and it'll load xD
Is there any reason to add ConvertToClientServerEntitywith the ClientAndServer ConversionTargetType to GameObjects instead of adding a subscene to the scene at build time?
Quick question about the Job system
I've seen multiple videos now about the Job system and how you can utilise multi threading with it.
Now, as you can only use native types its mostly impossible to adapt my whole AI code to it.
Question: Does it mean I have to split individual things from my AI code into jobs? So my AI code has multiple different Jobs I'll schedule?
Also, is this a problem if I execute those in a IEnumerator? As Coroutines are running on the Main thread? Or is that not a problem if I schedule a job in a Coroutine?
Thanks!
you can do your work in several jobs
1st grab data for job
2nd do jobs
3rd retrieve data from job into your managed world
so I wasnt that wrong with my 'theory'?
doing several jobs that depend on each other is totally fine in ECS
why wouldn't it be in just jobs?
Library/PackageCache/com.unity.dataflowgraph@0.19.0-preview.7/Runtime/AtomicSafetyManager.cs(32,74): error CS8377: The type 'T' must be a non-nullable value type, along with all fields at any level of nesting, in order to use it as parameter 'T' in the generic type or method 'NativeList<T>'
Hello, do anybody know how to fix this internal error?
Remove data flow graph
You probably have old unsupported animation package installed?
Not sure if it is old an unsupported, but i tried this one: https://docs.unity3d.com/Packages/com.unity.animation@0.2/manual/index.html
Yes it's no longer supported in entities 0.50
which one is proper instead?
You'll need to wait for after 1.0 for an updated animation package
None =(
Maybe any another way to animate 3d entities?
You need to use hybrid, just the old mecanim
Unless you want to write something yourself
I use hybrid renderer, and i know how to animate GameObjects but how to animated entitites i don't know yet
Hybrid as in use gameobjects not the render
Unless you want to do it all via shaders, wait for a third party solution or write a solution yourself
Basically stuck using gameobjects for now
so for now there is no way to animate enitites. If i want an animated character i should not convert it into the entity and should use it like a regular GameObject, right?
Pretty much
#archived-works-in-progress message
Shameless plug for my 78.404 animated characters in DOTS.
Thank you. And the last question. What about Rival Character Controller? They implemented their own animation system or their character actually GameObject nor Entity?
https://assetstore.unity.com/packages/tools/physics/rival-dots-character-controller-195567
But it's not the standard way of animating things.
Looks amazing. It's done similar to Animation Instancing?
No, its vertex animation, it has no skinned mesh renderer at all, its just a standard mesh. You just bake all the vertices of every frame of the animation into a texture, where every pixel means a position and rotation from your origin point. Then you go through the texture information and set each vertex on the correct spot.
I know this unusual but very efficient animation playing mechanism. I though that Animation Instancing is it actually.
And https://github.com/maxartz15/VertexAnimation
These guys did a scholarship on the university 2 years ago, but there is a pull request that has it updated. With a bit of tweaking you'll have it set up in a jiffy.
I'm not a hero when it comes to terminology, but I thought Animation Instancing is the same as GPU instancing. Where if you play the same animation with the same mesh Unity does some magic and it goes fast.
@oak sapphire this is an article form Unity about Animation Instancing https://blog.unity.com/technology/animation-instancing-instancing-for-skinnedmeshrenderer
Seems somewhat the same. Except that my version puts all the work on the CPU and this does most of it on the GPU.
With 78000 units I'm on 100% CPU usage.
Yeah what's I meant by Shader above
I don't generally recommend it as most people are primarily looking for a way to animate a player controller and this really isn't great for that
(just due to the number of animations a player controller can have as well as only have a couple of players at most visible at a time )
It's amazing for crowds of things though
I thought that as many animations i will have a many textures for storing vertices positions i will have to create for each of them and here is no limitation actually. Am i wrong?
We have over 1000 animations on our player controller
It becomes a bit of a nightmare for artists to maintain
but for simpler games it could be good enough or not?
And there is pretty much no benefit of using this technique on a single object
I 100% agree, it's great for my Kingdom Simulator game where you have thousands of people going about their life.
But you can not use all the fancy stuff like animation blending, so every animation transition looks janky.
As a main character you should not use this.
Do anybody know how the Rival Player Controller (i sent link above) is working?
if it's okay it's not a problem to pay for a great solution
Sorry, i've just read that it's not deal with input system, animations and cameras. So, this is not a solution for animations...
If I want to write a lot of values to a DynamicBuffer, is it enough to call Clear and then EnsureCapacity before writing to the native array returned by AsNativeArray? Or do I need to do something else to make sure the internal stuff like Length is updated correctly?
clear would set the length to 0 so the native array would be empty
is there a ResizeUninitialized? or is that just another extension i've added
What is "DOTS root assembly" under build config?
I want to launch my DOTS game patch on steam, and my Standalone doesn't match my editor. Quite literally an IDE compiler should never have this problem... But this has plagued me for months before on Unity. Lots of people can't get this scriptable build pipeline thing to work when the old build always worked.
It's part of the package, and that was what I was looking for instead of EnsureCapacity, thanks.
The fact this is still true what 5 years? after dots was announced is kind of a joke.
animations and sounds are basically the first thing they should have exposed to dots imo.
You literally can't make a game without them.
Hello, I'm trying to animate characters in my game, but I'm stuck. I would like to access to the animator component that's contained in a gameobject. I know how to do the conversion, but I don't know when in the code I'm supposed to do it in order to use it in a system
please help me
I doubt it will work, but considering previous findings you could try literally quering through GameObject component in ForEach loop
If my hopes are justified -it'll query through companion link that has that component
if you add the animator to the entity
you can literally just query it in an entities foreach
Entities.ForEach((Animator animator) => { }).WithoutBurst().Run();
My quest for a DOTS/ECS standalone seems promising. I have a file that is an offender in standalone, present only in my playerdatacache, but not in my actual assets. I'm going to backup, delete the library file, recompile library, then try and build standalone today. Thanks for everyone helping.
I'm excited to see if I can start attracting a user base to the update model: Keep player data through updates, but the game you play in radically changes each update.
oh wow, that's poggers
By doing this, will I be able to access the animator linked to the prefab ?*
I'm currently working on fps shooter using DOTS, but i'm struggling trying to get my Raycasts going from the camera position to a certain distance. I'm using this but it doesn't seem to work cs var cameraHeight = new float3(0f, 1.7f / 2, 0f); var startingPoint = localToWorld.Position + cameraHeight; var destinationPoint = math.mul(quaternion.Euler(math.radians(-90f + input.Rotation.y), math.radians(input.Rotation.x), 0f), startingPoint); Does someone know why ?
what are you expecting from this code?
I'm expecting to draw a ray that starts from the startingPoint and ends at the destinationPoint. The startingPoint being the camera position and en destinationPoint being a point in the direction of the camera with a certain range
I figured out how to make a Raycast but when I tested it, the line that I drew using DrawLine wasn't following what I expected
please, can someone help me ?
by this you will access Animator on Companion Game Object of that entity
Can you show me a little example of how I can do that please ? Iβm really a newbie with DOTS bro
Entities.ForEach((Animator animator) => { }).WithoutBurst().Run();
xD
Entities.ForEach((Animator animator) => {animator.Stop(); }).WithoutBurst().Run();
okayy ! I will try this
thank you very much
public partial class GameUISystem : SystemBase
{
protected override void OnCreate()
{
var UIDocumentObject = Object.FindObjectOfType<UIDocument>();
Entities.WithAll<UIDocument>().ForEach(
(UIDocument uiDocument) =>
{
uiDocument = UIDocumentObject;
}
).WithoutBurst().Run();
}
protected override void OnUpdate()
{
Entities.WithAll<UIDocument>().ForEach(
(UIDocument uiDocument, in PlayerData playerData) =>
{
var healthBar = uiDocument.rootVisualElement.Q<VisualElement>("player-health-bar");
healthBar.style.width = playerData.Health;
}
).WithoutBurst().Run();
}
}
``` I have implemented what you suggested but I get an error on this line var healthBar = uiDocument.rootVisualElement.Q<VisualElement>("player-health-bar");. But in the UIDocument that I created in the Scene, I added the uxml file containing a VisualElement with the name "player-health-bar" but i doesn't seem to be accesible. I also added a UIDocument component to my player archetype. Does someone has an idea why ?
I don't quite get what you are trying to do here
PlayerData is singleton?
No it isn't
Then there's something really wrong with this code
π
why do you have uiDocument on entity?
I want each player to have an HUD
is that smth multiplayer related?
yeah
Well, anyways
var UIDocumentObject = Object.FindObjectOfType<UIDocument>();
Entities.WithAll<UIDocument>().ForEach(
(UIDocument uiDocument) =>
{
uiDocument = UIDocumentObject;
}
).WithoutBurst().Run();
what you are doing here is assigning same UIdocument
to all entities
also, you are doing it in OnCreate
which means subscenes will not be loaded atm
and this most probably will not even run
ok
I am trying to attach a UIDocument component to each player. I did it on the code for the player spawning. But how would I assign the HUD that I made using UI Builder (uxml file, etc...) to that component because the UIDocument constructor is private so I can't do SetComponentData
I see, you'd want to ensure when each player gets created
they already get their UIDocument
so either assign it to game object if they are getting converted from it
or if you are creating it from scratch - add your UIDocument prefab manually after instantiation
how can I do this ?
well quite literally how you do it with game object
add all components you want
and press run
oh wait
UIDocument will not be converted automatically
you need authoring component for that I guess
ok ty
I am getting this error:
"The instruction Unity.Burst.Intrinsics.X86.Sse4_1.min_epi8(Unity.Burst.Intrinsics.v128 a, Unity.Burst.Intrinsics.v128 b) requires CPU feature SSE41 but the current block only supports None and the target CPU for this method is SSE2AndLower. Consider enclosing the usage of this instruction with an if test for the appropriate IsXXXSupported property."
but have that code inside of #if MOC_USE_SSE41 . Anyone have any clues to what might be causing this?
What is... AssertionException: Ensure TypeManager.Initialized has been called before using the Typemanager ... mean? Its different when live vs editor.
Is it because Standalone is faster to run and I'm waiting less cycles for DOTS to power up?
It means you have not initialised the type manager
But your using a component
This usually happens during automatic world bootstrap
Go to your burst settings in project settings and make sure sse4 is enabled
Anyone have any suggestions on how you can handles 1000s of audio sources efficiently?
I tried the companion game object thing mentioned but it didnt' produce any better performance than just using monobehaviors to manage them.
My vehicle controller has 100 sounds on it. I want to be able to handle up to 250 vehicles in my races. That is 25000 audio sources in a scene and its causing big lag.
that sounds excessive, can we even hear that many sounds 
Thanks, it wasn't enabled. After enabling "Everything" for 64-bit arch and trying to build, still getting several " but the current block only supports None and the target CPU for this method is SSE2AndLower" errors.
They aren't all playing at once. only about 40 or so play at any given time. But not really excessive. The engine has 30 different clips that change and blend together with rpm values, you can't just change the clip on the source because of how rapidly the clip changes it causes popping. Then there are 30 clips for the exhaust doing the same thing. Then you have tire squeels crash sounds transmission sounds various toggle sounds for lights. Gear shifter sounds.
What CPU are you using
threadripper
AMD Ryzen Threadripper 3970X 32-Core Processor 3.69 GHz
yeah I don't know I think audio is always going to be a problem, they use a ton of memory and no easy ways to pare them down that much
Maybe I'll try on my intel
Sse4.1 is pretty old, everything modern should support it
Bulldozer onwards for ams
Amd
There are definitely ways around it. Games like gran turismo and forza have even more sound effects for their vehicles than I do. So im just wondering what the play is to make this work. Audiosources would be fine if you could actually blend between multiple clips based on a value but that isn't possible unfortunately
Having that many audio sources seems wrong to me
Sounds like it should be mixing in fmod instead
any news for dots and 2021? I wanna use decals and deferred lights
don't they stream them or something when they need them, I doubt they would load that many audio sources at once and use them
I thought about that but I am developing vehicle physics with dots for an asset store release, and I dont think using fmod is a good plan due to the fact it will force the users to honor the fmod license
Yeah, I feel like the stuff based on RPM would be easily done in wwise or something
I think I even remember Mark Cerny talking about streaming audio sources really quickly from SSD only when games need them π€
Yeah, that's what it is saying . o O"about automatic world boostrap"... How do I fix it? I'm excited, my DOTS/ECS game is launching today if I can fix it. I finished it friday, but can't get a standalone yet. Remember Tertle, you ever need help IRL if I make it, you just ask and I help you out.
Who is mark cerny? haha and The memory from the audio being loaded isn't the issue. The audio sources(not even playing audio just existing in the scene) is eating cpu
Does unity even support streaming data from the hd in realtime? I mean I know asset bundles exist but they take an eternity to actually load.
yeah I don't know could you use subscenes maybe, probably not
its one way you can convert data to entities and load stuff
hey, any news for dots and 2021? I wanna use decals and deferred lights?
if you have to ask there's probably no news
just expect it june 30th and if it comes earlier be happily surprised π
I am not in touch with unity news as I'd like
my point is just that the dots crowd will be yelling so loud with joy that anyone could hear
Are you building with BuildAssets?
I dunno, is it really worth it to build an audio system for a asset pack that's not even revolving around audio? Or in other words, is it a scaling problem or does 1 car have so many audio sources?
and quite frankly, I'd go with Fmod for anything serious when it comes to audio. Maybe it's just my audio inexperience but I never had a good time with out of the box Unity audio
Fmod was pretty easy though
also, take a look at this: https://github.com/Dreaming381/Latios-Framework/blob/master/Documentation~/Myri Audio/README.md
Its not a problem with one car, its a problem when you start adding more. A selling point of my asset is going to be scaling, because none of the current vehicle physics solutions can handle more than 12 cars without it starting to become a problem for performance. I was trying to avoid using fmod because then anyone that decides to buy this will have to abide by the fmod license.
Oh nice, gonna check this out now
yeah, makes sense. the framework should give you a good idea of how to scale. It's not that every audio source is playing at once anyway.
not sure tying your plugin to a 3rd party asset is a good idea
that said, whatever solution you use should be modular and easily replaceable
I agree, however in the short run it's hard to go around some problems. Mainly animations and audio. When making a factorio prototype several years ago I also ran into audio problems and never found a good solution for it. The Unity implementation of audio is just not very good when it comes to scale.
thats why no studio uses it - sad dsp graph development stalled
unity bought so much useless stuff, yet has no good audio solution π€£
I've noticed if you have an abstract class that extends from SystemBase, when you extend it with an implementation you need to include the using for Entities or else it doesn't compile
Anyone know if this has been raised to Unity?
Hmm I haven't noticed
Going to check when I get home
Because I'm pretty sure I have some pretty simple implementations
And unused usings auto get culled
Is DSPGraph somewhat usable?
Yeah I just looked at my repo, I definitely have systems without using entities that work
For example
internal class AISystem : AISystemBase<AIContext, AIStorage>
public abstract unsafe partial class AISystemBase<T, TS> : SystemBase where T : unmanaged, IContext<T> where TS : AIStorageBase<T>
Unless I misunderstood what you're suggesting
Interesting... no you are understanding
Are you missing partial?
Otherwise no idea.
But I have a lot of this without issue
I'll try narrow it down..
The error is in the implementation of the abstract method from the base class..
The name 'ComponentType' does not exist in the current context
It makes little sense and if I put the using in, it compiles lol
Do you have code gen in your base class
By code gen I just mean like job. Withcode
oh umm, no actualyl
that could be it..
OK, it only occurs when I do a GetComponent call in the implementation, like e.g. GetSingleton
well that's why i never run into it
i only ever do GetSingletonEntity and get the component in the actual job
to avoid a sync point
(that said i dont think i've ever used that in abstract classes either)
I'll create a forum post for it
Whats that? It isn't googleable.
That probably means build configuration files
As far as I remember GetComponent equals just getting ComponentDataArray, but simplified?
Outside of a job it calls entity manager
Inside a job it uses component data from entity
But that's not the same as getsingleton
yeah, I know
I haven't really looked, but I guess
that GetSignleton is literally query through entities
Oh. I use Assemblies and DOTS/ECS. What scriptable build pipeline options do I need. I think it is an error for Unity to remove core functionality everyone uses and replace it with an experimental feature that is undocumented... But if you help me through this, I'm happy. Wanted to release on Steam last friday.
the only reason to use them - include subscenes in build
I do not use subscenes.
How do I compile a standalone?
My project is windows
in keeping settings intact
I can't compile a standlone.
if you don't have subscenes you can simply build through File thingy
This is very helpful, I will attempt said thing.
Still didn't work, crashing on level0 again... which isn't even my code, but .50 code
Looks like this "level0" is found in the following .50 files:
BoundingVolumeHeirarchyBuilder.cs
BlobificationTests.cs
ConvertGameObjectToEntityTests.cs
HierarchyIntegrationTest.cs
This may explain why my project built standalone in pre .50, but is not 100% certain the cause.
using NUnit.Framework;
using Unity.Collections;
namespace Unity.Entities.Tests
{
#if !UNITY_PORTABLE_TEST_RUNNER
// https://unity3d.atlassian.net/browse/DOTSR-1435
// These tests cause crashes in the IL2CPP runner. Cause not yet debugged.
Log in to Jira, Confluence, and all other Atlassian Cloud products here. Not an Atlassian user? Sign up for free.
what does the stacktrace say?
player.log or crash.log?
The file 'D:/starfighter/Starfighter_Data/level0' is corrupted! Remove it and launch unity again!
[Position out of bounds!]
post both logs
Crash Log: https://pastebin.com/avr9ve1f
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.
level0 is only found in .50 UNITY DOTS blackboxed behind API files.
Playerlog also complaines about level0
Player.log: https://pastebin.com/LpFNM0zL
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.
that's quite odd. you said you don't use subscenes? i'm not sure what would corrupt level0.
I did use scenes, but ripped em out with the new subscene routine being too difficult to use.
Maybe I have some floating code around, good call Enzi
did you find the error message in a code file? I couldn't find it in entities
So, I removed all the headers: #using Scenemanagement
and now I get a crash in editor, which is promising, thank you. This is probably it, but I gotta get into work soon
Hmm
So when scene is open
and I add Animator Component to CompanionLink
animator works in runtime
but when I close scene
it doesn't work
but it is certainly added
to companion link
monobehaviours don't work in subscene GOs. they are culled for some reason
test if the animator that is added is really valid but I guess if it would be you wouldn't have that issue
it is valid
animation exists
and it's also good
but as soon as I close it
nnnoep
is the animator added from script?
or is it already on the go?
if it's on the go, test if it works when you add a new animator in the conversion stage
I add it as AddComponentObject
yay
Updating manually works
hmm
now I wonder
how to know when subscene is open and when it's not
so I can enable/disable that system automatically
Is anyone familiar with the occlusion culling system in Hybrid? It seems to cull objects and their shadows as well, which is causing some weird instances where cliff shadows disappear when facing away from them. In the normal Unity occ. culling it seemed to still display shadows if in screen. Is there a way to get it working in Hybrid with the same behavior?
It works to duplicate each mesh in the LOD and make a shadow-only mesh + remove occludee component, but feel like that would be really inefficient
I experimented with it quite a bit before
To be blunt, not ready for use
The shadow issue makes it pretty unusable imo
But also it had a bug where if you hit 32k entities you'll crash
This is fixable by editing the package and changing the cull index field from a short to an int
@rotund token thanks. that helps. I can get around the shadows for the time being. Were you ever able to get the terrain to be included in occlusion calculations?
as an occluder
And I'm sure you saw on the slack, the issue with the SSE4 was I was using compiler blocks and it needed to be in if() statements instead
I never tried terrain
Also another issue is that dynamics currently don't work
There's no reason the system can't handle dynamics and I started updating it to fix the issue but then decided against using it for now as I had other priorities.
I'm pretty excited/hopeful for a runtime occlusion culling implementation but yeah needs work
hmm, I'm trying to make that EntitySelectionSystem work with sprite renderer
You can see my work on this here @olive kite
I assume I can just draw Quads
but I don't really get how to make it's scale according to sprite
Why is it that I can't build and run if I include DOTS components?
I guess a good question is, why do you have it included? π
if dots builds dont include, it doesn't build entities
Well like as of 3 months ago
ahh that's not true
the one in unitys own sample does not include it
and it works fine for me without
anyway your issue is probably you haven't included any scenes
all i use
builds run fine without it. the problem must be elsewhere
good catch, no scenes is indeed a problem. how did that ever run with that build conf?
just what his error is telling him ^_^'
did he post another error or the level0 is corrupted error?
level0
level0 is just the name of the first scene that unity tries to load
if you look at a build
all scenes are renamed to level0, level1, etc
in your X_Data folder
it's corrupted in the sense it doesn't exist
not totally obvious but now it makes much more sense. I've never seen a level0 error. I think the classic build menu doesn't even let you build without one as it defaults the open scene. shouldn't happen with the new build settings tbh
Is Unity Physics slow for anyone else? My project runs mostly without it, but I use it in 1 very simple trigger system. The system itself doesn't take so long, but the stepphysicsworld itself takes up a good 20 milliseconds in the profiler.
My Build Current Scene is checked. You have it unchecked and a 1?
you need to add it to the list
You used to be able to do "BUILD CURRENT SCENE" and have 0 other subscenes
the list used to be for subscenes I think
Actually I have no clue, but that's about what I did. No one listen to me. I have NO clue what scirptable build pipeline does.
I mean I do, but I don't.
you should not add any subscenes to the list
How can I create a local copy of a nativearray to use in the next frame so I can compare it to the current? No matter what I do it wants me to dispose the nativearray, if I dispose it then assign it with a new NativeArray it says that it cant use a disposed thing.
private static NativeArray<PathCompleteBuffer> previousPath;
...
previousPath = new NativeArray<PathCompleteBuffer>(buffArray.Length, Allocator.Persistent);
buffArray.CopyTo(previousPath);
I just want a copy of buffArray from the last frame to be accessible
What? Subscenes should not be included in build list?
no
why would you want to keep the scene asset in your build?
Oh
@remote crater i may be wrong but i think to use the build assets with dots, it requires Subscenes as it looks for them.. as tertle says the subscenes are built already to data and don't need to be added as scenes to the build... if you're not using subscenes i think you would need to use the old File->Build method which i think Issue suggested ( it does work with dots, but does not work with subscenes if i remember correctly )
So, if you have no subscenes - use the File> method
If you do have subscenes - use the build asset method
Another problem i had previously was when using the Rival dots asset, which used the Animation package. It was possible to build and run using File->, without using subscenes at all, but i found the skinned animations were not working. It turned out i think the animation clip assets were using blob assets or something blah blah blah and in order to get them to work in the build, i had to change my whole approach to using Subscenes, and building using the build asset approach.
I am trying to recursively collect LinkedEntityGroups. Is there anything like HasBuffer to check whether an entity has a LinkedEntityGroup or not?
shouldn't it be attached only to main prefab entity?
yeah probably it should
to check you can just use HasComponent btw
right now it isnt π¬
well this does not work:
HasComponent<LinkedEntityGroup>(entity);
I certainly used one of those
when made helper method to get all children recursively
entity manager can do it: EntityManager.HasComponent<LinkedEntityGroup>(entity);
but that wont work in a thread π
functionality between EntityManager, ECB and SystemBase not really consistent
well, yeah
ECB is pretty limited, no structural things
why are you even trying to collect LinkedEntityGroups through HasComponent?
why don't just make separate query to collect them?
I am basically trying to apply sth from another component to all "children":
Entities.WithSharedComponentFilter(gridGroup)
.WithChangeFilter<GridComponent>()
.ForEach(
(in DynamicBuffer<LinkedEntityGroup> linkedEntityGroup) =>
Otherwise I would need to add the SharedComponent to each and every sub entity
that's what I do, xD
every time SharedComponent needs to be changed
I add it recursively through transform hierarchy
I'm on day 5, 20 hours of just trying to get Unity to make a standalone.
Live streaming this if you want to help or feel my pain: https://www.youtube.com/watch?v=aieEpMDdIdQ
My clues I'm working on from crash log:
0x00007FFD11157AC7 (UnityPlayer) UnityMain
ERROR: SymGetSymFromAddr64, GetLastError: 'Attempt to access invalid address.' (Address: 00007FFD1020DE03)
I think Unity forgets to automatically build your "resources" folder for your addressables and stuff you load on the fly.
I have code like:
loader = Resources.LoadAll<GameObject>("spaceship1");
user.Add(loader[0]);
The above code loads from the /asset/resource folder at live time. I think Unity doesn't know how to copy the resource folder into the live build and this is why I am getting error:
I've coded over 40 years. I never saw any IDE designed for standalones not be able to make a standalone when it works in the editor.
I'm 20 hours into this. It's annoying because this was my big finish line I worked on since 1992. I have 7,000 hours into this project alone. I have probably 40,000 hours into coding MMOS since 1992. I was so s...
Maybe use Addressables instead? π€
I do use addressables too
I think there is a way to copy the resource folder manually if Unity doesn't do it
But I forget how to do it since last time I did it, been a while.
Yah, I think this might be in... Unity wouldn't copy the resources folder in with a live build, right?
So this could be the cause of my crash right?
I dont have a clue because I dont know which address it is trying to access there and also dont use the ressources folder in my projects
Np, its a general question for everyone.
yeah that might make sense. Both ways feel kind of weird though
does anyone else end up with a ton of commented out code when programming π€
No thats what a versioning system is good for. If you dont need it anymore just delete it. You can easily get it back later by restoring it from previous revisions
ah I see, I was going to figure out versioning but they depreciated collobarate
I would recommend using git with GitHubs Desktop client. Its pretty good to get started and there are plenty of resources
yeah that's what I was thinking I should probably figure out how to use that properly, thanks
version control is basic programming tool
it should be your priority to setup it when starting new project
I was thinking I may be a bit behind on that 
but about main topic, commented code is useful when rewriting your code to see what was there before but after that it's useless and should be deleted
my code is just a huge mess, I have all the code I might want to change back to
but versioning should solve all that
I just looked at my code and thought I must be doing something wrong 
Methodology being used to track down the problem with the standalone not working:
I'm disabling ALL of my START and UPDATE functions to see if the error still happens. This is time consuming. Been at this since 9 AM, it is now closing in on 12:45 PM. I probably have another few hours to go to start testing if it is my code causing the issue. If not, I can narrow down by removing stuff from my scene. If it is not my code and not my scene, I'll start removing Unity Packages and assets from my asset folders. I think the ol "Strip down" and binary search my way to the culprit will be in order here. I have an attack path, but it will take me many more hours. I should figure out this one eventually
Still that level0 error you talked about earlier ? If you make a new scene and only build that empty scene, uncheck all others, does it work ?
might be faster to start there rather than the scripts
Can I use a Quaternion as a field for a Job?
all unmanaged types allowed
Cool thanks a lot!
is there still a simple way to create a NativeList<T>, or do i have to use AllocatorHandle to do it? i feel like it used to be a lot easier, and didn't require it being unsafe
you can still use the old Allocator.TempJob etc
there's an implicit conversion built in to convert Allocator into AllocatorHandle
{
Index = (ushort)((uint)a & 0xFFFF),
Version = (ushort)((uint)a >> 16)
};```
so there is π€¦ i was trying to do it in an icky roundabout way with AllocatorManager.Allocate π
thanks!
I didn't even know they changed that 
So what should we use now? Is the "new" version just an extension or "better"? the ecs samples use World.Unmanaged for allocation. I mainly have TempJob and Persistent. Any need to change that?
yeah I'm confused why change that
will skinning in jobs + Graphics.DrawMesh be faster than skinned mesh?
or at least same speed
I'm looking for a faster combined mesh animation than skinned mesh or at least faster combining with jobs but updating SMR seems heavy
Hmmm. Is that supposed to stuck with loop?
protected override void OnCreate()
{
base.OnCreate();
LoadUIAsync().Forget();
_startedRunning = false;
}
private bool _startedRunning;
protected override void OnStartRunning() { _startedRunning = true; }
private async UniTaskVoid LoadUIAsync()
{
var tasks = new List<UniTask>();
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
foreach (var type in assembly.GetTypes().Where(x => typeof(UIBase).IsAssignableFrom(x)))
{
var ui = World.GetOrCreateSystem(type) as UIBase;
tasks.Add(ui.Load());
}
}
await UniTask.WhenAll(tasks);
await _startedRunning.WaitUntilTrue();
OnLoadUI();
}
Unity stopped on "Starting Running" stage
Hey, I'm trying to make entities appear in the editor, I have a gameobject with convert to entity in the scene, but it just disappears when I enter playmode. It's visible in the entity debugger at least.
I have the hybrid renderer installed, and I also have installed URP but haven't done anything with it - I don't know if it changes anything.
I'm on version 2020.3.34
Did anyone have a similar problem?
It's a fresh project, with all the packages installed, I have made this gameobject, put it in the scene and I'm trying to make it visible. I've looked on the forums but haven't found a working answer.
Alright, solved. I reimported the project with the URP template. Apparently URP had to be set up properly.
that's the point of conversion.
GameObject will be gone
yea but any entity did not appear become visible, as I expected
there was nothing
after properly setting up URP, they are visible, so I guess that was the issue
oh boy
### Changed
* Package Dependencies
* `com.unity.jobs` to version `0.51.0`
* `com.unity.platforms` to version `0.51.0`
* `com.unity.mathematics` to version `1.2.6`
* `com.unity.collections` to version `1.3.1`
* `com.unity.burst` to version `1.6.6`
* Increased the maximum number of shared components per entity from 8 to 16.
* Updated dependency on version of com.unity.roslyn package that will work with both Unity 2020 and Unity 2021.
### Fixed
* DOTS Entities throws a compilation error when using named arguments.
* Fix Create -> ECS -> System template now adds partial keyword.
* Fixed a possible memory stomp triggered by specific sequences of `ComponentDataFromEntity` or `BufferFromEntity` calls.
* EntityQuery.CopyFromComponentDataArray<T>() and EntityQuery.CopyFromComponentDataArrayAsync<T>() now correctly set the change version of any chunks they write to.
* If the value of the Parent component of an entity is changed while the previous parent entity was destroyed at the same time, an exception could be thrown during the next update of the transform system.
* Changes to ComponentData made outside of Systems will be properly detected by EntityQueries with changed version filters.
### Added
* New `BufferTypeHandle.Update()` method. Rather than creating new type handles every frame in `OnUpdate()`, it is more efficient to create the handle once in a system's `OnCreate()`, cache it as a member on the system, and call its `.Update()` method from `OnUpdate()` before using the handle.
* SystemBase.GetEntityQuery can now take an EntityQueryDescBuilder.```
not much but Unity 2021 and BufferTypeHandle.Update() is cool
in other words RIP Unity 2020.3 - you have been a long friend. now, good riddance!
decals and deffered light here i come
Shared component increase is my doing π©
Turns out you could hit the cap and hit 9 shared components from just all unity packages on a cube ghost in a subscene
But yay!
Finally fix my ui toolkit issues
haha, you crazy crazy man
nerds took a vacation for final fantasy. real nerds take one for new entities release
Anyone figured out about which Unity version he's talking? I don't think there are any. The improvements I know about are all in the core engine; we had to rewrite the core job queue implementation from scratch, since the old queue was fundamentally never going to cut the proverbial mustard. And, a rewrite like that is never going to get backported to an LTS, because risk.
I think either unreleased or 22.2+
cool, imo the job system is already pretty solid
that's the new world allocator
which can replace tempjob and is faster because most of the time it doesn't have to allocate
it also doesn't need to be disposed
and it doesn't suffer from the fixed update leak issue
ah, that's cool. have you done any testing vs. persistent?
i haven't really benchmarked it at all
the memory lives for 2 world updates
then is returned automatically
(there are 2 allocators that swap every frame)
they call it RewindAllocator
from top of my head
it's 64 separate pools of memory
that can grow and shrink if not used for a few frames
yeah, I've read about it but haven't figured out what to use it for
huh, guess i need to test this if I still need to hold on to persistent allocations
is unity 2021.3.4 from today?
not up to date with unity builds
I am getting constant validation failure
but from what i saw, main limiting feature of entities in 21 was the engine itself
so wouldn't surprise me
are you on 2021.3.4?
are you on mac? 2021.3.4 is marked lts now
mines installing atm
windows (gigachad)
i'm still on hub 2.4.5 π
oh im on hub 3.1.2
Where do you see this?