#archived-dots

1 messages Β· Page 120 of 1

odd cipher
#

I dont really know how I would avoid that though

bright sentinel
#

@odd cipher You can just use an int or enum for ID purposes

odd cipher
#

yeah I do but they have names too

#

like in minecraft, you wouldnt see Dirt named 1 would you

warped trail
#

you can have table with id and names

odd cipher
#

I suppose that will do yes

bright sentinel
#

Pretty sure that's also how Minecraft works

odd cipher
#

:p

warped trail
#

you can store it in human readable format and it will be pretty easy to modify πŸ‘

low tangle
#

you wouldn't see 1 at all

#

its a binary format with at least RLE typically in voxel chunks

opaque ledge
#

okay so

            var threatTables = entityManager.CreateEntity(typeof(ThreatAllyMasterTable), typeof(ThreatEnemyMasterTable));
            var allythreatTable = entityManager.GetBuffer<ThreatAllyMasterTable>(threatTables);
            var enemythreatTable = entityManager.GetBuffer<ThreatEnemyMasterTable>(threatTables);

            foreach (var item in AllyEntities)
            {
                Debug.Log("Adding to Ally");
                allythreatTable.Add(new ThreatAllyMasterTable { entity = item, threat = 0});
            }

            foreach (var item in EnemyEntities)
            {
                Debug.Log("Adding to Enemy");
                enemythreatTable.Add(new ThreatEnemyMasterTable { entity = item, threat = 0 });
            }
#

I am doing this in a MB, that is being called from a system that is run with WithStructralChanges and Run

#

the moment i am trying to add to those buffers it says NativeArray has been deallocated, it is not allowed to access it

#

i also tried to do add to list first, then clear buffer and do AddRange, but the moment i do Clear it gives the error

#

so i have no idea what is going on here

#

Okay nvm, i just read the documentation and it says dynamic buffers get invalidated if a structral change happens, which i was doing after i get those dynamic buffers

odd cipher
#

soo.. a NativeArray cant contain a struct that has a NativeArray in it?

#

I'm soo close to getting it to work with Burst but aghh

warped trail
#

there is FixedList

odd cipher
#

@warped trail Burst error BC1020: Boxing a valuetype `int` to a managed object is not supported

#

nevermind

#

well, I got burst fully working! aside from the fact that there doesnt seem to be a big difference

#

and I think its because I'm using a NativeMultiHashMap

warped trail
#

there is specific job for NativeMultiHashMap πŸ€”

odd cipher
#

I think its this loop part that is slow ```public NativeArray<Color32> GetSprite(TerrainSprite name) {
NativeArray<Color32> colors = new NativeArray<Color32>(terrainSpriteSize * terrainSpriteSize, Allocator.Temp);

        var valueEnumarator = colorTerrainTiles.GetValuesForKey(name);
        int i = colors.Length - 1;
        while(valueEnumarator.MoveNext()) {
            colors[i] = valueEnumarator.Current;
            i--;
        }

        return colors;
    }```
bright sentinel
#

Have you checked the profiler?

odd cipher
#

1 sec

bright sentinel
#

I mean, you can't really tell whether that part is the one being the problem if you haven't profiled it

odd cipher
#

not really sure what to be looking at

#

but with all the jobs together it took 900ms to generate the map

#

I'm sure there is some better way or something else to use other than NativeMultiHashMap

opaque ledge
#

if its taking 900ms either you are not using burst or you are creating lots of stuff from managed world

odd cipher
#

putting [BurstCompile] enables burst no?

#

disabling burst makes it take 1800ms

opaque ledge
#

yeah

#

never in something in existence will take 900 ms in pure bursted job πŸ˜„

odd cipher
#

well it has now πŸ˜„

opaque ledge
#

can you profile how much ms each job takes ?

odd cipher
#

~150

opaque ledge
#

is burst compile enabled ?

odd cipher
#

all that yep

opaque ledge
#

hmm, you are not using ECS right ? you are doing this all in MB ?

odd cipher
#

MB

opaque ledge
#

are jobs dependent on each other or do they can run in parallel ?

odd cipher
#

parallel

#

IJobParallelFor

opaque ledge
#

how many jobs you have ?

odd cipher
#

how do you know

opaque ledge
#

idk, its your code πŸ˜„

#

what i am trying to make sure is, if these job can run in paralel you should do JobHandle.CombineDependincies

odd cipher
#

I only create one job though

#

one IJobParallelFor

warped trail
#

and how many tiles do you have?

odd cipher
#

40,000

warped trail
#

then you are probably doing something not good enough πŸ˜…

opaque ledge
#

what is your batch size that you provide to parallel job ?

odd cipher
#

had it at 5000, but I got more performance at 1

opaque ledge
#

yeah, the more expensive the job is the less batch size should be used.

#

hmm what else πŸ€”

#

well, i guess its all about algorithm then, burst already halved your execution time so thats good

odd cipher
#

yeah im like 90% sure its because of that NativeMultiHashMap loop

warped trail
#

70 to 900 not quite halved πŸ˜†

odd cipher
#

which gets done 4 times per tile

opaque ledge
#

can you post your code to hastebin ?

#

he said 1800 to 900 πŸ˜„

odd cipher
#

well before Burst and all that it was 70

opaque ledge
#

70 ms ?

odd cipher
#

yeah

#

not such an improvement now is it :D

warped trail
#

why do you use HashMap?

opaque ledge
#

so wait, you init 40k tiles in MB in 70 ms ?

odd cipher
#

I render 40K tiles in 70 ms

opaque ledge
#

i mean thats already pretty good performance

odd cipher
#

yeah and I guess I could just revert to that and discard my 32 hours of time spent refactoring :>

#

but yeah should I send the Job in hastebin?

opaque ledge
#

i think there is something going wrong here, idk

#

even if job were to take longer it shouldnt be that drastic

#

yeah please

opaque ledge
#

so, you said you render 40k tiles in 70 ms, but how much does it take to create those tiles ?

#

you do create those tiles inside a job right ?

odd cipher
#

no they are created outside but thats how it was before too

#

wait crap I cut some code out of that

opaque ledge
#

πŸ˜„

odd cipher
#

ignore the commented ones that I forgot to delete

#

at the top

warped trail
#

so you store your tile table in hashmap?

odd cipher
#

the colors of terrain types

#

there are 5 terrain types atm

lusty otter
#

Just saw the ping from you, not sure if you still need the new tile stuff.

opaque ledge
#

i think you can make colorTerrainTiles ReadOnly

odd cipher
#

no sorry, I figured that out Burrito

lusty otter
#

Good.

#

For your rendering job, do you change a lot of sprites every frame?

odd cipher
#

no

lusty otter
#

Because if you only make changes to them sparingly, there's no point in recalculate texture for all of them every frame.

#

If you change one tile, you only need to recalculate that tile and the surrounding neighbours.

odd cipher
#

yes I know

opaque ledge
#

is GPU instancing for your material enabled ?

#

i think CodeMonkey had something about that

odd cipher
#

I dont know what GPU instancing for my material has anything to do with this but no

lusty otter
#

GPU can draw all of your tiles in one call, if enabled.

opaque ledge
#

its about batching the sprite

#

yep

odd cipher
#

didnt change anything though so

opaque ledge
#

is it unlit

lusty otter
#

I think you should profile it and see where the bottleneck is, before making changes.

opaque ledge
#

CodeMonkey mentioned that (because of a bug) it only worked with certain shader, i forgot the name now

lusty otter
#

I suspect your bottleneck is simply your job recalculating 40k tiles every time

opaque ledge
#

but anyway, i think i cant help you, hopefully more experienced people can

lusty otter
#

It doesn't scale well.

odd cipher
#

@lusty otter right yeah but I used to do that at 70ms before so

#

thought changing to burst would make it quicker

opaque ledge
#

70 to 900 tho πŸ˜„

#

i was in your situation as well, some calculations i was doing was taking 50-60 ms, i wanted to use job and burst compile but it didnt work because i had to read from dict to create structs, send them to job so it can calculate then i set the dictionary from the values job created, but this made it happen to 100 ms since i was accessing dictionary twice

#

it was a big dictionary πŸ˜„

lusty otter
#

I see.

opaque ledge
#

but 70 to 900 seems pretty extreme

odd cipher
#

yeah actually more like 70 to 150

lusty otter
#

I can't help much without diving deep into your project and even then there are people much better than me at this, sorry πŸ˜“

opaque ledge
#

i mean burst is pretty good at calculating stuff, not sure about rendering

odd cipher
#

I'm fine with 150ms but I thought there would be more than that

gusty comet
#

I have 10k cubes which move up and down

#

is this a decent fps count for that? i never tried 10k cubes without ECS πŸ€”

tawdry tree
#

