#archived-dots

1 messages ยท Page 255 of 1

rotund token
#

Haven't seen that

worn valley
#

Best way to figure out how to build a good mesh renderer in dots is use game object conversion to make it and then copy that info. Your matrix is invalid in LocalToWorld because it needs a 1 in there and your world render bounds is also zeroed out.

mystic mountain
# rotund token Haven't seen that

So I think unity have cleared my defines when I downgraded version or something^^ Seems it caused my ghost prefabs to fail serialize etc. ๐Ÿฅด

karmic basin
#

Then why not go for 5 fields ?

#

No it's not as ugly as you think ๐Ÿ˜›

white island
#

alright, now my entites look like this, but still arent showing up...

karmic basin
#

looks like you don't have a rendermesh ?

#

which by the way the renderbounds would have been computed automagically for you if you had I would assume

#

but don't quote me on that hehe

white island
karmic basin
#

RenderMesh.Mesh looks unassigned though

white island
white island
#

Okay,even though I am close, maybe instead of creating new entities from scratch, I should be instantiating prefabs and setting the emeshes? not sure how t odo that though

#

pardon me folks the ECS workflow hasnt quite clicked in my brain yet

tranquil jay
#

Hello! I have a VFX on a MonoBehavior where I want to send an event to trigger an explosion burst.

My logic is to have a NativeArray where I put the float3 positions within various ForEach-es in various Systems.
Inside a MonoBehavior i go over that NativeArray and use the float3 positions to do the triggers, then I dispose and recreate the NativeArray for the next frame.

My issue is that I cannot access that NativeArray from inside Lambdas because it's trying to access a "this".
I cannot access a Singleton Monobehavior either.
I cannot GetSingleton<VisualEffect> because it's a class

**
Is it possible to make the lambdas access that NativeArray in a legal way?
Or is it possible for my VFX to be triggered from within a lambda to avoid having to cache all the positions?
Or is it possible for a MonoBehavior to access some sort of storage of my explosion float3s ?
**

coarse turtle
tranquil jay
coarse turtle
#

it's a copy of the struct sure

#

but a NativeArray contains a pointer

#

you'll be pointing to the same memory address

tranquil jay
#

I try tomorrow that code, I seem to recall the using a local variable workaround and now I understand why, thank you @coarse turtle โค๏ธ

white island
#

Yeah I cant figure out why I am not able to see my meshes. They are there and are correct at least

rotund token
#

your local to world doesn't seem to match your world render bounds

white island
#

That is intentional, actually, for a complicated reason. Does that cause problems with the rnederer

#

renderer

#

Ok uh here is my situation
-I have a level editor, and part of the build process is that everything marked as "scenery" is stitched together into a single mesh for each "cell" (a 256x256 space) to reduce draw calls for static objects
-The stitched mesh is exported
-For each cell the mesh is read from disk and then built and spawned as an entity
The reason that the render bounds have such an offset is that a cell might have like, a rock in the middle of the field and that's it. And so while the spawned mesh is at 0,0,0, that rock mesh is actually over at 100,0,100 or something

#

but I just realized

#

