#archived-dots

1 messages ยท Page 257 of 1

worthy rampart
#

That's why you do this at author time

worn valley
#

And I do wish I could remove Transform from a GameObject. That is a major reason why ECS is so much more powerful.

worthy rampart
#

And you don't do this at runtime

rotund token
#

this only works in authoring so that's not an issue

worn valley
#

hmmm, I am well out of the loop on how the current authoring works so perhaps I do not fully understand how the authoring works now.

rotund token
#

authoring pre-creates all entities in 1 giant block of memory
Then just loads that giant block into the world

worn valley
#

So on the fly entity creation, like for example big ropes which may be generated at runtime. What happens then?

rotund token
#

are you talking manual creation via CreateEntity or via runtime conversion?

#

if you're talking runtime conversion, from memory it all happens in a separate conversion world then is copied into your actual game

#

so it's not creating new archetypes either

worn valley
#

I don't know exactly what I am asking :P.

rotund token
#

though i highly recommend against runtime conversion as it's slow, won't work with entities 1.0 features and has no real benefit over pre-converting

worn valley
#

I just knew that I was frustrated with the authoring they released for .17. So I should probably just shut up and actually look at .50

#

๐Ÿ˜‰

rotund token
#

well there ain't much difference except a bunch of bug fixes

worthy rampart
#

You should author whatever combination of entities you need to make the long rope

#

Then at runtime instantiate the prefabs

#

And link them together or w/e

worn valley
#

I will just need to review how Unity wants us to do it

#

from what I remember, it just seemed messy and complicated instead of just creating code to create whatever components you wanted on objects.

rotund token
#

on a tangent about instantiation, i wish i could improve this somehow =\ (it is 2 lots of 50k entities but still)

worn valley
#

But I like doing the low level stuff and I understand they are trying to make it easier for people

#

yeah that is frustrating, especially since you are generating a lot of temp allocations too

gusty comet
#

By that you mean an authoring that tags those entities with "PositionlessComponent" or something like that, and a system that executes only at the first frame that strips away components like that? Or can the Authoring itself do that - do entities returned by conversionSystem.GetPrimaryEntity() already have LocalToWorld and all that?

rotund token
#

something like that

gusty comet
#

I was told that conversion system is discouraged in favor of authorings

rotund token
#

not sure who said that but it's there for a reason

#

and this is the reason

#

you need to update after unity runs their conversion for transform/localtoworld

#

so you can remove the component

gusty comet
#

Welp, now I feel dumb for making my own StartSystem that does funky stuff to run only once. Thanks tertle, I'll use GameObjectConversionSystem from now on

#

My StartSystem was causing a ton of issues -_-

gentle harness
#

Do shared components with floats work?

warped trail
# gusty comet By that you mean an authoring that tags those entities with "PositionlessCompone...

https://youtu.be/TdlhTrq1oYk good video about conversion ๐Ÿค”

Uncover the process of converting GameObjects to Entities and how this can be extended and customized.

Find the code samples on GitHub: https://github.com/Unity-Technologies/unite2019-scenedatatodots

Speakers:
Simon Mogensen - Unity
Fabrice Lรฉte - Unity

More about DOTS: https://on.unity.com/2litTAx

Slides available here: https://www.slidesh...

โ–ถ Play video
gusty comet
dull copper
#

is conversion setup still same with 0.50?

#

(I haven't followed the development that closely, saw the proposal about 1.0 workflow)

rotund token
#

pretty much

odd ridge
#

did any version of DOTS have occlusion culling? I never saw it having it

#

or does it

robust scaffold
odd ridge
robust scaffold
safe lintel
#

HR works in tandem with the RP's, from what I gather the next iteration for 1.0 should have picking but it will still be reliant either URP or HDRP

gusty comet
#

GameObjectConversionSystem inherits from ComponentSystem instead of the newer SystemBase. This won't cause any issues down the line?

safe lintel
#

its been this way since conversion systems were introduced. id expect them to give some sort of basic utility like an api updater if they switch it in the future(as currently they havent introduced any alternatives for it)

gusty comet
#

Ok, thanks. I can still use ECBs in the older ForEAch like this?

var ecb = new EntityCommandBuffer(Allocator.Temp);

            Entities
                .WithAll<PositionlessComponent>()
                .ForEach((Entity positionlessEntity) =>
                {
                    ecb.RemoveComponent<LocalToWorld>(positionlessEntity);
                    ecb.RemoveComponent<Translation>(positionlessEntity);
                    ecb.RemoveComponent<Rotation>(positionlessEntity);
                    ecb.RemoveComponent<Parent>(positionlessEntity);
                    ecb.RemoveComponent<PreviousParent>(positionlessEntity);
                    ecb.RemoveComponent<Child>(positionlessEntity);
                });

            ecb.Playback(EntityManager);

            ecb.Dispose();
safe lintel
#

yeah

gusty comet
#

Thanks!

rotund token
safe lintel
#

I had errors last time I tried it though it was prior to .50

odd ridge
#

the sample image says that it should cull something but for some reason it doesn't work for me

#

(that's the documentation image showing that it culls, but mine shows 0)

rotund token
#

haven't tested the sample, will look at it tonight

gusty comet
#

I'm having a hard time understand the whole conversion process. Here ```
[UpdateInGroup(typeof(GameObjectAfterConversionGroup))]
public class PositionlessSystem : GameObjectConversionSystem
{
protected override void OnUpdate()
{
Debug.Log("running");
Entities
.WithAll<PositionlessComponent>()
.ForEach((Entity positionlessEntity) =>
{
Debug.Log("removing position");
EntityManager.RemoveComponent<PositionlessComponent>(positionlessEntity);
EntityManager.RemoveComponent<LocalToWorld>(positionlessEntity);
EntityManager.RemoveComponent<Translation>(positionlessEntity);
EntityManager.RemoveComponent<Rotation>(positionlessEntity);
EntityManager.RemoveComponent<LocalToParent>(positionlessEntity);
EntityManager.RemoveComponent<Parent>(positionlessEntity);
EntityManager.RemoveComponent<PreviousParent>(positionlessEntity);
EntityManager.RemoveComponent<Child>(positionlessEntity);
});
}
}

It looks like PositionlessSystem is updating in the wrong group, because it's trying to pick up PositionlessComponent which is injected during IConvertGameObjectToEntity. How should I configure this system so that it can pick up converted IComponentData, and is this even the r ecommended approach?
#

I've attached PositionlessAuthoring to both GameObjects and Prefabs in my Scene, but PositionlessSystem is never detecting any injected PositionlessComponent

odd ridge
# rotund token haven't tested the sample, will look at it tonight

were you able to use it successfully in your project? I got a stacktrace from using it in my project ```C#
IndexOutOfRangeException: Index 6089 is out of range of '1' Length.
Unity.Collections.NativeArray1[T].FailOutOfRangeError (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0) Unity.Collections.NativeArray1[T].CheckElementReadAccess (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0)
Unity.Collections.NativeArray1[T].get_Item (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0) Unity.Rendering.Occlusion.MOCTestJob.Execute (Unity.Entities.ArchetypeChunk chunk, System.Int32 chunkIndex, System.Int32 firstEntityIndex) (at Library/PackageCache/com.unity.rendering.hybrid@0.50.0-preview.24/Unity.Rendering.Hybrid/Occlusion/BurstIntrinsics/MOCTestJob.cs:83) Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper1[T]& jobWrapper, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/IJobChunk.cs:401) Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/IJobChunk.cs:368)

#

but when I look at the debug data, both the sample and my project look alike

gusty comet
#

It looks like you can only iterate over Monobehaviours, so

Entities
                .WithAll<PositionlessAuthoring>()

is able to find the Entities, and using

                    DstEntityManager.RemoveComponent<PositionlessComponent>(positionlessEntity);

I can remove the position-related components. However, this is causing issues elsewhere

Out of space in the NewChunks buffer
UnityEngine.Debug:Assert (bool,string)
Unity.Rendering.ClassifyNewChunksJob:ClassifyNewChunk (Unity.Entities.ArchetypeChunk) (at Library/PackageCache/com.unity.rendering.hybrid@0.50.0-preview.24/Unity.Rendering.Hybrid/HybridV2RenderSystem.cs:679)
odd ridge
# rotund token i haven't tried it

hmm, I think the demo isn't up to date. reading the commit messages, it seems like they updated entities to 0.5 but the code for occlusion is still based on 0.17

#

but that's just related to the sample repo itself, maybe they didn't update the occlusion backend to 0.5?

odd ridge
#

hmmm, it seems like the occlusion isn't 0.5 ready yet, but I can't even get it to work with the previous version, 0.17

rotund token
#

updates as well

odd ridge
# rotund token my demo works fine once i set it up

hmmm, I must have missed something. I just tried HDRP and it didn't work either. can you explain what you did to set it up? I verified the steps in the documentation and every step seems to be already applied by default, unless I missed something

rotund token
#

didn't read the document tbh

#

just setup an empty entities 0.50 project on 2020.3.30 with HDRP

#

and added the occlusion folder

#

and the shared asset folder

#

loaded the scene

#

reimported subscene

#

hit play

odd ridge
#

I'll give it a try

rotund token
#

opening sample had compile errors for me

#

in something i cant remember, didnt want to deal with it

odd ridge
#

@rotund token did you add these flags in your player settings too? ```C
ENABLE_HYBRID_RENDERER_V2
ENABLE_UNITY_OCCLUSION

rotund token
#

yes

odd ridge
#

wow okay, it does work when I copy the occlusion scene folder into a new project ^^

#

hmmm, so the occlusion scene works on its own, but when I try to open the scene within one of my scenes, I'm getting this error ```C
IndexOutOfRangeException: Index 1089827641 is out of range of '41' Length.
Unity.Collections.NativeArray1[T].FailOutOfRangeError (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0) Unity.Collections.NativeArray1[T].CheckElementReadAccess (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0)
Unity.Collections.NativeArray1[T].get_Item (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0) Unity.Rendering.Occlusion.MOCTestJob.Execute (Unity.Entities.ArchetypeChunk chunk, System.Int32 chunkIndex, System.Int32 firstEntityIndex) (at Library/PackageCache/com.unity.rendering.hybrid@0.50.0-preview.24/Unity.Rendering.Hybrid/Occlusion/BurstIntrinsics/MOCTestJob.cs:83) Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper1[T]& jobWrapper, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/IJobChunk.cs:401) Unity.Entities.JobChunkExtensions+JobChunkProducer1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/IJobChunk.cs:368)