I imagine doing the same with monobehaviours would be... stuttery. Don't get too stuck on the specific numbers - they're kinda useless unless you have a way to compare them (ie. have run two different versions of some code, and measured both)

gusty comet
#

I was just wondering if I am doing it right

tawdry tree
#

Have you checked the entity debugger to see what takes the most time?

gusty comet
#

Hmm no

tawdry tree
#

That would be useful info for optimizing, should you need that.
I'd say you aren't doing it wrong as long as it runs fine

gusty comet
#

Okay thanks

#

oh

#

RenderMeshSystemV2

tawdry tree
#

The profiler is also great

gusty comet
#

is that the time it took to draw?

#

or is that other stuff

tawdry tree
#

Not sure. Either the time to draw or the time for it to read the positions and all that to send it to the GPU

#

The profiler lets you see system vs draw time

gusty comet
#

i apparently have spikes where its 15 fps

tawdry tree
#

When that happens, pause the sim and click the spike to see the details of what happened

gusty comet
#

πŸ€”

tawdry tree
#

Mind you, it could well be because you're profiling or something else

gusty comet
#

oh

tawdry tree
#

Especially if it's when you swap to it at that moment

warped trail
#

by default JobDebugger and LeakDetection is On

#

you can disable them to see real performanceπŸ˜…

tawdry tree
#

You can also 'zoom' in the profiler to see more details, including how long each system and system group takes

gusty comet
#

What is EditorLoop

#

and why is taking so much :0

warped trail
#

and it is better to test performance in builds πŸ€”

tawdry tree
#

That would be the editor

gusty comet
#

oh i see

tawdry tree
#

And it has.... some overhead

gusty comet
#

why does that sometimes spike like to 80 ms

remote coyote
#

Anybody managed to use the Build Configuration stuff to build a headless server? Just the Net Code Conversion Settings alone don't seem to do the trick.

tawdry tree
#

Zoom in and see what takes time compared to other stuff. My guess would be that something runs only every few frames

odd cipher
#

Since you're storing colors of a bunch of tile varisnts it could end up being a very large array but the math to get the proper index is pretty straightforward
Tiletype * (TileSize * NumVariants) + (Tilesize * Variant)
@zenith wyvern when you get back online, do you think you can elaborate on this? I think it could save some frames, also I did get Burst working but the result was... underwhelming so trying this.

gusty comet
#

I don't see anything under the editorloop. I am building the game now with a fps counter

#

do i have to pay attention to something when building it?

warped trail
#

you can attach profiler to build

gusty comet
#

o damn thats much better

#

o you can do that?

north bay
#

@odd cipher Do you have collection checks disabled when profiling?

odd cipher
#

what do you mean

#

@north bay

north bay
#

Jobs->Burst->Safety Checks

warped trail
odd cipher
#

both those are off

gusty comet
#

Is there any performance benefit of using JobComponentSystem vs ComponentSystem ?

#

I don't understand the difference

warped trail
#

@gusty comet use SystemBase

gusty comet
#

πŸ€”

warped trail
#

JobComponentSystem and ComponentSystem are doomed to be deprecated

gusty comet
#

oof

#

i guess cuz its still in early development

#

cant rely on older yt videos πŸ˜‚

warped trail
#

and read Entities documentation😁

remote coyote
#

Right, so I've just got to make custom build player step for the pipeline.

round summit
#

I set it to 0.34 there
But i can't see any 0.34 in entity debugger when i look at that entity

gusty comet
#

did u get the Physics shape component?

#

it seems friction is indented a bit more than material so it is probably under physshape.material.friction

#

@round summit

round summit
#

@gusty comet Is there a physics shape component?

#

I see only a PhysicsCollider component but it doesn't seem to include matial field

#

There is no PhysicsShape component

warped trail
#

@round summit cs var colliderPtr = (SphereCollider*)collider.Value.GetUnsafePtr(); var material = colliderPtr->Material; material.Friction = 0; colliderPtr->Material = material; something like this i guessπŸ€”

#

collider is PhysicsCollider

#

but be careful, instantiated entity has copy of collider pointer

round summit
#
public struct MassProperties
    {
        public static readonly MassProperties UnitSphere;
        public MassDistribution MassDistribution;
        public float Volume;
        public float AngularExpansionFactor;
    }

Not here neither

warped trail
#

look at other colliders

#

like SphereCollider, BoxCollider etc

#

they all implement IConvexCollider

gusty comet
#

Is unity.physics for ecs ?

round summit
#

Oh i see thanks @warped trail

#

Yes this is ecs

#

I don't know why they didn't port it to monobehaviour, that's what i've been trying to do in last weeks

warped trail
#

so how can you do something like this (IConvexCollider*) ?πŸ˜…

#

why do they need to port it to monobehaviour?πŸ€”

gusty comet
#

How do you get the Physics?

round summit
#

@warped trail Am i the only one who wants to have stateless physics in monobehaviour?

gusty comet
#
public class MoverSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Local variable captured in ForEach
        float dT = Time.DeltaTime;

        Entities.ForEach((ref Translation translation, ref SpeedComponent speedComponent) =>
       {
           translation.Value.y += speedComponent.speed * dT;
           if(translation.Value.y > 10)
           {
               speedComponent.speed = -math.abs(speedComponent.speed);
           }
           if(translation.Value.y < -10)
           {
               speedComponent.speed = +math.abs(speedComponent.speed);
           }
       }).ScheduleParallel();
    }
}
#

is this good?

warped trail
#

i think yes

gusty comet
#

Changed to SystemBase

round summit
#

Am i the only one who wants to have stateless physics in monobehaviour?
Out of the ones that want the stateless physics

warped trail
#

πŸ€·β€β™‚οΈ

gusty comet
#

wow SystemBase is so much better

#
#define USE_SYSTEM_BASE

using System.Collections;
using System.Collections.Generic;
using Unity.Entities;
using UnityEngine;
using Unity.Transforms;
using Unity.Mathematics;

#if USE_SYSTEM_BASE
public class MoverSystem : SystemBase
{
    protected override void OnUpdate()
    {
        // Local variable captured in ForEach
        float dT = Time.DeltaTime;

        Entities.ForEach((ref Translation translation, ref SpeedComponent speedComponent) =>
       {
           translation.Value.y += speedComponent.speed * dT;
           if(translation.Value.y > 10)
           {
               speedComponent.speed = -math.abs(speedComponent.speed);
           }
           if(translation.Value.y < -10)
           {
               speedComponent.speed = +math.abs(speedComponent.speed);
           }
       }).ScheduleParallel();
    }
}
#else
public class MoverSystem : ComponentSystem
{
    protected override void OnUpdate()
    {
        float dT = Time.DeltaTime;
        Entities.ForEach((ref Translation translation, ref SpeedComponent speedComponent) =>
       {
           translation.Value.y += speedComponent.speed * dT;
           if(translation.Value.y > 10)
           {
               speedComponent.speed = -math.abs(speedComponent.speed);
           }
           if(translation.Value.y < -10)
           {
               speedComponent.speed = +math.abs(speedComponent.speed);
           }
       });
    }
}


#endif
#

100k cubes

#

ComponentSystem is around 13 fps and Systembase is around 50 fps

#

(in the editor)

#

now i am impressed

#

Thanks @warped trail

warped trail
#

this is old rendererπŸ˜…

gusty comet
#

What do you mean? :o

#

And where do I get ECS physics? I don't see it in the package manager :c

warped trail
#

look for Unity Physics

gusty comet
#

Oh πŸ€¦β€β™‚οΈ

#

And what did you mean by old renderer?

warped trail
#

there is new hybrid renderer V2

#

but it is in preview preview state πŸ˜…

gusty comet
#

Oh is it not for 2019.3?

#

I'd like to try, I am experimenting around

warped trail
#

no it is 2020+ only

gusty comet
#

:C i have to install yet another unity

warped trail
#

and you have to download specific project from github

gusty comet
#

Do these things also work on all platforms btw?

#

(or eventually will when they are out of dev)

warped trail
#

πŸ€·β€β™‚οΈ

#

probably don't bother with new renderer until they release it properlyπŸ€”

gusty comet
#

So this version is using V1 of Hybrid Renderer I guess?

#
An error occurred while resolving packages:
  Package com.unity.jobs@0.2.7-preview.11 has invalid dependencies:
    com.unity.collections: Resolved version [0.5.2-preview.8] does not satisfy requested version [0.7.0-preview.2]
#

Tried to install Unity Physics >_<

warped trail
#

update or downgrade required packages😏

gusty comet
opaque ledge
#

imo, just wait for proper release πŸ˜„

gusty comet
#

i want it now >:c

opaque ledge
#

πŸ˜„

#

no idea

#

its just that i got weird errors in 2020.1 for some reason so i downgraded

gusty comet
#

:c

warped trail
#

i managed to run it, but there there was no support for any lights except 1 directional light in URP πŸ˜•

#