since it's all 1 big object that's only going to be 256x256 in breadth (since that's the size of the world chunks) I could just make that my render bounds

#

Wait. The meshes are there. but they are invisible.

#

And it's not backface because I moved my camera inside of them and I still see nothing

#

what is this.

rotund token
#

material issue?

white island
# rotund token material issue?

No, the material is fine. I even set it to double sided. The mesh has triangles, and even shows up right in this preview, so I dont believe it's my deserialization code.

safe lintel
#

if you just slap the material onto a basic cube and convert it to entity it shows up fine?

white island
#

it's just an HDRP/Lit material, nothing fancy

river lake
#

is that mesh gonna be anywhere near the size of the renderbounds you are setting?

white island
#

like maybe, if I were to fill the entire thing with rocks and trees or whatwever

river lake
#

maybe try using Mesh.RecalculateBounds if you are exporting from unity?

white island
#

Oh I also have code to recalculate bounds, but it didn't do anything

river lake
#

perhaps the problem is not with the bounds then ๐Ÿ˜„

white island
#

Yes I figured that part out. But i have no idea what it could possibly be

#

because the material works, the mesh is deserialized correctly...

river lake
#

does it work without converting to entity?

white island
#

Well my whole system is made to use ECS, but Iโ€™ll try tomorrow.

river lake
#

does anyone know if it's possible to do raycast in jobs? specifically animation rigging constrain jobs

#

i am trying to get the raycasting info from my animation before the rigging constrains but doing something like

CollisionWorld collisionWorld = World.DefaultGameObjectInjectionWorld.GetExistingSystem<BuildPhysicsWorld>().PhysicsWorld.CollisionWorld;
#

isn't allowed in the constraint :X

rotund token
#

what you're doing doesn't look like you're doing it in a job? at least not a job in a system

river lake
#

sadly i have no idea how the different system groups in ECS are updated relative to unity's core gameloop

#

my last resort would be extracting raycast info from the animations itself but that feels like going a pretty big round to do simple IK

eager pawn
# karmic basin Then why not go for 5 fields ?

haha, i was actually thinking about that, but i want to access these 5 fields randomly, and it seems easier to just do unitComponentList[randomUnitIndex]. that's why i think i've decided to just go with dynamic buffers, at least for now

verbal pewter
#

I know this isn't exactly DOTS related, but not many people are familiar with the Unity.Mathematics library outside of here. Does anyone know if an angle passed to math.cos should be degrees or radians? Trying to implement boids in 3d and this solution (https://stackoverflow.com/a/65266247/4565536) mentions that some libraries expect values to be in degrees while most expect radians. Trying to figure out if I need to convert the angle value from degrees to radians or not. The documentation is, of course, no help.

devout prairie
#

F*** hell can unity not just serialize dicts for the inspector

#

Off topic sorry, i just like it here

karmic basin
#

let's find out

#

Library\PackageCache\com.unity.mathematics@1.2.1\Unity.Mathematics\math.cs

        /// <summary>Returns the cosine of a float value.</summary>
        [MethodImpl(MethodImplOptions.AggressiveInlining)]
        public static float cos(float x) { return (float)System.Math.Cos(x); }
eager pawn
#
    public class ShopSystem : ComponentSystem
    {
        protected override void OnUpdate()
        {
            Entities.WithAll<ShopComponent>().ForEach((Entity entity, ref ShopComponent shopComponent) =>
            {
                DynamicBuffer<IntBufferElement> shopUnits = EntityManager.GetBuffer<IntBufferElement>(entity);

                for (int i = 0; i < shopUnits.Length; i++)
                {
                    int randomIndex = Random.Range(0, shopUnits.Length);
                    //EntityManager.CreateEntity(TypeManager.GetType(shopUnits[randomIndex].Value));

                    Debug.Log(randomIndex);
                }

                EntityManager.CreateEntity(TypeManager.GetType(shopUnits[0].Value));
                EntityManager.CreateEntity(TypeManager.GetType(shopUnits[1].Value));
            });
        }
    }

why does this give me error structural changes when i add the second CreateEntity, but not if i just have the first?

#

also since i have two element in my buffer, wouldn't Length return 2? so wouldn't my randomIndex be 0, 1, or 2?

#

oh nevermind

Description
Return a random int within [minInclusive..maxExclusive)

so since it's maxExclusive ig i don't need to do Length - 1

haughty rampart
eager pawn
haughty rampart
north bay
#

The problem in your snippet is that the first CreateEntity => structural change invalidates the DynamicBuffer

haughty rampart
#

ah yeah right, tbh, don't use the entity manager at all, rather use ECB's

#

much less issues with those

karmic basin
haughty rampart
#

ah yeah right, my bad. i was first thinking about that it names an entity, then that it query's for an entity name, but no, correct, it names the job. never needed it (yet)

eager pawn
#

why do i have to write System.Random rng = new System.Random();

instead of using System; and the Random? is it cuz it assumes Random is UnityEngine.Random?

haughty rampart
#

yes. but you should use mathematics.random not System.Random / UnityEngine.Random

eager pawn
#

sorry but... whats that? i don't see any math.random

karmic basin
eager pawn
#

ohh unity.math icic

#

thx

#

how do i get a random uint seed? if im not wrong i think on unix you can use /dev/urandom

#

but im on windows

real vigil
#

Yo! I've been trying to upgrade entities package to 0.50, but I, for the life of me, can't get rid of these errors. Tried to look around for anyone else with the same problem, but couldn't find anything on this, so anyone here know what's going on? I've been trying to remove/reinstall all dots packages, but the wall of errors inevitably returns when I install entities 0.50

eager pawn
#

there's probably better ways but i'd comment code out, then when errors disappear i would un-comment until i found it

solar spire
coarse turtle
#

Cause that error typically on an incorrect version of Unity with Entities 50.

real vigil
solar spire
#

Upgrade to .30+

real vigil
#

Is the fix really that simple? ๐Ÿ˜…

eager pawn
#

what do u use for random seeds on windows? Mersenne Twister?

real vigil
#

Man I feel like an idiot again. Thanks vertx, I'll try that out

eager pawn
haughty rampart
eager pawn
haughty rampart
haughty rampart
eager pawn
# haughty rampart if you want it always random, just don't pass in anything

that's not possible. it gives

ArgumentException: Invalid state 0. Random object has not been properly initialized
Unity.Mathematics.Random.CheckState ()

https://forum.unity.com/threads/runtime-error-on-random.548449/

giving it a seed like var rng = new Random(0x6E624EB7u); does work tho

haughty rampart
eager pawn
#

using UnityEngine;
using Unity.Entities;
using Random = Unity.Mathematics.Random;

namespace AutoAllStar
{
    public partial class ShopSystem : SystemBase
    {
        protected override void OnUpdate()
        {
            Entities.WithAll<ShopComponent>().ForEach((Entity entity, ref ShopComponent shopComponent) =>
            {


                var rng = new Random(0x6E624EB7u);
                //var rng = new Random();


            }).ScheduleParallel();
        }
    }
}
dapper vine
uncut rover
eager pawn
#
    public partial class ShopSystem : SystemBase
    {
        private EndSimulationEntityCommandBufferSystem commandBufferSystem;

        protected override void OnCreate()
        {
            this.commandBufferSystem = World.GetOrCreateSystem<EndSimulationEntityCommandBufferSystem>();
        }

        protected override void OnUpdate()
        {
            EntityCommandBuffer.ParallelWriter ecb = this.commandBufferSystem.CreateCommandBuffer().AsParallelWriter();
            BufferFromEntity<IntBufferElement> buffer = GetBufferFromEntity<IntBufferElement>(true);

            Entities.WithAll<ShopComponent>()
            .WithReadOnly(buffer)
            .ForEach((Entity entity, int entityInQueryIndex, ref ShopComponent shopComponent) =>
            {
                DynamicBuffer<IntBufferElement> shopUnits = buffer[entity];



            }).ScheduleParallel();

            commandBufferSystem.AddJobHandleForProducer(this.Dependency);
        }
    }

i've tried with a readonly buffer and without it, but for some reason i keep running into errors no matter what i try :((

#

this line gives the error DynamicBuffer<IntBufferElement> shopUnits = buffer[entity];

#

System.ArgumentException: A component with type:{0} has not been added to the entity.
This Exception was thrown from a job compiled with Burst, which has limited exception support. Turn off burst (Jobs -> Burst -> Enable Compilation) to inspect full exceptions & stacktraces

#

that's the error with readonly set to true

coarse turtle
eager pawn
# coarse turtle It looks like `IntBufferElement` may not exist on the entity, is there a reason ...

just inexperience and following tutorials. ill try the parameter solution.

i think i might have missed a step when creating the buffer?

    public class GameManager : MonoBehaviour
    {
        private void Start()
        {
            EntityCommandBuffer ecb = new EntityCommandBuffer(Allocator.Temp);
            
            EntityManager eventManager = World.DefaultGameObjectInjectionWorld.EntityManager;
            Entity entity = eventManager.CreateEntity(
                typeof(ShopComponent)
            );

            ecb.RemoveComponent<ShopComponent>(entity);
            ecb.AddComponent<ShopComponent>(entity);

            DynamicBuffer<IntBufferElement> shopBuffer = ecb.AddBuffer<IntBufferElement>(entity);

            shopBuffer.Length = 2;
            shopBuffer[0] = new IntBufferElement { Value = 0 };
            shopBuffer[1] = new IntBufferElement { Value = 1 };
        }
    }
coarse turtle
#

your ecb is never played back since you're manually constructing it

#

A commandbuffer is just a storage of commands that needs to be played back at some point in time

#

All you're doing is constructing a command buffer and never executing it.

valid haven
#
HDRP: Added: Added minimal picking support for DOTS 1.0 (on parity with Hybrid Renderer V2).
#

not sure what this means. In 2021.2b13

uncut rover
#

@eager pawn you can start by running you code without burst to have a better idea of the actual error

eager pawn
#

i recoded everything and removed the gamemanager with the monobehaviour. i now got something that's working. ^^

karmic basin
# valid haven ``` HDRP: Added: Added minimal picking support for DOTS 1.0 (on parity with Hybr...

Looks like it's about Graphics Picking. It's a technique in Rendering which provides an alternative to Raycast picking.

Consider trying to select an object a user clicked through the transparent material of a hollow shape. Casting a ray would intersect with the collider shape between camera and aimed object.

So the gist of the technique is to render off-screen each different object with a unique color, hashed from its ID for example. Now when user clicks on viewport, you can pick the pixel color at clicked point coordinates, revert back from color code to ID, and here is your target object, regardless of obstacles in front of the camera.

#

That's my best guess anyway ๐Ÿ˜›

valid haven
#

sounds like a good guess. Thanks.

karmic basin
#

Looks like they're more concerned about having a bridge with BatchRendererGroup rather than transparent edge-case ๐Ÿค”

#

The basic idea here is to define a new shader for URP/HDRP and use that only when rendering the BatchRendererGroup objects for the picking (renders object instanceIDs in a tiny 4x4 texture, then read it back from CPU).

white island
river lake
# white island It does work

if it also works when you hit the converttoentity on that gameobject you just created, you can probably play spot the diff and get it working hopefully :X

dull copper
#

Unity's DOTS stream up in a bit (20+ minutes)

white island
#

Question: how do I change the name of an entity as it appears in the heirarchy

river lake
#

there's a setname function in entitymanager

white island
#

ah ok thank you

gusty comet
#

dots q&a about to start.

#

aaany minute now...

lusty pewter
#

late as usual

dull copper
#

live now

slow vault
#

Dunno if CpyAnd is in here, but here is better to chat than Twitch ๐Ÿ˜…

I use DOTSNET instead of Netcode, because back when those were first releasing, Netcode seemed super focused on making competitive FPS games work and not much else. DOTSNET seemed more flexible. I haven't kept up with Netcode at all since their FPS sample released, so others may be able to chat more about how Netcode is flexible & usable now?

DOTSNET is tricky to learn as a networking rookie, but the dev is super active & helpful. And super flexible for my Minecraft/Astroneers-inspired game.

devout prairie
#

Finally talking about dots on the stream

gusty comet
#

"We were a little bit silent about dots" ๐Ÿ˜…

lusty pewter
#

kinda weird to talk about the basics...

safe lintel
#

i assume this is aimed at those who dont know what dots is\

gusty comet
#

feels like marketing rather than q&a

dull copper
#

that's what GDC is ๐Ÿ™‚

devout prairie
gusty comet
#

you'd expect a q&a to be different than showing sizzle reel

#

gdc's nature has nothing to do with it

vast wedge
#

ask hard questions in twitch chat - i'm sure after the introduction they'll get into more details

safe lintel
#

are they collecting questions now?

dull copper
#

if you can even ask questions

#

apparently you can

lusty pewter
#

it's raining questions

devout prairie
#

ehhh lebaron question

dull copper
#

I'm totally expecting it to be jump from 0.5 to 1

slow vault
#

"communicate every quarter" and "release next quarter" means "no communication til the next release", right?

dull copper
#

with minor fixes to 0.5

lusty pewter
#

already said animations will be 1.0 right?

devout prairie
#

just said no anim in 1.0

#

:cries:

lusty pewter
#

cries in 1.0

vast wedge
#

1.0 doesn't usually mean 1.0 with Unity features ๐Ÿ˜„

devout prairie
#

so basically - if you make games, that have game stuff, like animation, forget about it until 6 months after 1.0

dull copper
#

so much for the 3 year plan :p

dull copper
#

I mean 1.0 was supposed to just be core DOTS all along but everyone expected animation and audio to be part of it ๐Ÿ™‚

vast wedge
#

omg so many questions on twitch haha the last 7 hours of interviews there were hardly any questions

lusty pewter
vast wedge
#

i have a mental image of a thousand DOTS nerds in clown costumes getting out of a little volkswagon ๐Ÿ˜„

dull copper
#

I don't really agree on this current view on DOTS enabling you to run things on lower end devices

#

unless he's talking about like some future vision

gusty comet
#

sounds nice for the investors though

dull copper
#

if you do something that needs brute force computing, sure it does help but you've then already designed the game to work with some DOTS tech.. but if you have traditional game and port parts of it to DOTS/ETC, you won't see huge gains for it.. can even have negative perf impact in some cases

devout prairie
gusty comet
#

I don't think they've said anything so far that we didn't know, right?

dull copper
#

when I still evaluated DOTS and just used Unity's own DOTS systems and none of my own, things actually slowed down due to less performant rendering and physics

devout prairie
dull copper
#

it was actually related to what I asked on the twitch chat... I found out that letting job system to run uncapped worker thread amount just caused perf to tank

devout prairie
lusty pewter
devout prairie
#

in my experience at least

dull copper
#

if I limited the whole job system to run on few threads, it improved DOTS system cost

#

but limiting the whole job system's worker amount is silly... you'd just want to limit the certain systems there and get huge gains

gusty comet
#

Was it the ecs that slowed things down or was it just hybrid rendering/dots physics?

dull copper
#

now I can only max like 1/4 of my cpu capacity

safe lintel
#

@devout prairie maybe im still in denial but im still hoping the animation team returns to public releases

devout prairie
#

unless you're using large data/iterations

safe lintel
#

like theyve made it clear that 1.0 no animation, but I just kinda hope it resumes unofficial/experimental releases soonish that fall outside of the whole "production ready" disclaimer they are pushing around 1.0

devout prairie
gusty comet
#

According to the animation roadmap, dots is the only thing they're working on. ยฏ_(ใƒ„)_/ยฏ

dull copper
#

my issue here is that to get good perf on more traditional game design / content, you'd have to push it back to few threads, where whole DOTS was advertised to go wide on all cores

safe lintel
#

if i see some of the main animation guys(mecanimdev, adam mechtley, some others i cant recall) say: "yeah not gonna release anything until its actually production ready" then obviously id be crushed

dull copper
#

I'm only on 12c / 24t system... I can only imagine how badly this works on 32c system ๐Ÿ˜„

devout prairie
slow vault
gusty comet
#

I think Unity became super conscious of their current reputation. I fully expect no animation release until it is "production ready"

#

they are publicly traded after all, they should care about their rep

safe lintel
#

renee's work was like a personal/hackweek thing afaik, the dots animation team have been working on it full time

#

not quite the same thing

slow vault
#

True, but still.. not exactly having much hope re: animation based on that ๐Ÿ™ƒ

lusty pewter
lusty pewter
#

we'll now i know what i'm doing this weekend

gusty comet
#

Got my hopes up. last commit: Jul 13, 2020 ๐Ÿ™ƒ

lusty pewter
#

doesn't matter. good inspiration for my own project ๐Ÿ˜‰

slow vault
#

I'll double-check to make sure my old repos that had it all working still work on the new DOTS next week, but yeah... the thing that makes new input work in DOTS might break since it's all about turning those input classes into systems.

devout prairie
#

i wonder if the attaching tags approach worked out quicker than just having the tags as components on all entities and polling them

safe lintel
#

im assuming this is dumbed down ๐Ÿ™‚

river lake
#

doesn't sound performant imo :X

devout prairie
#

i guess it would be if there's only limited numbers of tags so minimal restructuring stuff

gusty comet
#

performance probably came from burst rather than ecs

devout prairie
#

compared to highly contiguous batches of memory accessed only when needed, it's going to be night and day right

#

but in practice, is it a difference between 1ms and 0.1ms

#

or even less

safe lintel
#

heh 1.0 with 2022 confirmed! (except not at all but seems like thats their optimistic goal)

gusty comet
#

you can still do that with jobs ยฏ_(ใƒ„)_/ยฏ

devout prairie
#

i guess it all ads up

river lake
#

putting it in jobs would make more sense ://

#

but yea maybe they have other stuff that work tgt with it

#

might just be more convenient i guess

gusty comet
#

so many questions in chat that'll never get answered even if the stream had infinite time...

slow vault
#

The very pointed and emotionally-charged questions will never get answered, like that wall from ashkan

#

Kinda expected since there's no real communication though ๐Ÿคทโ€โ™‚๏ธ

#

It's all pent up

river lake
#

yea even tho it has valid points i wanted to know abt

#

iirc he said 0.51 is like 6 mths away, not sure tho

valid haven
#

he said 2-3 months for 0.51

river lake
#

๐Ÿ˜ฎ

gusty comet
#

this has been a rather disappointing session honestly. looks like IPO really did a number on unity.

lusty pewter
#

6 months would be brutal. i take the 2-3 months. would love to update 2021 projects

valid haven
#

I want 1.0 to drop in alpha as soon as possible.. I have a lot of work to convert my custom hybrid ECS to DOTs and Unity Physics.

dull copper
#

wonder if we'll even get 2022.2 alphas....

#

normally we would have had them for a long time already

safe lintel
valid haven
#

I would be really disappointed and surprised if DOTS 1.0 dropped like the day 2022 LTS drops.

#

I think its more likely it hits the tech stream.

gusty comet
#

(Please keep in mind I did not specify which LTS)

valid haven
#

I refuse to believe it.. because it will screw up my plans ๐Ÿ˜›

river lake
#

haha

lusty pewter
#

would have been funny if he said it does not use DOTS

river lake
#

sadly we all know in our hearts dots wont be rdy anytime soon

lusty pewter
#

depends on your definition of ready

river lake
#

they are like completely rehauling systems to be multithreaded and cache aware

#

after years of stuff that dun care abt that

river lake
valid haven
#

I am perfectly fine with 1.0 not being 100% pure dots.. I am even ok with it not having some desirable features like audio and animation. The benefits are still there.

river lake
#

their original goal was to build another unity from unity tiny ๐Ÿ˜„

lusty pewter
#

would already be great to have up to date sample projects without 100 TODOs

river lake
#

same, even after using dots for like almost a year, i still can't get used to doing hierarchical transforms in dots

#

most of the time my brain is like thinking abt whether i am doing the dependencies right so that things dont get updated one frame late

lusty pewter
#

really curious about the performance impact of the replay system. i guess a racing game produces not that many different kinds of inputs so it's not that high but i guess we'll never know

dull copper
#

I don't think it's even that game specific thing... for mobile racing game you probably have more limited amount of inputs but having like double the input values wouldn't change the cost. it's also not something new... people have done this for replay systems for a long time if their sims have been deterministic

lusty pewter
#

done my own with DOTS but not sure if the implementation was that optimal. that's why it would have been interesting to know how theirs performs

dull copper
#

I'd guess the main reason why people haven't used this in this manner is because doing deterministic simulation which you can rewind and resimulate using Unity has been really hard

#

stateless dots physics would help a lot on that

lusty pewter
#

isn't the current approach of dots physics to keep as little state as possible?

white island
#
  1. can the Havok physics interact with GameObject physics?
  2. Can a monobehaviour raycast against Entities colliders and physics?
rustic rain
#

entities physics don't interact with go physics

dull shell
#

guys, anyone used dots netcode, is it good enough to use?

eager pawn
#
  1. im trying to create a list of all the units in the game. one idea i have is to read all files in the UnitComponents folder, and add each unit into a dynamic buffer.
    or alternatively, maybe i could just manually create the list of units myself using a blobasset and a blobarray which would also make the data immutable?
  2. i want (preferably) a fixed sized mutable datastructure that holds a bunch of randomly selected units, for example, shopUnit[0] might hold a unit[randomIndex], although it's no big deal to use a dynamic buffer for this.
  3. all the units have a baseAttack and an Ability() where the ability will be something like Debug.Log("unit 1");.. so i was thinking i would have one system per unit type, but the only way i know how do distinguish between Entity unit1 and Entity unit2 is by filtering by component types, which would mean i would need to create a component for each unit too?

i hope im making sense. im inexperienced and i don't have really have a reason to do things in any particular way so im fine with a completely different approach that may be better at accomplishing my goals, thx :))

dull shell
#

for example if you store unit type in some component and select all entities with that component, then you can check component value to get type you need, its acceptable way

eager pawn
#

Alright, I will implement something real soon like that. Ig It just seems like it wouldn't be very DRY because I would repeat myself by creating new IComponentData for each unit where the only difference is their name.

#

Pseueocode:

Unit1 { blobassetreference}
unit 2 {blobassetreference}
unit 3 {blobassetreference}

Blobassetreference {int baseAttack;}

... This seems weird to me, but maybe it's not wrong

dull shell
#

Not sure what you mean, im not familiar with dots ECS specifically, IComponentData is basically new component? Why would you need to create it for each unit?

eager pawn
#

Yes, a new component. I want unit1 system, unit2 system, and unit3 system.

The only way I know how to make different systems is by adding a component tag and filtering.
pseueocode:

Entity.WithAll<Unit1> { Debug.Log("unit 1")}
Entity.WithAll<Unit2> { Debug.Log("unit 2")}
Entity.WithAll<Unit3> { Debug.Log("unit 3")}

dull shell
# eager pawn Yes, a new component. I want unit1 system, unit2 system, and unit3 system. The ...

if you dont need to store any new data for each unit type, you can just use Unit component and inside it property like int UnitType and get units like that
foreach unit component iterator {
//get component data here
if (unitComponent.UnitType != (your unity type from system)) continue;
//your system code
}
or you can just make component for each unit type, since you making new system for each unit type anyway

#

or 1 system and 1 component for all unit types with something like switch for conditions and multiple methods (for each unit type) (so you wont iterate for units you dont need)

eager pawn
#

Hmm okay, maybe I could make things more generic like you suggest

#

again, pseudocode, but something like this? (i removed the blobasset for now for simplicity)

{
    public int baseAttack;
    public int unitType;
}

Entities.WithAll<UnitComponent>.ForEach(() => {
    if (UnitComponent.unitType == UnitTypeEnum.Sonic) {
        // sonic system
        UnitComponent.baseAttack = 1;
    } else if (UnitComponent.unitType == UnitTypeEnum.Mario) {
        // mario system
        UnitComponent.baseAttack = 3;
    }
})```
eager pawn
#

yeah okay, i don't know what made me think this wasn't possible to do ๐Ÿค” but i like it! thanks, having one system and one component for all generic units make much more sense than doing one for each xDD

#

although, won't the mario system and sonic system override the data of unitComponent.baseAttack? or perhaps that's only if you use that sharedcomponent thingy

dull shell
#

if i understand you

eager pawn
#

dw, im pretty sure im wrong. i was thinking since both entities hold the same component, then changing the component's data would mess things up. it's probably more like they hold different instances of the same component so it won't happen

#

UnitComponent#1.baseAttack = 1;
UnitComponent#2.baseAttack = 3;

same "object" but different "instances"

dull shell
#

yes, components are entities data basically, its dynamic data mostly that you changing for each entity (like position of entity), as well as "static data" that you dont want to be changed, but technically you can (like unitType)

eager pawn
#

right! this solved a lot of headaches for me and i think things finally are clicking. this was super helpful, thank you :DD

devout prairie
#

so in 0.5 is there any clarity on hybrid work ie is the game object conversion stuff still the same or anything changed with the whole 'companion' thing

#

i'm guessing that's more in 1.0 territory

safe lintel
#

they havent really mentioned anything (and took away AddHybridComponent)

stone osprey
#

Small question, what unity version does support Spans in C# code ?

deft stump
#

unity doesn't support span<T> I believe

stone osprey
#

Not even ReadOnlySpan ?

deft stump
#

oh correction, I'm wrong

#

they do support it

stone osprey
#

Since when ? My 2021 editor says they cant be found ๐Ÿ˜ฎ

deft stump
#

I'm on 2021.2.10f1

stone osprey
#

Im using asmdefs and stuff, do i need to add something to them ? ^^

deft stump
#

no, you don't, but my 2021.2.10f1 isn't complaining at all

stone osprey
#

I have 2021.1.6f :/

#

System.Memory is not available at all

deft stump
#

well I think I'm wrong, i dunno.
I'll just shut up lmao XD

valid haven
#

I haven't looked into subscenes much, do they provide any benefit when origin shifting large scenes?

#

I have my own hybrid ecs/jobs system, with a large world coordinate library. In my monobehaviour prototype, I have a render space of 50km (before shifting object renders) and the world space scenes of 2km (for physics colliders) and while origin performance is acceptable, I am looking to convert it to and curious what strategies exist out there to accelerate this kind of overhead.

tame pelican
#

Can someone tell me how to handle trigger collisions, all tutorials are using JobComponentSystem which is obsolete. Also I couldn't find anything at the documentation either.

stone osprey
#

Just updated to unity 2021 and got this...

0,0): error error DC3002: Script.Client.ECS.Systems.Reactive.ReactiveSystem`3/AddedJob: generic jobs cannot have their reflection data auto-registered - you must use the assembly-level RegisterGenericJobType attribute to specify which instantiations you need

What does this even mean ? That Reactive Systems job uses a passed generic, thats all... why shouldnt this work anymore ? ( Worked in 2020 )

uncut rover
#

@tame pelican just replacing JobComponentSystem by SystemBase does not work on hte exemples ?

uncut rover
#

something like [assembly: RegisterGenericJobType(typeof(AbilityCostConsumerSystem<GENERIC>.CostHandlerJob))]

tame pelican
stone osprey
#

Another issue...

#
Library\PackageCache\com.unity.dots.editor@0.10.0-preview\Runtime\Unity.InternalAPIEngineBridge.002\TreeView\TreeView.cs(779,28): error CS1061: 'ListView' does not contain a definition for 'm_ItemHeight' and no accessible extension method 'm_ItemHeight' accepting a first argument of type 'ListView' could be found (are you missing a using directive or an assembly reference?)

Why do i get this error now ?

tame pelican
uncut rover
uncut rover
karmic basin
# tame pelican Can someone tell me how to handle trigger collisions, all tutorials are using Jo...

The official samples were up-to-date to entities 0.17 and physics 0.6
https://github.com/Unity-Technologies/EntityComponentSystemSamples/tree/master/UnityPhysicsSamples/Assets/Demos/2. Setup/2d. Events/2d1. Triggers/Scripts
If you use 0.50 (a PR is on the way to update the samples) or working from an old tutorials, you can always read the changelog from some date in the past to nowadays and apply any upgrade required

stone osprey
#

I hate upgrading packages

karmic basin
#

yeah they merged the editor within entities

#

they said it in the upgrade guide or forum post, can't remember

stone osprey
#

Alright... what went wrong this time ? xD

#

Im gonna cry

coarse turtle
karmic basin
#

make sure you are in version 2020.3.30f, and follow upgrade guide

stone osprey
#

Doesnt dots work with 2021f ?

#

I cant go back

coarse turtle
#

Not until they release 0.51 in q2 of 2022

karmic basin
#

Read the annoucement in the forum ๐Ÿ˜‰

valid haven
#

I just want to know when 1.0 will drop into 2022 tech stream alpha/beta... ๐Ÿ˜

#

I have no interest in developing against 0.51, which will change radically for 1.0.

stone osprey
#

Fuckkk... i need 2021 for spans but cant use it with entities ?

#

I hate it

karmic basin
#

oh .51 not .50, I misread ^^

valid haven
karmic basin
#

Fair

valid haven
#

My project depends on 2022 tech, so its really not an option anyway and my release target is 2022 LTS.

stone osprey
#

Can i use entities with 2022 beta ? xD I bet thats also a no, right ?

valid haven
#

The DOTS 0.50 release seems to be mainly target at those who already had DOTS projects. If someone is early in their development cycle today, I have a hard time imagining they would want to start their project in 2020.

valid haven
stone osprey
#

Okay which entities version should i use for 2020 lts ? ^^

#

0.50 can be used with 2020 right ?

karmic basin
#

2020.3.30f mini

#

for entities 0.50

stone osprey
#

Thanks, but 2020.3.32f should also work right ?

#

And JobComponentSystem is gone now ? Can i still use it like this :

#
            // Add the added component job
            var addedJob = new AddedJob{
                ecb = ecbParallel,
                entityHandle = GetEntityTypeHandle(),
                componentHandle = GetComponentTypeHandle<TComponent>(true),
                added = added.AsParallelWriter()
            };
            addedJob.ScheduleParallel(newEntities, inputDeps).Complete();

?

karmic basin
karmic basin
#

Please read the guide, all your concerns and more are raised

#

But yeah you can schedule a job like you did in SystemBase

rotund token
#

Just going to leave this right here

karmic basin
#

Nice

safe lintel
#

im quite disappointed it appears the newest game sample isnt based upon dots(like megacity, fpssample etc) ๐Ÿ˜”

haughty rampart
#

told you

safe lintel
#

yep, you were right!

uncut rover
stone osprey
#

Something i cant find in the migration guide... Cant we use "commandBuffer.DestroyEntity(query)" anymore ? It says its invalid

#

Ahhh solved

#

They renamed that, doesnt make sense but they did... cool

#

Is there a way to check if an entity command buffer is "active" ? Or created ?

safe lintel
#

er var commandbuffer = system.CreateCommandBuffer() @stone osprey

stone osprey
coarse turtle
safe lintel
#

assumably you have a system that plays them back right? like that timing between creation and playback is where they are valid

eager pawn
#

So umm, how do i set a dictionary on a entity? Nested dynamic buffers?

rotund token
#

Generally you don't and it'd need to be quite large to be worth it

eager pawn
rotund token
#

Anything unmanaged

eager pawn
#

Is it mutable?

rotund token
#

Yes

#

The only thing to really note is that if you're storing Entity it won't remap if you set it up in a subscene so you need to populate it at runtime instead

eager pawn
#

That's cool, thanks for creating this. I'm a bit worried your package might break in the future, but you seem very active with dots

rotund token
#

It's unlikely to break unless unity deleted dynamic buffers

#

Only other real alternative is to use unsafe hash map and deal with having to manage the memory yourself

half jay
#

im creating Meshes at run time and want to storage texture in NativeHashMap, but its require blittable type. So can i store texture in BlobAssetReference and the Blob asset store as value in NativeHashMap?

rotund token
#

Does your texture storage need to be on an Entity?

#

Seems like it should just be held in the system that's applying it

half jay
#

nope, im just have static class with this NativeHashMap. Im wondering is it a nice decision store texture as BlobAssetReference ?

tranquil jay
rotund token
#

I'm not using that just pointing out someone else's work

safe lintel
#

@tranquil jay unless theres something specific you need, id just stay on 2020.

devout prairie
#

Eh no thanks

calm edge
#

what is the best way to get a reference to a different system from inside a system? OnCreate doesn't seem to work because the other system isn't created yet, so OnStartRunning?

rotund token
#

Use on create

#

And use getorcreateexistingsystem

#

As the name suggests it will create the system if it doesn't exist yet

tranquil jay
eager pawn
eager pawn
#

at this point i almost feel like doing

units = [unit1, unit2, unit3, unit4, unit5, unit6, unit7, unit8, unit9];```

but it's probably better to do [EntityOne, EntityTwo, EntityThree] for the first dimension, and then give each entity a dynamic buffer for the second dimension?
alternatively maybe nested UnsafeList
eager pawn
#

Wait I could just use unsafehashmap?

harsh onyx
#

Unity devs please give us a native Materiallist that can only be written during start and awake, so we can point to those materials

haughty rampart
#

you sure you want that? why not just apply the material to the mesh renderer in the editor?

harsh onyx
# haughty rampart you sure you want that? why not just apply the material to the mesh renderer in ...

Was writing about it yesterday in the advanced section. Unity instantiates a new material when switching materials, they even wrote it on the material documentation.
Lets say you select 30 units in an rts and instead of switching a boolean in the shader (which can be costly depending on how big the shader is and how many different shader those 30 units have) you could just point to the exact same highlightmaterial (that is readonly).. which then can easily be batched also.

haughty rampart
#

but material is part of a SharedComponentData iirc, so just point to that?

harsh onyx
#

gotta try it out thanks

vocal wing
#

Hi. Not sure if itโ€™s the right channel, but what could be the reason the job system is limited to 1 worker thread on a headless build on Linux? I tried launching with -job-worker-count 2 and it just logs JobSystem: Invalid job-worker-count value 2 must be between 0->1 right at the start. Any hint on how I can find out more where this limit comes from? (2020.3.30)

misty wharf
#

Hi, i have a question about shared component data :
Can i treat it like static fields ? so if Entity a changes the shared component, the change will also be visible for Entity b (in its shared component) ?
If not do you have any reccomendation how i can achieve something like this ? (like a buffer that can be accessed by all entities)

safe lintel
#

@vocal wing how many cores/threads on the system?

haughty rampart
misty wharf
#

perfect thanks

haughty rampart
vocal wing
safe lintel
#

1 thread is reserved for the main thread

#

so what its saying is normal

vocal wing
#

ah, i mean 2 threads per core

#

so 4 hardware threads it should be

safe lintel
#

hm I guess I would double check the vm definitely has access to 4 threads? otherwise I guess its not normal

vocal wing
#

oh nevermind, I missinterpreted it. it's actually 1cpu, they just call it vCPU, so I guess you're right. i'll try it with more cores to see how it behaves.

ionic sierra
#

is dots easy now?

stone osprey
#

Any idea why i get this shitty error ?

#

What do they even mean with reflection data ? I think i do not use reflection anywhere

ionic sierra
stone osprey
#

I just try to run my job like this

#
            // Add the added component job
            var addedJob = new AddedJob{
                ecb = ecbParallel,
                entityHandle = GetEntityTypeHandle(),
                componentHandle = GetComponentTypeHandle<TComponent>(true),
                added = added.AsParallelWriter()
            };
            addedJob.ScheduleParallel(newEntities, Dependency).Complete();
#

Any one having an idea why i get the error above ?

safe lintel
#

@ionic sierra hasnt really changed in terms of ease of use from before 0.50 to current.

ionic sierra
#

anyone know how to instantiate soemthign in dots?

haughty rampart
#

EntityManager.CreateEntity

safe lintel
#

pinned messages has links to docs

haughty rampart
#

for some things

stone osprey
#
        protected override void OnUpdate() {
            
            var ecb = atFrameStartBuffer.CreateCommandBuffer();
            var ecbParallel = atFrameStartBuffer.CreateCommandBuffer().AsParallelWriter();
 
            var addedEntityCount = newEntities.CalculateEntityCount();
            var removedEntityCound = entitiesWithStateOnly.CalculateEntityCount();
            
            var added = new NativeList<Transmution>(addedEntityCount, Allocator.TempJob);
            var removed = new NativeList<Transmution>(removedEntityCound, Allocator.TempJob);

            // Add the added component job
            var addedJob = new AddedJob{
                ecb = ecbParallel,
                entityHandle = GetEntityTypeHandle(),
                componentHandle = GetComponentTypeHandle<TComponent>(true),
                added = added.AsParallelWriter()
            };
            addedJob.ScheduleParallel(newEntities, Dependency).Complete();  // ERROR HERE
        }
#

Once i try to schedule the job it throws that weird error

haughty rampart
#

don't think it has anything to do with your code

stone osprey
#

Oh well... thats actually worse... so do you think i have the wrong package versions ?

haughty rampart
#

nah

#

what's ReactiveSystem line 117?

stone osprey
haughty rampart
#

what's newentities?

karmic basin
#

a query it looks like

stone osprey
#

I also cant find any other sources on that error... no forum posts or similar stuff sadly

#

But this piece of code ( from unity itself ) causes it...

#

Looks like T is my "AddedJob"... and the check reflection method simply checks for a null pointer

#

But i have no idea why its null and throws that issue

karmic basin
#

my best guess would be something went wrong during codegen but I'm not sure

stone osprey
#

Is there a way to trigger the codegen again ?

haughty rampart
#

try restarting unity

eager pawn
#

I'm stuck rip

stone osprey
#

I hate such errors... what else would you suggest ?

karmic basin
#

Delete Library folder to let Unity rebuild it ?

stone osprey
karmic basin
#

Nope, the Library folder

stone osprey
#

I will try this, thanks ^^

#

Hopefully it works...

eager pawn
#

If you can't delete lld.exe try restarting ur pc.. That's what I had to do to delete library folder

vocal wing
stone osprey
#

I have several errors in the entities 0.50 package...

#

Like 110

#

At some points there even errors like "List" ambigious calls or however you write that word

#

Any idea why this is happening ?

#

Looks like there no posts about that issue in the forum... sooo im kinda stuck with it

#

Especially the subpackage editor is full of errors

#

Those are my packages...

#

Anyone having an idea ?

safe lintel
#

did you just upgrade to 0.50 to try to fix your previous error?

stone osprey
#

I upgraded yesterday ^^ and i just rebuild the library which results in this beautifull errors above

safe lintel
#

i would comment out that one job/system that seemed to give you errors

stone osprey
safe lintel
#

occasionally I get like 15 errors in entities package when one non entities package thing is broken, some odd new quirk of the codegen i guess

stone osprey
safe lintel
#

not until I fixed my own shit

haughty rampart
eager pawn
#

Still need help with multidimensional datastructures on entities. I'm aware of a couple solutions, but idk if they're any good

#

Or if my design is even good in the first place but I think so

haughty rampart
#

also: what ide are you using?

stone osprey
#

So i still have like 130 errors inside that damn entities package and i still get the damn jobs error which makes no fucking sense... i hate it, i think its easier to go back to 0.17... or does anyone know how i can resolve all that weird errors ?

#

I already rebuild library

#

Wheres that one dots god that always has a solution ?

eager pawn
#

Maybe I shouldn't even do this in ecs and just make it in non-dots code

stone osprey
#

When i try to clean and build my solution... this happens

#

Entities cant even find collection stuff like UnsafeList or NativeList

#

"Type or Namespace not found"

#

What the heck am i doing wrong ?

haughty rampart
stone osprey
#

Actually never did this before ^^

#

I recently deleted the library folder... if thats what you mean

haughty rampart
#

edit -> preferences -> regenerate files

stone osprey
#

Well somehow this didnt worked, the exact same errors

#

Did anyone got entities 0.50 to work ? If so... could you please post your package manifest ?

eager pawn
#

that's what i got from my project i started 4 days ago

stone osprey
eager pawn
stone osprey
#

Great ^^ And do you get any errors inside your IDE regarding the damn entity packages ? My rider ide told me there like 138 errors inside Unity.Entitites

eager pawn
#

no, but i would get similar types of errors every day cuz my code is wrong lol. i have no errors as of now tho

haughty rampart
stone osprey
eager pawn
#

oh btw my project is unity 2d, no idea if that has an affect on package manifest

stone osprey
#

We will see ^^

stone osprey
karmic basin
#

well it will remove your packages and put the ones in the list

#

2 different projects are... different projects

stone osprey
#

Yes which is great because mine do not work... i get errors like crazy from entities 0.50 because it cant find certain stuff xD

stone osprey
#

Its german, but basically "Type or Namespace not found"

karmic basin
#

it won't rebuild entities 0.50 because you use it

#

but it will remove any package you have installed and @eager pawn did not

#
  • install the 2d packages you don't care about if your project is not 2d
#

and so on

stone osprey
#

Alright how should i ever solve those damn errors above ? ^^

karmic basin
#

Do you use assemblies ? Maybe assembly references broke when you upgraded ๐Ÿคทโ€โ™‚๏ธ

stone osprey
#

Yes i use asmdefs... but how would i fix this ? The errors are inside the entities package... my code is fine

#

Like entities editor cant find certain classes... entities itself doesnt even know what an unsafe or native list is during build and such stuff

haughty rampart
#

can you make a new project and import all your assets from your existing project?

stone osprey
#

Oh well this will take hours :/

haughty rampart
#

why? just export all to a unitypackage, then import them

stone osprey
#

Besides that... is it possible that entities 0.50 only works with 2020.3.30 and not with 2020.3.32f ?

#

Both are lts versions

haughty rampart
#

nah, works with 30+

eager pawn
#

im on 31f and it works fine

#

also did you see my issue mindstyler?

stone osprey
#

Alright... so this cant be the problem

#

So i deleted all packages and resolved them again... same issues

#

EditorWindowBridge... where is this shit even from ?

safe lintel
#

Can you paste your packages.json?

stone osprey
safe lintel
#

Remove platforms package

stone osprey
#

Gonna try this, thanks ! What is this even for ?

safe lintel
#

Wait actually you need to upgrade it to 0.50 same preview version as entities

#

Confused it with the dots editor

#

Which got merged into entities

stone osprey
#

Alrightttt, putting it back into the packages ^^ one moment

#

Well it cant find the platforms package anymore... damn

#

Ah looks like its hidden

safe lintel
#

It should be the exact same preview version as entities

#

So just modifying it by text should do the trick

eager pawn
#

If I'm not wrong, adding com.unity.platforms in the package manager should give u the newest version automatically

safe lintel
#

That too

stone osprey
#

Alrighttt soooo

#

The platforms version should be fine now, right ? Its exact the same like that from entities

#

Oh wait

#

it cant be found

#

So i have installed it now... "com.unity.platforms" version 0.50 preview 4

#

Lets see how it goes

#

WEllllllll

#

Same issue...

#

My updated package manifest looks like this now...

#

Sooo i had some progress here... It now tells me the following

#

It cant find a "UnityIAPIEditorBride.dll"

#

Which may cause that issue above

#

Does anyone know what that is and where i can get this from ?

stone osprey
#

I regenerated the project sources and this issue is gone now

#

Finally

#

So back to previous issues...

        protected override void OnUpdate() {
            
            ....
            
            // Add the added component job
            var addedJob = new AddedJob{
                ecb = ecbParallel,
                entityHandle = GetEntityTypeHandle(),
                componentHandle = GetComponentTypeHandle<TComponent>(true),
                added = added.AsParallelWriter()
            };
            addedJob.ScheduleParallel(newEntities, Dependency).Complete();  // Error, Reflection Data was not set up by initialize() call ??
      }

      public struct AddedJob : ...{}

Does anyone have an idea why this wont work in entities 0.50 ? Its a schedule & job related error....

haughty rampart
safe lintel
#

what about separating schedule and complete?

stone osprey
karmic basin
#

AddedJob implements which kind of job ?

stone osprey
#

IJobChunk ^^

karmic basin
#

OK it's deprecated but I don't know if obsolete yet or if you can still use it

stone osprey
#

What should we use instead ?

#

My editor says its still fine and not marked with obsolete or deprecated ^^

karmic basin
#

oh ok probably still fine then ๐Ÿ™‚

stone osprey
#

Hmmm... so the replacement for JobChunk is JobBatch basically ?

karmic basin
#

added is a Native container ? you instanciated it ? Sorry I'm just throwing ideas

#

IJobEntityBatch yeah

#

was already advised on 0.17

stone osprey
#

Yes like this var added = new NativeList<Transmution>(addedEntityCount, Allocator.TempJob); it looks like that the damn was not initialized is a direct job issue, i will try to replace it real quick with entity batch

karmic basin
#

yeah actually you would have had a different error if you didnt instanciated the container, my bad

stone osprey
#

This little piece of code causes it in the schedule method

#

T is the Job struct

#

The job is nested in an class because it makes use of some generic stuff... is this probably the issue ?

safe lintel
#

whats TComponent?

stone osprey
# safe lintel whats TComponent?

The Generic i was talking about ^^ Its a generic job which worked pretty fine... its basically nested like this :

public class GenericSystem<T>...{

   public struct AddedJob{ // Works with component T }
}
safe lintel
#

'which worked pretty fine' in 0.17?

stone osprey
#

Yep it did ^^

#

Looks like that nested struct is really the problem, scheduling jobs outside the system works fine

#

Please tell me theres a nice solution to bypass this problem...

river lake
#

it's a problem of the new codegen which only works on the outer most declaration and forgets generics and attributes

north bay
#

No idea if burst will catch your job tho

eager pawn
# haughty rampart no. what issue?

I want a dictionary/map on a component. I could explain in further detail what game I'm actually trying to make if that helps? Maybe my entire approach is wrong.

stone osprey
safe lintel
#

@stone osprey was that error being called during playmode or actually preventing a compile?

rotund token
safe lintel
#

@rotund token what do you mean by restriction?

rotund token
#

: struct

#

Etc

safe lintel
#

ah

whole gyro
eager pawn
#

But yeah, a blobhashmap and a dynamichashmap is exactly what I want. I in the blob, I want exactly 5 unit tiers with each tier holding units. Later on, you will be able to customize each tier (but not the amount of tiers), so I could put some of the tier 2 units from the blob into tier 2 of the dynamichashmap

whole gyro
#

Hmm, I would probably need to know more about your use case, but I'm wondering if you even need the hashmap. Can you just have tag components for each tier and then use a query to grab the units for a given tier?

eager pawn
#

When the game starts, a datastructure with all units will be put inside it, as well as their associated tier. This can be a fixed length and Immutable.

If you choose to customize a tier, let's say tier2 (similar to customizing a card deck) you can copy a bunch of t2 units into the dynamic buffer, obviously this has to be mutable. I don't think a single dimensional array will work, but if I had two I could do something like, pseudocode:

unitTiers = [1,1,2,2,3]
units = [unit1, unit2, unit3, unit4, unit5]

In this example, unit5 would be the only tier 3 unit.

Since I have 5 tiers, you're suggesting maybe I could 5 entities, the first with tier1conponent, the second with tier2component, etc? Then each entity holds a dynamic buffer? I think that works too.

whole gyro
#

With the dynamic approach, each element would store a reference to the unit and the tier it is in. Basically, just squish your two arrays together. So it would be something like:

struct TieredUnit : IBufferElementData {
  public Entity Unit;
  public int Tier;
}

And the idea with tagging is that you never need to store the list of units by tier. Instead, the tier is stored on each unit entity as a tag. Then you can query for all entities that have the Tier2Tag.

eager pawn
#

Ohhh, I didn't even consider I could do it that way, I will try it first thing when I wake up tomorrow :DD

uncut rover
#

@blur
You probably don't need a map structure since you seem to have a fixed immutable dimension. If you now you have 5 tiers and then you want to have any number of unit of any tier, a simple implementation would be to have one buffer per tier so 5 in total.
For the non mutable structure you could do the same and have a blob asset with one blob array per tier.
Of course this is bad if you want to have a 6th tier at some point...

stone osprey
#

However... After upgrading to entities 0.50 my whole simulation group is pretty slow now... looks like theres something weird going on

stone osprey
#

Btw... is it now more performant to tag entities with empty components in entities 0.50 ? In previous versions it was quite expensive due to heavy copy operations from one archetype into another and similar stuff

viral sonnet
#

I don't think anything changed there. But I'm also not using structural changes and I haven't done a specific test to compare 0.17 to 0.50.

#

from what I've seen in my own project and report from others. There are no performance differences between 0.17 and 0.50

rotund token
#

Does it depend on something internal from unity?

eager pawn
# rotund token Does it depend on something internal from unity?

yeah, i think internal unity things may have changed, for example, CollectionHelper does not have a CheckIsUnmanaged method
https://i.imgur.com/4YtVJLA.png

im new to c# so idk exactly what internal means, but UnsafeHashMapData is an internal struct, maybe it was public in a different version? "'UnsafeHashMapData' is inaccessible due to its protection level"
https://i.imgur.com/Xt07cZK.png

and finally, the "it" variable never gets assigned to a value
https://i.imgur.com/q979ZI8.png

i added your code by extracting all files, including the license and stuff, and put them in a brand new 2020 LTS 31f project
https://i.imgur.com/EfxBNsb.png

karmic basin
#

So yeah you can't really use internal stuff unless you recode it yourself

haughty rampart
#

you could also add [InternalsVisibleTo()] to the assembly

stone osprey
#

Damn 2020 lts performs kinda bad... sometimes the editor runs at 15 fps without anything going on... even on empty scenes.

stone osprey
#

Can the ECB buffer component object operations ?

#

Cant find any method to buffer a object assignment

coarse turtle
stone osprey
#

Doesnt matter anymore, solved it ^^

#

Besides that... can i run a "IJobEntityBatch" directly on the main ( RunWithoutJobs )

#

This was possible with IJobChunks

#

But the method is gone for IJobEntityBatches...

#

Oh and can i run jobs with passed delegates in it ? It worked in the past... now i get an error that job structs may only contain references ๐Ÿ˜ฆ

#

I wanna run the jobs on the main so it actually doesnt matter

coarse turtle
#

IJobEntityBatchStruct { }.Run(someQuery) if you want to run it on the main thread.

stone osprey
#

It currently throws the following exception :

#

Which is true for scheduled jobs and such... but it doesnt matter if it executes on the main normally

coarse turtle
#

I imagine BurstCompile isn't an attribute on the struct right?

stone osprey
#

Its not ^^ I already removed it

#

But it still throws that error

coarse turtle
#

I think there was an attribute you can put onto a parameter

#

one second let me test it out real quick...

stone osprey
#

Alright thanks ^^

coarse turtle
#

nevermind there wasn't an attribute

north bay
#

Doing RunWithoutJobs on jobs implementing IJobChunk didn't go through the job scheduler which is why it was allowed
If I remember correctly you can use GCHandle to pass managed types to jobs just fine

stone osprey
#

Pinning ?

#

Damn why did they removed that RunWithoutJobs...

coarse turtle
#

You can try GetFunctionPointerForDelegate

#

I've only used it to pass C# functions into C++

stone osprey
#

I just wonder if that works when the delegate was modified in between with "+=" and "-=" operations... or if it requires a new function pointer after each modification

north bay
stone osprey
#

Alright that sounds good, i will just try it and see how it goes ^^

Still sad that they removed that feature

coarse turtle
#

I think you have to convert it back to a delegate to invoke it

stone osprey
#

And i bet this will not work becauseeeee its a managed type inside a job again

#

Oh boy, i hate it

#

Taking bets if it works or not

north bay
#

As long as you aren't using burst

mystic mountain
#

Anyone else having issues with GenerateAuthoringComponent and IBufferElementData?

stone osprey
mystic mountain
#

Seems like it works with anything but Entity field. ๐Ÿค”

eager pawn
#

this is illegal cuz Unit is a reference type?

    public struct TiersBlobAsset
    {
        public BlobArray<Unit> tierOne;
        public BlobArray<Unit> tierTwo;
        public BlobArray<Unit> tierThree;
        public BlobArray<Unit> tierFour;
        public BlobArray<Unit> tierFive;
    }```

instead, i should do BlobArray<int> and then "map" each unit to an id?
misty wedge
misty wedge
#

Just store the readonly data you want to have available directly inside the blob

eager pawn
#

ok, ig ill just use the UnitBufferElement then, and not the blobarray

worthy rampart
#

What's the status of terrains in DOTs

robust scaffold
valid haven
#

So what is the current way to deal with gameobject based terrains. Render them as gameobjects , but manually extract their collider and convert to Unity Physics?

worn valley
#

yeah I think that is how you deal with terrain physics now

shell berry
dawn cargo
#

Hi, I'm new to DOTS, but im looking in to using it for the physics of my game, and was wondering if there is an equivalent to the built in unity Physics.Simulate function that I can use to manually progress the simulation forward? I haven't been able to find much relating to this online

half jay
#

Hi, how can i get pointer of NativeHashMap? I saw special utility class NativeArrayUnsafeUtility, but it is for Native array

karmic basin
#

Not a perfect answer but hope that helps

#

Also check the official samples, they have a pool game where they predict the balls movements taking future collision into account and such. I guess that's exactly what you want

dawn cargo
#

perfect, thank you!

stone osprey
#

Can you schedule/parallelSchedule jobs which are NOT marked as burst compile ?

And can you acess managed stuff in there ?

minor sapphire
#

Entities.WithoutBurst().ForEach()

#

I think you need to be on main thread to access managed components though? It will quickly give you an error though so just try schedule first and watch the errors ๐Ÿ˜„

#

@stone osprey

stone osprey
#

Thanks ^^

#

Something different... im still trying to run my jobs on the main thread, looks like i cant make use of the job.Run method because i can not convert my delegate into a pointer ( its a generic delegate and c# dont really like them )...

So my next guess i could just call the .Execute method. But that one requires a ArcheTypeChunk. How do i get the ArcheTypeChunk of a certain query ?

tame pelican
#

I wonder how to implement a grid in ECS, I'm not sure how to put that in component , and does it even need to be a component. The point is to access the element with coordinate/index.

#

Also would it be faster to access to non changeable grid stored in blobasset , rather than accessing the grid using nativearray or dynamicbuffer or whatever it takes?

north bay
north bay
tame pelican
# worthy rampart What kind of grid

Grid of structs with unmanaged types, which will have size almost never changed, but having data in it change every few seconds. Used for pathfinding.

worthy rampart
#

Gotcha

#

You can store them in a BVH and query by AABB

#

Unity physics exposes one

#

That's how I'm currently building out my grid system

tame pelican
worthy rampart
#

To query for blocks on a grid defined by AABBs

#

If all the blocks are the same size this is overkill and you can probably just use a map

tame pelican
#

Pretty sure that point of the grid is that the every block is the same size.

#

(I was referring to solution for game of bomber-man type)

worthy rampart
#

Some grids may have blocks that are all the same size

#

Sometimes you might want to have blocks that span multiple cells

stone osprey
north bay
stone osprey
tame pelican
#

@worthy rampart I was referring to grid where you access elements by coordinate directly.

worthy rampart
#

Depends on if it's fixed size

#

Or expandable/sparse

#

If it's fixed size you can also do a single array

#

With 2d indexing

stone osprey
#

Does entities 0.50 already work on android ?

#

I really, really hope so...

eager pawn
#

can i create a blob from a system's OnCreate and later get it's data from within another systems OnUpdate, but only after the data has been set?

eager pawn
#

nvm, 2 systems can communicate if you put both their components on the same entity :))