#

I have 1529 objects in my scene but the moment I toggle a 1530th one, it crashes with the error

#

I will try to use a subscene

#

hmmm, I just had this crash happen while trying to run the occlusion in my scene ```

#

not sure if it's related, stack trace shows it's coming from physics

#

subscene doesn't work either, I'm getting out of range errors when having more than 1529 mesh entities in a scene that uses occlusion C IndexOutOfRangeException: Index -82 is out of range of '33' Length. Unity.Collections.NativeArray`1[T].FailOutOfRangeError (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0) Unity.Collections.NativeArray`1[T].CheckElementReadAccess (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0) Unity.Collections.NativeArray`1[T].get_Item (System.Int32 index) (at <3be1a7ff939c43f181c0a10b5a0189ac>:0) Unity.Rendering.Occlusion.MOCTestJob.Execute (Unity.Entities.ArchetypeChunk chunk, System.Int32 chunkIndex, System.Int32 firstEntityIndex) (at Library/PackageCache/com.unity.rendering.hybrid@0.50.0-preview.24/Unity.Rendering.Hybrid/Occlusion/BurstIntrinsics/MOCTestJob.cs:83) Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].ExecuteInternal (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/IJobChunk.cs:401) Unity.Entities.JobChunkExtensions+JobChunkProducer`1[T].Execute (Unity.Entities.JobChunkExtensions+JobChunkWrapper`1[T]& jobWrapper, System.IntPtr additionalPtr, System.IntPtr bufferRangePatchData, Unity.Jobs.LowLevel.Unsafe.JobRanges& ranges, System.Int32 jobIndex) (at Library/PackageCache/com.unity.entities@0.50.0-preview.24/Unity.Entities/IJobChunk.cs:368)

#

now I'm thinking it's an implementation bug, it's not like 1529 mesh objects is that many

#

also, none of my 1529 mesh entities have the occlusion components

#

but when I add a 1530th one, I get this crash (despite not having any occlusion components)

#

hmm, but then again, I can put 5k cubes in my occlusion scene without error. it seems it has an issue with detailed meshes (1k-15k tris)

#

hmm, with 5k cubes all with occlusion components, I'm getting 10 fps or so when entering play mode

#

I think I'm gonna leave that one alone for now, probably too experimental

rotund token
#

interesting, im at 3k cubes (spawning 10/second just watching what happens) and it's only doing 0.20ms

#

maybe not a great sample though since most are culled

#

im quite curious about this though because we have a new project coming up that will really need something like runtime capable occlusion culling

#

6k cubes now and its only taking 0.23ms so not sure why your fps was so low, these are only cubes though

#

did you not have burst on?

pulsar jay
#

Just found out why my companion objects dont show up in scene view:

#

I saw this Runtime/Authoring view thing on their GDC talk but I didnt know it was implemented already ๐Ÿ˜ฌ

#

Anyway it seems inconsistent and broken. As it does not hide runtime instanced entities but only their companion objects ๐Ÿ˜‘

rotund token
#

(this has been authenticated for years)

pulsar jay
#

Also weird that the default behaviour is the Authoring one

rotund token
#

nice that you solved your problem though!

pulsar jay
rotund token
#

yes

#

was all named slightly different though

pulsar jay
#

I see. Was wondering as the LiveConversionMenu.cs
file is new

#

But it did not do anything then did it? The scene view never hid any runtime stuff before

rotund token
#

i think that's more the change of companion/hybrid objects

#

it's definitely been 'improved' and a lot of bugs fixed in 0.50

pulsar jay
#

Right now it feels like its implemented halfway as it only hides runtime instanced companion objects but not entities

rotund token
#

what happens if you turn off live conversion

pulsar jay
pulsar jay
#

This is Scene view in Authoring mode:

#

And this in runtime mode:

#

The instanced cube is visible in both. The entities using companions are not

rotund token
pulsar jay
#

Does this make any difference for you in 0.17?

rotund token
#

i haven't had this issue

#

it works as i expect for what i'm using atm

#

so i can't really say

pulsar jay
#

I mean does it actually show any different state if you switch the sceneView mode?

rotund token
#

(also i rarely use scene view with dots since picking isn't implemented yet anyway so it's a bit useless)

#

looks the same for me in my setup, but i wouldn't expect it to be different

pulsar jay
rotund token
#

mostly use that

pulsar jay
#

judging from the presentation any runtime change e.g. moving object should be invisible in authoring mode

rotund token
#

also my project is netcode

#

so some of my subscenes are loaded twice (server/client)

#

some on 1 or other

#

i'm not really sure what behaviour i'd expect to be honest

#

i guess you wouldn't see anything on server because there's no renderers

pulsar jay
#

if there is anything that is instanced at runtime or changed at runtime like movement it should only be visible in runtime view

#

they basically had a moving platform as an example which just stands still in authoring mode

rotund token
#

yeah everything is static in my subscene

#

i only have a plane and 2 trees

#

im curious and will create a moving platform or something tomorrow

#

and see if it works

#

but for now going to continue my occlusion tests

#

at 35k boxes now for only 0.44ms pretty happy with this performance

#

not sure what bug michael was running into

pulsar jay
#

alright. thanks for your help. at least one problem is "solved" now ๐Ÿ™ƒ

pulsar jay
rotund token
#

interesting i did just run into his error

#

definitely hits a limit

rotund token
#

seems to break down ~32700 entities culling which I feel is too close to 32767 to be a coincidence

odd ridge
#

getting index out of range errors whenever I put more than 1529 relatively detailed meshes in my scene

rotund token
#

Yeah I can repo this, happens everytime just over 32k cubes for me

#

I'm very happy with performance so this will have a lot of potential in future

#

Which is good for preproduction research in doing atm

#

But I would like to get it working earlier than 1.0...

#

@odd ridge how many verts are your meshes total when it errors out

#

because i think you said you are error at 1529 meshes

#

but it takes me 32k cubes

#

so it doesn't seem be to entity count

#

or is it just 1529 meshes in view

odd ridge
#

but... none of these have the occlusion components so I'm not sure it would affect it

#

if I only have 1 entity with occlusion components it will crash after 1529 meshes

rotund token
#

thanks

#

HybridV2Culling can give StartIndex a negative value

#

going to branch this and see if i can fix it

#

yep ok switching that to ushort doubles number of cubes i can have (64k)

#

i think it just needs to be an int but they seem to have layed this out in memory very specifically so not sure what'll break, but hey let's give it a shot

#

seems to fix it

#

@odd ridge if you want a fix
HybridV2Culling - line 419 remove the cast to short
HybridV2RenderSystem - line 827 change StartIndex to int
(I think this struct should be reordered for memory saving now)

odd ridge
#

ah nice!

rotund token
#

but yeah im still going

#

performance seems good

#

for 250k cubes

odd ridge
#

while you're here, have you tried building the occlusion scene? I tried building the sample scene but nothing was showing up in the camera view

rotund token
#

i have not tried i can give it a shot

rotund token
#

yeah fails by default

#

the shader is bad

#

works fine if i replace material with default (though its just grey not colored)

odd ridge
#

oh okay, thanks

honest plinth
#

Is is possible for you to report a bug on this? It's absolutely something that should be fixed (the int/short problem that is)

rotund token
#

just heading to bed but I can make a report tomorrow

honest plinth
pulsar jay
#

Is there any convinient way to get the component object from an entitiy. Getting it from the CompanionLink componet would be the obvious way bat thats internal so I cannot even use GetComponent with it ๐Ÿ˜ฌ

coarse turtle
#

Has anyone tried out DynamicComponentTypeHandle<T>? Curious to know if this struct will be a "stable" API i can use in the long term

warped swallow
#

dots 1.0 will come with 2021lts right? when it will be available on 2022?

rustic rain
#

I heard rumors either late 2022 or 2023

dull copper
#

if it even runs on 2021 or older is still a question mark

#

I wouldn't count on it

warped swallow
#

so if i want to use Dots best call is to aim at unity 2021 right? and its LTS

#

at 2022.2 alfa i did not see Dots package tho

dull copper
#

they plan to ship it with final 2022.2, so next christmas

warped swallow
#

ohhhhh, that is soooo far away ๐Ÿ˜ญ

dull copper
#

and considering the past delays, it's not granted it will make it

#

if past experience means anything, it will not make it

#

there's no best calls with experimental packages like entities atm, other than if you want to use it, stick to latest but you still have to redo bunch of things when they get to 1.0

warped swallow
#

but expermental packages are fun :DTo be honest I amjust aiming to learn using it in more realistic enviroment thats all.

dull copper
#

also 2022.1 doesn't play nice out of the box with Entities 0.50 I think or there was some changes needed at least for rendering

#

Unity also removed animation package support on 0.50 I think.. so be prepared that things you use now might not exist on 1.0

warped swallow
#

Note taken. I though 0.5 was only on 2020, and not on 2021

karmic basin
#
  1. Reach compatibility with 2020 LTS: this is what is achieved today with the release of experimental Entities 0.50 and its compatible packages. Entities 0.50 is a breaking change from Entities 0.17.
    2. Reach compatibility with 2021 LTS: we are preparing a minor update to Entities, experimental Entities 0.51, that will make Entities and its compatible packages usable on both Unity 2020 LTS and Unity 2021 LTS projects. This update is currently scheduled for Q2 2022. More details will be shared as we approach its release.
  2. Reach compatibility with 2022 Tech Stream: the version Entities 1.0 and its compatible packages represent the ECS foundation supported for production for the entirety of the 2022 release cycle. Entities 1.0 will be a breaking change from Entities 0.51.
warped swallow
#

Thank you, I was aware of that forum, but thought maybe there are more updated data ๐Ÿ™‚

#

so asked discrod ๐Ÿ™‚

karmic basin
#

๐Ÿ‘Œ

harsh onyx
#

Can you shedule jobs, inside of jobs?

dense crypt
harsh onyx
stone osprey
#

Could need some help... trying to build my dots project and well when using the build configuration i ALWAYS get this...

#

But there no errors in my scripts... no idea why it tells me that

#

Restart didnt helped either

coarse turtle
#

the screenshot doesn't show much besides the 2 errors

worthy rampart
#

are we allowed to internalize and modify packages like unity.physics or the hybrid renderer?