i hope it is just a bugπŸ˜…

gusty comet
#

Which one do I import? o_o

#

apparently universal i guess and first core

warped trail
gusty comet
#

well now it wants shadergraph

junior fjord
#

do I understand it right that the jobs I start in InitializationGroup can also still run in SimulationGroup?

#

because I specifically need to pass in the jobhandle if I want the job to finish before the EndInitializationECB

warped trail
#

there is AddJobHandleForProducer(JobHandle) in EntityCommandBufferSystem

gusty comet
#

Can you point me to where the sample projects are?

warped trail
#

just wait for proper release, your disappointment will be immeasurable and your day will be ruined

opaque ledge
#

exactly

gusty comet
#

In the dots physics when i create an entity in code do i add a component of type PhysicsShape to it ?

gusty comet
#

is there a github to previews of com.unity.entities as well like there is for that renderer?

#

thx xzjv

opaque ledge
#

@zenith wyvern @amber flicker i found out why Transform System was taking 20 ms, because it was fairing for my raycast system which takes 15-16 ms, i am working on how to reduce them now

gusty comet
#

@warped trail it can't find RenderMesh with this setup? What do I have to use then?

coarse turtle
#

make sure hybrid renderer is installed as a package

gusty comet
#

Oh about that, I wanted to try out hybrid renderer v2

coarse turtle
#

o - w/ the new sources from github?

gusty comet
#

well i thought so

#

but apparently i am missing something

#

Is V2 included in the 0.4 Hybrid Renderer ?

coarse turtle
#

hmm I still think you need the Hybrid Renderer V2

#

Yeah I believe so

gusty comet
#

oh im dumbbb

#

it says right here added V2

#

thanks

coarse turtle
#

yeah you just need to put the scripting defines

gusty comet
#

yeah will do that

coarse turtle
#

im curious as to how people write graphics tests πŸ€”

gusty comet
#

btw why does unity now open scenes in the visual studio

#

double click or press open => vs

coarse turtle
#

that might be an issue with the visual studio package?

gusty comet
#

idk what i did >-<'

#

o no

warped trail
#

just wait for proper releaseπŸ˜‘

coarse turtle
#

Well that should be fine for the time being - it wont be removed immediately

gusty comet
#

but i can't run with errors

coarse turtle
#

that should be a warning tho

gusty comet
#

no

#

two errors

coarse turtle
#

Oh I see - guess it was different in my project

gusty comet
#

What package is bugging it?

#

I can't locate the issue

#

also 2020-06-20 ? Is unity doing time travel now? UnityChanLaugh

#

wait

dull copper
#

it just means they'll remove the feat for good by that date

gusty comet
#

@warped trail @coarse turtle did you really try v2 ???

dull copper
#

I tried it

coarse turtle
#

nope

gusty comet
#

it says u need b3

dull copper
#

and no, there's no official 9.0.0

gusty comet
#

which is not out yet

dull copper
#

there is master branch on SRP github tho

gusty comet
dull copper
#

yes, that last step

#

I ran it from master myself with HDRP

gusty comet
#

but 2020.1.b3 is not out yet?

dull copper
#

that being said

#

IMPORTANT: Unity 2020.1.0b3 is a hard requirement for Hybrid Renderer V2. Visuals will be completely broken if you test with earlier version (such as 2020.1.0a25).

#

no it's not

#

we just got b1

gusty comet
#

so how would you even have tried it

dull copper
#

well, I didn't say it worked perfectly

gusty comet
#

-<'

dull copper
#

there were meshes missing and stuff

gusty comet
#

ok

warped trail
#

πŸ˜…

dull copper
#

and like people before warned here you'd better wait if you want better experience

gusty comet
#

i need to become friends with unity staff to get b3 now ...

#

brb

dull copper
#

pretty sure b3 isn't a thing yet even

#

I'm not sure if even b2 is up internally yet as it doesn't show up in issue tracker yet

#

when they say you need b3 to run this, it means they have the changes launching on b3 eventually

#

right now they are just running this internally from their dev branch / turnk

#

also meaning, they probably missed the window to sneak these changes into b2

#

so b3 it is

#

wait 2 weeks basically

warped trail
#

Official URP support (minimal feature set) i hope minimal doesn't mean only 1 direction lightπŸ˜…

hollow sorrel
#

does it also add support for one-off rendermeshes?

#

without those getting their own chunk mansion

dull copper
#

oh I missed that they finally updated online docs for new hybrid renderer

finite ibex
#

Just found out about DOTS this morning, I am so excited to learn this!

dull copper
#

The main thread bottleneck of Hybrid Renderer V1 is gone, and render thread performance is also improved. The new data model allows us to feed the shader built-in data from C#, allowing us to implement missing HDRP and URP features.

zenith wyvern
#

@zenith wyvern when you get back online, do you think you can elaborate on this? I think it could save some frames, also I did get Burst working but the result was... underwhelming so trying this.
@odd cipher

Not sure what else there is to say about it, you store all the content for a given variant within a subsection of the array, and access the subsection based on the size of the content.

dull copper
#

heh IMPORTANT: Hybrid Renderer V2 is experimental in 2020.1. We have validated it on Windows DX11 and Mac Metal backends in both editor and standalone builds. Our aim is to validate Vulkan, DX12, mobile device and console platform support for 2020.2

#

this explains why I got nothing on DX12

zenith wyvern
#

I don't think the proper unity version is out for it though is it?

safe lintel
#

do you have any hints if lightmapping is part of v2?

gusty comet
#

when 2020.2 :P

dull copper
#

2020.2.0a3 can already be seen on issue reports

#

would expect public alphas this or next week

#

but it'll probably take a long time to get that DX12 support there

#

do note that 2020.2 is set to release on Q3/Q4 this year

#

so it's going to be the longer alpha/beta period in recent years

#

there's only two tech releases this year, 2020.3 is going to be the LTS

#

(which is supposedly out in 2021)

junior fjord
#

I have a world made out of tiles (one tile is probably as but as a minecraft chunk). But it won't be infine. How should I create the meshes for the world. I want the tiles to be able to change colors (I could do this through the Color array and using or writing a shader that uses the color array). What should I do:

  • One big mesh for the whole map
  • Small chunks (say 5x5 tiles), with different meshes (for the height), and different color arrays (for different colors) but the same material
  • Every tile is its own entity/mesh (all the same mesh now, just different positions at which the meshes are rendered) and a different color property (now color is just a material property, not the color mesh array, which maybe makes it easier somehow?)

Any help appreciated, I just don't want to spend a lot of time doing the wrong thing in case one of the ways is obviously better

dull copper
#

btw, have any of you looked at the hybrid v2 code?

#

they literally have few line files for those material property overrides now for HDRP and URP

junior fjord
#

so you think I should use the third way to use the material property?

dull copper
#

it feels bit hacky but I guess it gets the job done

#

ah, I'm just wondering about hybrid v2 in general here

#

but it's supposed to ease the pain on setting those properties too

#

so if you need it, might be worth waiting few weeks

junior fjord
#

hmm, I don't need it yet I think I can do with Graphics.Draw, but if one of the ways is obviously more clever in future I would chose that

gusty comet
#

i wanna try it now

glad solar
#

Hi. Seems to me that Dots requires the user to know alot more math or i'm not going to the right documentation.

I'm trying to make my object rotate to aim where the mouse is. But the way i'm doing, the object is moving in the scene. I know i'm doing something wrong here, but i'd like a help.

The mousePosition is a float3 with the world position.
My game is 3D but i'm doing a 2D game using X and Z positions.

Can anyone help me make my 2D aim to where the mouse is or tell me what am i doing wrong?

Thanks.

dull copper
#

@gusty comet it's not going to work properly without those beta 3 changes tho πŸ™‚

#

and there's nothing you can do about it but wait

gusty comet
#

Yeah .. anyway I am trying the physics now but it's a bit confusing looking at this :

#

I learned to create an entity via the manager

warped trail
#

just create entities through authoringπŸ€”

gusty comet
#

authoring?

dull copper
#

conversion scripts

#

there's conversion from rigidbody and colliders but you can just use the new authoring components for physics body and physics shapes

#

I do latter

warped trail
#

just put Physics Shape , Physics Body scripts and ConvertToEntity script

opaque ledge
#

@glad solar you sure this is the only system that affects the player ? your player shouldnt be moving at all with this system, you are just rotating your player and thats all

glad solar
#

@opaque ledge, i deactivated it, but it still moving depending on the angle it looks towards mouseposition.

The object have Rigidbody

gusty comet
#

o i got it to work, i didnt know what to pass in rendermesh but i just had to do the same as before

opaque ledge
#

sooo, what you want your system to do then ?

#

i thought you didnt want it to move, just rotate ?

glad solar
#

Just rotate (look at) to where the mouse is.
Right now is very glitchy

opaque ledge
#