stone osprey
#

Is dots supposed to work on release ? I somehow get my app ( Entities 0.50 ) to run on my phone in development mode... but not in release.
And i actually only use dots, no other fancy frameworks or packages.

tribal juniper
#

why do the child gameobjects not get converted when I use convert and inject gameworld . i cannot use convert and destroy because i am using animator component to drive animation. Please help. using unity.entities 0.50

stone osprey
stone osprey
#

Anyone ever had a similar problem where their dots build crashes on release but ran fine on development mode ?

#

Crashes directly after the unity logo, Any help would be great

haughty rampart
stone osprey
haughty rampart
#

in the project settings

trim lotus
#

I have a question since there is no answer I can find easily: Can you use DOTS Physics in Unity version 2021? or is it unavailable?

karmic basin
#

In our previous forum post, we explained we need to go through 3 steps to get to 1.0:

  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.
  3. 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.
#

If you stay on entities 0.17 and physics 0.6, it works for sure. Again if you encounter compatibility errors from packages, there's some fixes explained on the forums

trim lotus
karmic basin
#

๐Ÿ‘Œ have fun !

ruby cedar
#

Quick question about dots

My whole game is running without dots yet ( Iโ€™m building a RTS game similar to mount&blade )

But now Iโ€™m getting to the point to add AI and Iโ€™ll need a lot of them later on with good performance.

