#archived-dots

1 messages ยท Page 216 of 1

north bay
#

Yea that's what I meant

night venture
#

afaik, that should work...

#

fyi: after restarting unity, same behaviour

north bay
#

There has to be something else messing with your tag

night venture
#

find references only return 2: when creating the entity on another system onstartrunning and here...

#

should the ecb be created inside the foreach?

#

i already tried getting entity by ref, without success

north bay
#

You are saying that this is printing the entity twice?

{
    struct Component : IComponentData { }

    private EndSimulationEntityCommandBufferSystem m_barrier;
    
    protected override void OnCreate( )
    {
        m_barrier = World.GetExistingSystem<EndSimulationEntityCommandBufferSystem>( );
        EntityManager.CreateEntity( typeof( Component ) );
    }

    protected override void OnUpdate( )
    {
        var commandBuffer = m_barrier.CreateCommandBuffer( );

        Entities.WithAll<Component>( ).ForEach( ( Entity e ) =>
        {
            commandBuffer.RemoveComponent<Component>( e );
            Debug.Log( $"Entity({e.Index}:{e.Version})" );
        } ).Run( );
    }
}
night venture
#

copiying...

#

yes, its doing it

north bay
#

Do you have multiple worlds running?

night venture
#

...maybe...? xD

north bay
#

The EntityDebugger should show if you do

night venture
#

tbh, i dont know how to use it...but i dont see anything...photo?

#

in fact, if i pause the game, the second time is when I hit the next photogram, so +1 for the ecb being delayed theory...

north bay
#

When clicking on the button that states "ClientWorld" you get a dropdown that should list you the worlds.

#

The commandBuffer won't be delayed it updates in the same interval as the system

hollow sorrel
#
Script โ€” Today at 9:44 PM
Uhhh are you mixing the FixedStepSimulationSystemGroup with one of the other groups?

make sure this isn't the case, check what groups your system is in with entitydebugger

night venture
#

only default world plus a bunch of loadingsworld empty

north bay
#

If it would be delayed 50% of my code dependent on command buffers would be broken

#

Which are around 20-30 systems

night venture
#

...options?

north bay
#

They are working fine since 5+ months

night venture
#

doctor?

north bay
#

๐Ÿคทโ€โ™‚๏ธ

ocean tundra
#

@night venture You could try coding in a Debug Break before your Foreach and again after

#

confirm exactly how many entities you have, make sure theres no duplicates

night venture
#

1 entity 1 system...i think i cant remove anything more xD

ocean tundra
#

and look at all the entity inspectors, the systems window shows how many 'matches' it has so good idea to confirm that

#

unless its a new empty project I dont think you can assume theres nothing else

#

oh and clear the library folder too

#

I've had some compiled older version of a system hang around somehow

night venture
#

fresh project...see u in a while xD

hollow sorrel
#

from everything you said it sounds like your system is running twice in the same frame

ocean tundra
#

yea thats what i thought too

night venture
#

its not, cause it doesnt happen until i click next if paused

#

it is entering twice cause the ecb hasnt run yet, but it doesnt run a third time

#

so my ecb is delayed by 1 frame ๐Ÿ˜›

ocean tundra
#

where is your system in the UpdateOrder and what ECB system is it using?

north bay
#

If you see the same behaviour in a fresh project with the code I posted above you need to start worrying

#

Do you use a custom bootstrap?

#

Are you recreating worlds?

night venture
#

@north bay yes, no, no.

night venture
hollow sorrel
#

what does that mean you click next when paused

#

use breakpoints, debug.log frame numbers

night venture
#

when you hit pause+play, it show the scene and run the first frame

#

then you click next and the next frame is run

#

and there is when it magically "enters"

ocean tundra
#

Subscenes? or ConvertToEntity?

#

with the same trigger component?

#

Did you take @north bay's code, make a NEW system and NEW Component type to test?

night venture
#

nothing, nothing, nothing...
yes, used @north bay code and happened...almost ended creating the fresh project

ocean tundra
#

and in the systems window it only appears once?

night venture
#

fresh project, same code, it works

#

๐Ÿคฌ

ocean tundra
#

Werent you trying todo some weird custom OnCreate loop awhile ago?

night venture
ocean tundra
#

must have been someone else ๐Ÿ˜›

night venture
#

im messing with dynamicbuffers today

north bay
ocean tundra
#

well, no clue whats happening, You need to investigate all your existing systems and try figure out whats going on

#

try disabling EVERYTHING else

night venture
night venture
north bay
#

Try adding Debug.Log( this.GetHashCode( ) );
To the OnUpdate of the system I posted and see if it matches

#

To fully rule out my multiple world theory

north bay
night venture
#

Before the whole system went crazy I was messing with dynamic buffers, and I was trying to achieve a specific task:
systemA creates the entity A with a dynamic buffer of 10 elements (waypoints)
systemB must check those items and add some others in the middle (intermediate waypoints)

  1. tried creating a new dynamicbuffer to replace the older or to clean+iterate, but it didnt work, as memory wasn't allocated according to internals.
  2. tried using buffer.insert, but as the system uses i-1/i+1 (index), it didnt work as was accesing non-yet created waypoints.
  3. tried using a native list, but seems the entities are not created before the list is copied to the buffer...(using ecb inside foreach...)

can you think a simpler/better approach to solve the task ?

ocean tundra
#

you can use ECB setbuffer

#

that will replace the buffer

night venture
#

could you please elaborate? do you mean when using foreach+buffer is a copy (as Translation) and i have to write local changes to entity?

tight blade
#

does anyone know offhand if this kind of defensive JobHandle combining is necessary?

Do I have to combine with the original dependency each time considering the jobhandle I pass in already in theory includes that original dependency?

#

I feel like I've just always done it. Maybe I determined there was a reason for it at one point, but I certainly dont remember

night venture
#

as far as i can remember, when i tried to split things apart, it didnt work.
eg:

var foo = new somethingJob{...};
foo.schedule(..., foo); //ERROR

so i ended using dependency as a one line declaration-usage (as seems its declared by parent)

tight blade
#

thats not what I meant, I'm afraid. My question is about whether or not it was necessary for that second job to depend on Dependency, since it also depended on something else that depended on Dependency

north bay
ocean tundra
#

@tight blade No you dont need todo that

#

๐Ÿ˜›

#

2 seprate answers

tight blade
#

lol. good.

north bay
#

Choose the one you like more

#

lol

ocean tundra
#

i think if Job A has dependancy as a input then job B dosnt need to combine A handle + dependancy

tight blade
#

Well, at least I feel affirmed that it wasn't an obvious answer

ocean tundra
#

BUT you should combine the outputs back into Dependancy at the end

tight blade
#

that, at least, I definitely am aware of

north bay
# ocean tundra 2 seprate answers

Easy way to figure out tbh. Don't do it and see if the jobdebugger yells at you when you schedule another system that uses those component types

tight blade
#

I use a lot if unsafe pointers, so my job debugger often just washes its hands of me

night venture
#

@ocean tundra could you please elaborate? do you mean when using foreach+buffer is a copy (as Translation) and i have to write local changes to entity?

#

im probably not explaining the issue properly, and althoug there may exist workarounds, this ecb thing is giving me headaches today

#

systemA add source and destination+ component ready4pathfinding

#

systemb creates the pathfinding buffer and should replace existing buffer(source/destination)

north bay
#

Your problem was that you did add invalid entities to the dynamic buffer right?
EntityCommandBuffer has a method that is called SetBuffer. That method returns a empty DynamicBuffer<T> which you can add your elements to. At playback that dynamic buffer will overwrite the content of the previous DynamicBuffer<T> on the entity. That playback should handle deferred (the ones created by the entity command buffer) entities correctly.

night venture
#

but, it seems entities (created by ecb) dont exist when added to buffer

#

so setbuffer replaces the buffer with the resulting one when entities.foreach has ended?

north bay
#

It replaces the buffer once the command buffer is played back

safe lintel
#

are shared components automatically distributed or is there more to something than just using AddSharedComponentData to an entity?

sage mulch
#

Hi, I'm using an array of 26 bools within a job to store some data, just for within the job. Will need to reset all of the bools to false multiple times within the same job. Is there a way to set a nativecontainer to "false"/0 for all elements within it quickly, rather than iterating over all of its elements and setting them to false individually (like wiping the memory its using to 0 across the board)? Or is there a better way to do this, like using the first 26 bits of 4 bytes and setting them to 0/1 etc

unborn totem
#

hey all, been awhile since I've last messed around in DOTS, is there a specific Unity version it's best to work in at the moment?

#

Trying to get a project last used in 2020.1 beta build working where I used the SubScene and "ConvertToEntity" workflow

#

but I can't remember if I ever figured out how to get the whole SubScene and "ConvertToEntity" workflow working outside of the Editor, so I figured I'd just try and upgrade it to whatever stuff is happening now instead

unborn totem
#

I think I forgot ECS requires using a different way to build to get SubScenes to work

#

requires these Build Configuration assets, right?

#

it's why I feel like I should update, I feel like it's possible this whole workflow has changed by now ๐Ÿ˜…

#

yep, there's my SubScenes folder of binary subscene data...man it's hard to remember this stuff when you put it down for a year LUL

light mason
#

Can I use hybrid rendered with regular URP

#

Basically Iโ€™m trying to find out what hybrid doesnโ€™t and does not support in URP

light mason
#

Ty

#

Ok so letโ€™s say I enter a area where I really need to use reflection prob

#

Can I just not use hybrid for those particular objects

remote crater
#