then disable that movement system

#

you can put [DisableAutoCreation] attribute to your system calss

gusty comet
#

Ok so my collider works when i set its size as i want but the mesh ofc stays the same size, how do i scale that up?

warped trail
#

scale meshπŸ€”

gusty comet
#

Like I have this simple cube selected as the mesh

#

See that blue cube that should cover a wider area. The collider as you can see is as far as I want it (the boxes above not falling through)

warped trail
#

you are creating it in code?

gusty comet
#

The cube no, I still have it selected in the inspector

#

I think it's default cube

#

Like normally on a gameobject you can scale it it looks bigger

#

~~o or i just draw 100x100 cubes ~~

warped trail
#

i guess you are following some old tutorialπŸ€”

gusty comet
#

Probably

#

I had that cube since I started with this tbh

warped trail
#

have you looked at official unity ecs samples?

gusty comet
#

Not really πŸ˜‚

#

is it this?

warped trail
#

not that

gusty comet
#

o nice thx it even has physics samples

warped trail
gusty comet
#

o damn

#

thx

#

will have a nice watch later

junior fjord
#

erm if I remove and add a component in an ecb

#

please tell me it will do the magic of just not doing anything?

#

I mean of just changing the component data maybe, but not actually copying it to a different archetype in between

#

or how should I do this:
I have some entities that have a component X currently and I have a new set of entities that will now have component X (it is just a tag component, which meshes to draw). I want to most efficiently only remove the X from the entities that don't need it anymore and add it to the new ones

#

if I would just remove it from all that have it currently and then readd, it would do a lot of copying I am scared

warped trail
#

adding/removing is structural change, so yeah they will be traveling from chunk to chunkπŸ˜…

junior fjord
#

yeah I hoped that the ecb will notice this

#

if I all submit it to the same ecb, he might only do the copying in the very end and then there won't be much copying necessary

#

that was my dream

warped trail
#

you are removing component from entity and then adding it again?

zenith wyvern
#

You can use batch operations by passing entity queries to the ECB on the main thread, that will be pretty fast

junior fjord
#

@warped trail yeah as I described above

#

hmm I now added a bool to the component X, to check if it should still be there

#

then I will just remove only the X that that should not still be there

warped trail
#

can't you just not remove it at all?πŸ€”

zenith wyvern
#

You could always use state components to track newly created entities. This is pretty much what they were made for.

#

If you're not tracking external state just use a normal component, like a "RemoveX" component

finite ibex
#
``` I am using Rider 2019.3 if that makes a difference.  I could use ```World.Active.EntityManager```, and it didn't tell me that that was depreciated
#

the first one wont resolve symbol

bright sentinel
#

@finite ibex What is your context?

#

Is this in a system, monobehaviour etc?

finite ibex
#

Its a monobehaviour

opaque ledge
#

what entities package ?

finite ibex
#

Its not rider - same issue in VSCommunity

#

entities preview 0.1.1

#

unity 2019.2.2.f1

opaque ledge
#

well, entities package is 0.8 now

finite ibex
#

lemme upgrade unity version

opaque ledge
#

you need 2019.3 i think at least

finite ibex
#

what about using beta 2020?

opaque ledge
#

yep, thats also way to go, it gives me weird errors so i downgraded to 2019.3.5

#

i probably will try to upgrade it at b3

warped trail
#

πŸ˜…

finite ibex
#

I will learn from your issues and stick with 2019.3.5 for now πŸ™‚

opaque ledge
#

πŸ˜„

finite ibex
#
```  Let me try a fresh install instead of an update
opaque ledge
#

those packages are connected to each other so you have to upgrade them all

#

except platforms

finite ibex
#

that was after updating to .8 and hybrid to .4

opaque ledge
#

entities, burst, collections etc.

finite ibex
#

oh

#

ok, i didnt do collections

#

b/c i didnt install that package manually

opaque ledge
#

yeah, package manager is kinda derpy

finite ibex
#

collections is installed and up to date, going to try fresh

opaque ledge
#

just restart unity πŸ˜„

finite ibex
#

i did

opaque ledge
#

well deleting library folder can also help, but yeah maybe try it on new project

bright sentinel
#

Usually you shouldn't have to install Entities at all

#

Just install Hybrid Renderer, and it will automatically get the right dependencies

#

Should also work when updating

finite ibex
#

i'll keep that in mind bmandk for next time

bright sentinel
#

There are a few times where it derps out though, so this might be it

finite ibex
#

@opaque ledge Thank you, it works now

gusty comet
#

I just noticed that 2d finally seems to have gotten some love. Admittedly it has been a while since I last checked

warped coral
#

is ECS going to be the default way to program in unity eventually

warped trail
#

MonoBehaviour is not going anywhere πŸ˜…

gusty comet
#

I doubt that given how much they emphasized the conversion workflow intially. I hope it will be but I highly doubt it.

#

I am fine as long as there are means to go full dots eventually if you so choose.

vagrant surge
#

conversion workflow is just a hack

#

because making a proper ECS editor takes time

warped coral
#

oh

vagrant surge
#

tho its likely that "final" ECS editor does have something like conversion workflow, it has its uses after all, like flattening hierarchies

gusty comet
#

I mean if you have a full dots enviroment there is no such thing as a hirachy anymore I would say.

vagrant surge
#

oh there is

#

prefabs and other stuff, people do still want to abuse hierarchies for scene editiont

gusty comet
#

On the note of dots though, are there any recent tutorials especially on the 2d side of things?

safe lintel
#

yep conversion has its uses as editing a character in a native ecs editor today would be pure hell, so many buffers/arrays to keep track of and floating entities that are actually connected parts of it

vagrant surge
#

@gusty comet no, but the Tiny 2d samples are pretty great

gusty comet
#

Where can I find those? I just installed the package via the package manager

#

Because I learn best by picking apart working code. So looking at them would be a good thing to do.

warped trail
gusty comet
#

For reference I am speaking of the 2D Entities package in version 0.22.0

pliant pike
#

I don't suppose anyone can figure out what I'm doing wrong, and why I can't run this job multithreaded?

warped trail
#

why not just make RequireSingltonForUpdate() instead of this? cs if (!HasSingleton<BezierGraphSpawner>()) { Debug.Log("There is no Bezeiergraphspawer"); return default; }

pliant pike
#

ok yeah, good point

warped coral
#

is there a definite pure ecs tutorial that covers all the basics, like physics and stuff? or do i just look around and skim what i can?

pliant pike
#

I still just get the error The previously scheduled job Bezierecs:<>c__DisplayClass_OnUpdate_LambdaJob0 writes to the NativeArray <>c__DisplayClass_OnUpdate_LambdaJob0.Data._lambdaParameterValueProviders.forParameter_moventy._type. You are trying to schedule a new job Bezierecs:<>c__DisplayClass_OnUpdate_LambdaJob0, which writes to the same NativeArray (via <>c__DisplayClass_OnUpdate_LambdaJob0.Data._lambdaParameterValueProviders.forParameter_moventy._type). To guarantee safety, you must include Bezierecs:<>c__DisplayClass_OnUpdate_

opaque ledge
#

@warped coral you can start with GameMonkey's videos

#

sorry Code Monkey πŸ˜„

pliant pike
#

yeah codemonkeys tuts are good

warped coral
#

oh yeah i have that open in another tab. just making sure i start with what's recommended

pliant pike
#

we're all just winging it basically, learning, and then having to relearn things as they change

warped trail
#

@pliant pike you are not returning valid inputDepsπŸ€”

opaque ledge
#

yeah what Calabi said πŸ˜„

#

but Code Monkey is a great start

rancid geode
#

@pliant pike not sure if that's the issue, but you are not returning the JobHandle from the Entities.ForEach

inputDeps = Entities.ForEach(...).Schedule(inputDeps);
return inputDeps;
warped trail
#

^

pliant pike
#

I didn't think you had to do that πŸ€”

bright sentinel
#

Not if you're using SystemBase

pliant pike
#

unless there was dependancies

warped trail
#

this is SystemBase thing

fallow mason
#

if you use systembase you dont

pliant pike
#

I don't even know what systembase is

rancid geode
#

If using system base you don't need, but then you shuldn't pass the inputsdeps in the Schedule too

fallow mason
#

where you inherit from JobComponentSystem, inherit from SystemBase instead

rancid geode
#

But as this is a JobComponentSystem, then you need

fallow mason
#

there will be errors at first

gusty comet
#

shucks I tried the github sample project that was posted but it seems to be out of date.

warped trail
#

@gusty comet what do you mean?

pliant pike
#

Ok then thanks everyone

gusty comet
fallow mason
#

camera cant be in subscene yet. I had the same issue

warped trail
#

try build, tiny is not friendly with editorπŸ˜…

fallow mason
#

oh it works in build? did not know

gusty comet
#

