#archived-dots

1 messages Β· Page 52 of 1

weak delta
#

If I check indexes through a debug.log, the delay it adds is enough for the error not to happen

weak delta
#
System.IndexOutOfRangeException: Index {0} is out of range of '{1}' Length.
This Exception was thrown from a job compiled with Burst, which has limited exception support.
0x00007ffd010c4a13 (fb2c05e650545b2bd80ef220c2a61b9) _xmm
0x00007ffd010c495a (fb2c05e650545b2bd80ef220c2a61b9) _xmm
0x00007ffd010c4a79 (fb2c05e650545b2bd80ef220c2a61b9) _xmm
0x00007ffd010c44d1 (fb2c05e650545b2bd80ef220c2a61b9) _xmm
0x00007ffd010c4f09 (fb2c05e650545b2bd80ef220c2a61b9) _xmm
0x00007ffd010c4b75 (fb2c05e650545b2bd80ef220c2a61b9) _xmm
0x00007ffd010c4166 (fb2c05e650545b2bd80ef220c2a61b9) _real
#

THis error everytime is weirder

robust scaffold
weak delta
#

I do, but not on that

#

Could it be connected somehow?

#

well, i use [NativeDisableContainerSafetyRestriction]

#

But not on the same job

#

neither the same array

robust scaffold
#

No, it's only on the field that follows it. To be honest, without code, there is very little we can do to help.

#

Other than you going one by one through the code and checking if the indices line up. It's boring, tedious, but you'll need to do it anyways. Every first iteration of my own code for example is filled with this stuff so you might as well get good at it.

weak delta
#

This should be helpful I hope

#

But like, I don't get it. I have a readonly array that has 255 values. I then get a value and clamp it from 0 to 254. I then use that as the index of the array and get a value, that returns the error

robust scaffold
#

What is [SampledAnimationCurve.cs:57]

#

What's on that line.

weak delta
#

lowerValue.y = func[floorIndex.y];

robust scaffold
#

Does floorIndex.y ever go negative?

#

Check, comb through your code, add a debug.log($"{floorIndex.y}") right before it.

weak delta
#

int len = func.Length - 1;
float4 floatIndex = math.clamp(value,0f,1f)*len;
int4 floorIndex = (int4)math.floor(floatIndex);

robust scaffold
#

math.clamp(value,0f,1f) You can replace this with a math.saturate(value)

robust scaffold
weak delta
#

I'm following along

#

But the error still appears on that line mmm

robust scaffold
#

Did you add a debug.log?

#

Come on, debugging 101. If there's an error, slap debug.logs everywhere. Either that or use an actual debugger.

weak delta
#

I did add a debug, but there are so many values debuggin that unity doesn't like it XD

#

Okay, but managed to catch one

#

error with 83

#

But there are plenty of 83 and 92 without errors

robust scaffold
#

Try Debug.Log($"{floorIndex.y} vs {func.Length}");

rotund token
#

i really wish collections package logged an error

#

before throwing an exception

#

so we could read what the hell was going on

weak delta
#

Yeah, that would be nice

weak delta
robust scaffold
#

I dont know man, race conditions are pain. Are you on burst 1.8?

weak delta
#

Yup, 1.8.2

robust scaffold
#

Attach a managed debugger to unity. Enable break on exception and hopefully the debugger will be able to catch what is going on.

weak delta
#

I think I've found the issue

#

No idea how to fix it

#

But it seems that accessing the array 4 times in a row is not cool for burst

#

lowerValue.x = func[floorIndex.x];
lowerValue.y = func[floorIndex.y];
lowerValue.z = func[floorIndex.z];
lowerValue.w = func[floorIndex.w];
this is bad

#

lowerValue = func[floorIndex.x];
this is good

rotund token
#

shouldn't it be
lowerValue = func[floorIndex];

#

oh wait

#

func.Reinterpret<float4>()[floorIndex]

#

actually i guess your index would be wrong

#

you'd have to /4 or fix it above

weak delta
#

wym?

rotund token
#

i still find it unlikely this without some external influence this would cause issues

weak delta
rotund token
#

not unless you /4

weak delta
#

But floor index can be, 250, 200, 167, 252

rotund token
#

oh wait i'm reading what you're doing incorrectly

#

i thought you were taking 4 sequential values

#

but you aren't

weak delta
#

yeah, im not

rotund token
#

they are 4 random values

weak delta
#

yup

#

Normally, close to each other, but cant be certain of that

rotund token
#

how long is FunctionModifier

#

like max length?

weak delta
#

0 to 255

#

max length is 255

#

so 0 to 254 srry

#

So actually., If I close unity and reopen it and click play, the error doesn't appear

#

After a couple of play and stop it does

#

Does that give a hint to somethign?

#

The first play never returns errors

rotund token
#

you aren't recompiling between play are you?

weak delta
#

i am

#

I shouldn't?

rotund token
#

just wondering if burst is breaking

fallow trellis
#

anyone here who has experience with RaycastCommands and batchscheduling raycasts?

frosty siren
#

Can source gameobject be accessed from baking system?

rotund token
frosty siren
#

I wonder if baking world have any system which have map info GameObject -> baking Entity to get primary entity like Baker<T>.GetEntity()

misty wedge
#

Has there been any mention of future burst support for default interface implementations?

hushed lichen
#

This worked. Too noob to realise you don't need to store the buffer in a component but can do so via entity reference alone (GetBuffer<>).
Thanks again!

devout prairie
#

i take it the dev Q&A will be devs replying to the questions on the discord and forum, not a call that is streamed or something like that

edgy fulcrum
#

using IJE, how can I set a sharedcomponent filter? it's an unmanaged component too

misty wedge
#

Oh, a filter

edgy fulcrum
#

yeah I just want to filter πŸ™‚

misty wedge
#

You can't easily, you need to rebuild the auto generated query, and pass that to the IJE.Schedule method

#

It's pretty annoying atm

edgy fulcrum
#

using Entities.ForEach it was simple, but I'm trying to reap the benefits of codegen as much as possible

misty wedge
#

I hope they add an overload to IJE similar to the old Entities.ForEach().WithSharedFilter

edgy fulcrum
#

yeah thats what I was thinking, basically redo the query logic arg

misty wedge
#

I'm pretty sure they'll add an easier option sometime in the future though

edgy fulcrum
#

yeah agreed, I'm hoping the dev team realizes that a lot of people really like the direction IJE is going in

#

and try to make sure all of the old logic bits and pieces are fully usable in IJE in the future πŸ™‚

misty wedge
#

I think they like it too, it makes DOTS more approachable and is less boilerplate

edgy fulcrum
#

yup!

misty wedge
#

Especially with the new IJobEntityChunkBeginEnd interface

edgy fulcrum
#

thanks for the tip, I'll simply hack away at this and add a TODO to revisit it in a future release!

misty wedge
#

For some parts of my code I worked around it by just scheduling a single job that uses the chunk's shared component value to do the required logic, but that only works if all chunks require the same logic (based on the value of the shared component)

#

It seems you don't need [NativeDisableParallelForRestriction] anymore when writing to a NativeStream.Writer in parallel, I wonder when that was fixed. Very cool πŸ‘

robust scaffold
muted star
#

Hi everyone, is it somehow possible to unit test a unsafe burst method to check if it causes a memory leak?

gusty comet
#

do you guys think dots will someday become the default workflow

#

i tried it multiple times in the past but making anything slightly more complex was at least troublesome

rustic rain
pliant pike
#

yeah same I'm not going back to using monobehaviour unless I have to in places

robust scaffold
#

Remember everyone, DOTS Q&A is going on RIGHT NOW on the forums. Ask unity devs right now your pressing questions and get maybe some answers.

rustic rain
#

that is not relevant to game

vital sandal
#

whats the difference between NativeArray.Slice and NativeArray.GetSubArray ?

robust scaffold
vital sandal
#

ok ty

#

but there is no difference other than the type returned? allocation wise

robust scaffold
#

They're the same thing. Both are pointers with an additional length int that alias the same section of the array.

vital sandal
#

i see

#

ty

robust scaffold
#

Actually, let me check. GetSubArray may copy the section of data

robust scaffold
# vital sandal i see

Yea, they're the exact same thing, pointers with int length. I guess get subarray allows you to get a slice without using the collections package.

vital sandal
#

@robust scaffold But those subarray are read only, what if im trying to replace a range?

robust scaffold
#

They're direct pointers, you're free to write to it and it'll directly reference the range that you specified in the original array.

vital sandal
#

ok

#

ty

robust scaffold
#

Just be careful, I dont know about how the safety system works so if you're doing this in parallel, it might cause race conditions.

vital sandal
#

im trying to write myself a wrapper for flatteting 3D arrays to a single native array... for some reason I imagined I was going to replace entire subarrays in one go but thiking of it thats not going to happen, ill be writing one value at a time

#

i've been using a 2D array flattened to a nativearray for a while, (read and write) but I dont need to access values in parrallel so

#

i mean the "same" value in parallel

robust scaffold
#

You could using UnsafeUtility.MemCpyStride write "linearly" along a Y axis but it's very little performance benefit compared to just writing 1 by 1.

vital sandal
#

yes as long as your data is accessed in a linear manner without jumps between subbarray index ranges right?

#

sorry not used to using the AXIS idiom for arrays

robust scaffold
#

Yea, if you had a bunch of "Y" axis subarrays or slices, you can replicate a 2D array but you're basically just doing the classic i = x + y * width

vital sandal
#

yes

#

exactly

#

@robust scaffold is that slower?

robust scaffold
# vital sandal <@262065945936134144> is that slower?

Using slices? Depends. Just using direct pointer offsets have the benefit of burst vectorization with no memory overhead. Slices requires allocating memory for safety (in editor) and the length int. This is getting into micro-optimization territory though and fairly advanced C# and burst concepts.

vital sandal
#

yep, well im processing about 70k values each frame so I start seeing the effect

#