rotund token
#

yes

#

as long as it's for a unity project*

worthy rampart
#

sweet I had found that and thought I was in the clear

pliant pike
#

so is EntityQuery.SetSingleton() not working in the new 0.5

rotund token
#

i believe its broken if you have a multi component query

pliant pike
#

yeah that is probably it then

#

so what can I use instead

rotund token
#

get the entity, just call SetComponent

pliant pike
#

or just ordinary query with element [0] I guess

rotund token
#

yeah

pliant pike
#

your way is probably better though ๐Ÿ‘

harsh onyx
#

Is there a way to automaticly dispose native container?
I have the problem that I return them from a class and then after the return I can't dispose them anymore

rotund token
#

apart from Allocator.Temp, WorldAllocator is currently the only built in solution for automatic memory handling

pliant pike
#

if your having problems disposing them after a job then you can use a jobwithcode after that job to do some cleanup and dispose of stuff

rotund token
#

Dispose(Dependency) is usually more than enough

harsh onyx
pliant pike
#

yeah it depends on what your doing, I've seen it recommended from unity devs that they sometimes use the jobwithcode thing

rotund token
harsh onyx
#

Oh dang nice, didnt know. Time to upgrade

rotund token
#

only works with native array atm though

harsh onyx
#

thanks guys

pliant pike
#

if you do use it make sure its WithoutBurst().Run()

rotund token
#

what do you mean?

#

you can't allocate it in a job, sure, but it's meant to be used to allocate outside of a job then passed in

pliant pike
#

I mean if your using jobwithcode to cleanup you need to run it on the main thread as far as I'm aware

rotund token
#

oh you may as well just call complete() then and do it on main thread

#

because that's what withoutburst/run is doing

pliant pike
#

is it really the same though ๐Ÿ˜•

rotund token
#