Well that does not help me much If I have to build every time I want to see something?

warped trail
#

welcome to tiny πŸ€·β€β™‚οΈ

#

but you can build from IDE if you have only code changes πŸ˜…

gusty comet
#

Plus the build is actually failing

#

so much for that

dull copper
#

You have to keep the Main Camera SubScene open in Edit mode at all times to see anything being rendered in the GameView window

#

tbh, I'm not sure if even that is enough

gusty comet
#

it isnt

#

it at least renders now but a blank screen

#

This is why I was saying way back in october it needed another year.

fallow mason
#

try running once?

dull copper
#

ok this sounds alarming: But on the other hand, we do believe dots runtime as a framework can scale in every dimension very well, and in the long term we believe it will actually scale better than hybrid. I'd hope that we can even make a UI situation that you would prefer to the current hybrid one, but we'll leave that for you to judge when we ship it.

fallow mason
#

I know I had to do that

pliant pike
#

ok I've done the above, now I just get that error once ate the start instead of constantly

dull copper
#

that sounds like they make DOTS ui solution that only works on tiny / dots runtime

warped trail
#

πŸ˜‚

dull copper
#

and Unity has already said earlier they are making UI Elements runtime work with DOTS I think

#

so it's all messed up again

warped trail
#

URP, HDRP, Tiny3D, Tiny2D, BuiltIn

fallow mason
#

we going to have like 5 UI solutions

dull copper
#

I wish they would just make one system for all

#

instead of this nonsense

fallow mason
#

IMGUI, UGUI, UIElements, DOTS UI

#

well 4

#

and I'm going to use all of them to make a frankenstein UI

hollow sorrel
#

what's the context here? maybe they mean editor UI

dull copper
#

oh wait

opaque ledge
#

meh, dont count IMGUI imo

dull copper
#

they might not even talk about game UI on that comment πŸ˜„

bright sentinel
#

Is there a DOTS UI? And UGUI is for GameObjects

dull copper
#

they could really talk about dots editor again

fallow mason
#

why not? you can still use it in runtime.

opaque ledge
#

both IMGUI and UGUI is being depracted anyway in favor of UIElements

bright sentinel
#

IMGUI is really old

fallow mason
#

it's a nightmare I do not want to relive, but you can

bright sentinel
#

So UIElements is the future

dull copper
#

at this point, I'm so confused that I have no clue anymore

opaque ledge
#

you dont actually use IMGUI for production tho

#

just for debugging MAYBE

bright sentinel
#

I'm surprised it's not just stripped out at this point

hollow sorrel
#

the editor UI depends on it

opaque ledge
#

yeah

fallow mason
#

used for some editor still if I recall

dull copper
#

when I started using Unity, there was only wonky ui

#

is that IMGUI?

#

one we had on editor before ui elements?

opaque ledge
#

yeah

fallow mason
#

GUILayout.Label("This one...");

dull copper
#

yeah

gusty comet
#

is there not even a full documentation on 2d entities or am I just blind?

dull copper
#

that rings bells πŸ˜„

#

should be linked to this channel as well

#

check the pinned

gusty comet
#

thanks, its weird because it did not show up through the documentations search function

dull copper
#

package docs are elsewhere

gusty comet
#

ah that would explain it

dull copper
#

basically the old docs have stuff that are not in packages

#

and each package have their own doc page which isn't integrated to the old doc system

fallow mason
#

I actually like UGUI, but the web designer in me is very excited for UIElements

dull copper
#

I absolutely hate UGUI for making me assemble the UI in scene

#

or prefab but it doesn't take the point away

gusty comet
#

I prefer that over having to use something css like

dull copper
#

that's UI Elements for you

pliant pike
#

where the hell did SystemBase come from leahWTF

dull copper
#

they got stylesheets

#

systembase is so nice

#

even less boilerplate now

warped trail
#

systembase is cool

pliant pike
#

I thought I was just getting used to JCB's

dull copper
#

and that's DOTS for you

#

I can't remember how long they've kept some base usage api intact without replacing it with the new thing

warped trail
#

and now they are deprecating IJobForEachπŸ€”

fallow mason
#

yeah, I think SystemBase is at a really good place. getting to the comfort level of MBs in a way

dull copper
#

tbh, I'm not missing that injection stuff at all

pliant pike
#

I'm just now reading the docs and finding JCS are being phased out dammit leahYTHO

opaque ledge
#

yeah exactly DROD, more systems i write more comfortable i become with it

warped trail
#

but i dont like loong lambda parameters πŸ˜•

fallow mason
#

how would you make it more concise?

warped trail
#

to be precise i don't like formatting partπŸ€”

fallow mason
#

the LINQ-like query format you mean?

#

or just the lambda?

gusty comet
#

So yeah it works but what the heck are the various entities there?

#

All the tile has is literally one sprite

fallow mason
#

scene usually has some "overhead" of several entities. just some helper entities.

gusty comet
#

given I see an entity with just the texture on it looks like a massive amount of overhead for some arcane reason.

finite ibex
#

your main camera has a main camera in it, is that normal?

gusty comet
#

I might be totally of there mind you but it looks like that.

#

Thats what the doc said to do

#

put the main camera in its own subscene and the sprite in another.

finite ibex
#

my main camera doesnt have an object under it on a fresh project

gusty comet
#

yeah it doesnt on a fresh project

#

the docs explicitly stated to do that however

fallow mason
#

The subscene holding the Main Camera is just named "Main Camera". Doesn't have a camera of its own.

gusty comet
#

Guess I wait for a few more month. The more I look into it the more this looks cobble together.

finite ibex
#

In a nut shell im trying to spawn RenderMesh with a random color. This doesnt work but this is where my brain is at: _entityManager.GetComponent<RenderMesh>(entity).GetComponent<Material>().color = Random.ColorHSV(); I can set my position using _entityManager.SetComponentData(entity, new Translation { Value = position }); But if i do new RenderMesh in the above the material that i have access to cannot access the .color property.

flat talon
finite ibex
#

Thank you, i will take a look

opaque ledge
#

for hybrid renderer v2 there are override components i think

flat talon
#

you can pass even multiple params to your shaders, not just color. Hybrid V2 also has component material overrides, but we're waiting on HDRP 9.0 and 2020.1 beta3 to use that.