and that is just for one command in a job

robust scaffold
#

Yea, 70k is at the point where micro-optimizations become macro. Burst is a very deep rabbit hole and I am nowhere near qualified to teach people on it so all I can say is that try what you think is good, then go to the inspector and check if it vectorizes.

pliant plover
robust scaffold
vital sandal
#

@robust scaffold no worries, I'm not ready to go down that hole either

pliant plover
robust scaffold
vital sandal
#

I have to admit you two lost me. Can anyone recommend a good resource to help me get up to speed on pointers, unsafe stuff and vectorization?

#

and whatever sits in between i dont know about

#

im running out of "normal" optimisation opportunities

robust scaffold
vital sandal
#

I supose learning c++ would help

robust scaffold
#

I basically learned optimization from years of trial and error and seeing what is generally fastest. Even then, i still have to benchmark various methods.

#

That as well.

vital sandal
#

thanks!

hushed lichen
#

C or C++ is definitely a good way to learn pointers

covert lagoon
#

Does using IJobEntity instead of Entities.ForEach result in faster compilation times even when using Entities 0.51?

hushed lichen
#

Not sure if it's faster but it's the preferred method.
Entities.ForEach was, according to among others the guy behind the Jobs system, a mistake in hindsight.

frosty siren
covert lagoon
#

Ok thanks.

frosty siren
# robust scaffold What?
  1. We can inspect runtime / editor / etc worlds. Can I somehow inspect baking world?
  2. Is there a way inside baking system to get entity from gameobject like it was GameObjectConversionSystem.GetPrimaryEntity(GameObject) ?
robust scaffold
frosty siren
robust scaffold
#

The targeted GO being converted having a baking type that contains UnityObjectRef<GameObject> as a field and using the int within that struct as the InstanceID hash.

pliant plover
#

Then, when you are processing some entity, you can use the component value to get the corresponding gameobject. There's also public void GetEntitiesForAuthoringObject(UnityEngine.GameObject gameObject, NativeList<Entity> entities) in EntityManagerDebug.

vital sandal
#

@robust scaffold hey... sorry to interrupt, I just talked with someone about static methods, one thing led to another and he made me doubt what im doing with my flat array. What I mentioned earlier, is it still burst compatible? I though it wasnt a problem since im accessing my data one index after the other (as in 1,2,3 consecutive indexes, not 12, 46, 2992 ) but... yeah.

#

he made it sound like i was killing my performance somehow.

robust scaffold
pliant plover
pliant plover
warped fog
#

Dots dev blitz

All I care about is 2d support and it's just "provide feedback on the roadmap" bah

vital sandal
#

@pliant plover it's not really the static method that worries me, he said using a flattened array was not burst compatible... I wasnt sure how but..

robust scaffold
robust scaffold
hushed lichen
#

Flattened arrays should work just fine. Depending on the array's specific type, that is. Blittable types and all πŸ™‚

pliant plover
warped fog
#

Yeah, I know, I know. Just a shame that 2d ecs support isn't a priority

hushed lichen
#

I imagine a NativeArray is better performance but I've got a perfectly fine DynamicBuffer that works as a flattened array for a grid in a project right now.

pliant plover
#

Also, if something is not Burst compatible, I think Burst should give you an actual error message about it when you try to do it.

vital sandal
#

@pliant plover thank you for clarifying that

#

thats what I tought too but... he seemed sure haha

pliant plover
#

With anything performance related, I think the best advice is to always try profiling it and see what the numbers actually are. The Unity Profiler will also show you if it's actually running with Burst or not.

vital sandal
#

I use the profiler but I wasn't aware it could show you that info. Ill look into it

#

ty

pliant plover
#

I think by default it will show you Burst jobs in green, and non-Burst jobs in blue.

hushed lichen
#

Code that's burst compiled has that light green colour iirc

pliant plover
#

Burst jobs should also have (Burst) appended to their name in the Profiler.

true mirage
#

Is there any reason why math.up (job) for example creates (sets) fields every time?

// for compatibility? 
   /// <summary>
        /// Unity's up axis (0, 1, 0).
        /// </summary>
        /// <remarks>Matches [https://docs.unity3d.com/ScriptReference/Vector3-up.html](https://docs.unity3d.com/ScriptReference/Vector3-up.html)</remarks>
        /// <returns>The up axis.</returns>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float3 up() { return new float3(0.0f, 1.0f, 0.0f); }  // for compatibility
vital sandal
#

awesome

true mirage
#

and can I use NativeArray<NativeArray<>> ?? or I should use NativeMultiHash

hushed lichen
#

See here for Green burst compiled code in profiler πŸ™‚

vital sandal
#

@true mirage funny you mention that, im using a flattened nativearray exactly for that need.

pliant plover
pliant plover
true mirage
true mirage
#

It is a voxel game
Each chunk contains NativeArray<Voxel>

#

I guess NativeMultiHashMap is OK because there are not a lot of chunks

robust scaffold
vital sandal
#

@robust scaffold I can't wait

#

πŸ˜›

pliant plover
#

I think "unsafe" in the context of Unity Collections mostly means that there is no automatic race condition checking for jobs, and possibly less leak tracking. What you get in exchange is more options for memory allocation, and the ability to nest such containers within each other.

vital sandal
#

That's what I read too, nothing prevents you from "trying" to do two things at once with the same memory address, so you have to keep in mind how your code runs and will use it.

hushed lichen
frosty siren
pliant plover
rustic rain
#

Inability to debug baking is indeed frustrating

robust scaffold
#

The Data Oriented Technology Stack forum will be renamed to Entity Component System
@rotund token We've gone full circle finally. Back to Unity ECS. All we need now is [Inject] to complete the return.

coarse turtle
#

lool

pliant plover
robust scaffold
rustic rain
#

this is just one of them

#

can't wait for Unity to finally switch into .net CLR runtime

robust scaffold
# grizzled nexus and "hybrid" ECS

Hybrid is dead. They've purged it. The guy on the forums I'm trying to get a roadmap on hybrid moving forward on has suggested just using a pooled GO and int index on an entity to find the corresponding GO.

rustic rain
#

it's just faster

robust scaffold
rustic rain
#

Scene is static anyway

#

you can't have multiple scenes, thus whatever game objects you have can live as long

rustic rain
rotund token
#

Too much to read. Is there anything important I missed?

rustic rain
#

I wouldn't expect much important until new version at least

robust scaffold
rotund token
#

Yeah I saw that forum change

#

And was very confused by November update for a minute

robust scaffold
#

Ugh, they're now full categories instead of subcategories under ECS. Annoying.

rotund token
#

Yeah I'm much less likely to see new posts

gusty comet
#

I'm taking note of the above feedback! Will share it with the teams πŸ™

robust scaffold
#

Yea. I always went to the root DOTS category and then browsed the subcategories when I finished reading anything new.

rotund token
#

I haven't seen any particularly interesting questions let alone answers so far

robust scaffold
#

ha

rotund token
#

There's a lot of, I don't know how to do this questions

robust scaffold
#

Heh, I want some solid answers so I dont need to think about it.

#

I mean, the really pressing questions arent really questions. Like when will the baker stop crashing. When will a more automated baking workflow arrive? Soon to both. What happened to animation? (crickets) What if I wanted to make my own transform system? Edit the packages with your own components.

rotund token
#

Yeah my issue was more with the questions

#

I'm pretty sure I could have answered half of them

#

I do like just seeing activity though and a few unfamiliar faces interested in dots

robust scaffold
#

You could but I think it's valuable to have an official unity answer in a google-able format for future reference.

rotund token
#

yeah I refrained from answering anything

#

Not what people are looking for

robust scaffold
#

Exactly. Now I need to find some more random questions that I had banging around and was too lazy to source dive to figure out the answers to.

#

I got my most important question answered anyways by the rendering folks. A triple rotating compute buffer to ensure gpu reading and cpu writing do not overlap is disappointing but simple to implement.

rotund token
#

Hope we get another release by end of year but I'm not expecting it with Christmas

robust scaffold
#

They have netcode .21 on feature lock from what I can infer from various answers but unknown about the whole ecosystem as they all drop at once.

winter depot
#

Add <DepthSorted_Tag> to render entity and Z sorting works again..

viral sonnet
#

hm, any questions worth reading?

#

not hyped for how to do X questions.

safe lintel
#

ill be honest, i was expecting some master plan for the companion/hybrid questions like something is in the works but we cant talk about it yet, not yeah it they're quite awkward and rough to work with/no plans for companions

viral sonnet
#

yeah, the worst is animations...uhm...yeah 2023 or smth πŸ€·β€β™‚οΈ

#

my actual question would be simple, when does mega city stop crashing?

robust scaffold
robust scaffold
rotund token
#

yeah about the timeline i expected

#

i just want stability fixes sooner 😦

robust scaffold
#

Tertle, gib code now. I am waiting for lib 1.0 now.

#

i want a lib that reads my mind and tells me what i want.

rotund token
viral sonnet
#

was gonna say, try some ChatGPT πŸ˜„

safe lintel
#

the make art button arrived a while ago, bout time a make code button also exists πŸ˜€

coarse turtle
#

its been pretty fun trying out chatgpt3 to write something in c and then redo it in asm lol

true mirage
#

Sorry, a question, why do I need generic types instead of interface arguments?
avoid boxing? interface method call

rotund token
#

interfaces are managed

#

you can't have manged objects in burst

#

so yes this avoids boxing and having managed objects

true mirage
robust scaffold
#

Rainbow bracket plugin went paid on jetbrains. Wild.

#

Alright, let me just find a clone that's free.

viral sonnet
#

what you don't want a monthly sub for some colored brackets? WILD!

#

subs are really the bane of software. hate it

robust scaffold
#

Same, Im gonna enjoy codeglance while it's still free but if it goes paid, well i dont really need it.

viral sonnet
#

you need to be a special kind of clown to want a sub for something that doesn't need maintenance

winter depot
#