Can dots help me out with that? The AI would have animations and some logic for shooting and pathfinding.

Is dots capable for that? And is it different to normal unity system?

worthy rampart
#

are colliders in DOTS supposed to respect a NonUniformScale?

#

(I know some like Sphere can't)

patent stag
#

Hey any up-to-date tutorial for DOTS?

#

Most tutorials are from 2019 and I can't be sure if they're obsolete

hot basin
#

TurboMakesGames on YT

worthy rampart
#

I wouldn't say DOTS is particularly tutorial friendly

#

lots of good snippets on the forums

patent stag
#

Yeah over the past few years only a few things that were extremely well-document that I was able to learn from docs

#

Most of the time docs can only be used as a reference, not a getting-started guide or tutorial

worthy rampart
#

also good for getting started

#

lots of isolated examples of using various parts of DOTS

safe lintel
#

@worthy rampart only translation and rotation, no other transform components

eager pawn
#

when i do var blah = myNativeArray;

changes to blah will also change myNativeArray right cuz it references the same memory address

#

ig it would't have a Copy() method if it didn't

stone osprey
# eager pawn when i do var blah = myNativeArray; changes to blah will also change myNativeAr...

Lol... i just had a similar question or more like issue.

One component stores a "UnsafeList" inside of it... i modify that list, but dont set the component new. Did the list update or did it not ?

It did not, sadly... dont really understand why. I mean even if i only own a copy of that component with the list, the list still should reference the same memory adress like before. Somehow it did not, it required a ".Set" new operation

#

I assume nativelist behaves the same. However i still dont understand why. That behaviour doesnt make that much sense

worthy rampart
#

Ive done some more digging and it looks like at conversion time scale is respected

#

If you are converting from a gameobject

eager pawn
#

I dunno genar, but I hope you solved it.

#

Can I use ptr for unmanaged code? I mean I could try, but idk how to enable unsafe code, I already ticked the allow unsafe in unity settings

#

I need a mcs.rsp or something?

haughty rampart
#

no, should work already then. if you're inside an asmdef you need to tick it there as well

eager pawn
#

MAYBE its cuz im using vs code instead of vs hmm

#

the error pops up in the editor and not unity itself

coarse turtle
eager pawn
dim moat
#

Hey, I am not sure this is the right place to ask that question but... What is the burst compiler + job system place in the game architecture? Does it replace only the asynchronous code? Is it just 'better' and 'modern' replacement for coroutines or am I missing something?

dense crypt
#

Then Burst acts as an extra layer on top that optimizes your jobs very carefully for maximum performance

worthy rampart
#

Is game object conversion something that only happens in editor?

dense crypt
worthy rampart
#

Gotcha

#

So I can't make gameobjects at play time

#

For the purposes of conversion

dense crypt
#

You shouldn't want to, it's pretty slow and expensive compared to pre-converting them

#

If you're thinking abour Prefabs then the conversion process is smart enough to also convert Prefabs to "Entity Prefabs". Assuming you're referencing them in your conversion script.

eager pawn
#

So pointers are not allowed in a unmanaged component, right? Then an entity couldn't hold a pointer? Hmm so why would I want to use something like an array of pointers with ecs?

worthy rampart
eager pawn
worthy rampart
#

Not object references

#

Literal unsafe pointers

#

But you need to know what you're doing

#

Or you're likely to mess up

eager pawn
#

But would the component not be considered as managed if I did that?

#

Kinda like putting a blobassetref on it also makes it managed

worthy rampart
#

My guess is whatever you're trying to do is possible without a pointer

#

Unless you are integrating unmanaged code

#

You've not given any info on what you're trying to do with the pointer so it's hard to suggest anything else

eager pawn
#

I was thinking of nested arrays/dictionaries and wondered if I should learn how to use pointers, maybe they will help me with making a datastructure.

I checked the docs and it said a buffer element is a native container which would make it managed, right? So references and pointers would be allowed? If so, couldn't the buffer element hold a pointer to an array or something, or maybe that'd be useless.. Idek dude sorry ๐Ÿ˜…๐Ÿ˜…

#

Nvm I must have misread, it's unmanaged

worthy rampart
eager pawn
#

I made my first pointer today so yea

worn valley
#

Pretty much a pro now ๐Ÿ˜‰

eager pawn
#

No matter how I look at it I get O(n) when it could have been like half the list, or O(n^2) cuz of a nested foreach, or some other jank I dislike. Or Its superhard to generalize it and I need to repeat myself or w/e sadge

misty wharf
#

Hi i have a question : Is there a way to model a Dictionary<key, List<value>> that can be used by the job system ? i tried implementing my own and working with NativeHashmap<key, NativeArray<Value>> but there he says it is not blittable. Is there a workaround or am i forced to use flattened 2d arrays

misty wharf
#

thanks that works fine

knotty linden
#

Hey all, so I'm just checking out DOTS for the first time. I've installed 0.50 and it's now up and running.

Given 0.50 just came out - can anyone recommend a tutorial that isn't too outdated (0.17 I guess)? My plan is to have the changelog open so I can reference it when things don't work, and go from there.

Or have things changed so much that I should just read the unity docs straight away instead?

misty wharf
# knotty linden Hey all, so I'm just checking out DOTS for the first time. I've installed 0.50 a...

im quite new to dots aswell and this dude helped alot. https://www.youtube.com/c/TurboMakesGames/videos
since i am new i can not say a lot about changes but my feeling when learning was that i did not stumble across outdated stuff.

knotty linden
#

@misty wharf thanks for the tip. I'm using this one atm - it's working great for me so far. https://www.youtube.com/channel/UCWERX3S8tEGqNeLuQGCcJmw

misty wharf
#

Any one of you got a tip for me ?
My setup is this : I have multiple entities that move dependant on other entities on a graph. So i need to find and reference them inside of my system. Without dots (just with the jobsystem, threads or on main thread) i used a dictionary that maps the entity ids to a graph edge so i can look up where each is on my graph.
In dots i thought that i could use a shared component for this, but inside of the system logic i can only call it by value, not by reference. so if an entity updates its dictionary position the change just happens locally. Do you have an idea how to solve this ? Do i need to use reference types inside of the shared component or is there a good dots specific solution ?

hot basin
#

have someone good article/tutorial on unsafe/unmanaged?

#

I see that many answers talks about pointers and such but I have not work with them for a long time

pulsar jay
#

Did anyone else encounter this problem while updating to Entities 0.50?
(0,0): error Mono.Cecil.ResolutionException: Failed to resolve Tomlyn.Syntax.SyntaxList1<Tomlyn.Syntax.TableSyntaxBase>

knotty linden
pulsar jay
rotund token
safe lintel
#

ugh thanks unity for this extra helpful error
`Microsoft (R) Visual C# Compiler version 3.8.0-dev.20527.1 (53dc6556)
Copyright (C) Microsoft Corporation. All rights reserved.

error SGJE0003: The parameter 'index' of type int will be ignored.`

worthy rampart
#

I've seen that before

#

in a thread

#

I knew I had seen it recently

#

^ quote from Unity Dev in the thread

safe lintel
#

yeah that was it thanks

#

hope they improve the error handling, I almost nuked the library when a few restarts didnt clear it up

stone osprey
#

All i get is a CRASH.
Im trying to build my game in the "release" mode... the development build works fine ( Platform is android, Unity 2020 lts )

When i build and start my "release" build... it crashes with this nice exception.

#

Does anyone have an idea what the heck this error means... what it might cause ? I assume its dots related... because thats all i use in my game :/

#

Using entities 0.50 with the jobs 0.50 and burst 1.7

#

Stripping is disabled...

#

Im out of ideas what this shit might cause

haughty rampart
# stone osprey

how are you building your project? from the build settings?

stone osprey
#

The player settings will take one more sec

coarse turtle
#

is this the build configuration asset?

#

looks like the regular build settings ๐Ÿค”

haughty rampart
stone osprey
#

Oh... since when ? ๐Ÿ˜ฎ

haughty rampart
#

since 0.50 It tells you in the guide

stone osprey
#

Damn i guess i havent noticed that... that explains that issue ^^

#

Thanks, im gonna check the guide again real quick

haughty rampart
stone osprey
# haughty rampart got it working?

Yep it works now, thanks ^^ Damn such a stupid mistake.
I just wonder that it worked in development build without such an build configuration file

haughty rampart
#

development builds are always compiled way differently than release builds

#

in any software project

stone osprey
#

That explains it, i wonder if the release version is also faster now ๐Ÿ˜ฎ sadly i dont have an inbuild fps widget

haughty rampart
#

it definitely won't run worse

stone osprey
#

I wonder if the rendering mode set to "multithreading" increases the performance even more

rotund token
#

you only need it if you have subscenes (or no custom boostrap)

#

basically same rules as 0.17

#

and our project is too old for subscenes ๐Ÿ˜ข

#

(but yeah you should definitely use build configurations anyway)

safe lintel
#

Anyone have any difficulty in creating rigidbodies from code since 0.50? I've already added the PhysicsWorldIndex, cant seem to get anything to actually interact though its supposedly part of the relevant entity queries

worthy rampart
#

I haven't tried building the full set of physics components by hand tho

#

Ive just been instantiating and adjusting some

safe lintel
#

turns out it was my use of adding a PhysicsGravityFactor, though I thought it would just get ignored

#

for a kinematic body

#

I dunno, still feels different, having to rework a lot of stuff that "just worked" prior

rotund token
#

why i've been advocating for a long time not to create runtime entities

#

they could completely rework components in a future version

safe lintel
#

cant avoid it if you want to integrate mecanim(shudder) and entities

#

basically rewriting my old mecanim with Unity.Physics ragdoll workflow which kinda broke with 0.50. was hoping to ditch it but I guess gotta embrace it

worthy rampart
#

Don't try creating new types of entities at run time?

#

I fail to see how you can possibly get away with never creating entities at runtime

rotund token
#

i never create entities at runtime (except if they have a single component of my own for very specific purposes)

#

i create entity prefabs via conversion

#

and instantiate them

#

so required components are setup via authoring

worthy rampart
#

Ok

#

I was reading create as instantiate

#

That's also the method I've been doing

#

There's too much logic baked into their conversion

rotund token
#

yeah sorry create could definitely be a confusing term, just basing it off the name of ecb/em

worthy rampart
#

That's very annoying to replicate

#

It's much easier to make some Game Objects to convert

boreal forge
#

Is there a way to "name" a lambda job (Job.WithCode or Entities.ForEach) inside of a system onUpdate? On the burst inspector or the profiler all it says is SystemName.SystemName_LamdaJob_#NUMBER_Job Which really isn't helpful...

boreal forge
#

Also is there a reason an Entitles.Foreach with ScheduleParallel() is only running on a single job thread?

//Lines is a Native array<int4>
lines.ResizeUninitialized(query.CalculateEntityCount());
lines.Clear();
var localLines = lines.AsParallelWriter();

Entities.WithAll<SharedTeamComponent>()
  .ForEach((in Translation translation) =>
  {
  //Do a bunch of work
    localLines.AddNoResize(new int4(eX, eZ, pos.x, pos.y));
  })
  .ScheduleParallel();
safe lintel
#

Afaik itโ€™s โ€˜WithName(โ€œnameโ€)โ€™ @boreal forge

boreal forge
molten flame
#

I can't find any documentation for hybrid components in the 0.50 docs, am I blind?

rotund token
#

what are you looking for in particular?

#

well i should say, hybrid components dont exist in 0.50 outside of internal unity use

molten flame
#

Ah ok, I was just wondering if there was a way to query for UnityEngine components without creating a wrapper IComponentData managed component.
In the entity inspector you can see that the UnityEngine components are converted to managed components automatically but it maybe this is purely internal?

molten flame
#

Ok, turns out you can access them, its just a little clunky since they are not IComponentData so you need to use EntityQuery a lot and miss out on a bunch of the nice build in query stuff like GetSingleton.

tame pelican
#

I wonder for DOTS physics when moving a physics body . can I just simple use Translation (inside the "FixedStepSimulationSystemGroup") or is there a different way?

tame pelican
#

Also is there a way to lock one movement axis, and disable velocity, i.e. to move bodies manually but still to prevent them going through obstacles?

rotund token
haughty rampart
#

i've got a problem with upgrading some other code. since the animation package is not supported now, how can i store / evaluate an animation curve? i've used AnimationCurveBlob and AnimationCurveEvaluator until now

hot basin
haughty rampart
dull copper
#

(for those who don't know, he was lead of dots hybrid rendering team)

eager pawn
#

can i create a nativehashmap that holds another native container, like native array?

river lake
#

yes but the inner list has to be unsafe

eager pawn
#

so, no? it has to be NativeHashMap<int, UnsafeList<Unit>>

where unit is a uhh what do u call it, blittable struct? unmanaged struct

pulsar jay
#

With Entities 0.50 reading from a ComponentDataArray seems to create a dependency problem:

var translations = query.ToComponentDataArray<Translation>(Allocator.TempJob);

I thought using WithReadOnly(translations)would be the right way to declare reading dependency for automatic dependency management. If thats not the case how do I declare the read dependency on translations?

safe lintel
#

@dull copper hmm good for him to move on to what he wants to do but a bit worrying the lead of the still in progress hybrid renderer is leaving

worthy rampart
#

in an unsafe {} block you can pretty much do any pointer nonsense you'd want to

pulsar jay
winter depot
#

I have switched to using RenderMeshDescriptions with URP/Hybrid renderer and I am using "Universal Render Pipeline/Unlit" shader since that is the only shader that I can get to run without SRP batcher errors popping up. I have everything rendering, but it appears as if its not recognizing Alpha at all. Like every single texture has streaks of color where it should be transparent. Anyone able to point me in the right direction? *This is 2D btw

coarse turtle
worn valley
#

Does it work with VR?

coarse turtle
#

no I haven't had the time to tune the shader to work with VR

worn valley
#

okay, fair enough ๐Ÿ™‚

coarse turtle
#

I can probably put in my task queue

worn valley
#

I love me a one draw call thing

#

nah, don't worry about it. VR seems to be dying slowly anyways.

safe lintel
#

@haughty rampart yeah saw that earlier, still doesnt clear up the issue of can it be released as experimental ๐Ÿ˜…

haughty rampart
haughty rampart
#

i've got an issue with 0.50 currently. some code of mine throws 'object reference not set to an instance of an object' errors from a burst job. the problem is, if i disable burst compilation (to get stacktraces) it does not throw any errors at all. any idea how to debug this?

safe lintel
#

can you comment it out line by line to find the offending statement? though dont think ive encountered that

coarse turtle
#

When that happened for me i pretty much just disabled systems until I nailed down the system that was handling it - it wasn't the most efficient. ๐Ÿค”

haughty rampart
#

i only have one system, but i can't really comment out line by line because most lines are dependent on the line just before it

#

and it's also strange. when enabling synchronous compilation it does not throw an error either

#

but i'll see what i can do

coarse turtle
winter depot
# coarse turtle still not very familiar with hybrid renderer, but I imagine the shader is an unl...

Well its the default URP/Unlit that I was able to get to build without error, I assume I need a sprite shader for this to work, but none of them are compatible. I found a forum post that kind of mentions what to do from a unity team member. You need a subshader with #pragma target 4.5 The subshader needs to use #pragma multi_compile _ DOTS_INSTANCING_ON The shader needs to specify DOTS instanced property definitions for any properties that will be read from entity data, e.g. transform matrices. This is typically done by #including some shared headers. You can look at the example shader in the Hybrid Renderer package for a simple example, or URP/Lit and URP/Unlit for a full fledged example. I absolutely have no clue how to work with shaders so I guess its time to get my hands dirty and waste a week

#

Actually not sure its worth it though, may just go back to manually rendering with Graphics.Drawmesh

coarse turtle
#

from the post it sounds like adding in #pragma multi_compile _DOTS_INSTANCING_ON as a define in the .shader file. I haven't looked into exactly what DOTS_INSTANCING_ON requires for it to work properly but I imagine the URP shader source would have a struct that defines the data needed for everything to render

winter depot
#

I was able to sort it out by pre-creating a dummy material with the default unlit shader and switching from "Opaque" to "Transparent", then copying that instead of creating one in code. I am not sure how to tap into that property from code, so thats the solution for now.

worthy rampart
#

is there some way for me to get all buffers of a specific type

#

and do stuff on them in parallel

#

nvm

#

disable safety is my friend

half jay
#

Is it possible to use hybrid render V1 in ecs 0.50 version?

winter depot
#

I think only V2 now

half jay
#

And ECS 0.50 obligatorily require Hybrid render 0.50 too?

rotund token
#

you can only use the new 0.50 renderer which means no old rendering only SRPs

winter depot
#

btw tertle did you ever figure out a permanent solution to UIDocument or are we still "re-importing" every time?

rotund token
#

reimporting atm

#

i'm actually testing if i can run entities on 2021 atm with some modifications

#

2022 works fine if you don't use hybrid renderer

winter depot
#

I like the sound of that

#

Well I have switched all to hybrid so Im stuck for now

rotund token
#

(with Extrys modifications)

#

but 2022 has some giant graphic changes so that's expected

#

2021 doesn't have these changes so i think i'll be able to get that to run but we'll see

#

testing right atm

drifting sun
#

dots

half jay
#

it is very sad because we use Augmented Reality and as I know hybrid render v2 requare vulkan and it's not supported by AR

rotund token
#

nope no luck, 2021 hasn't backported the new jobsutility api from 2022 yet

#

so you can run entities on 2020.3.30+ or 2022 beta but not 2021
but you can only run hybrid rendering on 2020.3.30+

winter depot
#

I am stumped on what RenderMeshDescriptons "LayerMask" and "Layer" actually do at this moment. Have they not been implemented yet or is it a feature that doesn't work on 2d?

#

Back to using Z for depth

safe lintel
#

@rotund token you mentioned a short while ago you serialize everything to one nativearray, could you explain a little more how that works? trying to visualize this but Im failing

rotund token
#

for saving?

safe lintel
#

yeah

rotund token
#

can't share too much code because it was written for work, but basically each type of entity we want to save has it's own container type

#
        where T : unmanaged, ISave<T> {

        Entity GetEntity();
        void Serialize(StreamWriter writer);
        void Deserialize(ref StreamReader reader);
    }```
where StreamWriter just writes to a NativeList<byte>
#

these lists are then just combined together into a single nativearray

#

and written to disk

safe lintel
#

how do all the different container types fit into the one nativearray though?

#

thats the part that confuses me

rotund token
#

                var (result, count) = save.Value;

                var meta = new SaveMeta {
                    SaveType = save.Key,
                    SaveVersion = _saveSystems[save.Key].LatestVersion,
                    SaveCount = count.Value,
                    SaveLength = result.Length,
                };

                saveFile.AddRange(&meta, UnsafeUtility.SizeOf<SaveMeta>());
                saveFile.AddRange(result.GetUnsafeReadOnlyPtr(), result.Length);
                result.Dispose();
                count.Dispose();
            }```
where saving is just NativeList<byte> data and NativeReference<int> count
#

write a tiny amount of meta data about each chunk of memory, then write the data

#

save version is important so when we can deserialize we can migrate to new formats/etc when we add new stuff in future

#

but this is versioned per entity type

safe lintel
#

appreciate it, thanks. some new concepts I guess I gotta process ๐Ÿง 

rotund token
#

i think saving has always been a troubling problem for game dev

#

that is really not discussed nearly enough

safe lintel
#

yeah, i was disappointed serializeworld being made internal/ streambinarywriter. would have traded inflexibility for ease of use and not have to muck about with yet another thing to work on

rotund token
#

the problem is you can't really use serializeworld for saving

#

unless you never want to update your game

#

you change 1 component in the future and all existing saves break

#

we tried this for a year+

#

writing auto migration with mock components etc and all sorts of memory hacks

#

it was a complete nightmare to maintain

#

while it took me a month to rewrite our saving it was definitely worth the time

#

it's saved so much time since and is very easy to maintain

harsh onyx
#

is there a faster way to convert a regular Transform array to a Transformaccessarray (unity dots) than looping trough each element.

edit: well I can just use the constructor for it... I am so stupid.....
= new TransformAccessArray(RegularArray[])

harsh onyx
#

like a memcopy or something like that

worthy rampart
#

but you can cache the transformaccessors

harsh onyx
#

I currently have a prepared (serialized) Transform array that then gets copied at the start of the game into a transformaccessarray and never disposed (because the game works like that)

worthy rampart
#

does anyone know the fastest way to process entities for all values of a shared component filter?

#

I'm currently doing a regular foreach over the all unique shared component data

#

and dispatching a job for each of them

harsh onyx
#

Are the shared compontents added dynamicly and change a lot during the game?

worthy rampart
#

I'm wondering if something like a parallelfor would be better

#

they'll get created and destroyed with some frequency

#

but once one gets created it's value never changes

harsh onyx
#

I have like a precalculated array that holds all possible shared stuff (hashset then converted to array) and all the entities and gameobjects get is the index of the array, in a Byte.
Maybe you could do something like that too?

#

So instead of iterrating over get component you can then iterate over the Byte, ushort or int number (or numbers if they have multiple).

tribal juniper
#

how to solve this issue? what s causing this problem. character is falling down on its own. iam using dots entities 0.50. i am using dynamic physicsbody. also how can i find out if the player is grounded. code snippet will be helpful.

half jay
#

Does new instanced RenderMesh component save reference to same parent mesh after instantiating from Prefab Entity ?

tribal juniper
pulsar jay
#

Seems like the behaviour of ConvertGameObjectHierarchy changed with Entities 0.50. Converting a prefab pollutes the active scene with its Companion gameobjects. Instantiating these prefab entities does not but the ComponentObjects (VFX in this case) are only visible in Game view? ๐Ÿค” Anybody also encountered/resolved this? Conversion in subscenes works as expected. I guess it has sth to do with conversion flags

devout prairie
# tribal juniper how to solve this issue? what s causing this problem. character is falling down ...

A common way to do isGrounded is just a simple raycast down from say the hip position, with ray length just longer than the distance to the feet, and if it returns a hit for your ground mask layer then golden.
Regards the character tipping over, with normal unity physics you'd typically lock the axis right, not sure if there's a constraint for Unity.Physics or a field inside the rigidbody component which does the same.

safe lintel
pulsar jay
safe lintel
#

do you mean prefabs that contain hybrid components?

pulsar jay
#

I also found that the same VFX game objects will be created when pressing play while a subscene is in edit mode

#

Not sure if this is intended

dull copper
#

This video covers the improved Editor tooling in the upcoming Data-Oriented Tech Stack (DOTS) 0.50 release, including the Hierarchy, Inspectors, Profiler modules, Systems window, and entities journaling. It also addresses a new Editor workflow, coming in Entities 1.0, which allows artists, gameplay programmers, and level designers to author with...

โ–ถ Play video
safe lintel
#

unlisted, how did you find it?