warped trail
#
var renderMesh = _entityManager.GetSharedComponentData<RenderMesh>(entity);
renderMesh.material.color = Random.ColorHSV();
_entityManager.SetSharedComponentData<RenderMesh>(entity, renderMesh);```
flat talon
#

afaik that will change the color of all entities sharing that mesh, ie in the same chunk.. no? The correct way to do this is as outlined in my post (and the Hybrid V2 docs).

hollow sorrel
#

man

#

it's so weird they call it hybrid renderer v2 when the previous hybrid renderer was also referred to as v2

#

so now it's a different v2

flat talon
#

totally agree

warped trail
#

no, there was RenderMeshSystemV2πŸ˜…

#

but hybrid renderer V1

hollow sorrel
#

ah is that what i'm thinking of

#

so confusing

warped trail
#

there was RenderMeshSystemV1 a long time ago🧐

flat talon
#

yeah before the hybrid package πŸ™‚

finite ibex
#

@flat talon Do I need to do something to open the lit shader? UnityEditor.ShaderGraph tab opens but its a blank, and then i get this. Exception thrown while invoking [OnOpenAssetAttribute] method 'UnityEditor.ShaderGraph.ShaderGraphImporterEditor:OnOpenAsset (int,int)' : NullReferenceException: Object reference not set to an ins

#

...yes im still on step 1 πŸ™‚

flat talon
#

until we get HybridV2 you might need to create your own shader graph and expose a color parameter.

#

my instructions are perhaps a bit confusing, in step #1 I meant create a new shader graph (based on lit)

finite ibex
#

I did Shader -> HDRP -> lit graph

#

but i cant open that

#

I get a windows pop up asking me what application to use

#

and the editor bugs out

flat talon
#

that is very strange. Do you have the shadergraph package added ok?

finite ibex
#

yeah its there

flat talon
#

when you have your new file selected, what do you see in the inspector?

#

then you can press the Open Shader Editor button or simply double click on the file

finite ibex
#

I think the problem might have been i didnt press the compile button, its doing something

#

lets see if it opens after that

#

its been stuck on 105 of 113 for 5 minutes, idk what im doing

flat talon
#

what Unity version and HDRP version are you on?

finite ibex
#

2019.3.5f1 and 7.1.8

flat talon
#

that should work, but I believe that v7.2 was the official non-experimental release

finite ibex
#

as for what i see, i see what you see but a compile button and no 'preprocess only'

#

it says im up to date, so idk

flat talon
#

Does the HDRP wizard window find any errors? (Window->Rendering->HD something, can check for you in a bit)

finite ibex
#

oh lots of things to fix

#

also tells me 7.2.1 is available but package manager says im up to date so ..... idk

#

I think i'll put this to the side, im still early in learning ecs and my question was to understand a bit better, which i do. I'll bookmark your post and revisit when im more mature in my understanding

#

tyvm for your help!

flat talon
#

your welcome πŸ™‚ I know its a lot to take in, even a whole new renderer

finite ibex
#

to be fair i dont think i even touched the old one yet

plush crystal
#

Can anybody think of a way to achieve sorting in a NativeMultiHashMap?

#

as far as I can tell the sort is not guaranteed

#

One solution I can think of is to add the sort order as a property on each entry

hollow sorrel
#

i don't think so

#

it's meant to be unordered

plush crystal
#

"Mean to be" is one way to look at it for sure, but there are uses for ordered sets

#

Would be nice if there was a NativeSortedMultiHashMap πŸ™‚

zenith wyvern
#

NMHM is already pretty slow without adding sorting to it

plush crystal
#

Unless someone can think of a better data structure? I need to store an array for every [X,Y], the array length is not fixed.

zenith wyvern
#

I think if you need something like that your best bet is to try to collapse it into list

plush crystal
#

Seems like that would be challenging since it's not fixed length per coordinate

zenith wyvern
#

Maybe a second list to track how many per set

plush crystal
#

i see

#

interesting proposition

#

i guess the problem there is that lists need to be allocated aot

#

i dont know the length aot

zenith wyvern
#

You could always check the source for NMHM and try to extend it to be sorted

hollow sorrel
#

could maybe do a nativehashmap that points to an entity with a dynamicbuffer on it

#

and sort the dynamicbuffers

zenith wyvern
#

But yeah I think it would be very slow

plush crystal
#

i may stick with sorting jit for now. the number of items in the array is trivial - usually 3, rarely more - so maybe it wont be that slow 🀞

dull copper
#

no, there was RenderMeshSystemV2πŸ˜…
to make this even more clear hybrid renderer v2 is introduced in hybrid renderer 4.0

bright sentinel
#

Do you mean 0.4? πŸ˜…

dull copper
#

oh, snap, 0.4.0 πŸ˜„

#

yeah, mb

#

well that joke ruined right there

worldly pulsar
#

be ready for Hybrid Renderer NT and XP πŸ™‚

zenith wyvern
#

v2b

spring hare
#

How does Unity determine/extract info about component array order within a chunk?

#

Is there some sort of explicit type order? Is it arbitrary, and the chunk header just has full pointers to the head of each array?

#

Just curious.

odd cipher
#

@zenith wyvern Just unsure how to make it work with my "TerrainSprite" struct and such

fallow mason
#

@spring hare I think it's arbitrary. Though it's alphabetical in the inspector πŸ€·β€β™‚οΈ

spring hare
#

So I guess chunk header data determines where the start of each array is?

worldly pulsar
#

@spring hare afair the archetype stores the offset for each component for its chunks, but the order is essentially random

spring hare
#

I see

#

Do you know how archetypes store component membership info for when queries are first built? Is it some sort of bitfield mask, or an array with component type ids, or something else?

#

Maybe the component membership for an archetype is associated with that archetype through some external data structure?

worldly pulsar
#

Last time I dug deep into this code was ~v0.2, if you are interested I'd recommend looking into what CreateArchetype() does, since it is guaranteed to touch all those data structures

slim nebula
#

^ how do I figure out exactly what/where the problematic allocation happens?

#

the stack trace doesn't go through my code, but I assume the object was allocated 8 frames ago or whatever

#

I"m not sure how to track this down

#

I dont even know if it's happening on the server or client

low tangle
#

turn on leak detection

odd cipher
#

@zenith wyvern Hey, when you get back online, do you mind talking in dms about some things in my code? So I dont clutter this chat as much πŸ˜…

zenith wyvern
#

@odd cipher Sorry I'm just coming off an insane work week, not really up for a one on one code review, hahah. I'm happy to give you some general advice here as long as it's on topic. My one suggestion is to dial everything way back. Like Topher suggested it seems like you're pretty out of your depth. Learning dots is hard enough without trying to build a complicated framework on top of it at the same time

urban remnant
#

Im trying to Spawn an Entity from prefab, but it's not showing up. What do I miss?

#

using UnityEngine;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;

namespace ShiftBall
{
    public class Startup : MonoBehaviour
    {
        [SerializeField] private GameObject playerPrefab;

        private Entity playerEntity;
        private World defaultWorld;
        private EntityManager entityManager;

        void Start()
        {
            defaultWorld = World.DefaultGameObjectInjectionWorld;
            entityManager = defaultWorld.EntityManager;

            var settings = GameObjectConversionSettings.FromWorld(defaultWorld, null);
            playerEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(playerPrefab, settings);

            InstantiateEntity(new float3(4f, 0f, 0f));
        }

        private void InstantiateEntity(float3 position)
        {
            var entity = entityManager.Instantiate(playerEntity);
            entityManager.SetComponentData(entity, new Translation
            {
                Value = position
            });
        }

        // Update is called once per frame
        void Update()
        {

        }
    }

}
opaque ledge
#

i think passing null blob store to conversion is no longer supported, you have to create it

#

just do new BlobAssetStore() and pass it, and in OnDestroy method of MB dispose it

urban remnant
#

@opaque ledge same. Can see Entity in Debugger, but not on screen

opaque ledge
#

does it have any component in it ?

urban remnant
#

@opaque ledge no

opaque ledge
#

πŸ˜„

#

yeah like i said in my post, try it out^^

#

if you dispose the asset store right after the conversation it will crash your editor, so thats why you should dispose it in OnDestroy

urban remnant
#

@opaque ledge so the prefab needs at least on Component ?

#

Assets\Scripts\Startup.cs(11,45): warning CS0649: Field 'Startup.playerPrefab' is never assigned to, and will always have its default value null

#

But it is assigned

opaque ledge
#

no thats not what i am saying, it just doesnt properly convert if you pass null

urban remnant
#

@opaque ledge as I said, I put BlobAssetStore, and it same result. The object is not showing up on screen

opaque ledge
#

hmm πŸ€”

#

no idea then, i mean it should at least have Translation component

#

does it give any error on console ?

urban remnant
#

No :/

opaque ledge
#

do you spawn other entities ? does the same thing happens for to them as well ?

urban remnant
#

No its my first steps with dots

#

First script

#

I do have this warning in console Assets\Scripts\Startup.cs(11,45): warning CS0649: Field 'Startup.playerPrefab' is never assigned to, and will always have its default value null

opaque ledge
#

does your prefab has convert to entity script ?

#

and that warning is not a problem

urban remnant
#

does your prefab has convert to entity script > no

opaque ledge
#

can you put it ?

urban remnant
#

I did, same

#

wtf

opaque ledge
#

can you put your prefab to your scene ?

#

and go into play mode

urban remnant
#

Yes

#

But that not what I want to do

opaque ledge
#

yeah but does that entity work properly ?

#

can you see it once you go into play mode

urban remnant
#

Yes,

opaque ledge
#

Can you tick DOTS->Live Link Mode->SceneView: Live Game State ?

urban remnant
#

and?

opaque ledge
#

go into play mode πŸ˜„

urban remnant
#

And, nothing changed

opaque ledge
#

if that doesnt work, i have no idea, there must be something wrong with that conversation script

urban remnant
#

eh

opaque ledge
#

What Entities package are you using ?

urban remnant
#

0.8.0

opaque ledge
#

Can you take SS of what your prefab's inspector looks like and how it looks like in Entity Debugger after conversation ?

urban remnant
#

@opaque ledge these?

opaque ledge
#

yeah

#

you said there was no component in your entity πŸ˜„

#

its working fine actually but for some reason your render components arent being converted

#

do you have hybrid renderer package installed ?

urban remnant
#

No

opaque ledge
#

install it πŸ˜„

#

they go hand in hand

urban remnant
#

Installing

#

@opaque ledge tnx, dude, that was the problem

#

Only one

opaque ledge
#

Cheers man, gl^^

urban remnant
#

@opaque ledge one more question. I put rigidBody on my prefab, but it's not working. Is there something special for Phycis in DOTS?

opaque ledge
#

do you have Unity Phsyics package ? @urban remnant

urban remnant
#

@opaque ledge installed it and beng this

#

Brrr

gusty comet
#

edit the manifest and specify that version

opaque ledge
#

you have to update collections to 0.7

#

Collections, Jobs, Burst, Hybrid Renderer, Entities, Physics, Havoc Physics, these are all connected

#

perhaps even Unity Mathematics

#

so you have to update all of them to most recent version

#

except Platforms, 0.2.2 gives an error

#

so 0.2.1 better

gusty comet
#

i wonder why it doesnt detect when installing and auto update

opaque ledge
#

yeah, we have discussed this before with some other people, Unity is working on it, but until then its kinda derpy

urban remnant
#

Now I have to options

#

I can add typical Rigid body

#

Or c-sharp script Phycis Body

#

What should I use

opaque ledge
#

yeah, c sharp script one is Unity.Physics

#

they are both fine, if you use normal Rigid body and colliders then will be converted to Physics body and Physics Shape

#

tho i personally go with Physics body and Physics Shape

gusty comet
#

i made it in code

urban remnant
#

Ok

gusty comet
#

does this physics work with the mesh colliders too or only simple ones?

urban remnant
#

Noob question. How do make a rigid body not fall, like static?

opaque ledge
#

make gravity modifier 0 ?

gusty comet
#

physicsvelocity and some stuff

#

go far down

#

it shows how to create an entity without prefabs

opaque ledge
#

its 0.3 btw πŸ˜„

#

always click "Latest Version"

vagrant surge
#
Medium

This is the second in a series of posts about the guts of Flecs, an Entity Component System for C and C++. Each post will cover a…

#

2 blogposts by the creator of "Flecs" ECS lib (C lib)

#

its very similar to the way unity ECS works, tho it has more advanced stuff than it in some places

#

the second article basically explains how archetypes work, which is more or less the same unity uses

gusty comet
#

uh that latest is actually missing what i meant

opaque ledge
#

Hoo thanks vblanco

#

@gusty comet there is a version selector, you can click there

urban remnant
#

So I have a plane with Rigid body and Box collider. Then the Entity with Phycis Body and Phycis SHape

#

The entity falls trough the plane :/

opaque ledge
#

you have to handle the collision filter

#

its in Physics Shape, belongs to, collides with

#

in order to things to collide both sides want to collide with each other

#

so if you make 1: Test, and you give it to both of your plane and your Entity they will collide

urban remnant
#

Console full of shit πŸ˜„

opaque ledge
#

well tbh, sometimes deleting Library folder or restarting unity helps when you update your packages

#

especailly preview packages

urban remnant
#

@opaque ledge

#

Belongs to, collides with? Nan i see there

#

Collision filter is locked

opaque ledge
#

expand collision filter

#

click on the name, not on icon

urban remnant
#

Ok it says Eveything

warped trail
#

does your plane with Rigid body and Box collider converts to entity too?

urban remnant
#

@warped trail no

warped trail
#

this is why they are not colliding

urban remnant
#

@warped trail I just added "Convert to Entity", same falls trough

warped trail
#

change RigidBody and Box collider to PhysicsBody and Physics shapeπŸ€”

urban remnant
#

Ok I will try

#

I think I'm giving up

#

Tons of errors and crashes

#

Nice for experimenting, but actually making a game and publishing, seems not ready yet

warped trail
#

you are probably doing something wrongπŸ€·β€β™‚οΈ

opaque ledge
#

i get crashes as well, in fact i just got one, but its still open for experimenting, and yes definitely not ready for publishing, but you can still do stuff with it

#

like i said remove library and let Unity re create it

urban remnant
#

I did that

#

still getting this

#

I did add Phycis Body and Physics Shape to both, plane and ball

#

And it still falls trough

opaque ledge
#

what does the line at Startup:23
?

urban remnant
opaque ledge
#

not sure, maybe use plane instead of box

warped trail
#

what about Startup:23? πŸ˜…

urban remnant
#

@warped trail I think I fucked up there, some bad code πŸ™‚

#

No idea how to fix that Phycis

warped trail
#

0.003 is pretty small radiusπŸ€”

urban remnant
#

I set to plane, and its same

#

Radius is not issue

opaque ledge
#

idk man, i dont use physics/collisions, i only use triggers and its working fine

warped trail
#

are you using deafult unity sphere?

urban remnant
#

No its fbx

opaque ledge
#

i know that BARGOS is doing physics/collisions stuff and its also working fine for him so

#

🀷

warped trail
#

try with default unity sphereπŸ€”

urban remnant
#

OMg, the problem was related to that 23 line in Starup.cs

#

πŸ€¦β€β™€οΈ

#

Jahu

#

Is this cool to destroy the blobAsetStore?

#
void OnDestroy()
        {
            bas.Dispose();
        }
opaque ledge
#

yeah

urban remnant
#

I have on Enity in debuuger that I have no idea where it comes from

#

Is that normal?

warped trail
#

probably yes

urban remnant
#

Strange

#

My code is generating 2 Entities

#

One is not wisible

opaque ledge
#

one of them is prefab(they have prefab component) other one is the one you instatiate from the prefab

urban remnant
#

Yeah

#

Its like clone

#

so its my coding foult

opaque ledge
#

no, it suppose to work like that πŸ˜„

urban remnant
#

Hmm

opaque ledge
#

thats what instantiate does, clones an entity

urban remnant
#

SO when i try like this

opaque ledge
#

by default, entities that has prefab or disabled component is exluded from system queries

urban remnant
#
void Start()
        {
            defaultWorld = World.DefaultGameObjectInjectionWorld;
            entityManager = defaultWorld.EntityManager;
            bas = new BlobAssetStore();

            var settings = GameObjectConversionSettings.FromWorld(defaultWorld, bas);
            playerEntity = GameObjectConversionUtility.ConvertGameObjectHierarchy(playerPrefab, settings);

            entityManager.SetComponentData(playerEntity, new Translation
            {
                Value = new float3(0f, 2f, 0f)
            });

            //InstantiateEntity(new float3(0f, 2f, 0f));
        }
#

It doesn't work

opaque ledge
#

yeah because you are not instantiating an entity

urban remnant
#

But its weird. If I instantiate, I got 2 entities. And I can see in debugger, that the original is falling due the Physics (the position is changing)

#

That can not be good for performance

opaque ledge
#

did you check if your 'original' entity has prefab component ?

urban remnant
#

it doesn't

opaque ledge
#

'original' one is the one who has the prefab component

urban remnant
#

Ahh

#

So it might be some Phycis thing, that some values are changing all the time, despite the fact that my ball is standing still

warped trail
#

unity physics has no stacking, so you bodies will always moveπŸ˜…

#

dynamic on static body is kinda ok, but dynamic on dynamic is not okπŸ˜•

urban remnant
#

Physics velocities is changing madly all the time

#

My Plane is static

warped trail
#

and it is framerate dependent out of the box

gusty comet
#

@opaque ledge when i clicked latest i couldnt find the part for creating physic entities in code only

violet garden
#

Is it possible to use the new Unity Dots Physics without an actual Dots based project?
I would like to make a gamefeel focused (not physics) character controller with gravity/collisions but without all that rigidbody pushing each other and mass stuff

#

I tried both charactercontroller and rigidbody but I feel like in both cases I have to use a lot of gimmicks to get collisions without real physics

urban remnant
#

@violet garden I think yes

#

But u have to Convert the gameObjects to Entities

violet garden
#

Alrighty, I'll take a deeper look when I get the chance, thanks

opaque pilot
#

Anyone have a good 'pattern' to pass prefabs to systems? I'm looking to spawn a VFX prefab when an enemy is destroyed

#

I was going to use a GameObject, convert it to an entity and get the data on an update

#

But that feels a little hacky

dull copper
#
## [Burst 1.3.0-preview.7] - 2020-03-16

### Added
- Added additional diagnostic for tracking Visual Studio location failures.
- Added an override to bypass link.exe discovery under certain conditions.
- Added a ldloc -> stloc optimization which improves compile times.
- More documentation on function pointers, specifically some performance considerations to be aware of when using them.

### Changed
- Updated tools used for determining Visual Studio locations.

### Fixed
- Embedded Portable PDB handling improved.
- Fixed a case where our load/store optimizer would inadvertently combine a load/store into a cpblk where there were intermediate memory operations that should have been considered.
- Fixed a bug where the no-alias analysis would, through chains of complicated pointer math, deduce that a no-alias return (like from `UnsafeUtility.Malloc`) would not alias with itself.
- No longer log missing MonoPInvokeCallbackAttribute when running tests
#

"More documentation on function pointers, specifically some performance considerations to be aware of when using them."

zenith wyvern
#

@opaque pilot You could do that, or use a ScriptableObject or Addressables to get your prefabs in OnCreate

opaque pilot
#

Scriptiable object converted to an entity?

#

How would the SO be referenced to the system?

zenith wyvern
#

Well yeah I guess with a SO you'd still need to use addressables or Resources.Load to access it

opaque pilot
#

Ah, I see

bright sentinel
#

Could also look into using BlobAssets. I don't know much about them, but seems like they might be useful

zenith wyvern
#

Using the conversion system seems like a good way to go. Prefabs are ignored by queries unless they're explicitly included, so you can just query for your prefabs in whatever system needs them

opaque pilot
#

Awesome, thanks @digital scarab

warped trail
#

Soonβ„’πŸ˜…

opaque ledge
#

i use shared statics to hold my prefabs so i can instantiate them easily in a job

zenith wyvern
#

Their GDC stuff was supposed to be tomorrow

#

Before The Bad Times

opaque pilot
#

There's some stuff that is going to be streamed from GDC

zenith wyvern
#

I don't think Unity has announced anything though

opaque ledge
#

i want to see DOTS stuff 😦

bright sentinel
#

Maybe we'll see something about Hybrid Renderer V2

dull copper
#

megacity 2

warped trail
#

new fps sampleπŸ˜‚

zenith wyvern
#

Even More Mega

opaque ledge
#

I want to see about code stuff, like how would they code for certain situations, or even a MB to DOTS guide or smth

slim nebula
#

i want physics prediction for NetCode

mint iron
#

@digital scarab i've had two issues with that approach that i hope are being considered.

  1. Addressables has no synchronous request currently, so you have to download and cache all addressable assets in advance then trigger conversions to create all your prefabs.

  2. The conversion system doesn't ensure that child conversions have been run before parents that reference them, which makes certain situations of nested references fall apart if you do any processing in the child Conversion scripts (such as setting up add/remove components).

#

cheers, ill take a look, to be fair i haven't looked at it in maybe 6 months since i wrote the my caching setup to get around it.

#

my case is an addressable prefab that contains level definitions. After the game loads that prefab is instantiated, the conversion script grabs referenced prefabs (stuff used in each level - effects, parameters and whot-not) and turns them them into Entity Prefabs.

So in this case it needs to call GetPrimaryEntity on the referenced addressable prefabs, and multiple levels may reference the same assets.

safe lintel
#

@digital scarab is there any plan for use of convert&inject on a child where the root also has convert&inject?

#

hmm interesting. im still working with skinnedmeshrenderers so in this scenario the root gameobject(with legacy stuff like navmeshagent etc) needs to be injected, but then I also want to take advantage of the new conversion for joints so currently it doesnt work out of the box. ive made a copy of those systems to convert it manually but it doesnt sit right with me doing it this way πŸ˜‰

vagrant surge
#

ive been doing some ecs experiments with multithreading, on my self-rolled cpp ecs

#

ive been tinkering with "merging systems" in a pipeline

#

parallel-fors run across a set of chunks

#

but what if

#

instead of doing 1 parallel for per system

#

you instead gather all chunks that could match a set of systems, and then on the parallel for you execute multiple systems per chunk

#

saw some pretty sweet gains (20%) by removing sync points of parallel fors, and due to the improved cache usage

#

my pipeline was like boid_logic -> update transform matrix -> cull. So the 3 systems essentially get "merged"

dull copper
#

so... I guess I need to rethink my current convert and inject workflow :p

#

I'm pretty certain hybrid renderer v2 will take way more time to mature to a point where I can use it than what I actually have so I need to sync the GO transforms efficiently some way

#

convert and inject isn't mandatory there

#

it just makes it convenient

#

looking at the messaging on hybrid renderer v2, the initial goal is to support core functionality on SRPs

#

but that tells nothing about more niche things, like DXR support etc

safe lintel
#

well personally i hope to ditch it like a hot plate when animation conversion is more simpleton friendly for me to use

dull copper
#

I personally don't even need traditional animations much

amber flicker
#

presumably 'things like skinnedmeshrenderers.. online' is like years away though so it'll be around for a while yet?

safe lintel
#

@amber flicker well that hdrp animation samples project shows it appears to be on the horizon, as opposed to something like navigation

amber flicker
#

tech on horizon, sure.. but a drop-in replacement for existing animators etc? seems like a verrry long way off no? Talking about a time when animators would happily use a built-in dots anim editor to author character animations before you could seriously think about switching over to that. Would love it if it was closer than I thought.

junior fjord
#

is there an easy way to create the float4x4 matrix of a localtoworld component?

#

rotation is not relevant for now, I just have a float3 position

warped trail
#

float4x4.TRS()πŸ€”

amber flicker
#

I'm ~~mildly ~~concerned the line between 'experimenting with ECS' and 'using Unity in production' is going to get a lot more blurred than that over the next couple of years @digital scarab but I'm really positive about the direction.

dull copper
#

changing api's and deprecating old workarounds for hybrid solutions isn't ideal

#

ECS core is pretty solid in Unity now, but almost everything else has strong "alpha" feel to it

#

so if you want to use it in production today, you'd assume Unity would make it easier to use in hybrid scenarios today

#

but that part isn't that great today

#

I also do hope Unity can show some serious workflow improvements on conversion stuff soon

#

or rather, using editor with them

opaque pilot
#

Do particle effects work in dots?

amber flicker
#

There's a very fine balance to strike between giving people tools to experiment with (that they shouldn't use in production for years*) and expecting people to use years old tech... Especially if the answer to peoples performance problems is to use the new stuff. Just hope I'm not watching a car crash in slow motion as I want the endeavour to be a success.
*~2 so far and expecting another 2-4 more

#

not via entities @opaque pilot - I think at some point I saw an open source dots particle system but a quick google's not turning it up - this is one of those cases you need to keep a GameObject around (I think)

safe lintel
#

@opaque pilot they work like all old UnityEngine things with Inject but theres no official dots equivalent yet

opaque pilot
#

oh. That explains why I can't see them πŸ˜…

#

Thanks!

mystic mountain
#

Anyone wrapped their head around the new physics package update where they now use LocalToWorld instead of directly Transform? It seems like they fetch from that, but writes back to localposition :S

safe lintel
#

I wasnt aware they made a change to how they handle translation?

mystic mountain
#
If a static body as a Parent, then its transform is always decomposed from its LocalToWorld component (which may be the result of last frame's transformations if you have not manually updated it).
If there is no Parent, then the body is assumed to be in world space and its Translation and Rotation are read directly as before, if they exist; otherwise corresponding values are decomposed from LocalToWorld if it exists.
In any case where a value must be decomposed from LocalToWorld but none exists, then a corresponding identity value is used (float3.zero for Translation and quaternion.identity for Rotation).```
#