I'm sad because I made a huge video game, super high quality in my books using DOTS/ECS. It works perfectly in the editor, but when I try and make a stand alone, it errors out and won't run. I cannot downgrade my unity because every single version errors out. My project without library/temp is 17 gig, so every time I port it, it takes 2 hours. I tried so many versions over 5 days, I would say I put 40 hours of trial and error there, but I'm ramming my head against a brick wall. I feel like I have a really huge hit on my hands, but I can't even release it to go live. Just when you thought you crossed the finish line the goal line moves and a brick wall appears between you and it. I've done my part. I've coded an awesome game. Will Unity do their part and make a 2021 alpha version that allows DOTS? I can't even get my unity to load alpha 11,12,13, because errors many other people are having. I choose Alpha to do DOTS/ECS the new technology because I thought I had to.

If I can't downgrade, how long do I expect to be waiting? I have like 5 devs working on the project now that I called in when I got it working[wo standalone]. But they may run out of steam when I'm not pushing forward anymore.

I like coding. I do not like being stuck on a technical brick wall with no one to help me. Can we use DOTS/ECS with alpha soon? After all, alpha infers your latest technologies, AKA DOTS/ECS.

light mason
#

Hang in there @remote crater

#

Freaking sad to read your struggles

remote crater
#

Upgraded to .14: Library\PackageCache\com.unity.platforms@0.10.0-preview.10\Editor\Unity.InternalAPIEditorBridge.012\EditorGUIBridge.cs(15,45): error CS0426: The type name 'HyperLinkClickedEventArgs' does not exist in the type 'EditorGUILayout'

#

That is the same error I got on .13,.12,.11

#

Maybe .14 could compile to standalone, but that is the one error I get I can't pass. My choices are "Wait for a version that works", or "Someone help me past that error."

light mason
#

Long shot but have you tried blowing away you packageCache ?

wheat blade
#

The situation sounds.... confusing

deft stump
#

"the future of Unity" is no longer compatible with future versions of Unity

#

quite worrying

wheat blade
#

Yeah, I don't get this whole area. Nor why they're being so cryptic about it. Saying barely anything almost seems worse than nothing too.

deft stump
#

it's kinda like...

#

they're embarrassed or something

wheat blade
#

It very much gives the impression that a serious mistake was made somewhere

deft stump
#

in either case being transparent about the actual situation should be considered.

#

DOTS will slowly die at this rate if they just keep drip feeding us

wheat blade
#

Yes

deft stump
#

and that worries me since we've spent hours studying the bloody thing

wheat blade
#

"Won't work in 2021 until the end of the year at the earliest" is like, really bad

tulip robin
#

hey for procรฉdural gรฉnรฉration Noise DOTS or thread from scratch or other ?

slim nebula
#

Procedural generation of noise sounds like a shader graph thing

tulip robin
#

damn....

#

i m going to find alone np thks for your help ^^

bright sentinel
karmic basin
#

@remote crater say again how you make your builds ? (Just to make sure you use the new workflow and not the usual way)

stiff skiff
#

Lets hope they won't do something stupid like releasing a DOTS only version of Unity (Bit like Tiny)

tulip robin
#

result = new NativeArray<int>(1, Allocator.Persistent);
// nvm for me
//this work
int *ptr = malloc(1, 4);
ptr[0] = 0x000000FF; || *ptr

//WTF ...
Unity.Collections.NativeArray`1:.ctor(Int32, Allocator, NativeArrayOptions)
#

Any explain ?

stiff skiff
#

What's the question

tulip robin
#

Why constructor failed

stiff skiff
#

And what is the exception it threw

tulip robin
#

Unity.Collections.NativeArray`1:.ctor(Int32, Allocator, NativeArrayOptions)

#

ctor

stiff skiff
#

That's not an exception

#

Thats a part of a stacktrace

tulip robin
#

same

#

...

#

it's exception or not ?

#

it's same for Allocator.TempJob

slim nebula
#

If your fps is too high unity's own components will show this error. Try removing this code and running it. Does the error still happen?

tulip robin
#

when i remove NativeArray

#

worked

slim nebula
#

Hmm

tulip robin
#

but when i need to alloc it ..

hollow sorrel
#

you're allocating but not disposing

slim nebula
#

Oh

#

Yea

tulip robin
#

O.O

#

disposing ?? calloc ?

slim nebula
#

The job class just isn't held by any other variables so when the job gets deallocated the native Ray member gets deallocated in the.net side which triggers the error because you haven't disposed of it on the unmanaged side

#

Just call result dispose at the end of your job

#

Sorry at the end of your job

tulip robin
#

ok

#

when my jobs finished

#

free so memory leak?

slim nebula
#

Dotnet is freeing the job class and.net is freeing the c sharp side of the native array class. This is what detects that you haven't disposed the native side of the array. This safety check only exists in the unity editor. Users of a build would never see the error

tulip robin
#

Ok when i put this its work but i have question

slim nebula
#

Surr

tulip robin
#

when i call complete my main thread is block ?

slim nebula
#

Yup

tulip robin
#

....

slim nebula
#

?

tulip robin
#

i don''t want to block my main thread...

slim nebula
#

If you want to wait until the job is done then your thread is going to wait until the job is done

#

If you don't want to block your main thread then don't call . complete

tulip robin
#

but if i don't call it segfault

#

xD

deft stump
#

@tulip robin are you using regular jobs or using it in entities?

slim nebula
#

If you have something that depends on the data in that job then that dependent thing needs to wait for the previous job to complete

#

It's not magic

tulip robin
#

com.unity.entities

#

??? O.O
simoyd, in basic Thread i don't need to call .join, i don't want to block my main thread so my game just because i m generating chunk ...

slim nebula
#

What is causing the seg fault if not some other code that needs to wait for your job? You say if your job runs then there's no segfault right? What am I missing?

tulip robin
#

Ok, step one my english is bad sorry for this.

step two: i need to generate chunk without lock my main thread.
SO complete block him == for me, just freeze and wait when it's finish...
it's same way then do sync

#

@deft stump why ?

#

OH

slim nebula
#

So after you're done generating a chunk you would do some other process right? To consume the data generated by the function you wrote. That process would call Complete. You wouldn't call complete right when you schedule it

tulip robin
#

i will try one thing

#

handle have isCompleted

slim nebula
#

You can make a second job dependent on a first job

#

So that both your generate chunk and your following process is in a background thread

tulip robin
#

yeah i already think BUT

slim nebula
#

If you call complete on the main thread it will block your main thread

tulip robin
#

you can't because job don't accept mesh etc

tulip robin
#

i m trying something and i will back

slim nebula
#

Xd

#

I gtg 4 now

tulip robin
#

LOL

#

Greedy way
thread.Start()

hollow sorrel
#

does that even run

tulip robin
#

xD right

#

raaahhh not work

#

๐Ÿ˜ซ

north bay
#

You don't have any references to the result array which is the reason why the leak detection shows you that error. After the job completes there are no references to the allocated data anymore and there is no way for you to free the memory which is what that message makes you aware of.

stiff skiff
#

why not just call thatArray.Dispose and pass in the job handle?

#

Actually, no. Why not dispose the array when you're done with the result?

tulip robin
#

it's obviously greedy but ok it's work

#

thks mate โค๏ธ

#

but no documentation said that ๐Ÿ˜ข

stiff skiff
#

That you have to free memory that you allocate?

tight blade
#

anybody here a fair hand with raw pointers? I've got a pointer to an array that is size 2n, and I want to pass half of it into 2 different systems, so one side gets elements 0 to n, the other gets element n to 2n

#

I seem to recall thats a trivial thing you can do with just, like, arithmetic on pointers

#

but I dont remember how

#

like I feel like you can just select the nth element, effectively, and say "here, this is the start of your n length array"

tulip robin
tight blade
#

yep!

stiff skiff
#

You might be able to use a NativeSlice then?

tight blade
#

yeah, I mean I could use nativearray operations

#

yeah this is more one of those "does anyone know the particular implementation im thinking of" questions

stiff skiff
#

Pointer arithmatic is literally just using the + and - operator on a typed pointer

#

so byte* test = stackalloc byte[10]; test += 5;

tight blade
#

oh, yeah, so I might just add n * size(float) or what have you

stiff skiff
#

no need for the sizeof

#

unless it's a void*

tight blade
#

gotcha, that's awesome.

stiff skiff
#

float* would already have the size included when you add or substract

tight blade
#

right, yeah that makes sense. Thanks, zero!

stiff skiff
#

I would recomment using the NativeArray and Slice however to abstract away the unsafe stuff

tight blade
#

lol, im in too deep for that

#

I agree with that recommendation though, for anyone else seeing this ๐Ÿ˜‰

#

once I get everything working, I'll probably refactor to use more abstractions.

stiff skiff
#

Are you dealing with interop perhaps?

remote crater
#

Mr. K. I know you tried to help before, but I could not follow your instructions. They didn't make sense to me. To you it is obvious, but to me it is not or I'd have it working. I tried for about 8 hours alone trying to install this "WINDOWS PLATFORM" build thing, but was unable.

bright sentinel
karmic basin
# remote crater Mr. K. I know you tried to help before, but I could not follow your instructions...