Job.WithCode(() => {// Do Something}).WithoutBurst().Run()
what is that doing

#

except just running main thread on the spot?

pliant pike
#

I know it is running on the main thread but I thought it was more efficient

rotund token
#

only if you use burst

pliant pike
#

because its not going straight back to the update method in that system

#

and there might be less of a gap between those jobs

rotund token
#

Job.WithCode(() => {// Do Something}).WithoutBurst().Run()
is the same as
Dependency.Complete()
// Do Something

pliant pike
#

but I guess I'd have to do tests to find out

#

yeah I did speak to a unity dev and they said they were using jobwithcode instead of dependency.complete

rotund token
#
            Job.WithCode(() => array.Dispose()).WithoutBurst().Run();```
You can see the codegen do exactly that
```            var __job = new CullingStatsToolbarSystem_LambdaJob_0_Job{array = array};
            CompleteDependency();
            __job.Execute();```
pliant pike
#

I might have been doing a bit more than just disposing that's why it wasn't optimal to just use Complete.Dependency()

dense crypt
#

How can I convert a bool3 to an int3 (0 or 1)?

#

Oh never mind, I could just do
math.int3(myBool3)

pliant pike
#

yeah I had to update a bunch of gameobjects and clear a bunch arrays in reverse and also playback a dynamicbuffer all after a threaded bursted job

harsh onyx
#

I am always using bytes instead of bools

pliant pike
#

I'll do a quick test to see if there's any difference though

#

if your comparing things like int3s or float3s I think its best to use float3.equals()

harsh onyx
#

Wait a second, c# as a destructor too, never used it but I just remembered. You can clean up there too

rotund token
#

destructor is not reliable

#

at least for this

#

it might /work/ but there is a good chance under certain circumstances unity complains about leaks before the destructor runs

#

when doing stuff like leaving play mode

#

i.e. you're basically relying on your destructor to run before unity's destructor on allocation tracking

#

so yeah, it might work fine but it doesn't seem like the best approach if you ask me ๐Ÿคทโ€โ™‚๏ธ

harsh onyx
#

true that

pliant pike
#

ok Dependency.Complete() might be slightly faster or no difference according to my not very good repeatable tests

rotund token
#

because it's exactly the same thing ^_^'

#

codegen calls

        {
            // Previous frame job
            m_JobHandle.Complete();```
Dependency.Complete() is the same handle
```        public JobHandle Dependency
        {
            get
            {
                return m_JobHandle;```
pliant pike
#

well you don't always know until you try these things ๐Ÿคท

rotund token
#

sorry i'm not trying to be an ass - i just prefer to read the source code to figure out what's going on

pliant pike
#

hey no, its cool I barely know what I'm doing, so I appreciate all info

remote crater
#

Anyone sticking with .17 since they can't do the super complex upgrade to .5? Why not make it incremental steps? Its like a zillion different things to do and you're not sure if any is right.

rotund token
#

upgrades will only get worse

#

it's like a band-aid rip it off in 1 guy

remote crater
#

I can't tho

rotund token
#

did my own libraries in 3 hours, then did work libraries over 12 hours

#

15 hours straight upgrading

#

and now i'm done
(my own libraries only took 3 hours because i did it first and wasn't sure about the quirks yet)

remote crater
#

I spent 6 hours and I'm not sure I went forward.

#

Like here's what I got stuck on:

pliant pike
#

I did it it wasn't so bad

remote crater
rotund token
#

why do you need to foreach it?

#

are you adding the new RegisterDependency for physics?

remote crater
#

Upgrade JobComponentSystem to SystemBase

rotund token
#

oh... you're still using JobComponentSystem?

remote crater
#

Its a JobComponentSystem that was the only way I could do collision detection

rotund token
#

should have stopped using that like 2 years ago ^_^'

remote crater
#

No other way worked

rotund token
#

there's nothing systembase can't do that JobComponentSystem can

pliant pike
#

yeah that is slightly behind leahS

remote crater
#

I'm sure, but I spent like 30 hours finding out how to do collision detection

#

no one knew how, and someone linked me code that worked

rotund token
#

so your issue isn't updating to 0.50

#

it's updating to systembase?

remote crater
#

No, this is .5 stuff

rotund token
#

yes but jobcomponentsystem was deprecated 2 years ago

#

you could have done this before 0.50 is what i'm saying

#

you're just forced to do it now

remote crater
#

Like when I update stuff, I wish there was one step I could validate I did it right.

rotund token
#

what exactly is your issue on updating?

remote crater
#

You get no liberties unless you upgrade like 30 things at once

#

This is not how its supposed to be done

rotund token
#

why not just upgrade your project in 0.17 from JobSystem to SystemBase

#

then get it compiling

#

then upgrade to 0.50

#

this way you don't have to worry about other 0.50 issues stopping you compiling

remote crater
#

Not a bad idea, I'd be set back 6 hours

rotund token
#

while you get rid of your JobComponentSystems

remote crater
#

Oh what I could do

#

is

#

Fix it in one version

#

bring it to my advanced possibly version 6 hours in future

rotund token
#

yeah just copy the JobComponentSystem upgraded systems into your 0.50 branch

remote crater
#

see if it works. But I have zillions of errors

#

My main error is something about a windows build

#

Sec

#

I think you guys may be able to help me!

rotund token
#

do you still have the windows build package installed?

remote crater
#

You already helped me a ton

rotund token
#

you need to get rid of that

remote crater
#

oooh

#

Round 2, fight!

rotund token
#

all those .windows .ios etc packages are gone

#

there is only 1 package now for building everything

#

(imported as a dependency)

remote crater
#

You helped me in the past bro

#

I'm so so so close to launching a mmo

#

Probably shoulda just did it in game object

#

Woulda had it out like last year lol

#

I was stubborn and wanted parallel processing even before I heard of dots

#

someone told me you did parallel and I was stoked I didn't have to code it myself

harsh onyx
#

Would be cool if we could specifiy the transformaccessarray even further. I know you can do that yourself, just ease of use.
Like transformsaccesarray.positions or transformaccessrray.rotations

white island
#

What exactly does this error mean? does it mean my types inside my struct are nullable?
The type 'ImageParsingJob' must be a non-nullable value type in order to use it as parameter 'T' in the generic type or method 'IJobParallelForExtensions.Schedule<T>(T, int, int, JobHandle)' [Assembly-CSharp]

#

For reference this is my Job:

public class ImageParsingJob : IJobParallelFor
{
    [ReadOnly]
    public NativeArray<Color32> imageData;
    public NativeArray<float> res;
    public int numThreads;

    int width = 256;
    int height = 256;

    public void Execute(int index)
    {
        for (int i = 0; i < width * (height / numThreads); i++)
        {
            res[
                (width * (height / numThreads)) * index //offset from 0
                + i //how far into the chunk we are
            ] = imageData[
                (width * (height / numThreads)) * index
                + i
            ].r;

            //TODO: Math
        }

    }
}

left oak
white island
#

oh whoops i missed that

#

ok well it's telling me I need to use double buffering strategies but i have no idea what that means

#

I'm trying to read a specific channel of a texture 2D to an array

coarse turtle
white island
coarse turtle
#

Cool, if you know that you can try putting in NativeDisableParallelForRestriction attribute onto res

coarse turtle
#
[NativeDisableParallelForRestriction]
public NativeArray<float> res;

yea

white island
#

well good news is my code runs

#

is there a way this could cause 115 ms of garbage collection lmfao

coarse turtle
#

safety system?

white island
#

my code for this section that the profile says is causing it is

NativeArray<float> results = new NativeArray<float>(256 * 256, Allocator.TempJob); //result array

                ImageParsingJob jobData = new ImageParsingJob();
                jobData.imageData = tex.GetPixelData<Color32>(0); //feed in image data
                jobData.res = results;
                jobData.numThreads = 8;
                jobData.width = 256;
                jobData.height = 256;

                JobHandle jobHandle = jobData.Schedule(8, 1);
                jobHandle.Complete();

                float[] bufferArr = results.ToArray();
                Buffer.BlockCopy(bufferArr, 0, heights, 0, sizeof(float) * bufferArr.Length); //should hopefully copy over the read height information

                results.Dispose(); //Release memory
coarse turtle
#

results.ToArray() allocates a new array.

#

then you're doing a Buffer.BlockCopy from bufferArr into heights. Since bufferArr is no longer needed - gc would collect it

#

what you can do instead is

fixed (float* head = heights) {
  UnsafeUtility.MemCpy(heights, results.GetUnsafePtr(), results.Length * sizeof(float));
}

or just write directly into heights via pointers.

coarse turtle
#

Unity.Collections.LowLevel.Unsafe or Unity.Collections.Unsafe.LowLevel - I can't remember the order from the top of my head

harsh onyx
#

have you found a use for allocator temp?

#

I have never found a usecase for it

coarse turtle
harsh onyx
coarse turtle
#

yea

white island
#

dang it this is supposed to be simple

#

Am I allowed to pass an array to a job or is it only nativearrays

#

o\nly nativearrays, right?

coarse turtle
white island
coarse turtle
#

Give me one moment I can give an example

white island
#

just a copyto?

#

ok

coarse turtle
# white island yeah im trying to figure how to do that
public static NativeArray<T> AsNativeArray<T>(this T[] array) where T : unmanaged {
    unsafe {
        fixed (T* ptr = array) {
            return NativeArrayUnsafeUtility.ConvertExistingDataToNativeArray<T>(
                ptr, 
                array.Length, 
                Allocator.None);
        }
    }
}
#

When you put the native array into a job, I would put [NativeDisableContainerSafetyRestriction], mainly because I got lazy and didn't want to hook the safety system for something I had pinned.

white island
#

dang, I disposed it too.

#

oh. Ican just use CopyFrom

white island
#

oh changing it to head made the red line go away

#

Wait, what? So I'm calling this job spawning and scheduling routine like 5 times for this one frame, and it takes 4ms for every call (not great) except the last one, which then gets hit with a massive 100 ms garbage collection run

#

i even used memcopy?...

#
using (s_ProcessHeights.Auto())
            {
                NativeArray<float> results = new NativeArray<float>(256 * 256, Allocator.TempJob); //result array

                //Get pixel data from image and convert to native array
                NativeArray<Color> pxData = new NativeArray<Color>(256 * 256, Allocator.TempJob);
                pxData.CopyFrom(tex.GetPixels()); //TODO: Color32?

                //Construct job data
                ImageParsingJob jobData = new ImageParsingJob();
                jobData.imageData = pxData; //feed in image data
                jobData.res = results;
                jobData.numThreads = 8;
                jobData.width = 256;
                jobData.height = 256;

                //Job handle creation
                JobHandle jobHandle = jobData.Schedule(8, 1);
                jobHandle.Complete();

                //Copy memory
                fixed (float* head = heights)
                {
                    UnsafeUtility.MemCpy(head, results.GetUnsafePtr(), results.Length * sizeof(float));
                }

                //Release memory
                results.Dispose();
                pxData.Dispose();
            }
#

is it releasing tex.GetPixels()?

#

other than that it does work correctly (except for the parts that dont but that's my own fault)

#

I wopuld get GetPixelData<> but that seems to only return white colors

coarse turtle
#

yea most likely, since GetPixels returns a copy of the pixel data from the texture.

white island
#

Argh, this is frustrating. I wrote a compute shader to do this but it somehow broke unity so I am stuck with this

meager sequoia
#

do Scriptable Objects have efficient ram usage like the Entity Component System?

harsh onyx
upper tiger
#

I am having a general problem with my DOTS systems. Basically I have two systems which have an Entity.ForEach that gets their own unique component types (A and B). Both systems want to modify another component (SharedType) based on conditional logic in their respective systems. Is it fundamentally possible for these two systems to run in parallel over multiple threads or is the race condition of writing to the same data mean they always have to run one after the other? I find I get this sort of logic a lot in my code.

protected override void OnUpdate()
{
    NativeArray<SharedType> data = sharedTypeQuery.ToComponentDataArray<SharedType>(Allocator.TempJob);

    Entities
        .ForEach((Entity entity, int entityInQueryIndex, ref ComponentType_A A) =>
        {
            // do stuff with data conditional on A
        }).ScheduleParallel();
}


protected override void OnUpdate()
{
    NativeArray<SharedType> data = sharedTypeQuery.ToComponentDataArray<SharedType>(Allocator.TempJob);

    Entities
        .ForEach((Entity entity, int entityInQueryIndex, ref ComponentType_B B) =>
        {
            // do stuff with data conditional on B
        }).ScheduleParallel();
}
rotund token
#

theres no way to do it without turning off safety

#

unity can't know that you won't write to the wrong index

upper tiger
#

Another question. I have a NativeArray that I want as read only. Despite using the syntax below, the system says it is still read and write. I have checked and there aren't any places where the array is written to. Whats going on?

NativeArray<Tile>.ReadOnly tiles = m_tilesQuery.ToComponentDataArray<Tile>(Allocator.TempJob).AsReadOnly();
rotund token
#

AsReadOnly(tiles) on the Entities.ForEach

#

most people would not bother with NativeArray.ReadOnly

#

Safety will ensure the regular array is only read from anyway

upper tiger
#

Its just that my Entity system overview shows that data type as read&write, I thought readonly was much faster and allows multiple jobs that only read from the type to be run in parellel.

#

This is a basic system I just made, the editor says the Tile type is read&write

public partial class Test : SystemBase
{
    public EntityQuery q_tiles;

    protected override void OnUpdate()
    {
        NativeArray<Tile>.ReadOnly tileMap = q_tiles.ToComponentDataArray<Tile>(Allocator.TempJob).AsReadOnly();
    }

    protected override void OnCreate()
    {
        q_tiles = GetEntityQuery(typeof(Tile));
    }
}
harsh onyx
#

Wait readonly native array cant be disposed? Would be cool if we can still dispose readonly n arays, not only readonly for the job

rotund token
#

q_tiles = GetEntityQuery(typeof(Tile));

#

is getting Tile Read/Write

#

if you want it readonly
q_tiles = GetEntityQuery(ComponentType.ReadOnly<Tile>());

upper tiger
#

Why does NativeArray<T> have a .ReadOnly then?

#

if it is always read&write

rotund token
#

your native array has nothing to do with this

#

my Entity system overview shows that data type as read&write
it's showing your entity read/write permissions not the entity array

upper tiger
#

oh right

rotund token
upper tiger
#

so when I get the query, that determines rw access

rotund token
#

yes there is a bit of confusion here

#

(not just you but in general)

#

there are really 2 permission systems going on here

#

ReadWrite on components

#

ReadWrite on jobs

upper tiger
#

so is my example actually readonly as far as unity optimisation and it just appears in the editor as read&write?

rotund token
#

for job scheduling and component safety it appears as having write access

#

for burst optimization it appears as readonly

upper tiger
#

ahhhh gotcha

rotund token
#

if you have 2 jobs with readonly permission on the entity query, unity can schedule these at the same time

#

but as you are currently using write permission, it will schedule them after each other

upper tiger
#

thats what i want

#

thanks a lot, that makes sense

upper tiger
#

So everywhere I have put

m_tileMapGroup = GetEntityQuery(ComponentType.ReadOnly<Tile>());

and use it like so in a system onUpdate

var tileMap = m_tileMapGroup.ToComponentDataArray<Tile>(Allocator.TempJob).AsReadOnly();

Is saying that a native container has not been disposed. Even though I can no longer dispose it as it is flagged AsReadOnly().
Why aren't they disposing properly now?

#

oh I found your forum post tertle, ill look at that first

pulsar jay
#

Is there an easier way to iterate linkedentities than using .Reinterpret<Entity>().ToNativeArray(Allocator.Temp) to create a native array?

gentle harness
#

Is it possible to get the entity reference using IJobEntity?

pulsar jay
#

How do I handle the PhysicsSystemRuntimeData if I have no way to access it because its internal? For example I have a query that is used to destroy all runtime instanced entities. I would have to exclude the PhysicsSystemRuntimeData from that query which seems to be impossible?

worthy rampart
#

there's no reason to copy

pulsar jay
worthy rampart
#

if you use AsNativeArray()

#

you can get a native array from the buffer

#

that aliases the same memory

#

with no copies

#

and do your foreach

pulsar jay
#

I think my fault was that I thought I have to use Reinterpret<Entity>(). But I could just use buffer[i].Value instead ๐Ÿ˜…

karmic basin
#

_entityTypeHandle here is a job field you populate from the system with the GetEntityTypeHandle() helper

#

you can then iterate your entities collection and do whatever you need

karmic basin
pulsar jay
#

I just thought I could just add my DontDestroyOnLoadTag to the PhysicsSystemRuntimeData entity. But I forgot that I cant because I cannot use it in a query. These internal components really give me a headache ๐Ÿ˜ฌ

karmic basin
#

they are runtime instanced but also built ? I mean not authored from GameObjects ?

pulsar jay
karmic basin
#

oh so this component is internal and unity adds it to some of your entities but not all of them, and you want to pick those without it. Uhm I didn't have a look at that yet.
Did you consider local copy of package to modify the internal component ?

pulsar jay
#

The problem is it must not be destroyed because otherwise all systems depending on physics will throw errors

#

But I have no way to exclude it from the destruction query nor any way to reacreate it.

#

Before modifying the package I would rather use an AssemblyDefinition hack to just make it public. But I would like to avoid such hacks ๐Ÿ™„

karmic basin
#

Does it have any other component you can target for the query instead ?

karmic basin
#

oh sad. Ok I didn't study it so I'm gonna stop throwing random suggestions ๐Ÿ˜›

pulsar jay
#

Afaik there is no (public) way to get a component by its type id or is there?

coarse turtle
pulsar jay
coarse turtle
#

they generally arent

#

if you add more types it changes

#

better to grab the type index from the type

#

on runtime

valid haven
#
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.
0x00007ffb9ade1f9c (f2f191b2eb06a2441dee69db0f498ab) [unknown:0] Unity.Collections.NativeArray`1<SharpDx.Int3>::Unity.Collections.NativeArray`1<SharpDx.Int3>.set_Item 
0x00007ffb9ade2c8a (f2f191b2eb06a2441dee69db0f498ab) [unknown:0] Unity.Jobs.IJobExtensions.JobStruct`1<Assets.Systems.World.Regions.Territories.Sectors.NewSectors>.Execute ```
#

any ideas on this.. am I reading this backwards or is it saying [0] is invalid for a array of 1 length? I remove the burst compile flag and I don't see an error. This code also used to work, not sure if its now failing due to new burst compiler and better sanity checks or what.

worn valley
#

You are probably trying to write to something in parallel

#

If you know what you are doing you can add NativeDisableParrelleRestriction to the array

pulsar jay
#

So I guess FromTypeIndex wont help with that if the ids arent fixed

coarse turtle
#

I have a similar issue, I just load it by the type path. So string -> type -> typeindex

#

Since you know the type you're looking for the string can be const is what Im thinking

pulsar jay
valid haven
#

hmm adding NativeDisableParrelleRestriction does not appear to avoid the issue

coarse turtle
pulsar jay
valid haven
#

I suspect the issue is with this index

#
    [BurstCompile(FloatPrecision.High, FloatMode.Strict, OptimizeFor = OptimizeFor.Performance)]
    public struct UpdateWorldTransform : IJobParallelForTransform
    {
        [ReadOnly]
        public readonly NativeArray<int> WorldIndexMap;

        [WriteOnly]
        public NativeList<WorldPositionCache>.ParallelWriter WorldPositionCache;

        [WriteOnly]
        public NativeList<TransformChange>.ParallelWriter Change;

        [NativeDisableParallelForRestriction]
        public NativeArray<WorldTransform> WorldTransforms;

        public UpdateWorldTransform(in NativeArray<WorldTransform> worldTransforms, in NativeArray<int> worldIndexMap, in NativeList<WorldPositionCache>.ParallelWriter worldPositionCache, in NativeList<TransformChange>.ParallelWriter change)
        {
            WorldTransforms = worldTransforms;
            WorldIndexMap = worldIndexMap;
            WorldPositionCache = worldPositionCache;
            Change = change;
        }

        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public void Execute(int index, TransformAccess transform)
        {
            var worldIndex = WorldIndexMap[index];
            var worldTransform = WorldTransforms[worldIndex];```
#

hmm it seems to be tied to a dependent job.

worn valley
#

Is worldindex a different number from index

#

@valid haven

worn valley
#

That is probably your issue then. When doing things in parallel you are only usually allowed to write to the same index

#

So in this case you are trying to write elsewhere and the safety system kicks in

valid haven
#

yes I am aware, in this case I know it should be safe and was working fine with older burst with the proper safety flags disbled hmm

worn valley
#

Well unity wants to make it dummy proof so they probably added more catches

valid haven
#

well thats sad. Been awhile since i looked at this code, but from memory I am avoiding having to use a dictionary for these lookups.

valid haven
#

well adding "[BurstCompile(FloatPrecision.High, FloatMode.Strict, OptimizeFor = OptimizeFor.Performance, DisableSafetyChecks = true)]" to either of the dependent jobs which both share a collection seems to avoid the error... which isnt a great solution.

#

both jobs share a public NativeArray<WorldPositionCache> WorldPositionCache; collection, the first writes to it the second reads.

worn valley
#

problem solved, yeah I don't know why that is happening. I am not too familiar with IJobParallelForTransform

valid haven
#

Ya, I guess I should just not worry about it as I will be switching all of this code to DOTs once 1.0 is out ๐Ÿ˜‰

worn valley
#

haha yeah

#

I've decided to just avoid DOTS till 1.0

#

i wrote a bunch of stuff in .4, then they changed a lot

#

wrote some stuff in .17, seems to be changing even more

valid haven
#

We have dual work efforts at the moment, some of the code that is safer to refactor to 1.0 is being designed around dots 0.5 while the rest that has been focused on unity 2022 will wait until 1.0alpha drops at which point we will merge the two effortss.

#

We are exploring how best to integrate our large world coordinate system in to dots at the moment and the transition from PhysX to Unity Physics.

worn valley
#

sounds like suppper fun

valid haven
#

hopefully, getting large coordinates working in PhysX w/ gameobjects was not super fun lol

#

well parts of it was fun.. the parts that didn't need to interface with Unity Scenes/Physics heh

worn valley
#

I am glad they are adding their own physics engine. Seems like PhysX is no longer having anything added to it

valid haven
#

Definitely, the fact they provide source is also super cool. For our project it still isn't clear if we will be best served with unity physics or havok. Seems like Unity Physics will be a bonus for our multiplayer, but we also will have a ton of dynamic colliders so we are somewhat concerned about the cacheless nature of it.

worn valley
#

I don't really understand stateless but I only do simple physics stuff.

#

I do love DOTS though. And Burst is the best thing to happen to the games industry in 10 years

valid haven
#

Ya burst is great.

gentle harness
karmic basin
#

Oh damn really ? Didnt try yet but manual says it autogens an IJEB

#

So I would expect params to be passed over

#

Oh damn having another look at the manual it looks like you're right, method signature is the same as the foreach lambda

#

Apologies I was wrong

#

"The generated IJobEntityBatch type in turn invokes the Execute() method on the IJobEntity type with the appropriate arguments."

#

Ah I see my mistake, it was the other way around, my bad

coarse turtle
gentle harness
#

Yes, this works

#

docs don't mention it explicitly

molten flame
rotund token
#

๐Ÿ˜ณ just trying to get a discussion started! everyone so secretive about saving

valid haven
#

I am just waiting for tertle to release his saving tech with MIT license so we can stea.... use it ๐Ÿ˜›

safe lintel
#

@rotund token how does your new method handle entity references? i saw someone mentioning that in the thread

rotund token
#

i wrote a follow up post on exactly how i do it

safe lintel
#

aah remap part

#

also when using GetDynamicComponentDataArrayReinterpret would size be TypeInfo.SizeInChunk?

rotund token
#

been using typeinfo elementsize

safe lintel
#

btw do your artists/designers use a custom prefab/material/texture/asset browser when dealing with scene design related duties(goes back to my prev comment about not using prefabs enough apparently)?

amber flicker
#

We may be diving into serializing entities soon - all code and insights are greatly appreciated- thanks tertle ๐Ÿ™

rotund token
#

in our template editor, which are i guess mini scenes are just a collection of prefabs + bunch of data

#

(i was told it was written before nested prefabs even existed)

safe lintel
#

ive kinda always wondered whats best; have some sort of prefab database and only instantiate from a central location or just use prefab references here and there(or I guess a mix). also wish unity had a more dedicated asset browsers(and dont want to code my own)

rotund token
#

i feel a bit sorry for our designers/artists

#

our tooling is shocking for them

#

im doing a bunch of pre-pre-production research for a new project

#

and dedicating a lot of time trying to ensure we have really good workflow for them

#

my objective as a developer is to basically code myself out of the job

#

i want to build enough generic and flexible tools that at some point, we only need design/artists on the project!

#

it's a dream that won't ever be reality but we can definitely reduce the need for artists/designers to rely on devs for adding content

safe lintel
#

the level editors of old(worldcraft, radiant etc) just have so much useful stuff that unity lacks

#

probuilder was a fantastic acquisition but it makes me sad it hasnt really changed since being bought out

coarse turtle
safe lintel
#

have any links of the editor?

coarse turtle
#

uhh, sorry i dont. Though you could download it cause that's where I saw it & played around with it: https://www.techblox.com

safe lintel
coarse turtle
#

ah thought you meant in game. Although I will say I'd be probably paralyze over an editor like this with all the buttons ๐Ÿ˜…

drowsy pagoda
#

How come I can't seem to find any docs on ICollisionEventsJobBase? I wrote a struct that implements that interface, but I can't find where to call it? Or is it supposed to be called automatically?

safe lintel
#

I havent touched physics collision events for some time, but maybe theres something in the physics samples you can glean info from? iirc there is an updated branch now(though not sure how wip that branch is)

#

@coarse turtle maybe if I can figure out tertles saving system, I can make a half decent ingame editor for my project though, powered by nimgui ๐Ÿ˜‰

rotund token
#

use ICollisionEventsJob (it inherits from it)

#

then just schedule using
.Schedule(this.stepPhysicsWorld.Simulation, this.Dependency);

drowsy pagoda
#

Yup, you're right. My intellisense wasn't recognizing it because I didn't add Havok.Physics ASMDEF reference. Now I can I see ICollisionEventsJob

#

Why would it only execute once? I just do a simple Debug log in there. And on play the collision triggers (I'm assuming it's when the player lands on the floor) But any collisions after not are not intercepted by my script.

rotund token
#

have you marked them as send events during authoring?

drowsy pagoda
#

Do colliding parties both require that flag? Or just one?

rotund token
#

from memory you'll just get events on the entity that has the flag

drowsy pagoda
gusty comet
#

Can anyone help me when i start my own apk game it just shows a black screen

rotund token
#

what do your logs say

gusty comet
#

Logs?

rotund token
#

yeah the logs that tell you why you crash

#

its been a good 6+ years since i've touched android development but I assume you can still hookup logcat

drowsy pagoda
#

I figured out why it was triggering only one time. It was because the system I wrote this in is only needed for that one frame until another circumstance triggers it on. How can I force the system to stay on even if no queries match?

rotund token
#

[AlwaysUpdateSystem]

drowsy pagoda
#

ah I see. thx.

upper tiger
#

Is there a place I can add a component to a prefab entity just after it has been converted from a gameobject?

#

I tried in the convert function but the entity doesnt have all its component data set (or converted) yet

rotund token
odd ridge
#

does anyone know when unity 2021 will receive DOTS?

odd ridge
#

thanks

odd ridge
#

does someone know when hybrid renderer will get spot lights ๐Ÿ˜…

karmic basin
#

Maybe more info on the forum ๐Ÿคทโ€โ™‚๏ธ

odd ridge
#

I want the HDRP features without paying for the performance cost, do you know if there's a way to downgrade or lower the quality of the HDRP shaders to get performance close to URP?

karmic basin
#

Unfortunately I'm not a graphics expert so I'll will refrain to answer ๐Ÿ™‚

odd ridge
#

i'll ask on the srp area

safe lintel
#

@odd ridge should come with 2021 and deferred

#

it was actually working fine all the way back in 2021(year not version๐Ÿ˜ข ) for a time in the betas before dots/entities reached that incompatibility and prior to the announcement of stay on 2020 lts

#

well, point lights with hybrid that is, I didnt try spotlights at the time

drowsy pagoda
#

I have two systems, movement and sensory. Movement system schedules an ICollisionEventsJob which reads BuildPhysicsWorld.PhysicsWorld.Bodies.
The Sensory system does a point distance query on BuildPhysicsWorld.CollisionWorld.CalculateDistance.
Both are scheduled.
As a result, unity throws a safety error saying that one is trying to read to physics world bodies while another write. (I'm assuming CalculateDistance, forces a write?).

Anyways, what's a conventional way to have one system use Dependency of another system if they are separate systems?

drowsy pagoda
#

Oh turns out I forgot to buildPhysicsSystem.AddInputDependencyToComplete(Dependency) after I schedule the ICollisionEventsJob.

molten flame
#

Quick one for the Netcode folks.
Can I add commands on the server side of things for stuff like AI?
I feel like this would work fine but not 100% if I'd need some manual stuff to handle some auto acks or something like that?

worn valley
#

@molten flame not sure what you mean by commands on the server side? The server can run your entire AI and just sent the positions for the result of an AI actor for example. So then the client has nothing to do with AI doing anything

molten flame
#

Commands are just a dynamic buffer, so I was just thinking this would be easy by adding commands on the server for the AI ghost.
So long as there are no gotchas..

rotund token
#

i havent tried but if it doesn't work you can just reverse it, make command receivers simply convert them to 'server commands' that the AI also uses

#

let us know if it works though could have handy

upper tiger
#

If I am trying to debug a single system, if I use [DisableAutoCreation] on all other systems is that the same as a new entities project with just that system I want to test in it?

north bay
austere wren
#

Hello all. I'm trying to do something with the Unity C# Job System that's trivially easy to do in single-thread but seemingly impossible to do with the C# Job System. Any help would be appreciated.

Basically I just need a job that calculates the distances between all positions. You would think that could be done with IJobParallelForTransform, but instead Unity is constantly throwing the error:

InvalidOperationException: CalcDistancesJob.dists is not declared [ReadOnly] in a IJobParallelFor job. The container does not support parallel writing. Please use a more suitable container type.

I obviously don't want the dists variable to be ReadOnly because that's what I'm using to store the distance values.

Anyone know a way to get around this issue and simply create a C# job to calculate distances between all positions?

#

For reference, here's the related code:

CALC DISTANCES JOB DECLARATION

  [BurstCompile]
  public struct CalcDistancesJob : IJobParallelForTransform {
    [ReadOnly] public float3 starPos;
    public NativeList<float> dists;

    public void Execute(int i, TransformAccess tfm) {
      dists[i] = math.distance(tfm.position, starPos);
    }
  }

SET UP AND SCHEDULE THE JOB

    calcDistancesJob = new CalcDistancesJob {
      starPos = transform.position,
      dists = starDistances
    };

    calcDistJobHandle = calcDistancesJob.Schedule(taa);
worn valley
#

Why don't you use a NativeArray?

#

@austere wren

#

Lists aren't great in multi thread because you can't change the size of the list while in a job so they are basically pointless

#

May as well use a standard Array

austere wren
# worn valley Why don't you use a NativeArray?

Funny enough, I'm actually reworking my code to convert from NativeList to Native Arrays. I still need a resizeable list outside of the Job, but within the job I'm using NativeArray and then casting the list to an array using .AsArray()

Still working on it but fingers crossed

worn valley
#

Yeah I hardly use lists anymore. They used to be my go to

orchid gate
#

Hi, I'm trying to update my package to entities 0.50 but having issues with rendering anything. My existing entities don't render with a custom material which is fine if I need to change that, but I tried with just a simple Cube GO with ConvertToEntity set and this doesn't render either. I have also tried to render a default cube in a fresh project with entities 0.50, hybrid renderer 0.50, and URP 10.8.1 installed. What's the simplest way to just get something rendered as an entity for testing?

#

components from the cube

rotund token
#

Component looks fine

gentle harness
#

I'm having issues removing a value from NativeMultiHashMap

#

I've written this, which I assumed would work:

if (map.TryGetFirstValue(originSquare, out Entity item, out NativeMultiHashMapIterator<int2> it))
                do
                {
                    if (item == e)
                    {
                        map.Remove(it);
                        UnityEngine.Debug.Log("Removed");
                        break;
                    }
                } while (map.TryGetNextValue(out item, ref it));
#

Of course, it did not

molten flame
#

Could anyone help a complete moron out.
I'm just trying to fill a fixed list with random floats...

    public struct ThrusterTrail : IComponentData
    {
        //...
        public FixedList4096Bytes<float> FlickerNoiseTexture;
    }
    //...
    var thrusterTrail = new ThrusterTrail();
    for (var i = 0; i < thrusterTrail.FlickerNoiseTexture.Capacity; i++) 
        thrusterTrail.FlickerNoiseTexture.Add(UnityEngine.Random.value);

I'm doing this in authoring code to setup a small noise texture but when I try to loop through the texture in a system its empty.

coarse turtle
molten flame
#

Yeah immediately after

#

next line is dstManager.AddComponentData(entity, thrusterTrail);

coarse turtle
#

๐Ÿค” Honestly the snippet looks right to me. I don't think you have to do:

ref var list = ref thrusterTrail.FlickerNoiseTexture;
list.Add(random_value);
#

That's the only entity being generated and being read by your system?

molten flame
#

Yeah, when I create the texture in the system as a global one using NativeList I don't have any issues

coarse turtle
#

yea, I'm not really sure

hollow sorrel
#

before 0.50 I would fetch unity's default systems and add them to a custom world with world.GetOrCreateSystem(type);, but now that errors because some systems are now ISystem and cannot be constructed
what's the new way to do it then?

molten flame
#

Mmmm this is at some point during runtime though isnt it

hollow sorrel
#

yeah that used to be in old version too but am not using that because i'm handling custom world

#

with not every unity system needed

#

oh but i could check how they do it in there so that's a lead at least, thanks @molten flame

molten flame
#

AddSystemsToRootLevelSystemGroups maybe?

#

looks like there is some code for handling ISystem there

calm edge
#

I need to handle joining a server, either start/stop systems that run the gameplay, or using some kind of event sent to the systems. Does anyone here have an experience, or know any resources that might be helpful?

rotund token
#

are you using netcode or some other package?

calm edge
#

no it's custom

rotund token
#

we just have our default world with limited systems for menu/assetsmanagement/game management etc

#

and then we create separate client/server worlds when we want to start/join a server

calm edge
#

ah that was the other option

#

do you have to set up the client world from scratch?

rotund token
#

we just have an interface to determine if a a system should be on client/server/both - IClientSystem, IServerSystem etc

#

though i'd do it with an attribute instead like netcode

#

which is how i do it in my personal project

#

though my personal project i use netcode and do things quite a bit different
I don't really have a default world i just create the client world in menu and then on join connect or on self host create the server (in future i'll figure out how to merge client/server for listen servers for performance)

#

i'm doing this so i can run mini game simulations in my menu to make interesting screens

#

but yeah that is not standard i dont think

calm edge
#

I'm a little wary of adding a new world because it's going to be a big change

#

but I broke some stuff that used to use game objects for lifetimes but now with systems it's running all the time

worthy rampart
#

Tertle do you have any published games using ECS right now?

rotund token
#

yes

#

we released an early access game last year

worthy rampart
#

You willing to share what it is?

rotund token
#

i wouldn't use it as an example of how to develop an ecs project

worthy rampart
#

Haha I wouldn't I'm just curious

rotund token
#

the dev team basically converted an existing project to entities after a half week game jam to learn it

#

i was basically hired to help, let's say, iron out some problems

#

anyway it's called beyond contact on steam (consoles coming soon~)

#

if you were interested playing, i recommend waiting a few months we have some really large content drops coming - it was released as an actual early access with no advertising or anything yet to get feedback

#

but yeah my interest is more in our next project which I hope to build from the ground up as pure entities (as the vision for it is ridiculous)

worthy rampart
#

Haha we also have a ridiculous vision we hope entities will help with

rotund token
#

will probably be a bit healthier for me, i might not need to spend so much personal time to get my dots hit ^_^'

calm edge
#

and here I am retrofitting systems to a 5+ year old game ๐Ÿ˜†

rotund token
#

yeah so thats the problem, the code is over 5 years old

#

the server is nearly pure ecs but the client is 80% monobehaviours

#

and it's a nightmare

#

if i was to give advice to a team looking at converting an existing project it would be don't

#

if you need performance, rewrite chunks of critical code to use burst/jobs

worthy rampart
#

Yea conversion seems really hard

#

You need to basically completely redesign

rotund token
#

it requires a big shift in thinking and if you do it on an existing project you'll most likely have to refactor it half a dozen times

#

and most teams who are looking to shift an existing project to dots are doing it for performance reasons

#

and if you design it poorly it can just run worse

#

apart from that, it is still an experimental package and many people who weren't up to date with how Unity wants you to use the package got caught out on just the 0.50 update

#

and the 1.0 package will be even more breaking

#

also takes quite a bit of time to train a team for it

#

way back when entities was first released publicly i actually took off 6 months of work to learn it

#

i was a bit burnt out at the time and was lucky i was in a position to be able to do this - but most people aren't

#

luckily these days there are plenty more resources and help available and it shouldn't take that long to get to a competent ability but it still takes quite a bit of time

#

and it's much harder if you aren't starting from scratch

#

i would say, evne though they've been working with dots for 2+ years i would say 75% of our devs still don't really have a good grasp on it because they haven't had to learn

#

not from a fault of their own, but because either they still spend a lot of their time on the client which is still mostly monobehaviours or most of their work involves basic systems that they can just mostly replicate from existing resources

#

they've never had a chance to learn, something i hope to rectify in our next pure project

#

anyway long slightly off topic rant >_> back to saving!

safe lintel
#

its dots, its on topic!

drowsy pagoda
#

Are Hybrid Components no longer a thing in ECS 0.50? I can't find docs about it...

safe lintel
#

not meant to be touched by the user, theyre all internal now(or should be)

drowsy pagoda
#

Oof. What would be a hybrid equivalent of 0.17 now? Or that whole concept is now out the window?

#

I did notice that if you place any GO in a NON-ECS sub scene, and slap a ConvertAndInject component on it, it will actually convert all of it's components to hybrid companions that you can access from ECS.

safe lintel
#

you can make a class component and store any managed unityengine component in it

drowsy pagoda
#

I found a way. During conversion you can dstManager.AddComponentObject(myAuthoringCompanion), this will create a companion link in ecs. So when I instantiate my player, for instance, I have a global method that will Instantiate the registered prefab on ECS side, and instantiate a "shell" prefab on legacy side, and add that component as companion.

gusty comet
#

Is there a recommended way to run a โ€œStartSystemโ€ just once at the beginning of the Scene? Right now I have a system group that is updated from a Monobehaviorโ€™s Start method and then disabled, but systems running in that group tend to have issues like ECB. playback not working.

#

Iโ€™ve been thinking of using [UpdateInGroup(typeof(GameobjectAfterConversionSystemGroup))] and extending from GameObjectConversionSystem, but Iโ€™m not sure if thatโ€™s worth a rewrite

#

Nor if thatโ€™s the intended use of GOCS

safe lintel
#

I think doing it in conversion in that group is best if you are able to

#

I had a few systems inside the initialize system group or whatever its called but changing components unnecessarily increases the archetypes and if you can avoid that during runtime its better

#

I do a lot of things in GameobjectAfterConversionSystemGroup so imo its quite handy and you should utilize it, not avoid it

gusty comet
#

Thanks. GOCSG runs only once at the beginning of the scene, correct?

safe lintel
#

should happen only once per gameobject converted but it could be runtime or edit time, depends how your project is setup

gusty comet
#

Got it. I have these Unit authorings which spawns a single Formation, a single Officer, and dozens of Soldiers. May I ask if these are the correct steps for spawning all of them and wiring up their references to each other?

  1. In the Prefab conversion group, spawn the officer, formation, and soldiers prefabs. Those are still authorings at this point
  2. In the pre conversion group, have the authorings reference each other correctly. For example, formation referencing the officer and soldiers, and soldiers referencing the formation
  3. Let the conversion group do its job
  4. All entities are now converted and wired up after post-conversion group
rotund token
#

seems fine

steady blaze
#

Hello, when in Jobs -> Burst the Safety Checks are on, will this also be for the compiled game or is this setting just for playing in editor?

steady blaze
shut pewter
#

I have a fun problematic: I want to send information about my entities over the network.

For example, I have a packet that initializes a Unit (in my game) and takes in various data from said unit: It's health, equipment, name, owner etc..

Is it better to have one component with all the data for said unit, or is it better to have many components and "grab" them all, pass them into a function that serializes my data to send over the network?

One reason I have many components is stuff like Translation: I'd rather use Unity's built in translation component (I should, right?) instead of having my own

worthy rampart
#

it lets you have better control over exactly what's needed for each system

#

and lets the safety system be more finegrained

#

IE if you put health as a health component

#

it lets systems determine if they need to read/write to it individually

#

vs if you have it inside of a "stats" component

shut pewter
#

I figured that was the best approach. I do wonder how good it is to grab components around tho

sinful cipher
#

I always have difficulty finding the changelogs for the Entities package.
Is there a list of changes somewhere for the new 0.50 version?

#

Id like to know what new things there might be to check out. Its been a few months since I worked with Unity

karmic basin
nova ferry
#

I have no idea how we are supposed to be able to install DOTS

#

the com.unity.platforms package does not exist

#

I tried installing the entities package but I got a lot of build errors and a ton of .csproj files in my root

#

is there a starter project or something I can just download?

karmic basin
#

0.50 not 0.60

#

and since 0.50 you need to uninstall any com.unity.platforms.X package, only com.unity.platforms remains

nova ferry
#

Why did unity add like 50 .csproj files to my project root?

#

is that intended?

#

I'm still getting around a dozen errors from the entities package

worthy rampart
near quarry
#

anyone having trouble finding the hybrid renderer package? im adding it by git url and im getting an error

#

im on 2020 lts

#

oh it appears 2020 lts doesnt let you use those packages

nova ferry
#

yes a detailed changelog would be great...

split cargo
#

I see people had this problem, but being on the wrong version, so I'm a bit confused... I'm on 2020.3.31f1, the forum post about 0.50 (https://forum.unity.com/threads/experimental-entities-0-50-is-available.1253394/) mentioned min version of 2020.3.30, but when I try to install it, I get an error about it the package not being found https://i.imgur.com/K9zebpv.png

nova ferry
#

Yeah install the latest version. That fixed the issue for me. The docs are quite wrong

split cargo
worn valley
#

So I am trying to reinstall Unity after a complete windows reinstall and now it won't let me install the jobs packages or the collections packages. Have those been rolled in with Burst?

whole gyro
worn valley
# whole gyro Nope. Can you share your manifest.json file?

I am trying to manually add the jobs to my editor and returrns this error
Cannot perform upm operation: Unable to add package [com.unity.jobs@0.50]: Package [com.unity.jobs@0.50] cannot be found [NotFound] UnityEditor.EditorApplication:Internal_CallUpdateFunctions ()

#

Seems like Visual Studio 2017 has been completely depreciated

whole gyro
#

How are you adding the package? From the list in the package manager window?

worn valley
#

I can't even find the jobs in the package manager window. The above error happens when I try to add it from a GIT URL

whole gyro
#

What are you typing in for the git url?

worn valley
#

com.unity.jobs@0.50

whole gyro
#

Hmm, not sure why that isn't working. Try editing the manifest.json file instead

worn valley
#

tried that, throws an error when I boot

#

this is crazy frustrating

#

thank you for the help

#

I've installed a ton of stuff before in the exact same way

#

there is something funky going on with my computer. I don't know why it is just refusing to find certain packages

whole gyro
#

Are you using "0.50" or this:
"com.unity.jobs": "0.50.0-preview.8"?

#

My project already has the package installed, but the git url method also isn't working for me

#

I mean it gives me the same error

worn valley
#

oh thanks a ton. I just updated my manifest file with that exact line

#

and it can't be found. I bet something is blocking the URL

whole gyro
#

Yeah or maybe their package registry is having issues

worn valley
#

Oh yeah, that is gonna be frustrating if this is entirely on Unity and just bad luck. Thank you for the help.

whole gyro
worn valley
#

ah, I should have just looked up above

haughty rampart
worn valley
#

ah fair enough. I've found updating my IDE super frustrating in the past so I tend to avoid it

worn valley
haughty rampart
#

it...should be working this way i think, but i'll get the a line directly from the manifest that you can paste into your manifest file and test it

worn valley
#

I did that as well, no dice. Keeps throwing an error. I thinks something is wrong on Unity's side

split cargo
haughty rampart
#

and even though vs 2022 is not yet 'officially' supported, i've used it since preview version and had no real problems with it, even with unity. but vs 2022 is definitely waaaaay smoother and nice than vs before it

worn valley
haughty rampart
#

@worn valley @split cargo try pasting ONLY this into your manifest, preferrably empty project to test, "com.unity.rendering.hybrid": "0.50.0-preview.24", that should add everything of the other packages as a dependency

worn valley
worn valley
#

Just core DOTS

haughty rampart
worn valley
#

2019 already felt slower to me than 2017. Maybe just imaging it

haughty rampart
worn valley
#

oh true

haughty rampart
worn valley
#

yup can't find that package

#

must be an issue on Unity's side

haughty rampart
#

yeah, maybe your local server is just fucked.

worn valley
#

Dragonblade has the same problem too ๐Ÿ˜ฆ

haughty rampart
#

i mean, i could send you a cached version if you need it urgently

worn valley
#

nah I think I'll take a break. This is too frustrating

near quarry
#

it looked to me like 2020+ didnt have any ecs packages

#

but 2019 does

#

but 2020 has netcode

#

so im confused

worn valley
#

Tried typing this into the + git url com.unity.collections@1.2 and error thrown

worthy rampart
#

does anyone know whether it's Ok for me to generate game objects for the purposes of converting them

safe lintel
#

the latest gave me errors, I had to go back to .pre @worn valley

worthy rampart
#

and where it would be safe for me to do that

#

I was trying to generate them in an IDeclareReferencedPrefabs

#

but the gameobjects just end up in the world without being converted

worthy rampart
#

I have a prefab cube

#

I want to generate a bunch of different scalings of it

#

and turn those into entities

#

and let the collider baking process run on those game objects as normal

#

but I don't want to save all those game object prefabs

#

I just want the entities

haughty rampart
worthy rampart
#

yea that doesn't work

#

you can't change scalings at run time

#

for physics

safe lintel
#

you can actually

worthy rampart
#

not without regenerating the colliders

haughty rampart
#

+1

haughty rampart
worthy rampart
#

But the part that I'm trying to get out of this is having Unity prebake all of those various scaled colliders

safe lintel
#

im not exactly sure how you want to do this but you could make more entities in a conversion system that runs during GameObjectAfterConversionGroup and modify rthe collider

worthy rampart
#

So I don't have to do that logic myself

#

I'm just trying to find a spot where I can add more game objects to the conversion process

#

Programmatically

worn valley
safe lintel
#

you dont want to make more gameobjects

haughty rampart
#

you could do that, but that's kinda anti dots

worthy rampart
#

I don't want to make any game objects at run time

#

I want to have generated game objects that get authored into entity prefabs

#

How is that possibly anti dots

haughty rampart
#

yeah then do that. it's anti dots because you save many equal things that are only different in very few aspects

safe lintel
#

@worn valley easiest to not explicitly add collections and use whatever the other package requires as a dependency

#

@worthy rampart more generated gameobjects sounds like an editor script rather than conversion. if you want more entities from a singular cube gameobject, thats easy in a conversionsystem where you dont make new gameobjects

haughty rampart
#

+1

worn valley
#

@safe lintel Ah I see. I specifically need to use collections so I have access to NativeList<T>. So yeah, kind of hooped now.

rotund token
#

you can still use it if it's brought in as a dependency

worn valley
#

I am getting weird errors that won't load specific packages.

rotund token
#

is unity's npm server down?

#

just saw a bunch of stuff above about that

worthy rampart
worn valley
haughty rampart
worthy rampart
#

I guess I thought it wouldn't be weird to want to generate game objects specifically for the purposes of immediately converting them

worn valley
#

Thanks so much @haughty rampart

rotund token
worn valley
#

I had no idea, you are awesome

rotund token
#

i haven't actually checked but i assume 0.50 physics doesn't support uniform scale yet right? i believe it's a coming feature though

worthy rampart
#

No tertle

#

Only at bake time

rotund token
#

that's a shame

worthy rampart
#

Other than spheres I think non uniform scale should be fine

#

And capsules

rotund token
#

i believe they said they don't intend to support non-uniform scale

worthy rampart
#

Yea I think I read that as well

remote crater
#

Hey guys, hope everyone is well. I finally have time to stab at .5 upgrade. Tertle is very helpful and gave me many ideas.

haughty rampart
#

0.50

safe lintel
#

can I rely on stablehashes in EntityArchetype's for serialization?

rotund token
#

ok entity journaling is amazing for tracking down ecb issues

safe lintel
#

ive sort of been looking forward to trying it(but then at the same time not needing to use it is preferable)

worthy rampart
#

How are you all handling animation at this point

haughty rampart
remote crater
#

I have no idea what the old code did, but it was the only code that was able to check for collisions properly for me

rotund token
#

you dont need to change anything really

#

just override the correct OnUpdate

#

change inputDeps to Dependency

#

and for 0.50 you'll want to add this.RegisterPhysicsRuntimeSystemReadOnly(); in OnStartRunning

#

i cant remember if ICollisionEventsJob schedule method changed

remote crater
#

I do not have a for each in this.

#

How do I change that Update to a .foreach. I know what a .foreach is, but have no clue what that blackbox style thing that is in the update is doing.

#

Thank you for help tertle. I believe I can get to .5. You helped me before.

rotund token
#

yeah you dont have an entities.foreach so you dont need to change anything

#

just use your same job

calm edge
#

After updating everything to .50, nothing that uses the hybrid renderer is rendering anymore, was there any guide for needed updates for rendering?

rotund token
#

are you manually creating your entities or using authoring

#

also were you using V2 before the upgrade?

calm edge
#

manually, and I'm not actually sure

rotund token
calm edge
#

so I updated my list of components with the ones RenderMeshUtility.AddComponents uses

#

ok that's working now, I had to set the rendering layer and world transform params components

#

I'm creating an archetype but AddComponents wants a live mesh

rustic rain
#

What is fastest way to add all basic entities packages?
"com.unity.rendering.hybrid": "0.50.0-preview.24",?

worthy rampart
#

Steal them from one of the projects on that

#

If you just want to edit the file in repo

rustic rain
#

nah, installing renderer is enough kek

worthy rampart
#

It won't add physics

#

Havok

rustic rain
#

I don't need it

worthy rampart
#

๐Ÿ‘

rustic rain
#

What I'm interested in tho is input

#

Is new input system still meh with ECS?

rotund token
#

i find it works quite well

rustic rain
rotund token
#

no

rustic rain
#

Is there any tutorial on what you are doing?

#

I am trying to find it in google, but no luck yet

rotund token
#

doubtful

#

since i kind of just invented the pattern i use without reading anything ^_^'

#

tldr: my settings have bindings setup via InputActionReference

#

these are stored on class based IComponentData

#

i have a system that creates bindings in OnStartRunning

#

that reacts to the input events

#

then I apply it every frame in OnUpdate

#

i also have a state system that enables/disables separate entity mappings

#

which just requires me to call the extension method
this.InputEnable("build");
in my game state system

#

to enable the key bindings for this

#

basically all my keybindings in inputsystem are separated into their various action maps and these maps match to different game states

#

many benefits, can easily enable/disable a bunch of keys for different game states

#

but also it makes rebinding keys really easy

#

you can disallow duplicate key bindings within a mapping but safely allow duplicate key bindings in different mappings as you know* they won't be active at the same time

rustic rain
#

So in other words you create action map for every action?

rotund token
#

no

#

groups of actions

#

Might be
Player
Vehicle
Menu
GameMenu
etc

#

(I have no vehicles in my game but it's a common example)

remote crater
# rotund token just use your same job

I already tried once and failed. This is calling a loop outside the CollisionJobLoop? Can .Foreach call loops outside loops? I have no idea how this chunk of code I downloaded worked, so I don't know how to turn it into a .foreach https://pastebin.com/mGzjXw9F

worthy rampart
#

hmmm

#

is it possible for me to attach an existing scene

#

as a subscene to a different scene

rotund token
worthy rampart
#

ohhh

#

is subscene just a gameobject component

#

nice

haughty rampart
remote crater
#

I have two JobComponent Systems I need to turn into SystemBase. In order to do so. I need to know what I have in this boilerplate code I downloaded in order to turn it into a .for each. I took about 30 hours trying to do collision on my own, and this was the only stuff someone directed me to download that worked. I don't know what it does, but it worked.https://pastebin.com/mGzjXw9F

remote crater
#

I'm not asking a million questions, just one.

haughty rampart
#

then it should be no problem for you to figure out what that code actually does

remote crater
#

Sir

#

Let me tell you a story.

#

There was once a man who bought Toyota.

#

He's been telling time since elementary school. He knows digital and analog.

haughty rampart
#

you don't have any Entities.Foreach()

#

you are using a job struct

remote crater
#

But to set the clock, he must read the mind of a Japanese Engineer.

#

It is not his inability to tell time that prevents him for doing this... Just like a software engineer can be great at coding, and not know someone else's API.

haughty rampart
#

literally, just rename the base class to SystemBase, keep everything the same, and only change the things like Dependency, etc...

remote crater
#

I'm aware I do not have a .foreach. You jumped into this one fast.

haughty rampart
#

because you keep on asking about a .foreach

#

........

remote crater
#

How do I turn that update into a .foreach I don't know how an inputDeps = new CollisionJob translates into a .foreach

rotund token
#

Why do you want to turn it into a foreach

#

You can't

haughty rampart
#

what loop are you referring to? that code is like 500 lines

rotund token
#

It's physics job

remote crater
#

.5 does not accept JobComponentsystems

rotund token
#

Stop looking at entities foreach

rotund token
#

Yes

remote crater
#

Its in my class: public class ObstacleHitSystem : JobComponentSystem

rotund token
#

And job vs system has nothing to do with this

#

You can write foreach in job component system

haughty rampart
#

+1

remote crater
#

I have two classes of JobComponentSystems which are critical to my game to keep playing.

rotund token
#

Yes change it to system base

#

Rename the on update

#

Change inputdeps to Dependency

#

And you're done

haughty rampart
#

literally what you've been told before

remote crater
#

Oh I don't need a .foreach? Thank you.

rotund token
#

You need foreach as much as you need it in the job component system

remote crater
#

Plz Mind, you're not being helpful, but kinda just putting me down for some reason...

rotund token
#

System base is really just job component system and component system

#

Merged into a single system

#

(at least that's how it started)

remote crater
#

I've seen it used interchangably.

haughty rampart
#

wtf, we've been telling you that you don't have / need a .foreach

haughty rampart
remote crater
# rotund token You need foreach as much as you need it in the job component system

I was able to change to system base, and fix the update. That went off without a hitch. I am not familiar with what a "inputDeps = new CollisionJob()" should become. There are three problem lines inputDeps is causing as illustrated here: https://pastebin.com/4Uhw5ZAe

haughty rampart
#

remove inputDeps =

remote crater
#

Thank you. I did that before, but the remaining two problem lines persisted so I wasn't sure I was ahead.

haughty rampart
#

what's erroring now?

remote crater
#

}.Schedule(_stepPhysicsWorldSystem.Simulation, ref _buildPhysicsWorldSystem.PhysicsWorld, inputDeps);

#

&

#

_endSimEntityCommandBufferSystem.AddJobHandleForProducer(inputDeps);

haughty rampart
#

remove inputDeps

remote crater
#

I have tried that. It produces new errors.

haughty rampart
#

or rather, change inputDeps to Dependency

remote crater
#

That took away errors. Much obliged. Remember, I'm a nice guy. I really am altruistic. If my games make good money and you remember helping me, get ahold of me in the future and I help you back n stuff. Love's the way bro. Thank you so much for help guys. We are all team humanity. Lets see if I can get it running or if there are more errors.

#

I really appreciate all the help of all of younz.

#

I'm a solid software engineer, but techs really brick wall me hard. Both Mindstyler and Tertle I really appreciate the help from or I'd be stuck for days on this, maybe never get past it.

haughty rampart
remote crater
#

On runtime I get this error: InvalidOperationException: The system ObstacleHitSystem reads EntityData via TriggerHitSystem:TriggerJob but that type was not assigned to the Dependency property. To ensure correct behavior of other systems, the job or a dependency must be assigned to the Dependency property before returning from the OnUpdate method.

haughty rampart
#

where you previously had inputDeps = change it to Dependency =

remote crater
#

Ohok!

haughty rampart
#

yeah....physics jobs are a bit different than normal jobs, so that's maybe why you get the error

#

no actually, i wasn't smart. you only don't need to assign to Dependency when using Entities.Foreach(), but since you have a job struct, you definitely have to assign to Dependency

remote crater
#

Looks like I'm flying in space and still colliding. I need to do more tests.

gusty comet
#

Are there any pitfalls with the following setup?
SystemA requires some setup
SystemB does that setup, but is [DisableAutoCreation]
In it's OnCreate, SystemA GetOrCreateSystem SystemB, enables it, and calls Update() once. Then it disables it.
The reason is that SystemA's setup requires iterating over entities, so like any query, but only at the start of the game

haughty rampart
#

why don't you just do a query in OnCreate() then?

gusty comet
#

I'm worried that making SystemB a GameObjectConversionSystem instead would trigger it every time Monobehavior conersion happens

gusty comet
#

Does that mean that Systems' OnCreate are called after all entities are converted?

haughty rampart
#

or you could also just put the query in OnUpdate() with .RequireSingleton() and after it's done, remove the 'empty' singleton component. then it will only ever run once

gusty comet
#

Thank you. Your first suggestion worked perfectly and it's behavior implies that it ran after the conversion completed

coarse turtle
gusty comet
#

That's odd. I just had OnCreate do EntityQuery.CalculateEntityCount and it returned the correct number of entities with a certain archetype in the scene.

#

Oh I remember now, conversion happens in the Conversion World but the systems are instantiated in the Destination World which happens after CW, and thus after all entities are converted

coarse turtle
#

ah

#

yea

pale fiber
#

A beginner's question: Can ECS 0.50 be used in Unity 2021? Or will this be possible when ECS 0.51 is published?

haughty rampart
#

0.50 is only compatible with 2020.3 right now. 0.51 will be compatible with 2021

pale fiber
#

ok, ty ^ ^

#

One more question that may sound strange: Can I use DOTS with the standard Unity environment
(GameObjects, MonoBehavior), a kind of hybrid? For example, can I call a function, from a MonoBehaviour class / component, inside the "DOTS class"?

minor sapphire
pale fiber
#

Cool ^ ^

#

When ECS 0.51 comes out, I will start studying DOTS technology

minor sapphire
#

Please use MonoBehaviours responsibly ๐Ÿ˜„