I noticed this also is true for dynamics on a side note.

fallow mason
#

really disappointed I haven't seen any GDC online talk activity today. I was hoping to hear some more about DOTS and Tiny.

bright sentinel
#

What are options for spreading jobs over multiple frames?

#

With MBs, it was really easy with coroutines

amber flicker
#

It's much harder to do it in a precise way due to scheduling other threads etc. One technique is simply to use the number of entities as a proxy for how much work needs to be done and use a queue/list or something to only process x entities per frame. I personally quite like this as it's very scalable. Also, as usually all the entities have very similar data associated, combined with chunk behaviour (cache line), it's a much more predictable proxy for work done than managed monobehaviours/data of past.

bright sentinel
#

What about something like chunk-based procgen? You don't really want it to happen all in one frame, and it won't run every frame. You'd want it to run over maybe a seconds worth of frames or something, and then not run it again until it's needed

#

The problem is that sure, you can specify every frame to run X amount of batches, but that's going to be pretty arbitrary. It would be really useful if I could say run for X ms or something like that, and then stop

#

But I guess that would break determinism

amber flicker
#

so.. I don't know if there's a better way.. but x seconds can be calculated with sample size and then quantity lerped - similar to auto adjusting graphics ... that's how I'd approach it. Run xmin amount of batches, next frame increase it while time taken < threshold or similar. Just a thought.