Alright don't worry I'll try again to help. It's all explained here https://docs.unity3d.com/Packages/com.unity.entities@0.17/manual/install_setup.html#standalone-builds
This means you need to:
0. Completely IGNORE the usual Build MENU (this doesn't know what entities are) that is File > Build Settings

  1. Install com.unity.platforms package through the package manager, & then let's say com.unity.platforms.windows to make a windows build.
  2. Create a build asset from Assets > Create > Build menu
  3. Click the asset from your project tab to show its inspector, like you would for any other asset. From there you will find the new Build button
#

If that's installing the packages through the package manager that you have trouble with, maybe we can help with that too (sometimes it can be stubborn)

torpid mulch
#

Hi
I'm trying to make a selection box system for my RTS game. What I'm doing is drawing a selection box on the screen, projecting the four points onto the world and creating a pyramid convex collider (the four points and camera position) and then add all colliding units to the selection script. But it seems to behaves weirdly if units have non zero rotations.

#
//initialPosition - one corner of selection box, finalPosition - Diagonally opposite corner
NativeArray<float3> vertices = new NativeArray<float3>(5, Allocator.Persistent, NativeArrayOptions.UninitializedMemory);
        vertices[0] = new float3(Camera.main.transform.position);
        vertices[1] = Camera.main.ScreenToWorldPoint(new Vector3(math.min(initialPosition.x, finalPosition.x),
            math.max(initialPosition.y, finalPosition.y), 25));
        vertices[2] = Camera.main.ScreenToWorldPoint(new Vector3(math.max(initialPosition.x, finalPosition.x),
            math.max(initialPosition.y, finalPosition.y), 25));
        vertices[3] = Camera.main.ScreenToWorldPoint(new Vector3(math.max(initialPosition.x, finalPosition.x),
            math.min(initialPosition.y, finalPosition.y), 25));
        vertices[4] = Camera.main.ScreenToWorldPoint(new Vector3(math.min(initialPosition.x, finalPosition.x),
            math.min(initialPosition.y, finalPosition.y), 25));


        BlobAssetReference<Collider> collider = Unity.Physics.ConvexCollider.Create(vertices, ConvexHullGenerationParameters.Default, 
            new CollisionFilter()
            {
                GroupIndex = 0,
                BelongsTo = 0x00000001,
                CollidesWith = 0x00000001
            }, 
            new Unity.Physics.Material()
            {
                CollisionResponse = CollisionResponsePolicy.RaiseTriggerEvents
            });
        vertices.Dispose();

        ColliderCastInput input = new ColliderCastInput()
        {
            Collider = (Collider*) collider.GetUnsafePtr(),
            Start = float3.zero,
            End = float3.zero
        };
      physicsWorld.PhysicsWorld.CastCollider(input, ref hits);
#

If units have non zero rotations, their colliders seem to be in shifted positions when I select with castCollider but I do know that they aren't since I can select them just fine with simple raycasts.

frosty siren
#

Noob question: if i use for example EntityArchetype inside bursted lambda, which defined in system, then how can i avoid caching it's value every time before lambda scheduling?

north bay
torpid mulch
#

I'll try that, I assumed it'd be default

#

๐Ÿ‘€
ITS WORKING

#

thanks ๐Ÿ™‚

remote crater
#

Thank you SO much MR.K! I'm gonna give that a try for a few hours. If it does not work, I am going to make a version of my game for my Starforger level designers and they have technical knowledge that they may be able to downgrade to 2020LTS. I'm no longer stuck at a brick wall because of you guys.

#

Help required to continue: I have Platforms package 0.10.0-preview.10 installed, but do not see where to install com.unity.platforms.windows. It is not in the Package Manager, and when as I said, I spent 8 hours trying to mess with manifest.json to try get it in, but failed.

safe lintel
#

in the package manager theres a + icon, click it and type in com.unity.platforms.windows to add it

remote crater
#

When I tried to build, I got "Empty Build COnfiguration."

#

Thank you thelebaron I will check that.

#

looks like it is installing that package

remote crater
#

Now there is a Classic Windows configuration on the asset->create->build menu

untold night
remote crater
#

It appears to be compiling. I'll let you know if it does

remote crater
#

It appeared to have compiled and ran. The DOTS part threw up a bunch of errors. Still this is very very good. I can finally patch my game with new stuff for non DOTS mode. I think there is a high chance of the reason DOTS not working is because I funkified my code/scene to try and remove it. So this is very very very good. Thank you much Mr.K and thelebaron and everyone else who helped. Remember my promise: If I make it big, and you track me down somehow later, I will send you a nice ph@t Manilla envelope. hahahah, but for serious cuz I am generous.

#

Yes, this is awesome! I have a few things to patch over the past few weeks for a minor update. Today I'll work on adding power level bars on ships. ๐Ÿ™‚ And do an update tomorrow. This is good and encouraging news for my developers. You guys rock. I'll let you know if I can get DOTS working at all.

remote crater
#

It looks like yeah, DOTS ain't working. But it's a small victory to do a NON DOTS update, thank you.

#

DOTS work in client, but not standalone.

night venture
#

is there any way Entities.Foreach being able to invoke a class method with burst?

north bay
#

Only if it's static

night venture
#

but static cant use GetComponent ๐Ÿ˜ฆ

karmic basin
#

No problem, do GetComponent on onUpdate and pass it as param to the static method

ocean tundra
#

or use that GetComponentFromEntity thing

unborn totem
#

when I build out my DOTS game that uses entities and SubScene's, do I need to keep all 3 of these binary files for SubScenes to load properly?

ocean tundra
#

yea pretty sure you do

#

try removing them and seeing what happens?

unborn totem
#

well I know they won't load with Bundles

#

I just wonder what the difference is between Bundles and Entities

#

it takes me 16+ minutes to build my project, so thought I'd ask if anyone knew before trying it myself

ocean tundra
#

maybe bundles is unity stuff

#

like meshes/materials/textures?

unborn totem
#

maybe

#

i forgot the version of DOTS I am using probably does copy the sprite sheet I am using unnecessarily

#

all of my entities are just planes that use a single (somewhat giant) spritesheet to draw a texture

#

and I have 2.12 million of those entities

#

about 100,000 per subscene

ocean tundra
#

Ooo very nice

unborn totem
#

so it's probably copying my spritesheet a lot

#

oh wait, it's 10,000 per subscene

ocean tundra
#

yea dont think subscenes is very good at optmizing away unity objects

#

but maybe soon

#

๐Ÿ˜›

#

are you on a very old version?

unborn totem
#

yeah, probably. it's a project I haven't touched in a year, I just wanted to make another build of it for my portfolio

#

i think i'm in like entities version 0.11.something

#

and I know that's up to 0.17 now

ocean tundra
#

yup

#

and locked to 2020 LTS

unborn totem
#

may try to update when I get more time

ocean tundra
#

so dont go to far on the unity versions if you update

unborn totem
#

yeah I saw that

#

strange unity versioning going on for DOTs

#

very ominous

ocean tundra
#

yea

#

but im thinking "something" is comming

#

for now a version or 2 locked on 2020

#

but they cant stay there, as merging back into the 2021+ will be a MASSIVE pain

#

and the longer they leave the bigger pain it will be

safe lintel
#

im not getting my hopes up, time between releases has been growing steadily while new features inversely proportionally dropped with the time between releases. considering they want more stability id only guess this could take even longer?

ocean tundra
#

yea definitly, im expecting 6ish months for the next 2-3 versions

#

a announcement of some sort in 3ish months, but whatever their plan is we wont see it till early next year (10ish months)

safe lintel
#

im disappointed because theyre now pursuing stability over features tbh, I want audio and pathfinding

ocean tundra
#

me too

#

still so many core things

#

optmize tags, the enable/disable components feature

safe lintel
#

yeah, animation is super rough, editor experience kinda sucks, im not too upset about the code workflow but obviously tons of people really dont find it appealing at all, and seemingly no changes on the horizon there

#

graphics is a weird hodge podge

ocean tundra
#

yea that hybrid renderer

#

i really want that nice

safe lintel
#

i saw a tweet by the hybrid team lead saying they managed 1.42ms with 100k dynamic entity stress test scene

#

super beefy hardware tho ๐Ÿ˜„

ocean tundra
#

yea

#

still that would be nice to have

#

but also i love procedural stuff, so better performance for individual rendering would be nice too

safe lintel
#

and no word on if job scheduling overhead will improve or if the job system will scale with more cores(as it gets worse in physics)

ocean tundra
#

wait

#

it dosnt scale with more cores?

#

i just ordered a ryzen 9 5950x ๐Ÿ˜›

#

i need to use all them cores

safe lintel
#

it sorta does and also sorta doesnt? i remember seeing 0lento mention with a similar ryzen, that perf suffered with all job workers enabled and maybe something similar on the forums

ocean tundra
#

oh damn

safe lintel
#

well you will be able to test it out for yourself soon๐Ÿ˜…

ocean tundra
#

i guess the main thread scheduling begins to suffer?

#

but hopfully burstable systems will help with that

safe lintel
#

that too was disappointing lol

ocean tundra
#

yea it sucks atm

safe lintel
#

a few tests didnt seem to yield any gains but then again its not yet complete so who knows

ocean tundra
#

yea im hoping next version will add full support for jobs

#

and then maybe the one after add Entities.Foreach codegen

#

i also would realllly love to be able to update a entire world in a different thread

safe lintel
#

after reading so many posts here regarding ForEach stuff, imo its a real shame unity decided to kill off IJobForEach, I think that taught me so much about proper job usage while being easier to digest than chunk iteration at the time. Simply starting out learning ForEach lambda has a lot of useful job stuff obfuscated, like kiwi asking how to use HasComponent from a static burst method, very easy in the regular job usage with cdfe but someone new theres like a big jump and current docs dont illustrate it well.

ocean tundra
#

would be awesome to get my whole Server/Simulation world into background

#

they replaces IJobForEach with something else tho didnt they?

#

thats not chunk based

safe lintel
#

afaik they havent actually released its replacement yet

#

they talked about it

safe lintel
#

I dont think the IJobEntityBatch is it because thats still kind of similar to chunk usage

ocean tundra
#

hmmm yea

#

im still at the stage where im mainly using Entities.Foreach

safe lintel
#

Id like to be able to schedule jobs from jobs, give me a super unsafe way to try it out ๐Ÿ™‚

ocean tundra
#

haha nooo so much chaos

#

but if we could somehow use a old long lived thread

#

or some sort of new engine loop hooks to plug in a world to a different thread

#

i work super hard at keeping my Server world away from all the unity stuff

#

it is basily just the simulation, then pipes stuff into network/accross to local clients

safe lintel
#

its in combination with the netcode package?

ocean tundra
#

i guess i could run a headless unity

#

na custom netcode

#

made mainly for stragety/rts/management type games

#

managed to network the unity Boids sample the other day, 8k unoptized boids flying round ๐Ÿ™‚

safe lintel
#

nice, after making an fps id love to make a simulation game of some sort

ocean tundra
#

well message me when you do, if you want networking

#

im building more samples and stuff then i want to find some 'beta' users

#

but also one of my friends has started talking game ideas, and i kinda want to try build a prototype using the networking library

safe lintel
#

probably be forever at the rate of things ๐Ÿ˜ฉ

ocean tundra
#

haha yea same here ๐Ÿ˜›

#

have you done much with custom worlds

#

a big part of the idea depends on sub worlds
Think spaceship RTS with Capital ships having a internal simulation world

#

so i need a nice way to link worlds together (parent server world has captial ship entities which contain a sub internal world)

coarse turtle
#

I don't really want to start figuring it out lol

ocean tundra
#

yea i do that

#

its aweful ๐Ÿ˜›

#

when you create a new world you can give it a name

#

so inside the ICustomBootstrap i do if (worldName.StartsWith("Server)) or client

#

i hate it

#

we should be able to pass a object in with the world creation, so we can pass any setting we like

safe lintel
#

ive done zero custom world stuff, I dont want to touch manual system ordering or anything like that, too much cognitive load ๐Ÿฅฒ

ocean tundra
#

yea i get that

#

you can trigger the defult system ordering somehow. something like World.Sort or SystemGroup.Sort

#

but yea custom worlds are painful

#

im really on the fence, i 'might' be able to hack at phyics and things so that it can all exist within the same world

#

but additional worlds seem so much cleaner

#

what i want todo is create a world, store it in a component (and NOT add it into unitys auto world update) then when the server updates, dynamicly update the sub worlds (with optmizations like only update 1 sub world per frame, ect)

#

but i also need to find a nice way to sync data between them, maybe passing around a ECB?

#

meh, all random ideas ATM, i need to get hybrid entities working in my netcode first

coarse turtle
#

Did you disable automatic initialization for your worlds?

ocean tundra
#

No I leave it on

#

And unity creates the default world

coarse turtle
#

Ah - yeah I'm looking to turn that off

ocean tundra
#

Then from that I trigger additional worlds

#

There's a define you can add

#

Something like, disable world initialization or something

coarse turtle
#

yeah something like that

sage mulch
#

Converted to decimal, those bits should become 3963910912 in decimal

#

oh huh

#

they're reversed

#

should have checked that first

#

is that normal for this kind of bit struct?

#

Guess I was treating it too much like an array

ocean tundra
#

no clue

#

ive been bitpacking manually

sage mulch
#

As in, not using these provided structs?

ocean tundra
#

yup

sage mulch
#

got it, i'll have to look into that

ocean tundra
#

that way i can get my sizes a bit smaller

sage mulch
#

that makes a lot of sense

#

i only need 26 bits

ocean tundra
#

ill see if i can find the link

#

here

#

26 is annoying

#

you cant really save there

#

smallest we can pack into is a byte

sage mulch
#

yep that was my thoughts too lol

#

thanks for the link tho

#

i'm sure it will come in handy later

ocean tundra
#

which is 8 bits (8 values) so 26/8 = 3.25 and you need to round up so 4

#

same size as a that 32 bit field

#

๐Ÿ˜›

#

out of interest what are you bit packing?

sage mulch
#

neighbors for a voxel

#

trying to determine a certain kind of shape for a voxel based on its neighbors

#

just need a flag for whether a neighbor is solid or not, and in my case there are 26 "neighbors"

ocean tundra
#

ok cool

#

you sould def look at that link then

#

you could probably bit pack something else into the spare 6 bits

#

you can fit 64 numbers in that

#

maybe enough for voxel type?

sage mulch
#

ooh i like that a lot

#

thank you

#

first comment is by another Liam ๐Ÿ˜‚ must be a sign

ocean tundra
#

tho 64 block types is kinda low

#

but if you added 1 more byte you get a TON of numbers

sage mulch
#

tru

ocean tundra
#

like 16k

#

๐Ÿ˜›

#

that feels like 2 many

#

lots of cool things you can do with bit packing

#

how many voxels can you fit in a entity/chunk?

#

when i was 'planning' voxels out i could almost get 16*16*16 in

sage mulch
#

same so far altho i haven't really messed with it

#

tbh i'm not worried about size at this point, more trying to get my mesh generating correctly hahaha

#

i've been jumping around with differing methods, marching cubes, wave function collapse, brute force lol

#

none of them completely fit but im back with just writing out each case manually

ocean tundra
#

๐Ÿ˜›

#

you should worry a bit about size

#

if 1 entity ends up being bigger then a chunk you will have errors

#

which is 16kb

sage mulch
#

that's a good point

sharp flax
#

I got a math static class for jobs, which exclusively uses Unity's math library. I don't need to add the burstcompile attrib on that class right? it'll be burst compiled already as long as the job using those methods is tagged with burstcompile

north bay
#

Ye

jaunty herald
#

Are tuples supported in burst jobs nowadays?

#

It doesn't see to be throwing an error for me on compilation

solid rock
jaunty herald
#

Yeah, burst does not support structs with auto layout

solid rock
#

ah

jaunty herald
#

Or it didnt use to

#

Not sure if there is now some magic going on in the background or something

north bay
#

Support for them got added in 1.5 if I remember correctly

safe lintel
#

anyone know if you can use setcomponent with a nativearray of componentdata? in a similar way to instantiating with a nativearray?

robust scaffold
robust scaffold
ocean tundra
#

๐Ÿ˜›

safe lintel
#

im talking about a batch operation rather than reading and writing every element in a loop

robust scaffold
#

I really wish there was. Makes my entity creation a lot simplier but instead a we need to use a bunch of foreach.

safe lintel
#

yeah the comparison of entity creation in the best practises highlights instantiation optimization, but then after that for setting or adding components I guess theres just nothing?

robust scaffold
#

You can probably make an extension function but it'll just be a foreach loop rather than something bursted.

safe lintel
#

was hoping I was overlooking something

robust scaffold
#

Yea, it's nothing at all. Incredibly annoying to type out var entity = entityManager.CreateEntity(typeof()); and then entityManager.SetComponent(entity, new()) every single fucking time.

#

If I could burst populate then burst set entity components, what would be amazing. But no.

ocean tundra
#

i would like a batched version of the ECB

robust scaffold
#

Welllll, I could technically using an unmanaged system. But that's even more pain.

ocean tundra
#

many of those methods have batch versions on entity manager

#

that looks like what your after

safe lintel
#

ahh

robust scaffold
#

That's add component. Will error out if you already have that component on the entity

safe lintel
#

oh my other caveat was like to do this with a native array of entities

#

lol

robust scaffold
#

There's no equivalent SetCompnent(EntityQuery)

ocean tundra
#

like 2 native arrays? one of entitys and one of data

#

hmm annoying theres no set component version

#

thats kinda dumb

robust scaffold
#

Thank unity

#

I mean, you can do it technically using a ForEach()

ocean tundra
#

you could probably do the asmref trick and add your own to entity manager

safe lintel
#

something like that, like you use entitymanager to instantiate a nativearray of entities, then also add component on that subsequent resulting batch entities but not the entire query?

ocean tundra
#

as the code must exist within that AddComponent version somewhere

robust scaffold
#

Maybe the Tag should have a single int called Index which corresponds to the native array index.

ocean tundra
#

yea i kinda have that pattern too,
My prefabs get a tag added to them in conversion,
Runtime i have a WithAll<TAG> ..... then ECB.RemoveTag

#

so i can do my 'init' logic

robust scaffold
#

Then use that tag index to sample the native array, get the component data from the NA, then write to the actual entity. Then outside the ForEach or using a ECB, remove the tag. That's what I do with some of my logic.

#

Not the best, I prefer to set the component data at instantiation. Get the data array first then create the entity.

safe lintel
#

thanks, will have to experiment but seems like there should be a more obvious and direct way

ocean tundra
#

yup

#

the whole ECB/EntityManager api needs some love

#

its 'good'

#

but could be so much better

robust scaffold
#

I wouldnt say "good". It works but has so much boilerplate.

#

Probably because it isnt built into the core of C#, rather working around with the limitation of the language.

#

If it could be as easy as object creation and setting, that would be amazing.

ocean tundra
#

maybe some super fancy code gen could get us there

#

but since we have to use structs i dont think it will ever be like object creation

#

Also which sounds better:
Arc Networking
OR
Arc Multiplayer

robust scaffold
#

Sounds more professional

safe lintel
#

agreed

ocean tundra
#

Sweet ty

ocean tundra
#

ok, so how do we kill off companion/hybrid components?

#

im adding support for hybrid to my networking BUT i only want them to be for the client world, server world should remove/disable all hybrid components from its entities/prefabs

#

last i looked at this CompanionLink was private/internal

#

and it still is ๐Ÿ˜ฆ

coarse turtle
safe lintel
#

ah finally resolved my gc issues with compute buffer, so at long last my use of drawmeshinstancedindirect doesnt trigger gc constantly allocating buffers!

ocean tundra
#

very nice

#

@coarse turtle Yea i think i just need to remove the component, not sure if it works but will test shortly

#

hopfully it removes the GO too

#

so remove component does NOT actually remove the GO/delete the component

#

and because CompanionLink is internal destorying the GO myself causes things to break

ocean tundra
#

ewwww ๐Ÿ˜›

#
        {
            _serverSpritesQuery = GetEntityQuery(typeof(SpriteRenderer));


            _type = Type.GetType("Unity.Entities.CompanionLink, Unity.Entities.Hybrid, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null");
            _componentType = (ComponentType) _type;
        }

        protected override void OnUpdate()
        {
            Entities.ForEach((Entity e, SpriteRenderer sr) =>
                {
                    GameObject.Destroy(sr.gameObject);
                })
                .WithoutBurst()
                .Run();
            
            EntityManager.RemoveComponent(_serverSpritesQuery, _componentType);
            EntityManager.RemoveComponent<SpriteRenderer>(_serverSpritesQuery);
        }```
light mason
#

What happens to DOTS audio

robust scaffold
light mason
#

What ?

#

@robust scaffold

#

Do you have a post or blog I can read

ocean tundra
#

@light mason Its not dead, just no updates/news/progress

light mason
#

O ok

#

Ty

ocean tundra
#

it 'could' be dead

#

๐Ÿ˜›

light mason
#

Lol

ocean tundra
#

but i expect thats unlikly

#

just not the focus of the DOTS team atm

gusty comet
#

hello

#

there are 2 sets of entities under different parents, can they be in same chunks?

#

theyre same type

ocean tundra
#

Yea they will be in the same chunk

gusty comet
#

ah nice

gusty comet
#

i thought theyre amount of chunks but prob not cause

#

one chunk has just scene in it and it displays big number

#

also is Schedule actually faster than scheduleparralel?

#

reaching more fps with schedule but i cant tell

karmic basin
gusty comet
#

can you get entity by its index?

#

from entity manager

#

or by its name

#

some fast way?

#

i know i can iterate by each entity in monobehaviour => get some component => gread value

#

but its probably slow

#

by the way i am trying to do this so i can get entity in some optimized manner from mb instead of looping through thousands of entities and checking if name matches

#

Lol

mint iron
#

Could you search for it by the presence of a component, ForEach ? entity index is not going to be reliable.

gusty comet
#

what if you stored entities in list List<entity> at start of the game?

#

will that list be reliable

#

eg will it not be corrupted later

#

if entities move to diff chunks or whatever

deft stump
#

yes that list will still be reliable

#

since their ID's won't change

gusty comet
gusty comet
north bay
#

What do you mean with reliable? As long as the entity exists the Entity struct will point to the same instance

gusty comet
#

i dont know what he particularly means

mint iron
#

i just mean that its a runtime variable, its going to change when working with SubScenes/Conversions, it could be deleted elsewhere, moved around as you build things out. Its fine for super temporary lists that you're needing to cache to pass into subsequent steps but id limit it to that. The entire thing is built around querying by component existence (and optimized for it), if whatever entity you need has a specific component then you don't have to care if the entity exists.

pliant pike
#

I don't suppose anyone knows the best way to check whether a singleton entity exists in a monobehaviour?

karmic basin
#

Build an EntityQuery in your MB then .CalculateCount() or smthg like that ?

pliant pike
#

yeah exactly what I'm doing, just wasn't sure if there was another better way, thanks

gusty comet
#

I used to think that rendermesh changes chunk only if you change mesh, cause its SharedMeshComponent, but now i noticed theres other values too in that component

        public Mesh mesh;
        public Material material;
        public int subMesh;
        [LayerField]
        public int layer;
        public ShadowCastingMode castShadows;
        public bool receiveShadows;
        public bool needMotionVectorPass;

        public bool Equals(RenderMesh other);
        public override int GetHashCode();

is the chunk changing mechanism triggered by change of any of the above? or is it just about mesh

#

thats quite limiting haha

#

i thought ill use same meshes with different materials but guess not

bright sentinel
#

@gusty comet Pretty sure, but the thinking is that the RenderMesh changes rarely, so it's not really an issue

#

You could create some batching system if it's becoming too big of an issue

gusty comet
#

yeah but the more meshes/materials the more chunks

karmic basin
#

sadly yeah. 2 alternatives that should be more performant atm (leveragaing the GPU) would be Graphics API .DrawInstancedMesh or smthg like that or compute buffers

frosty siren
#

Guys, Entities 0.17 changelog no more fixed in forum title. Can it be preparation for updates? ๐Ÿ‘€

gusty comet
#

drawinstancedmesh are painful to setup and my meshes will be moving anyway

#

so i made them dots/ecs instead of Mono xD

gusty comet
frosty siren
#

As i can understand what is written by MartinGram, 0.17 version and next releases are compatible with only 2020 LTS. Why no updates for whole year?

gusty comet
#

yeah thats what i mean

#

no updates if u use newer unity

#

its kinda funny, you have to choose between up to date unity and up to date dots ๐Ÿ˜›

frosty siren
#

Today, the situation makes "Unity" name more ironic than ever

#

For now whole my project is written with Entitites and i can't be with modern cool guys on 2021, so i only can wait for shiny 0.18

gusty comet
#

damn do you have any screens? of project

#

ive made only world as entities

#

rest is monobehaviour

frosty siren
#

As console says by error message i can't use SetComponent<T>() and can't use writable ComponentDataFromEntity if there is the same type in ForEach lambda expression.
Is there a way to write to component in this situation?

gusty comet
#

cant imagine converting everything to entities ๐Ÿ˜›

frosty siren
gusty comet
#

oh ok im writing some mono-entity interaction framework right now, for the world. mainly stuff like discarding models if player is too far, or changing planet LoD. planet and models are entities, but player is mono

#

what is rendermesh.submesh int value for?

gusty comet
#

does SetComponentData overwrite whole data with new default struct values? + the change you specified. or does it only add the change to already existing data

bright sentinel
#

@gusty comet It overwrites it

#

But if you just get the component, change the value in the component you get, and then set it back it will be just that value

gusty comet
#

oh ok thx

#

any elegant way to store children of entity? i use protected override void OnStartRunning()

#

but theyre not converted yet so acessing child buffer results null

undone delta
#

Beginner at ECS here, im tryiung to setup cinemachine with ECS right now but its not working
im using the conversion workflow

#

player will be converted into an entity

#

i thought there would be some sort of bridge for senarios like this

robust scaffold
undone delta
#

i actually found a tutorial ๐Ÿ˜…

#

but im still gonna move the player via ECS systems

#

just the camera stuff in Mono

frosty siren
#

Why NativeMultiHashMap has SetValue() and NativeHashMap don't ๐Ÿ˜ฉ

solid rock
#

It's for replacing the current value in the iteration

#

I guess you want a method to replace the current value?

frosty siren
#

yes

solid rock
#

You can

frosty siren
#

I have ended up with Remove + Add

solid rock
#

You just use the indexer

#
myNativeHashMap[key] = value;
frosty siren
#

thank you. i didn't see indexer in haspmap

solid rock
#

This mirrors the api of System.Collections.Dictionary

#

documentation is not the best - as it just says "retrieves a value by key" but you can see it has both get and set defined

robust scaffold
karmic basin
#

It's still experimental so it's expected that documentation is not top-level

gusty comet
#

am I getting

#

world or local value by reading translation.Value

amber flicker
gusty comet
#

should ECB only be used from within job or can be called from monobehaviour too

gusty comet
frosty siren
#

When i want to use some struct defined in system inside scheduled lambda i need to cache it in OnUpdate like this

public class MySys : SystemBase
{
  private SomeStruct _someData;

  protected override void OnUpdate()
  {
    var someData = _someData;

    Entities
      .ForeEach((...) => 
      {
        ...
        if(someData.value ...)
          ...
        ...
      })
      .Schedule();
  }
}

Is there cleaner solution?

gusty comet
#

yeah that looks pretty ugly

frosty siren
#

even more when i have 3 archetypes, some ComonentTypes and other struct data

bright sentinel
frosty siren
worldly pulsar
#

What problem do you see with storing ComponentTypes/Archetypes etc inside systems?

frosty siren
#

are you asking Bmandk?

worldly pulsar
#

both of you tbh ๐Ÿ™‚

#

same for "SomeStruct" if it's persistent data internal to the system

frosty siren
#

I see no problem to store data in system if talking about concepts. But it leads to heavy boilerplate code

gusty comet
#

ive discarded my well optimized monobehaviour based world system for the sake of dots, i wonder if it will result in better performance in the end

bright sentinel
bright sentinel
#

By also storing the data in the entity, you also fulfill the age-old saying of separating data and behaviour

#

Sure, you have to write one or two extra lines of code to retrieve the data in that isolated system, but if you ever want to access that data in the future, then you're already set to do it much easier

gusty comet
#

then you get copy of that data in every entity though

#

that can be like 4000 copies

bright sentinel
#

No you don 't

#

Why would you copy the data to other entities?

worldly pulsar
#

if you want to do this you should have a singleton entity with that data as a component

bright sentinel
#

Yep

gusty comet
#

i dont see issue with

#

storing temporary local variable in OnUpdate

bright sentinel
#

The Overwatch devs did exactly what I'm advocating for here
https://www.youtube.com/watch?v=W3aieHjyNvw

GDC

In this 2017 GDC session, Blizzard's Timothy Ford explains how Overwatch uses the Entity Component System (ECS) architecture to create a rich variety of layered gameplay.

Register for GDC: https://ubm.io/2yWXW38

Join the GDC mailing list: http://www.gdconf.com/subscribe

Follow GDC on Twitter: https://twitter.com/Official_GDC

GDC talks cover...

โ–ถ Play video
#

They used to store it in their systems

#

But for good reasons, they went to singletons

worldly pulsar
#

I'd still argue for doing the simplest thing that works, and modify when needed (i.e. store your internal system config stuff in the system). Especially for things like caching queries/archetypes/componentTypes (if it was possible to store them in the ECS), because this is strictly an optimisation (you can just recreate the archetype every OnUpdate) and querying the entity system gives you nothing.

#

If you expect that piece of data to be needed in other systems, by all means store it in a singleton

#

but don't add complexity for the sake of dogmatic "don't store data in systems"

slim nebula
#

i think this debate is taking longer than adding 20 singletons

#

XD

#

get yo snippets on

bright sentinel
#

I mean, I can link tons of forums, blogs etc that advocate for separating data and logic. The only argument so far against it is because it's more convenient to write that code.

slim nebula
#

there's definitely an argument for being agile. dont do things you dont need

#

but separating data and systems is so important

#

and it's super quick

gusty comet
#

ive noticed something weird, my monobs were rendered with gpu

#

but entities with cpu

worldly pulsar
#

One quick question: do you consider things like Queries/ComponentTypes/Archetypes to be data?

slim nebula
#

no. that's logic to figure out what data to perform operations on

#

not unlike for (int i

#

yeah "i" is a variable but it's just like... not really data

bright sentinel
slim nebula
#

you may persist it as a variable, but that's not unlike a lambda

bright sentinel
#

And even if you don't need any specific data other than the types, I think you could also store the ComponentTypes

slim nebula
#

interesting

bright sentinel
#

But I also think it's quite rare that you're creating an archetype without any data anyways

worldly pulsar
#

Archetype is just an entity description

bright sentinel
#

So is a prefab, just with data

slim nebula
#

like even programatically generating an entity, you can still initialize it with a prefab then update it

#

you dont have to make it in code from scratch

gusty comet
#

soo is it normal that entities are rendered

#

with cpu and not gpu

#

omg

#

anyone knows

worldly pulsar
#

what do you mean as "rendered with cpu"

gusty comet
#

cpu usage increases when you look at entities and gpu stays the same

worldly pulsar
#

were your monobehaviours static vs entities dynamic? and what rendering system are you using?

bright sentinel
#

SUN?

#

? ๐Ÿ˜‚

amber flicker
gusty comet
#

thats with 100 entities

#

jumps to cpu 30ms+ and stays there sometimes

#

okay it was done by shadows

#

(decreasing the shadow distance from 30 meter to 10 meters solved the issue) but is that normal that shadows are calculated with cpu?

worldly pulsar
#

They are not, there is no software renderer in Unity. Something is putting more cpu pressure for some reason (data upload or culling if I had to guess? but may be anything). Make sure you are on Hybrid v2 and paste your frame profile

gusty comet
#

hybrid v2 not compatible with my shaders

worldly pulsar
#

Wait so you are on Hybrid v1 + built-in render pipeline?

#

Because that option was never really supported afair

#

and just worked by accident

#

Either way, there is no DOTS rendering system that doesn't rely on the scriptable rendering pipelines for performance

gusty comet
#

i planned to convert them somewhere along the way

#

but last time i attempted it wouldnt work

gusty comet
#

Has anyone ever encountered
Burst error BC1028: Creating a managed array `byte[]` is not supported?

#

I am declaring a static readonly Guid inside a class that extends SystemBase, assigning it to a variable in OnUpdate, and then using that variable in a Job.WithCode. The declaration of the Guid shouldn't be bursted yet Unity is complaining about it

safe lintel
#

change the array to a native array?

worldly pulsar
#

I think System.Guid is implemented with a byte[] inside

#

so using it at all inside Burst may be impossible

#

see the sources for System.Guid in the Mono repository and check the DOTS compiler window to see if it doesn't try to put a new byte[] anywhere inside the bursted section

safe lintel
#

entities has a Hash128 which I think should be burst friendly? may want to try that over guid

gusty comet
#

Hash128 sounds good! Thanks guys

#

@worldly pulsar According to https://github.com/mono/mono/blob/main/mcs/class/corlib/System/Guid.cs the code for creating a new Guid is ```namespace System
{
partial struct Guid
{
// used in ModuleBuilder so mcs doesn't need to invoke
// CryptoConfig for simple assemblies.
internal static unsafe byte[] FastNewGuidArray ()
{
byte[] guid = new byte [16];
fixed (byte *ptr = guid) {
Interop.GetRandomBytes(ptr, 16);
}

        // Mask in Variant 1-0 in Bit[7..6]
        guid [8] = (byte) ((guid [8] & 0x3f) | 0x80);
        // Mask in Version 4 (random based Guid) in Bits[15..13]
        guid [7] = (byte) ((guid [7] & 0x0f) | 0x40);

        return guid;
    }
}

}```

GitHub

Mono open source ECMA CLI, C# and .NET implementation. - mono/mono

#

So you're right, Guid cannot be used anywhere in bursted code

light mason
#

Anyone used DSPGraph?

#

Or know how to access spectrum data fast from a microphone?

gusty comet
#

@safe lintel I made my own Guid struct and put a Hash128 inside, which basically replaced all instances of the old Guid class in my project. Thank you so much!

#

Sometimes after script compilation the following exception is thrown, which causes the scene to lose all references to scripts upon clicking Play.

#

Manually triggering a recompilation corrects the script references, though it's very annoying and time consuming

warm panther
#

Is this the most effective way to remove a component from all entities that have it? (group is a EQ for just that component)

Does the EQ need ReadWrite componenttype or just ReadOnly or just a Desc with All = ... (what exactly?)?

_group = GetEntityQuery(                                 ComponentType.ReadWrite<TagBubblePhysicsRefresh>()
                                   );
worldly pulsar
#
  1. yes 2. doesn't matter afaik
warm panther
#

Thank you, @worldly pulsar

frosty siren
# bright sentinel Well, that sounds just like a prefab tbh

I see couple of problems.

When i use EntityArchetype to create entities i do it when i need no data, i mean when i can and want initialize entity from scratch.
Yes, i can use prefabs, this will eliminate the need for the system to have such data as EntityArchetype. But using Prefabs leads to increasing Archetype count, because PrefabTag creates unique entity description. I don't really know how much Archetypes is good to have, this is the question for me. But if i don't need data, why not do it for myself?
I have read your reply below about storing ComponentType as data and then construct entity from it. But can you set ComponentType from inspector? I think inspector can't do this for you. So you will need a code somewhere to initialise some singleton entity with some ComponentType data.

worldly pulsar
#

how much Archetypes is good to have
Last I checked having archetypes is essentially free (same for queries). Creating archetypes is somewhat costly (in the "don't do that every frame" sense) but other than that, having an additional archetype from a prefab is not something I'd worry about.

bright sentinel
# frosty siren I see couple of problems. When i use EntityArchetype to create entities i do it...

It's a good point about prefabs creating more chunks. As we discussed, you can use ComponentTypes, but you still need the data somewhere. If you really wanted to optimize that, you can store it in some blob asset, to make the entity count less. Your blob asset could also have the component types in there.

As for setting in inspector, I guess not by default. But it's not too hard to create an editor script that gathers all the component types you want through some reflection and creates an enum or something for it, and then displays those in your inspector.

bright sentinel
frosty siren
frosty siren
worldly pulsar
#

So if you have 100 of these they will take 1.5 MB. If they are actually useful to you (which I'd argue in this case they are not) it really isn't something you'll notice unless you are on a really old mobile

frosty siren
#

But maybe with ComponentType it will work

bright sentinel
frosty siren
#

Year ago i was trying to find solution to be able to have something like ComponentPreset which stores component with data, not just types. And using this you'll be able to add components to entity at runtime. I was need such solution to construct arbitrary entity at runtime. I ended up with codegen.
Also i think that i can trick with conversion workflow to inject components at runtime.

remote crater
bright sentinel
frosty siren
bright sentinel
#

If you continue and go into the packagemanager you might be able to downgrade directly

#

Otherwise you will have to find out which versions are compatible with 2020

#

Most of the info should be on the SRP or URP manual

frosty siren
#

@remote crater you can create empty project on 2020 and see latest versions of your packages

bright sentinel
#

10.4.0 is the latest compatible versions

#

I'd recommend just going to the manifest and changing it there

frosty siren
#

If i use DynamicBuffer in lambda and use GetBuffer inside lambda with the same type console tells me that i can't use writable access to buffers with same type.

My case: I use IngredientElement : IBufferElementData to represent what ingredients player has at the moment, and also i use same IngredientElement to represent required ingredient for recipe.

Is there something like DisableNative...WhateverToBeHappy ? Or what do you do in such cases?

worldly pulsar
#

What I'd do is use IngredientInInventory and IngredientRequired structs as buffer elements, but if you guarantee the buffer on player is never the same as the buffer on requirements then I think it's [NativeDisableParallelForRestriction] Entities.WithDisabledParallelForRestriction()

#

(I assume the IngredientElement has some kind of ingredient ID so duplicating these is not a problem)

bright sentinel
#

But it might be ParallelFor as @worldly pulsar said

worldly pulsar
#

uh, wait, the ForEach syntax has Entities.WithDisabled..., not an attribute

bright sentinel
#

Yeah that's what I meant ๐Ÿ˜„

frosty siren
#

Thanks for answers, will try ๐Ÿ™‚

remote crater
#

oh i had no clue what that meant. Thanks guys.

warm panther
#
var patched_filter = collider.Value.Value.Filter;
patched_filter.GroupIndex = bubble.id;
var cv = collider.Value;
var cvv = cv.Value;
cvv.Filter = patched_filter;
                                                          Debug.Assert(collider.Value.Value.Filter.Equals(patched_filter), "This assertion fails. Why?");

I'm struggling with setting a collision filter on an existing collider. This used to work (possibly by coincidence through case 0), so now I added the assertion and it always trips.

worldly pulsar
#

is any of cv or cvv a struct type?

#

because then you are overriding a copy

warm panther
#

BlobAssetReferences are apparently structs.

#

But... its value is a ref.

#

And I am changing the object at that ref.

#

Man those chains of structs... and abstracting away everything behind a BARef is just so difficult to debug.

remote crater
#

I actually feel confident I can finally make a standalone.

worldly pulsar
#
patched_filter.GroupIndex = bubble.id;
var cv = collider.Value;
ref var cvv = ref cv.Value;
cvv.Filter = patched_filter;
                                                          Debug.Assert(collider.Value.Value.Filter.Equals(patched_filter), "This assertion fails. Why?");```
I think it should work this way, because `cvv` in your version is a copy and the `Filter` setter takes the `this*` and does magic with it... but the copied Collider has this* pointing at the stack
warm panther
#

But the functionality behind it doesnt work, so there is still something off.

#

(i.e. the collisions aren't detected)

worldly pulsar
#

I'm actually not sure var cvv = cv.Value is even valid, because they assume C++ style data layout, where there Collider is just a header and they expect there to be more data in memory after it

warm panther
#

collider is a PhysicsCollider componentdata

#

Looking at some ways people on the forums use to set collision filters, this seems to be a surprisingly convoluted topic.

#

collider.Value.Value.Filter = patched_filter;My old code was this.

#

Ok that passes the assertion, too.

#

Weird.

#

Well, not weird.

worldly pulsar
#

this should be equivalent to my version (with ref)

warm panther
#

I think maybe BuildPhysicsWorld doesnt pick these up then. There IS a bug in Unity ECS that I found and that got confirmed, but my new code is much simpler so that shouldn't trigger.

#

But in IsCollisionEnabled in Unity.Physics, the collision filters aren't properly updated.

worldly pulsar
#

Is updating those blob assets at runtime even supported? (I barely ever use Unity.Physics)

warm panther
#

It is.

#

hoo

#

good question though as to what extent

gusty comet
#

Hey, I'm having trouble using Unity.Mathematics.random. I'm initializing a global random to be used by static variables like this
public static readonly MyGuid = /* code that uses the global random */
It has to be Unity.Mathematics,random, otherwise it won't be burstable. However, I keep getting the same generated value in all the classes that call the code that uses the global random. Anyone knows how to make each call to nextInt alter the global random's state?

#

I seeded it with a constant integer of 1

#

The random generator code is ```public static class RandomGenerator
{
private static readonly uint SEED = 1;

public static Random GenerateThreadSafeRandom()
{
    return new Random(SEED);
}

public static Random GenerateMainThreadRandom()
{
    var ticks = (uint)System.DateTime.Now.Ticks;
    var nonZeroTicks = ticks == 0 ? 1 : ticks;
    return new Random(nonZeroTicks);
}

}

#

And the Guid code is ```
public struct Guid : IEquatable<Guid>
{
private Unity.Entities.Hash128 hash;

private static readonly Unity.Mathematics.Random RANDOM = RandomGenerator.GenerateThreadSafeRandom();

public bool Equals(Guid other)
{
    return hash.Equals(other.hash);
}

public override int GetHashCode()
{
    return hash.GetHashCode();
}

public static Guid NewGuid()
{
    return new Guid
    {
        hash = new Unity.Entities.Hash128(RANDOM.NextUInt4())
    };
}

}

#

An example call to NewGuid() would be

public class SomeSystem : SystemBase
{
     public static readonly Guid SOME_GUID = Guid.NewGuid();
}
worldly pulsar
#

You don't have a global rng, you have a static method that returns a copy of the same rng each time it's called

#

i.e. every time you call GenerateThreadSafeRandom() the resulting rng will produce the same sequence of numbers

gusty comet
#

That's weird because the Guid class stores a single result of GenerateThreadSafeRandom()

worldly pulsar
#

and i think the RANDOM in your guid doesn't work because it's readonly

#

so the compiler generates a copy before calling methods on it

gusty comet
#

interesting, thanks for the info, I'll test things out

#

shucks, removing the readonly causes burst compiler to complain

#

This all stems from my trying to use SOME_GUID in jobs

#

Sorry that my use case is so convoluted ๐Ÿ˜…

remote crater
gusty comet
#

I tried caching the private static readonly Guid in a local variable in OnUpdate outside of the ForEach, then using the local variable inside of the ForEach. Burst still thinks that I'm trying to directly load from a non-readonly static field

remote crater
#

UnityEditor.Experimental.SceneManagement

#

Instead of the old SCenemanagement

warm panther
#

@worldly pulsar The code did work, the problem was the following:

  • I had custom code depending on this, a change to DOTS Physics that interprets the GroupIndex field differently (like a layer)
  • the way Physics determines compound collider collisions is by checking the union of the colliders first; that caused the value to be written to 0 (which is the most inclusive GroupIndex in the default behaviour) again and then further checks just not done.
  • I do not know why a simple capsule is a compound collider but ok ๐Ÿ™‚

Learned something here...

#

Solution was to set GroupIndex of compound colliders to -1 (or any other value that can't occur naturally), and then for that case to check if the Belongsto/collideswith bits overlap, and return true if so.

remote crater
#

So I was able to port my DOTS/ECS project down to 2020, yet still on standalone, it has different execution behavior than in UNITY Editor as seen here: https://youtu.be/ChOdL0pOCWc Any idea why?

If you like what you saw, please sub for more. It helps me. It may help you, but I make no promises!

You can also come to like the only positive zone of the Internet I know: www.twitch.tv/goodnewsjim The Bro Zone Layer.

Temporary offer for anyone of any skill level: Can someone contact me to promote my game? www.starfightergeneral.com I'll gi...

โ–ถ Play video
crude sierra
#

Hey guys, when using entities, the only way to detect collision is with physics bodies? or is it still possible to use collider components?

flat agate
#

Hey guys, is it possible to have a native array with a array inside? im trying to create parallel jobs and i wanted each job to give me a float array

solid rock
#

Do you know how big the result array will be for each job?

#

or it's dynamic?

#

If it's dynamic - you could try using NativeMultiHashMap so each job can write into its own key.

#

If you know ahead of time how many results each will give, just use a NativeArray and have each job write into a segment of the array

flat agate
#

thanks again for the help, i know ahead of time how many results each job will give, the thing is and correct me if im wrong but when using parallel jobs i need to use NativeArray to store each result of each thread

#

so like 3 threads working at the same time so the native array would have a size of 3

#

but im still super new to jobs so this might be wrong

solid rock
#

You can use a single NativeArray of resultCount * number of iterations

#

your job doesn't need to correspond to the number of threads

flat agate
#

Yeah that might work

solid rock
#

If you use IJobParallelFor you get an execution index

#

so let's say you need to do a job on 20 elements

#

and each job has 5 floats as a result

flat agate
#

so index * array size

solid rock
#

then you make a NativeArray of 100

#

yeah

flat agate
#

Thanks i wouldnยดt get there myself

solid rock
#

and then for each job you write results to to executionIndex * resultSize, so index * 5 through index * 5 + 4

#

so the first job would write to 0-4, the second to 5-9 and so on

bright sentinel
flat agate
solid rock
# flat agate Yeah im gonna give it a try thanks.

You'll need to use [NativeDisableParallelForRestriction] in your jobs or the safety system will be upset with you writing to indexes that are not the same as the execution index, assuming you're using IJobParallelFor

#

Just a heads up

remote crater
flat agate
#

aside from that i think everything will workout ok

bright sentinel
solid rock
#

For example here's one of mine

flat agate
#

Thanks again

remote crater
#

Bmandk, so wait, "use open scenes" doesn't actually register em for dots, but works for MONO?

remote crater
#

Bmandk, I don't think that is the case. My scene loaded and played fine.

#

Its just when I enter DOTS/ECS mode, it crashes.

#

So I tried your mode and manually added a scene.

#

Still same behavior, crashes on DOTS/ECS play mode.

#

Is DOTS/ECS not supported in 2020LTS either?

slim nebula
#

I know "use open scenes" does not do nested subscenes. not sure if there are other issues. I had to all all my scenes and subscenes for it to work. not sure what the deal is exactly

#

2020LTS is the main version that dots is supported in

#

@remote crater

remote crater
#

I have no subscenes

#

I just have a scene

slim nebula
#

o

remote crater
#

I can screen shot my build options

#

Maybe I'm missing a build flag?

slim nebula
#

what does the log say? what's causing the crash?

remote crater
#

Let me see, I never looked at a log file before.

#

Where is the log located. Seems like there is none.

slim nebula
#

it should be in appdata. i forget if it's local or roaming, but then it'll be your company name or game title in there or something

remote crater
#

kkk

slim nebula
#

I... can't find mine... I dunno rofl

#

it's somewhere!

#

haha

#

google should be able to help

remote crater
#

I found it, but can't understand it

#

Apparently it is saying certain things are null which aren't in the actual editor version.

#

Is it possible order of operations gets changed?

#

Cuz I convert to entity to a singleton for reference using hybrid mono/dots which people say you should do.

slim nebula
#
NullReferenceException: Object reference not set to an instance of an object
  at Unity.Collections.LowLevel.Unsafe.UnsafeUtility.InternalCopyStructureToPtr[T] (T& input, System.Void* ptr) [0x00001] in C:\buildslave\unity\build\Runtime\Export\Unsafe\UnsafeUtilityPatched.cs:42 
  at Unity.Collections.LowLevel.Unsafe.UnsafeUtility.CopyStructureToPtr[T] (T& input, System.Void* ptr) [0x00001] in C:\buildslave\unity\build\Runtime\Export\Unsafe\UnsafeUtilityPatched.cs:36 
  at Unity.Entities.EntityDataAccess.SetComponentData[T] (Unity.Entities.Entity entity, T componentData) [0x0003a] in D:\unity\unity projects\starfighterclient - Copy (2) - Copy\Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities\EntityDataAccess.cs:1017 
  at Unity.Entities.EntityManager.SetComponentData[T] (Unity.Entities.Entity entity, T componentData) [0x00008] in D:\unity\unity projects\starfighterclient - Copy (2) - Copy\Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities\EntityManagerAccessComponentData.cs:50 
  at Controls.FixedUpdate () [0x0028a] in D:\unity\unity projects\starfighterclient - Copy (2) - Copy\Assets\Scripts\Player Scripts\Controls.cs:1600 ```
remote crater
#

Nulls everywhere man

slim nebula
#

D:\unity\unity projects\starfighterclient - Copy (2) - Copy\Library\PackageCache\com.unity.entities@0.17.0-preview.41\Unity.Entities\EntityDataAccess.cs:1017

remote crater
#

But it isn't the case in editor version.

#

Thats a core package.

slim nebula
#

oh sorry whoops read it wrong

#

D:\unity\unity projects\starfighterclient - Copy (2) - Copy\Assets\Scripts\Player Scripts\Controls.cs:1600

remote crater
#

oooh!

#

That helps!

slim nebula
#

I find that because the release build runs faster the initial order of system is sometimes different in a build than in unity

remote crater
slim nebula
#

might need to add some before and after attributes

remote crater
#

OOOOH so that IS THE PROBLEM! AS I expected, Unity has no set order of operations

#

That's terrible design, but I can hack it to make it work maybe

#

That's really good stuff to know bro.

#

DOTS/ECS is awesome otherwise, their stock is gonna rocket when this is done.

#

So that log file, is there a way for my debug.log statements to show up in them. This could help me find the order of operations in my editor vs standalone.

slim nebula
#

they do

#

they're there

remote crater
#

oh yeah I see em now

#

I thought I had more

#

TY. Ok, gonna get dinner, and theorize how to do this.

#

Should be as easy as just putting Debug.Log before every entity call

#

which I only have about 20

#

Thanks coder bro.

#

Remember if I make it big, ask me for a Manilla Enevelope ๐Ÿ™‚

slim nebula
#

assuming that doesn't make a system take so long that the order changes again after you remove the debug statement XD

#

but good luck

remote crater
#

Well in order to avoid race conditions, I could have a pacer variable

#

Don't run this unless > x

slim nebula
#

you can just use UpdateBefore and UpdateAfter attributes on the systems to enforce order

remote crater
#

I've dealt with should be racer condition hell with that decades ago.

#

TY, I book marked that.

normal scarab
#

Hey guys is minmax ai a common use case for dots?

#

Or any kind of state space search

#

It's a bottleneck for my game and I'm wondering if I should invest in writing a dots solution/find one online

robust scaffold
robust scaffold
normal scarab
#

Hmm yeah this kind of high level decision making was the only result I could find too

#

I've only scratched the surface of dots so I'm probably not gonna try it if there are no examples of it being done but lemme know if anyone has any ideas

light mason
#

Anyone use DSPGraph

frosty siren
bright sentinel
frosty siren
#

i'm not quite understand how

bright sentinel
# frosty siren i'm not quite understand how

Something like

OnUpdate()
{
  SomeBuffer yourBuffers = GetBufferFromEntity<SomeBuffer>(Allocator.TempJob);
  Entities.WithNativeDisableParallelFor(yourBuffers).ForEach((Entity entity, SomeData someData) => {
    var buffer1 = yourBuffers[entity];
    var buffer2 = yourBuffers[someData.someEntityReference];
  }).Schedule();
}
#

Does that make sense?

frosty siren
#

oh, ok, i've got it

bright sentinel
#

@frosty siren You might also be able to use the "new" syntax, with GetBuffer to replace most of it.

#
OnUpdate()
{
  Entities.ForEach((Entity entity, SomeData someData) => {
    var buffer1 = GetBuffer<SomeBuffer>(entity);
    var buffer2 = GetBuffer<SomeBuffer>(someData.someEntityReference);
  }).Schedule();
}

Although I'm unsure if the disable thing gets added automatically with that or not

frosty siren
#

I already use new syntax everywhere, but it leads to this problem

frosty siren
bright sentinel
#

@frosty siren Yeah, but that's why you don't have the dynamicbuffer as part of the ForEach, but use the BufferFromEntity type instead

#

Oh, I also mistyped I guess.

frosty siren
#

WithNativeDisableContainerSafetyRestriction works

bright sentinel
#

SomeBuffer yourBuffers = GetBufferFromEntity<SomeBuffer>(Allocator.TempJob); should be BufferFromEntity<SomeBuffer> yourBuffers = GetBufferFromEntity<SomeBuffer>(Allocator.TempJob);

#

But good that it works ๐Ÿ˜„

frosty siren
#

LOL. I could use BFE for entity in ForEach instead of pass DynamicBuffer to query. Little overhead and so less problems

#

Simple things sometimes pass my head

crude sierra
#

hey guys, let's say some of my project is classic unity and I want to only implement ECS in one system. however, that system is linked to the other systems in the game. How do I do the conversion without worrying too much of it breaking other things? I'm currently trying the Convert And Inject Game Object on my entity, but changes to the entity don't reflect back on the gameobject (such as destroying the entity, does not destroy the related game object)
where can I read of the best way to do this, or do I need to convert the entire game to ECS for this?

frosty siren
# crude sierra hey guys, let's say some of my project is classic unity and I want to only imple...

No, you can ship your game to dots partially. Convert And Inject Game Object will just add all components from gameobject to entity as ComponentObject, and you will be able to access GO's components from ECS systems. But by default this kind of conversion do no sync for gameobject<->entity. If you want to sync positions, you can use CopyTransformToGameObject/CopyTransformFromGameobject/etc. But there is no built in way to sync destroying for injected gameobject, you must create something by yourself.
Convert and Destroy will just destroy gameobject after conversion, but all GO's components that used in GameObjectConversionSystem.AddHybridComponent(Component) will appear on new gameobject which will be completely linked to entity (means sync position, destroying, creating). For example by default, if you use HybridRenderer, SpriteRenderer component will be added as Hybrid in case of use Convert and Destroy. AFAIK it called Companion, when gameobject recreated and linked to entity during conversion. Using companions very simple, but it has downsides.

crude sierra
frosty siren
#

can you please refer to section you're talking about?

crude sierra
frosty siren
#

To sync destroying?

crude sierra
frosty siren
#

Conversion systems only works when conversion happens. If your game perfectly uses dots, then conversion wont be needed at runtime. So to destroy gameobject, you have to

  • Cache entity destroy event (maybe SystemStateComponent can help)
  • Access to related gameobject
  • Destroy gameobject manually (or reuse it ๐Ÿ™‚ )
crude sierra
crude sierra
gusty comet
#

is it possible to update variable of SystemBase ?

#

from MB

karmic basin
#

yes

#

from entitymanger you have a system getter

#

wrong, my bad. You access systems from World, not EM

gusty comet
#
World.DefaultGameObjectInjectionWorld.GetExistingSystem<GalaxySystem>().set
#

whats next though

karmic basin
#

World.DefaultGameObjectInjectionWorld.GetExistingSystem<GalaxySystem>().myPublicVariableInSystemScope ?

gusty comet
#

oh it was private thats why

#

thank you!

karmic basin
#

you're welcome, and another thing, check if it exists, just in case your MB Update() runs before your system

gusty comet
#

thats not needed for this particular case

karmic basin
#

should probably check if system was returned

#

oh ok ๐Ÿ˜›

gusty comet
#

i am submitting player transform to system, on player login

#

so the system can calculate distance from planets to player

karmic basin
#

Isn't it enough to have a system that queries player + its position components, and just instantiate the player prefab on login, and let the query in the system pick up the player position. Without having to set anything ?

#

that is to say, without setting position explicitely

gusty comet
#

do you know about this?

UnloadTime: 2.157500 ms
NullReferenceException: Object reference not set to an instance of an object
at Unity.Scenes.ResourceCatalogData.GetGUIDFromPath (System.String path) [0x00096] in <6d6849833010407eaf68aacfba8931a1>:0
at Unity.Scenes.SceneSystem.GetSceneGUID (System.String scenePath) [0x0000b] in <6d6849833010407eaf68aacfba8931a1>:0
at Unity.Scenes.GameObjectSceneUtility.AddGameObjectSceneReferences () [0x00034] in <6d6849833010407eaf68aacfba8931a1>:0
at Unity.Entities.AutomaticWorldBootstrap.Initialize () [0x0000c] in <666db234fd54498496918391b0314900>:0

#

in build only

karmic basin
#

yeah, check if system getter returned something before trying to set one of it's var ?

gusty comet
#

wait, this is something related to scenes

karmic basin
#

double check you included all scenes in build ?

gusty comet
#

do you compile differently for dots?

karmic basin
#

yup, from the build asset, not the classic build menu

gusty comet
#

i have all scenes

#

what is build asset? i dont have it faik

karmic basin
gusty comet
#

ohh

#

i get it now

#

i was reading this actually rn

karmic basin
#

๐Ÿ™‚

gusty comet
#

you know i dont use subscenes

#

uwu

#

wondering if it will bite me back

#

but in my game its important that you see things happening 1000 meters away

karmic basin
#

1km is okay you wont have floating point origin problems

gusty comet
#

these kind of problems start to appear after 5k-10k-40k

#

depending what kind of code you use

#

egg AddForce based gravity worked poorly even at 5k

karmic basin
#

yup

gusty comet
#

but i replced it with

#

raycast

#

and it worked fine until 40k

#

if i remember correctly

#

by raycast i mean snapping the player to planet to raycast.point instead of pushing him via addforce

#

would love to have super big world though, i did hear dots will be able to help with floating point precision

#

but they probably dont care about this atm

karmic basin
#

even with dots i would still have Position components with doubles instead of UNity transform with floats, and have some 3d grid for spatial partitionning and shift everything in view above a threshold. But I still need to test if that messes up physics or not one day

#
  • have some kind of Interest management for additional far/big objects to render in the client view
#

Erf, the list of things to prototype is infinite ๐Ÿ˜ญ

gusty comet
#

are they doubles?

#

the position components

karmic basin
#

I mean make your own

gusty comet
#

ah

#

well except my player is monobehaviioour XDD

karmic basin
#

and you use that for simulation computations

#

then convert/approximate to MB's transform.position