Is there a reason we can't add buffer to systemhandle? Its just referencing its m_Entity on AddComponent. I assume structural change invalidation would be too common?

robust scaffold
#

Then use GetBuffer<BufType>(sys)

winter depot
#

Mmm so its just syntax they haven't updateD?

robust scaffold
#

Nah, it's just annoying.

winter depot
robust scaffold
winter depot
#

I see, hmm maybe not worth doing then. Would have felt clean

viral sonnet
#

i sadly forgot (maybe it's been fixed) system entities do count as singletons. either SystemAPI.GetSingleton or the normal GetSingleton works

#

just one of them doesn't include the systemEntities in query

winter depot
#

Seems like SystemAPI does

viral sonnet
#

yes, just checked

#

it failed for me with RequiresSingletonForUpdate - that one was missing it

#

probably others too, so make sure to test first

winter depot
#

Yeah, same. No ability to disable filter for that?

#

Would be nice to have a RequireForUpdate<>().IgnoreFilter

robust scaffold
#

What they need is RequireForUpdate<>().WithOptions()

devout prairie
#

Main things i was interested in:
Q - Physics - are there updates coming, can you share a roadmap of what's planned for it?
A - No
Q - Animation - can you give us some info on what/when/anything?
A - No

true mirage
#

We should not define unity Native structs as readonly fields, right? because of copy every time when its method is invoked

robust scaffold
true mirage
#

So, I cannot mark my struct as readonly struct as well

robust scaffold
#

You can also enforce readonly using { get; private set; }

true mirage
#
public (readonly) struct CustomStruct
{
   private (readonly) NativeArray<> array;
   public void Method(){
        // call array method
   }
}
robust scaffold
#

seems to work (ignore the comment, i just stuck this in a random component)

true mirage
#

I think I should not use readonly fields in struct and instead apply getter

#

Bad habit to define readonly as much as possible

robust scaffold
# true mirage

NativeX are basically pointers and a bunch of accessing methods. When a struct is copied (that warning), it only copies a ulong which is the pointer. You're fine.

#

NativeStream might be more copied as that's a bit different but you're fine.

true mirage
robust scaffold
true mirage
#

OK, remove both readonly and getters (props) for struct fields in jobs

#

πŸ˜…

true mirage
#

I should remove unmanaged constraint because in my structs, there are some fields like NativeHashSet<int3>
int3 is not unmanaged type

#
public void Method<T1>(T1 t) where T1: unmanaged
{
}
#
type '' must be valid unmanaged type (simple numeric, 'bool', 'char', 'void', enumeration type or struct type with all fields of unmanaged types at any level of nesting) in order to use it as a type argument for 'TW' parameter
feral mural
#

Ecs 1.0 pre-15 , what happened to LocalToWorldTransform? My ecs code base got wrecked with that missing

vivid rune
#

Where is the ECS Webgl sample mentioned on pre-release notes

robust scaffold
feral mural
weak delta
robust scaffold
#

By not using unity's transform components, I have nearly tripled chunk capacity:

#

I looked at GO pooling for a manual companion GO implementation and I just gave up. Might as well make my own sprite renderer. So i revived my old circle and square renderer.

viral sonnet
#

did you have trouble with the pooling itself or with the subsequent performance?

robust scaffold
#

And then managing the transforms. Might as well go the extra step of setting up a custom rendering call.

viral sonnet
#

roundabout? that's how i spawn my GOs ```Entities
.WithoutBurst()
.WithStructuralChanges()
.ForEach((Entity entity, in HybridMainEntity hybridMainEntity, in HybridSpawnPrefab hybridEntity) =>
{
commandBuffer.DestroyEntity(entity);
var go = _poolSystem.Get(hybridEntity.prefab, out bool freshInstance); // use pooling system

            transformMapping.AddTransform(go.transform, hybridMainEntity.entity);

            var animator = go.GetComponentInChildren<Animator>();
            if (animator != null)
                EntityManager.AddComponentObject(hybridMainEntity.entity, animator);
        }).Run();``` i have a pretty straight forward pooling systemBase
#

and the transformMapping deals with the syncing of position/transform

covert lagoon
#

What kind of script directory hierarchy do you use for your ECS games? For example:

  • /{Components,Systems}
  • /{Characters,Terrain,...}/{Components,Systems}
  • /{Characters,Terrain,...}/{Authoring,Components,Systems}
  • /{Characters,Terrain,...}/{Authoring,Components,Systems}[/{Client,Server}]
rotund token
covert lagoon
#

Damn.

#

At what point is it worth it to separate your code into assemblies?

rotund token
#

i start it separated

#

i simply wrote a little tool to auto create assemblies for me

#

and link them, setup dependencies etc

#

so it's absolutely no effort for me to create assemblies

whole gyro
#
  • Multiple aspects in a query can have overlapping components
  • SystemAPI.QueryBuilder.WithAspect<>()
  • IAspect.Lookup inside IJobEntity
  • IAspect.Lookup.HasAspect(Entity)
  • IAspect.Lookup.TryGetAspect(Entity)
    😁
robust scaffold
#

Ya know, aspect as query parameter makes so much sense, why have I not thought of it myself?

#

It's gonna be in a few months though so we'll have to make due adding all of those types manually

robust scaffold
#

I'm wondering, why should I calculate indexOfFirstEntityInQuery if I can just use an interlocked add?

rotund token
robust scaffold
# rotund token not sure how they're even related ^_^'

I'm trying to copy all entities into one linear native array. I could use the calculated index from the scheduled job or I could just interlocked add the chunk's count to a single shared int to reserve a section of the array for this chunk's entities. Since the order of writing doesnt matter.

#

Question is, would it be faster and could I use a private field inside the job instead of a nativeArray<int> with size 1...

rotund token
#

isn't that just what entityquery.ToNativeListAsync is for?

robust scaffold
#

Yea but I would like to do multiple components at once. So a custom job.

rotund token
#

ToComponentDataListAsync ^_^'

robust scaffold
rotund token
#

im not sure what you mean by that

#

it memcpys each chunk

#
            {
                v128 maskCopy = chunkEnabledMask;
                int rangeStart = 0;
                int rangeEnd = 0;
                while (EnabledBitUtility.GetNextRange(ref maskCopy, ref rangeStart, ref rangeEnd))
                {
                    int rangeCount = rangeEnd - rangeStart;
                    UnsafeUtility.MemCpy(dstBytes, srcBytes + rangeStart * typeSize, rangeCount * typeSize);
                    dstBytes += rangeCount * typeSize;
                }
            }
            else
            {
                UnsafeUtility.MemCpy(dstBytes, srcBytes, chunk.Count * typeSize);
            }```
straight memcpy if no filter
robust scaffold
#

It only produces the data for a single component type. I need 3. Yes, i can schedule 3 of these in parallel but 1 is faster.

#

And not that much work, I'm just caught up on the idea that I could use an interlocked add instead of requiring the precomputing of chunk entity offsets.

rotund token
#

i dont think you need the offsets?

#

or are you doing each chunk in parallel not each component?

#

because i'm not sure combining this will be faster than just doing 1 component per thread

robust scaffold
#

Which is why the interlocked would work. If each job before copying interlocked added a single int the amount of entities within the chunk, it can "reserve" a section of the array for it to copy into.

robust scaffold
#

It some micro optimization but it reduces the need for scheduling one small job.

#

Something like this

rotund token
#

you know, you've just replicated NativeList.AddRangeNoResize

#

i guess you're saving 2 interlocks though

#

since it woudl have to do it once per list

#

i take it order of entities doesn't matter for you?

robust scaffold
robust scaffold
rotund token
#

yes

#
            {
                CheckArgPositive(count);

#if ENABLE_UNITY_COLLECTIONS_CHECKS
                AtomicSafetyHandle.CheckWriteAndThrow(m_Safety);
#endif
                var idx = Interlocked.Add(ref ListData->m_length, count) - count;
                CheckSufficientCapacity(ListData->Capacity, idx + count);

                var sizeOf = sizeof(T);
                void* dst = (byte*)ListData->Ptr + idx * sizeOf;
                UnsafeUtility.MemCpy(dst, ptr, count * sizeOf);
            }```
#

on ParallelWriter

robust scaffold
#

Ah. Yep. Microoptimized....

#

2 interlocks, next the world.

safe lintel
#

are baking systems run after all bakers, or is it just random?

#

docs arent really clear on this

rotund token
#

after all

#

well

#

you can run before

#

^

#

that was like first 1.0 version but i don't think it's changed much

safe lintel
#

do the docs show that overview somewhere or is that from gleaning package code?

rotund token
#

i just looked at the code

#

its literally just
SystemGroup.Update
BakingSystem.Update
SystemGroup.Update
SystemGroup.Update
SystemGroup.Update
etc

safe lintel
#

ho hum didnt get an answer to my physics authoring components question πŸ₯²

rotund token
#

rip

#

whichh one

sick nexus
#

they said they'll answer more questions in the coming days, so if your question isn't answered yet, it may still be later

gusty comet
#

Is GPU Instancing possible with Entities? The default behavior with it enabled doesn't seem to be doing any batching at all.

rustic rain
#

you don't need to implement any instancing unless you want to draw smth super custom

gusty comet
#

Is this metric wrong then?

rotund token
#

not wrong

#

but it just does something different these days

#

that isn't measured by this

true mirage
#

There is a class VoxelWorld to manipulate some data (voxels) and create chunk mesh, etc. There are a bunch of methods inside, GetVoxel(), AddVoxel(), RemoveVoxel(), etc. and some query methods.
Inside path finding procedure (it is a job), I use some methods of VoxelWorld.
How can I handle it?
Implement a struct with voxel native array data inside and methods to manipulate it, then use it inside VoxelWorld class and in path finding job?

public class VoxelWorld{    // it is used in many classes,.. 
   public VoxelWorldData WorldData;
   //...
}
public strut VoxelWorldData{
   private NativeArray<Voxel> voxels;
   //...
}
public struct PathFinding{  //job
   public VoxelWorldData WorldData;
}
rotund token
#

my approach is basically firstly make voxelworld a struct/unmanaged and then store it on a singleton component that can be read from anywhere

true mirage
#

It is a big work:/

#
  public class VoxelWorld
    {
        //public VoxelWorldData WorldData;
        public List<ChunkObject> ChunkObjects { get; private set; }
        public FirstDownwardBlockedVoxel[,,] FirstDownwardBlockedVoxels { get; }

        private readonly WorldSetting _worldSetting;
        private readonly IElementRepository _elementRepository;
        private readonly RoadSystem _roadSystem;
        private readonly int _chunkSize;
rotund token
#

well yeah but this is a basically a requirement of using dots/ecs

true mirage
#

ChunkObjects --> List of chunks (mono/ gameobjects)
IElementRepository --> A respository to query voxel stats data (scriptable objects)
RoadSystem --> It is a class to update/add roads or check if a voxel is road
WorldSetting --> it is a SO

rotund token
#

i usually recommend against people porting existing games to entities

#

you can optimize critical code paths with jobs/burst

true mirage
rotund token
#

but porting an existing game causes a lot of issues

#

and from experience, would take less time to write it from scratch if it was a sufficient enough project

frosty siren
#

Have bakers BlobAssetStore or equivalent?

#

Oh, ok, I see that AddBlobAsset automatically resolve duplicates

warm panther
#

ECS Baking Question: Hey, I have a problem - I don't understand when a GameObject's scale becomes a NonUniformScale during Subscene Baking, and whether that is my bug or someone else's bug. The problem already occasionally occurred before with some sort of quaternion normalization error, but now it is 100% reproducible and visible due to a bug in the new Entities that causes a baking error. πŸ™‚

The first image is a GameObject (which is a connected Prefab Variant Instance) to be baked, it has a PhysicsBody and a PhysicsShape with a Mesh to build a convex hull for. It has 1 child object with a simple meshrenderer and meshfilter for Quad.mesh, at local origin, and local scale 1. It bakes fine.

The second image is that same GameObject rotated any value around Y, and this will have a ** baking error** (but the error isn't the problem, just an indication, the problem is that actually the scale is treated as nonuniform or something?)

Question: Why does the 2nd Image result in PhysicsBaker adding a PropagateLocalToWorld and non-uniform scale to the Entity?
(this triggers the physics baking bug mentioned in the release notes for Entities 1.0.0-pre.15, but the problem is, my objects technically are all uniformly scaled, [1,1,1])

I'm trying to find out what causes this wrong "classification".

#

More amazingly, THIS is OKAY and does not trigger the bug or scale being treated as non-uniform, only rotations of more than 20Β° ... lolwut? (90 is also not fine, 180 is fine, ... so weird)

#

For X, the threshold is at + or -5Β°.

true mirage
#

We can send ref data (or array) to struct ctor in job and then create native array based on it inside or get struct field of that instance (ref type), right?
or it is better to make it outside and then pass them to job ctor

frosty siren
#

bakers can't work with derived classes? like when I have derived class and baker for base class, then derived instance won't be baked

rustic rain
#

hold on

#

are you talking about 0.51 or 1.0?

frosty siren
rustic rain
#

then it's probably type specific

#

in 1.0 they don't favor OOP at all

#

in baking

#

so no inheritance πŸ˜…

frosty siren
#

see no reason to do so, cause authoring lives completely in oop world

frosty siren
rustic rain
#

because Unity doesn't want us

#

kek

frosty siren
#

lol why

rustic rain
#

idk, sir

#

I liked previous conversion more too

frosty siren
#

I mean ok, when dealing with baking/editor/runtime/build lets go DOD

#

bit what the deal with authoring monobehaviours

#

they are oop, why strip theirs functionality if we use them to authoring data

rustic rain
#

monob is not oop for baking though

#

you have literally no functionality for it

#

aside from data holding

frosty siren
# rustic rain I liked previous conversion more too

hmm, I actually like how they make this baking conversion, because this time we have baking world and can query pre-result entities instead of some wierd authoring entities with components attached as managed IComponentData. Also now authorings can depends on each other, because they stay alive during/after conversion happened

frosty siren
rustic rain
#

but as we know, it only makes things worse

#

πŸ˜…

frosty siren
#

yeah, but what If i want to make calculations depending on transform hierarchy or some other unity built-in component functionality?

rustic rain
#

you cry

#

πŸ₯²

frosty siren
#

yes I am 😒

rustic rain
#

I guess

#

the indended approach

#

is you write your own baker for built in component

#

do whatever you want with it

#

and then let baking system finish job

viral sonnet
#

i could make a generic baker work

frosty siren
viral sonnet
#
        where TAuthoringType : ScriptableObjectConverterBase 
        where TSOClass : ScriptableObject, IConvertToBlob<TBlobStruct>
        where TBlobStruct : unmanaged
        where TBlobReference : unmanaged, IComponentData, IBlobAssetReference<TBlobStruct>
    {
        public override void Bake(TAuthoringType converter)```
#

TAuthoringType is the important part that needs to be defined in the overriden baker and in the base abstract class

#
{
    //[HideInInspector]
    public List<string> scriptableObjects;

    public bool autoLoad = false;
    public string scriptableObjectType;

    public void GatherScriptableObjects()
    {
        scriptableObjects = new List<string>();
        
        if (string.IsNullOrEmpty(scriptableObjectType) || !autoLoad)
            return;

        var guids = AssetDatabase.FindAssets("t: " + scriptableObjectType);

        foreach (var guid in guids)
        {
            scriptableObjects.Add(guid);
        }
    }
}``` probably not relevant to you. i think you can just use a monobehaviour as contraint
#

then you only need to implement the classes/structs you want public class ResourceItemConverter : ScriptableObjectConverterBase { } public class ResourceItemConversionSystem : ScriptableObjectConverter_Baker<ResourceItemConverter, SO_ResourceItem, ResourceItemBlobAsset, ResourceItemBlobReference> { }

blissful bobcat
#

Can someone enlight me about unity 2022.2.0f1? Ive it installed on windows and plastic scm seems fine there, but the same version of the engine has not shown the option to open plastic scm on unity 2022.2.0f1 on Ubuntu. (My personal pc has windows but at the lab i gotta use Ubuntu)> Someone said me its now a package. Could someone give direction to what should i do on Ubuntu to run Plastic SCM?

frosty siren
true mirage
#

Can't I use struct with serialize field inside in jobs?

#

I want to use it in jobs and also as serialized data in another situation
or wrap that struct type to a serializable class type

#

OK, structs cannot be serialized

covert lagoon
#

I installed the Entities 1.0 package on Unity 2022.2.0f1, got a pop-up saying that the Burst version used by my project changed and that I had to restart the Editor to continue, so after it was done installing the package and its dependencies I tried to close the Editor and it crashed in burst_signal_handler. Is this "normal"?

#

The bug reporter always wants me to upload my entire project directory but I have 2 Mbit/s upload.

#

I don't know if I'm supposed to remove it and only upload the Assets, Packages and ProjectSettings subdirectories.

safe lintel
#

do you keep crashing with more restarts?

viral sonnet
viral sonnet
covert lagoon
true mirage
#

Is it a good strategy to use math type data(int3, float3) every where unless I have to use Vector3 and Vector3Int, etc. For example to serialize them or in the inspector
Because if I mix these types, I have to convert them in many classes back and forth

covert lagoon
#

Rival has been updated to the 1.0 pre-release?

robust scaffold
covert lagoon
#

I'm pretty sure I looked at the asset store page yesterday and it said Unity 2021.

#

Well that's really nice.

covert lagoon
#

Woah.

#

The asset store page says it was updated today.

#

I was about to try to update it myself lol, these are really good news.

true mirage
#

For readonly fields in a struct (job), do you define [ReadOnly] as well as readonly keyword for it? or [ReadOnly] attribute is enough to boost performance?

#

and suppose some fields can change, is it better to create it (copy data) again using ctor? so they can be all ReadOnly or not

viral sonnet
#

heh, not even an update in the rival discord

#

tag is enough

covert lagoon
#

Not cool.

#

I don't know why it prints "port {}."

robust scaffold
covert lagoon
#

Updated OnlineFPS sample.

robust scaffold
#

Found it.

#

Interesting, probably a better sample than the netcode guys...

covert lagoon
#

Works better now.

#

Rare error.

#

I tried to add a thin client while playing and this happened.

#

The server didn't close its listen port properly. I can't play again now.

#

Thin clients are broken even after restarting Unity and setting the number of thin clients to 1 before entering play mode.

covert lagoon
#

After restarting Unity, this time I don't get this error after exiting then re-entering play mode.

viral sonnet
#

yeah his fps sample is pretty dope

stone osprey
#

How does chunks/archetypes behave for huge entities ?

I heard that they increase the internal capacity ? Is this true ?

#

If so... When exactly ? And to how many kb ?

viral sonnet
#

a chunk is always 16k

#

the archetype size defines how many entities can go into such a chunk

#

if you'd have a 16k archetype you can get 1 entity into 1 chunk. anything above will probably error out

stone osprey
viral sonnet
#

no, size doesn't increase. it's a constant in code defining how much bytes are allocated

#

the constant can be changed

#

where did you read that chunks can be increased to 32k with bigger archetypes? pretty certain it wasn't in this discord or the forum

signal phoenix
covert lagoon
#

Thanks.

robust scaffold
#

Does calculate entity count cause a dependency.complete call?

robust scaffold
#

Ugh, systembase calls complete at start of update anyways.

robust scaffold
#

TIL: Do not put ref fields inside of an aspect. It will crash unity

rustic rain
#

Ref fields?

viral sonnet
winter depot
#

Does anyone use LocalTransform rotation, and is it working for you?

#

Position and Scale seem to work fine, but Rotation not so much

viral sonnet
#

the rotation in LocalTransform works fine for me

weak delta
#

Hello, I'm once back again here trying to understand a bug that I've been having for the past week

#

Race conditions are only possible when you write to data, right?

#

And so, if a field has the [ReadOnly] attribute it shouldn't be even possible for that to happen, right?

winter depot
hazy acorn
weak delta
#

I'm 100% is not happening

#

Sure,

#

This is the error

#

And here is all the code

weak delta
#

Apart from that, if you search for my previous comments you will find previous tries of other people to try to fix it with me

robust scaffold
robust scaffold
hazy acorn
# robust scaffold

This only means it's completing its own dependencies from last frame. (Like the comment explains)

hazy acorn
#

The values that you're interested in are:
length, minIndex & maxIndex

#

They determine whether your index is in range.
Burst supports logging, so right before you get the exception in burst your logs should explain why. (also log the index you're using)

#

If it's a really nasty race condition your logs could miss it, but let's pray not πŸ™

robust scaffold
viral sonnet
# robust scaffold

ah i see but it's just the handle from the previous update. should be okay, right?

robust scaffold
hazy acorn
gusty comet
#

Is it possible to opt out of the SRP batcher with entities? Disabling it in the URP settings just stops rendering the entities altogether.

gusty comet
#

Thanks, couldn't find anything indicating that in the docs for the life of me

#

Follow-up: Is there anything to be done as far as optimizing out draw calls with SRP on the user side, or am I pretty much at the mercy of the blackbox

robust scaffold
gusty comet
#

Yeah I'm just running into CPU bottleneck earlier than I'd have hoped, even with a single mesh in the pipeline. Was hoping there might be some extra tricks.

robust scaffold
#

CPU? Unless you're rendering a 10,000 vertex mesh and deforming it every frame, you shouldnt be having a problem. Entity rendering does have a significant overhead though.

gusty comet
#

Standard capsule, just a ton of instances.

#

I'm still getting around 110fps with 10k instances on pretty old hardware, so it's leaps and bounds better than gameobjects. Just wanna make sure I'm pushing the new pipeline as much as it can be

robust scaffold
#

Oh, that'll do it.

#

The renderer right now does not have a really robust LOD and LOS culling mechanism so that might also be a problem.

gusty comet
#

Yeah that's with zero culling. I'm sure there's things I can do to thin out what's actually being sent to the renderer. I'm just limit testing to see how feasible the concept I have in mind is, because it relies on thousands of entities.

robust scaffold
#

If you have a lot of identical meshes, you might be able to optimize for your use case by constructing a custom renderer. Not too difficult but that's if you know exactly what to optimize for. I got a custom light renderer for purely circular lights and up to 8192 visible at once. Far more performant than the built in URP 2d lighting but far less customization.

gusty comet
#

I looked into Graphics.RenderMeshInstanced but haven't experimented with it yet. I'm worried about how z depth sorting would work with it.

robust scaffold
quick gazelle
#

Sure

robust scaffold
#

I hate baking systems

whole gyro
#

is it possible to create additional entities in a baking system (not baker)?

robust scaffold
whole gyro
#

ugh

#

thanks for the quick reply! @robust scaffold

hazy acorn
# whole gyro is it possible to create additional entities in a baking system (not baker)?

I struggled with this too. But it's possible without hacks.
The trick is to add the correct SceneSection shared component to the entity otherwise it won't get picked up.
You can leave the SectionIndex to 0, but the GUID needs to be correct.
You can use the GetSceneGUID() inside a Baker<T> and somehow feed it it through on an entity to the BakingSystem.
Or you could grab the SceneSection from a random other entity during the bake (haven't confirmed this approach).

gusty comet
#

what editor version do I need to get com.unity.entities@1.0.0-exp.12 (latest) to work without throwing errors immediately upon install?

hazy acorn
gusty comet
#

I must be missing something

hazy acorn
# gusty comet i.e.

Not sure why it's compiling the tests from the entities package, mmh.
Is it a brand new project or are you upgrading an older one?

I can reproduce it if I add the package as a testable to my project, did you maybe do that by accident?
You can check your manifest to see if it's in the testables.

safe lintel
gusty comet
hazy acorn
# gusty comet upgrading, I'll try with a new project I guess

anyhow, you'll need to figure out why the tests are included from the entities packages.
This can have multiple reasons (You added the package as a 'testable' in the manifest or you copied the package directly into your project or something else)

gusty comet
#

@hazy acorn yep, testables in my manifest, leftover from probably 3 years ago when I put it there (copy pasting from whatever example project of the time)

frosty fern
#

dots DOTS support large world coordinates?

balmy thistle
#

Not in 1.0, but it's on the roadmap

robust scaffold
#

I mean, technically yes. If you're willing to code everything for it.

#

I'm making my own transform system and wow, its surprisingly hard.

balmy thistle
robust scaffold
# balmy thistle Can you share what challenges you've run into?

Mainly it's just design phase overthinking. Transform components are the bedrock of the entire entity world so any changes to their structure changes everything in the project. So nailing down a specific format from the start is key to not wasting hours of time. Especially since I use pointers very liberally and make hard-coded assumptions about field offsets which bites me in the ass later when I change a field and then unity crashes from a segfault.

So the main debate I had with myself is whether to use unity's new TransformV2 format where all the transform elements are gathered in 1 component or use the V1 format of individual components per concept. I initially designed my 2D transform component along the lines of TransformV2 as having one singular component was extremely convenient for rendering (I declined to create a LocalToWorld component so every matrix is being re-generated every frame from raw transforms).

However, as I continued fleshing out other parts of my project and particularly in regions of high performance requirement (e.g. within the predicted simulation loop of netcode), I found myself having to constantly "extract" specific elements of the combined transform component for vectorization. Basically for extremely optimized code sections, I've been using mem-cpy-stride liberally to create SoA stack allocated buffers that are then multiplied component-wise manually to maximize Burst vectorization and unrolling potential.

Furthermore, I've structured my jobs to use one element of transform at a time, position only in this job, then rotation, maybe scale. By shoving in a giant 2DLocalTransform component and only using 2/4 of the floats in it at most wastes valuable cache space. Regular LocalTransform is even worse in that aspect with 2D gameplay, 2 floats out of 8 is wasteful.

robust scaffold
# balmy thistle Can you share what challenges you've run into?

And frankly, for rendering, a transform aspect has completely filled the niche that a combined LocalTransform component filled. I stick my L2W matrix generation as a method in the aspect and pull that every frame for uploading to the GPU. Works very well.

robust scaffold
robust scaffold
# balmy thistle Can you share what challenges you've run into?

And this is the function that generates the spatial hash given the position vector of each 2D physics body. I opted for a more simplistic spatial hashing compared to my old BVH tree due to the speed of rebuilding provided by a parallel hash generation. My old BVH while extremely effective for broadphase collision detection and raycast solutions was singlethreaded and expensive to regenerate. Which is a major problem in netcode where for a predicted physics world the physics step must be replayed multiple times proportional to the roundtrip ping experienced by the client.

robust scaffold
# balmy thistle Can you share what challenges you've run into?

TL;DR: I spent a few hours today converting my custom transform components from a V2 conglomerated component to V1 divided triple component setup as I found myself using only specific parts of transforms per job. A transform aspect filled the niche of V2 in generating local to world rendering matrices easily.

#

And I'm currently wondering if I should go the final step and just have a PositionX float component and PositionY component...

robust scaffold
#

My god, coding my own entity viewer UI was one of the best decisions I've made so far. I'm checking an entity and wished that the archetype it was a part of was highlighted when the entity was clicked and not just when I clicked the chunk header. Then I realized I coded it myself and I can do that.

#

Although now that i have ComponentX and ComponentY variants, I'm getting the urge to re-code the entirety of entity inspector to allow for a hybrid Aspect-Component view...

#

As I make everything XY variants, I realize this pretty much is only possible for 1D (?) and 2D worlds. More dimensions would balloon the required types even more.

#

QueryBuilder's restriction of 2 types per RW addition however aligns perfectly with a fragmented XY vector component. I think this singlehandedly justifies my decision.

rustic rain
#

Oh wait

#

Property

#

I see

robust scaffold
robust scaffold
robust scaffold
strong horizon
#

!Bug

past palmBOT
#

If you have a Unity bug you would like to report, follow these guidelines! https://unity3d.com/unity/qa/bug-reporting

Unity

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 players.

robust scaffold
# strong horizon !Bug

The problem is I dont have a reproducable. I reported the more frequent one that occurred in exp.8 which thankfully got fixed.

strong horizon
robust scaffold
weak delta
#

We tried that yesterday I think, i don't have good connection right now, but if you search for my nametag you will see some messages and images of the different logs

#

And it happens randomly too, more often after the first play mode. (first one is alright, second and so on have the bug)

#

Disabling burst makes the error disappear also

#

Oh, i see you don't mean the same values to check, okay, will debug those and see what i get

true mirage
#

How do you avoid copying data when passing struct types contained NativeArray and some value type fields in methods?
Can I use ref?

true mirage
rustic rain
true mirage
#

At least, NativeArray copy is cheap but inside my structs, there are some int3 as well (4,5)

#

and is NativeArray/NativeList faster than List and standard Array even if they are not used in jobs?

true mirage
rustic rain
#

yes

#

πŸ˜…

true mirage
#

For example, in a private method, I create a List and add some data then return it.
Is it better to convert it to NativeList even if it is not used in jobs?

private List<> Method(){
   List<> list= new List<>();
   for(){
       //...
   }
   return list;
}
#

B depends on A.
A is a struct type used in job but B is a normal class.
This Private Method is in B.

rustic rain
#

generally if it's game logic, you'd want to avoid GC allocations

true mirage
#

Is it a good approach to use math type data(int3, float3) every where unless I have to use Vector3 and Vector3Int, etc. For example to serialize them or in the inspector, raycast hit, etc.
Because if I mix these types, I have to convert them in many classes back and forth

frosty siren
wet crag
#

Heyoo,
I just started with dots but I already ran into a issue that I can't find on the forum and multiple tutorials don't seem to have. My ecs transforms and aspect are getting their positions changed but the GameObject itself is not moving. Does anyone know what the problem could be?

true mirage
#

There is a definition list (scriptable objects and POCO class types). I use them (query) in job routines.
Should I convert them to a native hash type for example and use it in jobs?
Because it is used in different job procedures, it is suitable to define it as Singleton component?

wet crag
#

But nothing from the entity menu seems to actually move it visually.

covert lagoon
#

Are you sure that your system moves it then?

wet crag
#

Well the transform components in the inspectors are changing

covert lagoon
#

Did the previous transform values you saw in the inspector match what your system did?

wet crag
#

Yep

covert lagoon
#

πŸ€”

wet crag
#

Thats why i'm confused.

covert lagoon
wet crag
#

And it also has all the correct entity system rendering components so that shouldnt be the problem either

covert lagoon
#

I thought you could move it from the inspector.

wet crag
#

Oooh no i literally just have a very simple moving to the right thing from the code monkey dots 1.0 in 60 minutes.

#

And i wouldnt be so confused if it wouldnt actually change the entity transform components

true mirage
#

Thanks, you helped a lot, remove a lot of confusion and doubt

covert lagoon
#

Have you tried using .WorldPosition instead?

wet crag
#

Yep tried that as well. Also tried translateworld. Remaking an entirely new project atm to see if its something corrupted in the project.

wet crag
#

@covert lagoon Remade the project. With the exact same scripts drag and dropped in. And it works. :)

#

:')

covert lagoon
#

😐

robust scaffold
solemn hollow
#

need quick primer : how do i replace translationLookUp = systemBase.GetComponentLookup<Translation>();
with the transform aspect?

viral sonnet
#

use the TypeHandle of the Aspect (it gets codegened)

#

or Lookup

solemn hollow
#

i cant use codegen here. need to write a jobchunk

viral sonnet
#

some useful methods are missing from lookup. tertle complained about it πŸ™‚

#

the codegen of the aspect

solemn hollow
#

ah

#

sry i am not getting it yet
translationLookUp = systemBase.GetComponentLookup<TransformAspect>(); complains that it needs an ICompData

#

and there is no GetAspectTypeHandle is there?

#

SystemAPI.GetAspectRO<TransformAspect>();
and this needs an entity as param?

robust scaffold
viral sonnet
#

you were faster πŸ™‚ just loaded up my project. yes, just new it. that's the codegen from the lookup ```public struct Lookup
{
bool _IsReadOnly
{
get { return __IsReadOnly == 1; }
set { __IsReadOnly = value ? (byte) 1 : (byte) 0; }
}
private byte __IsReadOnly;

        global::Unity.Transforms.TransformAspect.Lookup Transform;
        public Lookup(ref global::Unity.Entities.SystemState state, bool isReadOnly)
        {
            __IsReadOnly = isReadOnly ? (byte) 1u : (byte) 0u;


            this.Transform = new global::Unity.Transforms.TransformAspect.Lookup(ref state, isReadOnly);
        }
        public void Update(ref global::Unity.Entities.SystemState state)
        {

            this.Transform.Update(ref state);
        }
        public SpellCasterAspect this[global::Unity.Entities.Entity entity]
        {
            get
            {
                return new SpellCasterAspect(this.Transform[entity]);
            }
        }
    }```
#

it's just a wrapper really

#

does SystemAPI support it though or do we have to call Update ourselves. i don't know

#

(not using aspects) πŸ˜„

robust scaffold
solemn hollow
#

i am very sorry but i still dont get it :S. My TransformAspect has no .LookUp?

#

maybe cause some codegen did not run yet

solemn hollow
#

oh wait a sec. does Transform V1 work with aspect too?

#

since i need to stay on V1 for now

robust scaffold
solemn hollow
#

ah i thought V1 would support transforms already and ill just transition to them to make the later transition to V2 easier

robust scaffold
#

But IIRC V1 transform aspect was very limited.

#

You can make a transform aspect yourself if you wish. Easy enough to do with V1 components.

solemn hollow
void girder
#

For some reason an IJobEntity job is only giving me the option to execute it using Run(), not ScheduleParallel()
Anyone else have this problem?

viral sonnet
#

missing Unity.Jobs namespace perhaps?

void girder
#

Just tried it no luck

viral sonnet
#

hm, just checked. using Unity.Jobs; is needed. is the whole method not recognized or just a parameter missing?

void girder
#

Oh interesting it's being referenced from Unity.Entities

viral sonnet
#

yeah, IJE is in Unity.Entities

#

do you have an ISystem?

void girder
#

Yeah it's set to ISystem

viral sonnet
#

does state state.Dependency = testJob.Schedule(state.Dependency); work?

void girder
#

Nope the Schedule method doesn't exist

viral sonnet
#

my system with IJE only has using Unity.Burst; using Unity.Entities; namespaces

#

hm, that's weird

void girder
#
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine.UI;
using Unity.Jobs;

[UpdateInGroup(typeof(SimulationSystemGroup))]
[UpdateAfter(typeof(SteeringSystem))]
public partial struct MoveSystem : ISystem
{
    public void OnCreate(ref SystemState state)
    {
        
    }

    public void OnDestroy(ref SystemState state)
    {
        
    }

    public void OnUpdate(ref SystemState state)
    {
        var testJob = new TestJob();
        
        testJob.Run();
    }
    
    [BurstCompile]
    private partial struct TestJob : IJobEntity
    {
        public void Execute(TransformAspect transform)
        {
            transform.WorldPosition = float3.zero;
        }
    }
}```
#

Just upgraded to 2022.2 and Entities, so there's a bunch of compile errors - maybe something to do with that?

viral sonnet
#

I'd guess so

#

btw you are missing [BurstCompile] on the MoveSystem

void girder
#

Oh right on the ISystem struct?

viral sonnet
#

and for OnCreate/Destroy/Update too

void girder
#

Oh yeah thanks

solemn hollow
#

A question i actually had for a long time now : Are we supposed to manage GlobalEntitySceneDependency.asset in git or should it be ignored?

#

for some reason i quite often get changes in there when there shouldnt be any

viral sonnet
#

i think you can safely ignore it. same goes for anything in sceneDependencies or what it's called. I don't even know why that stuff is in the assets folder and not library

balmy thistle
#

Legacy

solemn hollow
#

thanks! its what i assumed but it really made me think twice cause usually nothing in the assets folder is ignored

void girder
#

Are aspects compatible with SystemBase Entities.Foreach jobs?
What's the easiest way to port the Translation/Rotation components in those jobs now that they're replaced?

robust scaffold
#

They've been wholesale replaced by Local/WorldTransform which contain both translation, rotation, and scale in one component.

rustic rain
void girder
rustic rain
#

Making IJE is as fast as making ForEach

void girder
#

I shouldn't be writing to WorldTransform right? The manual says it's "derived" so changes to it won't stick

solemn hollow
#

then upgrade later to v2

#

there are enough problems with updating to 1.0 without transform system causing issues

void girder
solemn hollow
#

1 sec. i need to look it up. editor hangs because i need to remove thousands of converttoentity scripts :S

void girder
quick gazelle
#

Is NativeArray and NativeList faster than List and standard Array

void girder
#

How do we access unmanaged shared components? It's one of the best things about 1.0 imo

#

Is it just getting a list from EntityManager.GetAllUniqueSharedComponents() and iterate through a loop while setting a AddSharedComponentFilter() to an entity query?

robust scaffold
weak delta
#

It's inaccessible

void girder
robust scaffold
# void girder IJobEntity

Just a in SharedType shared in the Execute() parameter list will get it. Do you want to filter by a shared component?

void girder
robust scaffold
#

All the special types that can be used in an IJobEntity. IJobChunk is slightly more difficult.

cunning perch
#

does DOTS with with VR?

robust scaffold
cunning perch
#

I doubt there's any resources on how to get started?

hazy acorn
#

How can I log those values

true mirage
#

Should we add [ReadOnly] attribute for ReadOnly native array types?

true mirage
#

Can Singleton component data change after creation?

solemn hollow
#

Whats up with warnings such as those: [Worker14] 1 entities in the scene 'UnitsSubscene' had no SceneSection and as a result were not serialized at all.

#

it feels like every subscene gives me this warning once

#

am i supposed to manually add SceneSection somewhere?

robust scaffold
solemn hollow
#

ah okay. i had hoped those issues would be resolved with the preview release. we all learned to live with strange warnings in ecs for some time now πŸ™‚

robust scaffold
solemn hollow
robust scaffold
#

But yea, living with errors and crashes is kinda the name of the game right now with dots unity ecs. It's strange they call it "production ready" now. I hate to agree with acid arrow with anything but he does have a point, ecs is nowhere near stable.

solemn hollow
#

i hope at least the core API is now stable. the unity team is doing great work. pretty sure they get those crashes fixed till full release

brave field
#

πŸ₯² Looks like I'm hitting ECB bug that at editor everything works nicely but actual game build ECB keep spamming instantiate entity until throw u error then crash

weak delta
#

So, what's the best/fastest way to detect and transfrom float3(nan,nan,nan) to float3(0,0,0)

misty wedge
#

Why are you ending up with NaN values?

frigid crypt
#

So, after I updated my packages from experimental to preview I started getting this error in editor

weak delta
misty wedge
weak delta
#

That would be ideal yes

misty wedge
#

Since it sounds like this needs to be very fast, it's hard to say. Unless you manage to somehow index which vertices are incorrect, you would probably just need to iterate over it

#

(which is also very fast, but may not be fast enough for what you are doing)

weak delta
#

i see

naive eagle
#

Anyone else getting this when trying to upgrade from 2022.2.0b8 to 2022.2f1? The URP upgrade fails and the editor freezes up.

viral sonnet
oblique cosmos
#

Any ideas as to why my spotlights don't illuminate an object? Shadows work just fine but the damn thing won't light up at all. If I drag it out of the subscene it works fine (even with the actual light source still in there). Is this a known thing that just doesn't work or am I missing something?

rustic rain
#

Any lights but direction haven't worked in subscenes since forever I think

oblique cosmos
#

I see... hm. That's unfortunate.

rustic rain
#

would be interesting to check whether light sources as GO affect entities

oblique cosmos
#

A quick test would suggest a big fat "nope"

rustic rain
oblique cosmos
#

Just a really quick test in a, currently rather messy, scene

rustic rain
#

should also check in runtime πŸ˜…

#

don't think entities graphics work properly in edit mode

oblique cosmos
#

Doesn't seem to change anything

rustic rain
#

wait what

#

2022.2.0f1 released?

#

do entities support it?

#

anyone tested?

frigid crypt
rustic rain
#

πŸ€”

#

pre-release means you can find those in package manager

#

instead of using url

covert lagoon
#

Rival too.

rustic rain
#

Is it stable enough?

#

or no difference?

#

I mean entities with that version

covert lagoon
#

Hasn't crashed yet.

rustic rain
#

what about baker errors?

brave field
#

Anyone know how to fix this build error?

UnityEditor.Build.Pipeline.ContentPipeline:BuildAssetBundles```
covert lagoon
#

Haven't had that while trying the Rival OnlineFPS sample.

#

But I had not tried 1.0-exp.

#

Only 0.51 and now 1.0-pre.

frigid crypt
#

But somehow in playmode it still works as it was before

robust scaffold
hollow jolt
#

anyone knows how to use mathematics package matrix similar to transform.InverseTransformVector & transform.TransformVector

rustic rain
#

You guys have any ideas about other ECS frameworks for Unity?
I need temporary production ready solution πŸ˜…

frigid crypt
#

Well, now I have an issue with implementing collisions

rustic rain
robust scaffold
#

Ya know, I wonder what happened to the people who wanted bevy. They've gotten really quiet over the years

frigid crypt
#
[BurstCompile]
public partial struct MagicMissileSystem : ISystem
{
    [BurstCompile]
    public partial struct MissileCollisionEvent : ICollisionEventsJob
    {
        public ComponentLookup<ProjectileData> projectileData;
        public ComponentLookup<EnemyData> enemyData;
        public void Execute(CollisionEvent collisionEvent)
        {
            Entity entityA = collisionEvent.EntityA;
            Entity entityB = collisionEvent.EntityB;

            bool isEntityAProjectile = projectileData.HasComponent(entityA);
            bool isEntityBProjectile = projectileData.HasComponent(entityB);

            bool isEntityAEnemy = enemyData.HasComponent(entityA);
            bool isEntityBEnemy = enemyData.HasComponent(entityB);

            if(isEntityAProjectile & isEntityBEnemy)
            {

            }
            else if(isEntityAEnemy & isEntityBProjectile)
            {

            }
        }
    }
    public void OnUpdate(ref SystemState state)
    {
    (...)
      state.Dependency = new MissileCollisionEvent
        {
            projectileData = SystemAPI.GetComponentLookup<ProjectileData>(),
            enemyData = SystemAPI.GetComponentLookup<EnemyData>()
        }.Schedule(SystemAPI.GetSingleton<SimulationSingleton>());
    }
}
robust scaffold
frigid crypt
#

I tried doing it like it was shown in documentation

frigid crypt
#

But it doesn't like SystemAPI.GetSingleton<SimulationSingleton>() as a parameter for Schedule()

robust scaffold
rustic rain
frigid crypt
#

Even though it is exactly what is shown to be used in documentation

robust scaffold
rustic rain
robust scaffold
rustic rain
#

I am trying to learn how to make simple projects that are easy to be implemented into other Unity projects

#

kind of "minigames"

covert lagoon
#

Does anyone use cleanup components?

frigid crypt
#

So, no one knows what is wrong on my end?

naive eagle
frigid crypt
#

Well, I don't get any errors anymore

#

But for some reason it doesn't do anything when entities collide

#

This is how my struct looks like

    [BurstCompile]
    public partial struct MissileCollisionEvent : ICollisionEventsJob
    {
        public ComponentLookup<ProjectileData> projectileData;
        public ComponentLookup<EnemyData> enemyData;
        public void Execute(CollisionEvent collisionEvent)
        {
            Entity entityA = collisionEvent.EntityA;
            Entity entityB = collisionEvent.EntityB;

            bool isEntityAProjectile = projectileData.HasComponent(entityA);
            bool isEntityBProjectile = projectileData.HasComponent(entityB);

            bool isEntityAEnemy = enemyData.HasComponent(entityA);
            bool isEntityBEnemy = enemyData.HasComponent(entityB);

            if(isEntityAProjectile && isEntityBEnemy)
            {
                var temp = enemyData[entityB];
                temp.hp -= projectileData[entityA].damage;
                enemyData[entityB] = temp;
            }
            else if(isEntityAEnemy && isEntityBProjectile)
            {
                var temp = enemyData[entityA];
                temp.hp -= projectileData[entityB].damage;
                enemyData[entityA] = temp;
            }
        }
    }
rustic rain
#

just debug it

blissful bobcat
#

Ive downloaded the 2022.2.0f1 on Ubuntu but it came out without Plastic SCM option on Windows list inside unity, do I've to install a package to use it? Which and how?

frigid crypt
void girder
#

How are people reading scriptable objects in systems? Does it involve turning each SO into singleton entities?

viral sonnet
#

i convert them to blobs

void girder
#

I used to reference them directly with addressables but with ISystems that's no longer possible

pliant pike
#

probably best to stick with standard SystemBase in that case then

rustic rain
rustic rain
#

you can either create data in baker

#

or in monob's start or awake

void girder
#

Yeah baker

frigid crypt
#

Ok, one more question for today

#

Are there any easy ways to implement an equivalent of button onClick() for menus?

rustic rain
#

what UI do you even use?

true mirage
#

When do you se readonly and readonly ref struct for job data?

rustic rain
#

πŸ€”

#

what readonly struct?

frigid crypt
rustic rain
#

if it's uGUI

#

just use whatever uGUI uses generally

#

because it's independent

#

same as UI Toolkit tbh

true mirage
#

and readonly ref struct

hollow jolt
hot basin
#

do someone know if unity plus license allows to edit dots (or any other) packages for commercial use?

#

or do I need pro (or higher) which allows me to edit source code?

robust scaffold
hot basin
#

I meant it from legal standpoint

robust scaffold
#

Huh, in a production sense, I think you might need a license.

robust scaffold
rustic rain
#

Entities Β© 2018 Unity Technologies

Licensed under the Unity Companion License for Unity-dependent projects (see https://unity3d.com/legal/licenses/unity_companion_license).

Unless expressly provided otherwise, the Software under this license is made available strictly on an β€œAS IS” BASIS WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. Please review the license for details on these and other terms and conditions.

hot basin
robust scaffold
#

3.1 You own your content. In this License, β€œderivative works” means derivatives of the Work itself--works derived only from the Work by you under this License (for example, modifying the code of the Work itself to improve its efficacy); β€œderivative works” of the Work do not include, for example, games, apps, or content that you create with the Work. You keep all right, title, and interest in your own content.

#

Seems like it's okay, as long as you use the unity engine

hot basin
#

yeah seem so

#

thanks!

rustic rain
#

hm

#

Where should I report bugs in Rival?

#

Do I use Editor report feature or?

#

πŸ€”

light badger
#

You can create a bug report via the editor, or since I'm here at the moment you can share what the bug is so we can see if a report is necessary

rustic rain
#

public partial struct FixedTickSystem : ISystem
In standard characters

#

for some reason it uses this code in OnUpdate

        if (!SystemAPI.HasSingleton<Singleton>())
        {
            Entity singletonEntity = state.EntityManager.CreateEntity();
            state.EntityManager.AddComponentData(singletonEntity, new Singleton());
        }
#

which causes exception in singleton that doesn't exist

#

in other systems

#

if this system got updated later than them

#

simply moving this code to OnCreate fixes it and makes OnUpdate slightly faster

light badger
#

Ah yes I see. I put this in the update just in case someone accidentally deletes the singleton, but i'll make sure i also create it in OnCreate by default. No need for a report, thanks!

rustic rain
#

I think if someone deletes singleton that wasn't created by them, it should be on them πŸ˜…

signal phoenix
#

That's true, but I was thinking maybe some people might attempt to reset scenes by deleting all entities and whatnot. I'm probably overthinking this 😁

robust scaffold
signal phoenix
#

I never tried it to be honest

stone osprey
#

Where would you store data which neither really belongs to an entity nor system ?
For example Collision or AOI ( Area of influence/interest ) data ?

Imagine we wanna track new, staying and left collisions for each entity. We then would fire events to react on them.
However, each entity actually needs several lists to do the tracking... Like a list with all collisions this frame and all from the last frame to determine entered and left collisions.

We could either put those lists into the entity itself (CollisionsComponent{ UnsafeList<...> } or buffer) or the system (Dictionary<Entity, List<CollisionStruct>>) which handles them to fire events.
Where would you put those lists ?

rustic rain
#

@signal phoenix btw, I tried to look into character implementation and it seems like it's all done in one system: velocity evaluation, transform modification and etc
Have you considered splitting it though?
This way there is a way to modify data of controller's step by 3rd party, simply by updating after velocity evaluation and before it's applied to transforms (similiar to how physics work now)

#

and there won't be a need to make checks like friction floor, because friction floor will be able to make it's modification manually instead

robust scaffold
rotund token
#

I've only looked at rival once but from what I recall each module is a seperate struct and it was promoted to implement it yourself with features you need

stone osprey
rustic rain
robust scaffold
rustic rain
#

so that probably sounds like cleanest one I guess

robust scaffold
#

Ugh, i have a system that needs to conduct iterative steps but the problem is one half of it must be done in series and the other should be done in parallel. I need to somehow reimplement something like a first-lane wave intrinsic with unity jobs.

#

What I'm thinking is a NA<int>[2] value that all available threads interlocked increment the [0] and check the return value. If it's 1, that means the current thread is a "first-lane" and should conduct the first half series data. Once the "first-lane" completes, it should set [1] to true (1). Other threads should remain idle in a while(true) loop until the [1] value returns true and conduct the parallel portion.

I wonder if there's a built in way to conduct this cross-thread synchronization scheme other than hacking it together using a nativearray buffer.

signal phoenix
# rustic rain <@1021403886688424006> btw, I tried to look into character implementation and it...

It's something I've considered for sure, but I ended up choosing to keep things simple in the "standard" characters (which can just be seen as starting points).

But as a user you'd be free to split it in multiple steps:

  • grounding update
  • velocity handling
  • move

The thing is; there will be cases where you'll need even more splitting than this. What if you want to insert a step between parent movement and ground detection? What if you want to replace the default moving platform detection step with your own? Etc... In the end, the correct amount of splitting depends on the specifics of the project, so I decided to make this the user's responsibility. More splitting means more places to pass data to jobs when a character step needs access to custon data lookups & singletons, so there's a bit of a ease-of-use price to pay for splitting things

rustic rain
#

yeah, that's true

rustic rain
misty wedge
#

Looks right to me

rustic rain
#

speedrun community approves

viral sonnet
solid rock
#

So I tried to write to a NativeParallelMultiHashMap in an IJobParallelFor and got

InvalidOperationException: PopulateNeighborsJob._neighbors is not declared [ReadOnly] in a IJobParallelFor job. The container does not support parallel writing. Please use a more suitable container type.```
Is there any documentation anywhere about which containers support parallel writes?
misty wedge
#

You need to use the ParallelWriter struct

#

(for the respective container type)

#

e.g. NativeParallelMultiHashMap.ParallelWriter

#

You can get one by calling AsParallel on the container

#

All containers that have Parallel in the name support parallel writing, as well as NativeMultiHashMap, which is currently named incorrectly

misty wedge
#

Basically anything that you can call AsParallelWriter on

#

Just note that a lot of parallel containers do not support allocating additional memory when used in parallel, e.g. NativeList. So it may throw an error if it needs to resize

solid rock
#

Oh interesting I see they also have a different API for writing. I can't simply use the indexer

#

I have to use TryWrite?

misty wedge
#

Yes

#

That's why it's called TryWrite, because it may fail

solid rock
#

Oh sorry - actually NativeParallelMultiHashMap.ParallelWriter only has Add() which returns void So I guess if there's a memory issue it will fail with some kind of exception?

It's NativeParallelHashMap.ParallelWriter that has the TryAdd - which is documented to fail/return false if the key exists already

misty wedge
#

Yes, if the key is present in a NativeParallelHashMap it will just not do anything, but it can still run out of memory and throw an exception

#

It throws an InvalidOperationException if it's full and you attempt to add something wile using a ParallelWriter

solid rock
#

Hmmm now this leads to a new issue for me.

I'm using a NativeParallelHashMap to store distances per-coordinate for a pathfinding algorithm. I know for sure each thread is going to be dealing with unique sets of keys (they are partitioned beforehand), but I need each execution to be able to read and write from the HashMap

#

Is that possible?

misty wedge
#

Are they mutually exclusive? Meaning no keys are shared

solid rock
#

yes

misty wedge
#

You can use a NativeStream in that case

#

Basically each parallel writer will open an index for it to write to, and then afterwards you can read each index

#

You'll still need to write and read after each other, since doing both at the same time is not thread safe

#

Unless I'm misunderstanding what you are attempting to do

#

But I'm a little confused, you just need the container as a lookup inside the job?

solid rock
#

Yeah - the short story is I'm doing a BFS on a different area of a graph in each execution of the job. Think of it like... doing BFS on separate islands of a graph, and storing the distance to the starting point for each node in the hashmap. Each execution is working on a disjoint part of the graph and there's no chance of overlap, but they're still using the same HashMap to store everything

#

In order to get the distance to a given node, I need to read the distance of the node it is a neighbor of and add one

misty wedge
#

But you do need the result outside of the job?

solid rock
#

Which was calculated earlier in the algorithm

#

yeah the result is needed outside the job

misty wedge
#

What type of job is it?

solid rock
#

IJobParallelFor

misty wedge
#

So this is only running for a single graph at a time

solid rock
#

Ok let me drop the veil here a bit. It's for a grid pathfinding system. There are multiple different destinations an AI can navigate to. I'm running a job that marks each tile on the grid with a number representing how far it is from the destination. To do that I do a BFS from the destination radiating outward on the grid and add 1 to the previous node's distance to get the new distance.

The parallel part is that I'm doing this in parallel for each potential destination.

So it's the same graph for every execution but a different destination.

true mirage
#

Is there EqualityComparer (Assert) for float2,int2,float3,int3 in testing?

misty wedge
solid rock
#

The keys in the NativeParallelHashMap are a pair of (tile, destinationTile). So since each thread is using a different destinationTile, the keys are always unique per thread.

misty wedge
true mirage
#

but it is not a good way to show errors

misty wedge
#

Oh, you need to use math.all

#

In case you are getting a compile error

true mirage
#

(expected, value) like Assert.Equals(a,b)

#

I mean in logging

misty wedge
#

Can you show some code? Since all mathematics types certainly have their equals override implemented, so I'm not sure what issue you are having

solid rock
true mirage
#

Also, float3.Equals(float3) not ==

solid rock
#

My router just decided to reboot so gimme a few minutes to come back online lol

misty wedge
true mirage
#

Assert.IsTrue() it does not work I mean with ==

misty wedge
#

What issue are you having?

true mirage
#

Assert.IsTrue(float3.Equals(float3))

#

It is correct

misty wedge
#

Yes, or Assert.IsTrue(math.all(float3 == float3))

true mirage
#

I said. I want to show the meaningful logs like expected and value

#

Assert.IsTrue returns only true or false not meaningful texts

misty wedge
#

The second parameter is a message

true mirage
#

OK, I convert int3,float3 to Vector3 and Vector3Int and then use EqualityComparer, thanks

#

I think you have not written test codes or I cannot say my meaning

misty wedge
#

You want to assert, and have the exception print the expected value

true mirage
#

When I write Assert.Equals(float,float), it says exactly the expected value is ... float value and the result value is ... float value

#

You cannot achieve it with Asset.IsTrue

misty wedge
#

What assertion class are you using?

true mirage
#

I want something like it for float3

#
AssertUtility.AreEqual(data.LocalPos, localPos);

I have written EqualityComparer for Vector3 before. It is perfect
Vector3IntEqualityComparer --> unity class

 public static class AssertUtility
    {
        private static readonly Vector3EqualityComparer Vector3EqualityComparer = new(10e-5f);
        private static readonly Vector2EqualityComparer Vector2EqualityComparer = new(10e-5f);

        private static readonly Vector3IntEqualityComparer Vector3IntEqualityComparer = new();

        public static void AreEqual(Vector3 expected, Vector3 actual)
        {
            Assert.That(actual, Is.EqualTo(expected).Using(Vector3EqualityComparer));
        }

        public static void AreEqual(Vector2 expected, Vector2 actual)
        {
            Assert.That(actual, Is.EqualTo(expected).Using(Vector2EqualityComparer));
        }

        public static void AreEqual(Vector3Int expected, Vector3Int actual)
        {
            Assert.That(actual, Is.EqualTo(expected).Using(Vector3IntEqualityComparer));
        }
    }
solid rock
misty wedge
true mirage
#

Yes, it is test codes, nunit

#

Assert is a class in nunit

misty wedge
#

Yes, but it is also a class in Unity.Assertions

misty wedge
solid rock
misty wedge
solid rock
#

You were of a lot of help actually πŸ‘

misty wedge
true mirage
#

I have used the nunit one

true mirage
#

πŸ™‚

misty wedge
#

I just did

#

It's in the screenshot

true mirage
#

Thanks, now I see

#

Weird, thanks

misty wedge
#

What output are you getting?

true mirage
#

I switched my unity from 2019 to 2021

#

In my old project, I cannot see it when using Assert.IsTrue :/

#

Perfect, probably my wrong

misty wedge
#

Well it will not show for Assert.IsTrue since you've converted the input to a boolean...

true mirage
#

What is your assert statement, plz?

#

exactly

misty wedge
#

For which screenshot?

true mirage
true mirage
misty wedge
true mirage
# misty wedge

Appreciated, the generic one

    public static void AreEqual<T>(T expected, T actual, string message) => Assert.AreEqual<T>(expected, actual, message, (IEqualityComparer<T>) EqualityComparer<T>.Default);
#

I think it does not exist in 2019. Awesome

pliant pike
#

How do I check if an entity exists now, I'm sure there used to be an Entity.exists() method

rotund token
#

in a job or main thread?

pliant pike
#

in an IJobEntity

rotund token
#

SystemAPI.GetEntityStorageInfoLookup

#

You can use this - pass it into the job

pliant pike
#

does that work in 0.51

rotund token
#

well not systemapi

#

but you can get it from a system instead
GetStorageInfoFromEntity()

light badger
# rustic rain Rival has interesting glitches kek

Can you check if this is still happening if you add a TrackedTransformAuthoring to the sphere you're jumping on? It's basically the component you put on bodies that the character can stand on, like moving platforms and such

I'll see if there's a way to make the behaviour less weird when the component's not there though

pliant pike
#

cool it worked

robust scaffold
#

@light badger Do you have any examples of smoothing the prediction of rotational components?

#

I would've sworn there was one but I cant find it anymore. And the linear smoothing of course doesnt work with radians.

true mirage
#

Is it good to define fields as static ones in struct types to avoid copying as much as possible?