bright sentinel
#

Hm, that might be a way to go. Thanks for the input, I'll try it out if I need to spread a task over multiple frames πŸ˜„

amber flicker
#

the one thing I'm not sure about off the top of my head is what non-editor api allows you to measure the time taken across all threads for a job.. that would be useful

bright sentinel
#

Oh yeah, I didn't really think about that. How would I even check when a job has completed?

amber flicker
#

well.. there are markers in the profiler but I guess you can't use the profiler api at runtime - perhaps someone else here knows a good way

bright sentinel
#

I know there's the IsComplete field, but I can't really check that multiple times in the frame

amber flicker
#

well, even if you could, it doesn't help much as often the work doesn't start until a while after it's scheduled.. for scaling you want to know how how long the job took in a similar way to what's displayed in the profiler I'd have thought

bright sentinel
#

Yeah, would definitely like this to be dynamic

#

I mean, not blocking the main thread seems to be the whole point of multithreading, but with ECS they've kinda removed that πŸ˜…

amber flicker
#

not sure I know what you mean by that?

warped trail
#

maybe you can move this work to another world, like they do with subscene loading?

amber flicker
#

that is one approach.. but it doesn't help much with comfortably splitting work across frames? Also you incur the cost of copying all the data there and back again once it's done

warped trail
#

is it copying, i thought you will just pay the price of remapping entities?πŸ€”

bright sentinel
#

I didn't mean so much blocking the main thread, but more blocking other stuff, like rendering and input (and just other jobs in general)