#archived-dots

1 messages ยท Page 119 of 1

junior fjord
#

they are going rapidly

opaque pilot
#

I'm still confused on why planetEntities needs to be readonly and damagableEntities was fine not to be

opaque ledge
#

well otherwise you unity thinks you want to write to it, in that case you have to put [NativeDisableProtectionForParallel](or smth) Attribute to your field

junior fjord
#

@remote coyote I just tried 2020.1 and I immeadiatly got errors in an empty project

#

and every time I clicked one of the errors a new one appeared ๐Ÿ˜„

opaque ledge
#

do any other system updates damagableEntities ?

opaque pilot
#

Not yet

opaque ledge
#

yeah thats the reason ๐Ÿ˜„

mystic mountain
#

Many errors usually fix if you close unity, remove assemblies and packages, and start again

opaque pilot
#

This is the first system to use both

opaque ledge
#

once you put it, it will give you an error just like with planet tags

round summit
junior fjord
#

@mystic mountain ah ok thanks, I'll try that

round summit
junior fjord
#

is the changelog for entities 0.8 anywhere to be found?

opaque ledge
#

yes i posted it above, or just check your packages if you have updated it

#

wasnt there a specific component for Gravity ๐Ÿค”

fallow mason
#

PhysicsGravityFactor

round summit
round summit
#

Hmm, interesting

junior fjord
#

@opaque ledge how do I check my package? when I click changelog in the package manager nothing happens

opaque ledge
#

from your project files

fallow mason
#

might show up if you change it in the authoring component

opaque ledge
#

instead of Assets go to Packages

fallow mason
#

no need to add component if you can assume 1

opaque ledge
#

yeah, same thing goes for scale component i believe, if its 1,1,1 it doesnt actually add scale component

round summit
#

Oh, that component wasn't being added if you keep it at 1 or 0 apparently
I'll add it then, thanks

opaque pilot
#

@opaque ledge Ah, thanks

amber flicker
#

did you get hrv2 working @opaque ledge ? I'm getting RenderMeshSystemV2 could not be found - am I missing a package or smth? 2020.1.0b1 - hmm, don't think ENABLE_HYBRID_RENDERER_V2; is needed maybe we need to wait for 2020.1 proper?

junior fjord
#

@opaque ledge so I should search in Packages->Entities?

worldly pulsar
dull copper
#

oh the new packages ๐Ÿ˜„

fallow mason
#

why not?

worldly pulsar
#

what happens when I do CreateEntity(MyGameArchetypes.PlayerArchetype) from a system that is not in the default world?

dull copper
#

ok, lets testthe hybrid v2 now:D

worldly pulsar
#

Please report on the URP support if you happen to use it ๐Ÿ™‚

warped trail
#

where is this HybridURPSamples ?๐Ÿ˜…

dull copper
#

you need this

warped trail
#

ty

dull copper
#

that has both hybrid v2 changes for upr and hdrp + samples on testprojects

amber flicker
#

hmm does that mean no longer any support for ~~universal ~~legacy/builtin with the new hybrid renderer do you think?

dull copper
#

also need to change the test projects manifest since those point to "com.unity.rendering.hybrid": "0.4.0-preview.7",

#

instead of preview.8 which we got

#

also need to remove the custom registry path from it

#

it points to some internal unity registry

opaque ledge
#

@amber flicker i am getting the same error

#

@junior fjord yes

dull copper
#

anyway, I'm opening this here now, will report back once I get this running

#

would expect these testprojects to just... work

mint iron
#

they'll work after we've found all the bugs!

dull copper
#

lol

#

we'll find out soon enough

warped trail
#

ENABLE_HYBRID_RENDERER_V2 && UNITY_2020_1_OR_NEWER && (HDRP_9_0_0_OR_NEWER || URP_9_0_0_OR_NEWER)๐Ÿค”

amber flicker
#

๐Ÿ˜ฆ

dull copper
#

and then it crashed ๐Ÿ˜„

amber flicker
#

just works tm

dull copper
#

tbh, I haven't yet found a test scene that would make much sense to me

amber flicker
#

I guess we're too eager as usual

dull copper
#

well

amber flicker
#

didn't realise they'd be dropping support for the built-in pipeline with the new renderer though.. that's a bit sad

dull copper
#

technically this branch is for 9.0

#

so it's meant for 2020.2

#

I'm testing it on 2020.1.0b1

#

also they will definitely backport these samples for 8.0 too

#

so I dunno if this is related to the crashing or if the editor version we got is simple not new enough for required functionality

warped trail
#

how can i get URP_9_0_0_OR_NEWER? ๐Ÿง ๐Ÿ˜…

dull copper
#

?

opaque ledge
#

lol i thought the same thing ๐Ÿ˜„

dull copper
#

that branch I linked is URP 9.0

#

wip for it but still

#

also HDRP 9.0

opaque ledge
#

what does wip stand for

dull copper
#

meaning, it's not released yet

warped trail
#

work in progress

dull copper
#

basically this is a work on progress branch that hasn't even been merged to SRP master yet

opaque ledge
#

ah cool

dull copper
#

so... don't expect it to be functional and you're good

#

only reason to check it now is to do early testing & see how they setup this here

zenith wyvern
#

Seems weird for them to release it if the URP stuff isn't even ready

warped trail
#

it works ok in HDRP?

zenith wyvern
#

Maybe it was an accident

dull copper
#

basically, we'd officially need a new 8.x release for URP and HDRP so that this new hybrid renderer v2 would be officially functional

#

@warped trail still trying to figure this out, I'm testing HDRP samples here

#

hmmm, they probably still are going to release separate HybridHDRPSamples & HybridURPSamples somewhere

#

I don't think they refer to these SRP testprojects with them

#

as these are more like meant for internal testing (but can be often handy when trying to figure out how to use some feats)

warped trail
#

this is very cruel joke๐Ÿ˜ญ

flat talon
#

Hybrid V2 needs 2020.1 beta 3 and HDRP/URP 9.0 preview

dull copper
#

it was on hybrid package itself?

#

that would explain it

#

I'm testing on HDRP 9.0 with hybrid changes here

#

but this is definitely not fully functional on beta 1 ๐Ÿ˜„

flat talon
#

its not, I have that confirmed from a source ๐Ÿ™‚ I was very exited too to test it out.

dull copper
#

at least, I don't think that is supposed to happen

flat talon
#

hmm "Sample projects are using Hybrid Renderer V2 and require Unity 2020.1.a025 or later and SRP 9.0.0-preview package." in the released docs.. I'm not sure if that is true or not

#

I was told it needed beta 3

dull copper
#

beta 3 sounds logical to me

flat talon
#

btw did you read the hybrid V2 docs yet? the feature sure is quite nice ๐Ÿ˜„

dull copper
#

not yet

flat talon
#

New features in 2020.1 + hybrid.renderer 0.3.6:

  • Official URP support (minimal feature set)
  • Support for non-ShaderGraph shaders
  • Motion blur (motion vectors)
  • Temporal antialiasing (motion vectors)
  • RenderLayer (layered lighting)
  • TransformParams (correct lighting for inverse scale)
  • Hybrid Entities: Subscene support for Light, Camera and other managed components
#
  • more ๐Ÿ™‚ material overrides etc
loud matrix
#

Is it me or does no one seem to use ECS without converting game objects to entities? I'm trying to find examples and look into loading models and setting up physics with pure ECS but damned if I can find much.

dull copper
#

yeah, I knew about the movecs

#

I'm personally more interested on what all "full" HDRP featureset really includes

flat talon
#

@loud matrix Most people have moved away from that workflow yes. Convert prefabs to "prefab entitites" and then instantiate as needed

dull copper
#

because I'm still super skeptical that this would work with say, HDRP DXR

flat talon
#

Once this is out Im sure they will quickly add more support as needed

dull copper
#

btw, the test projects only had this on player settings: ENABLE_HYBRID_RENDERER_V2

loud matrix
#

@flat talon Moved away from pure ECS you mean?

flat talon
#

yep you still need that

dull copper
#

well, I'm not really as hopeful

vagrant surge
#

@loud matrix mostly because unity decided adding real editor support is too hard/costly

dull copper
#

quickly can mean anything for yet another year or even multiple years

vagrant surge
#

so the conversion hack/workaround is the official thing

flat talon
#

@loud matrix Yes, there wont really be a "pure ECS" for some years. All authoring will be via gameobjects, but they are converted so if you use a subscene no gameobjects are ever instantiated

dull copper
#

I wasn't born yesterday and have seen how certain things take their time with Unity ๐Ÿ˜„

vagrant surge
#

lets see next week, unreal gdc streams, with the rumors for unreal engine ecs

#

and btw, with editor support XD

dull copper
#

that will be interesting

flat talon
#

oh boy that would be great ๐Ÿ™‚ but Im skeptical, Im not sure Sweeney was buying into DoD

pliant pike
#

its a whole paradigm change so I would hope it wouldn't be rushed

vagrant surge
#

epic engineers contacted me and another guys a year ago about ecs stuff

zenith wyvern
#

I doubt I would use Unreal still, it's just too massive for hobbyists imo

flat talon
#

the whole actor->subactor and actorcomponent setup in UE4.. yeah, Im not a fan ๐Ÿ˜›

vagrant surge
#

its shit

#

its basically a flawed concept

#

it automatically makes games create hypermonolythic character/game classes

flat talon
#

totally agree. And it gets even worse when you have to deal with network replication.

vagrant surge
#

gears of war character.cpp is 50k lines

dull copper
#

well the main issue it is the bloat and overhead

vagrant surge
#

oh it actually works crazy well with networking

dull copper
#

framework itself is quite nice

vagrant surge
#

its just how much it bloats and overheads

zenith wyvern
#

Hell yeah dude, 90s style

flat talon
#

vblanco with networking actor instantiation order becomes a big issue, and it you use "sub actors" that quickly becomes a nightmare mesh of missing references ๐Ÿ˜ฆ at least last when I did work there around 2.5 years ago

vagrant surge
#

its workable

#

the real issue is the separation beetween actors, scene components, and actor components

flat talon
#

sure, I shipped a game with it.. but it was shaky AF, and hard to maintain and debug

vagrant surge
#

ive generally seen much worse being done with unity

#

due to it being "more freeform"

flat talon
#

lol, yes ๐Ÿ™‚ definitely

vagrant surge
#

so its also more freeform to hang yourself

#

which is what ive seen everyone doing

flat talon
#

If you give a person a rope...

vagrant surge
#

on unreal it breeds bloated character.cpp type stuff, but the "structure" of projects is a lot more standarized

flat talon
#

oh totally ๐Ÿ™‚ we prototyped EVE Valkyrie in Unity and then migrated to Unreal. Structure was a lot better after that

vagrant surge
#

kinda the point of ECS itself is how easy it is to "architect"

#

have you checked the samples?

#

the new tiny ones

#

they are all super easy to understand

flat talon
#

not recently no, was kinda waiting on the next release with 2d support.. but it seems that is out now

zenith wyvern
#

I would wait still. They are very close to a major update to make it compatible with the latest entities version.

#

It seems like they just backported the 2d stuff into .22 to let people mess with it until .23 is ready

vagrant surge
#

the tiny samples are actually the best way to undestand ecs

#

its the best samples unity has atm for dots

flat talon
#

yeah I love what I've seen with Tiny so far, its the most "pure ECS" so far. I really want to make a simple game with it to learn, a simple shmup or something

vagrant surge
#

TPS shooter is a huge lmao

#

but the tiny samples are pretty great

zenith wyvern
#

It seems awesome, the problem is just getting your project set up correctly right now is horrible

#

Very arcane

vagrant surge
#

and its beyond fragile

#

and doesnt work well with play-in-editor

flat talon
#

how so Sark? Just not in line with latest Entities packages?

fallow mason
#

yup^

north bay
#

Yea the FPS sample was so hacky

vagrant surge
#

@flat talon look in the forums

zenith wyvern
#

how so Sark? Just not in line with latest Entities packages?
@flat talon
That and you need to manually set up very specific settings in the "BuildSettings" asset and make sure you import the correct versions of packages (ie not the latest versions), or import their custom made example project. Otherwise everything just fails miserably.

vagrant surge
#

its bad enough that the tiny guys say that the best way to create a new tiny project is to copy one of the samples and just customize it

fallow mason
#

never update a package in a tiny project...just don't do it

dull copper
#

@vagrant surge they did come up with template for it

#

it's pinned on this channel too

#

well, for 2D anyway

flat talon
#

I so look forward to Entities 1.0 shipping and getting some stability. The current DOTS Animation package is also throwing warnings with latest 0.8 Entities package

stiff skiff
#

A quick question on the 0.8.0 release notes, * Added missing dynamic component has API: ArchetypeChunk.Has(ArchetypeChunkComponentTypeDynamic). Are these dynamic components a special concept? Or does this just mean components added to an entity post-creation?

zenith wyvern
#

They said the next Tiny version will be compatible with 0.8. Along with runtime dynamic mesh support I will finally be taking a serious look at Tiny then

vagrant surge
#

personally i think tiny should be more compatible with "not tiny"

#

you should be able to run tiny projects on the desktop runtimes

#

with proper play-in-editor working well and similar stuff

zenith wyvern
#

You can build Tiny as standalone, or is that not what you mean?

dull copper
#

@opaque ledge btw you can use "md" (markdown) formatting for those changelog quotes, if you use "cs" etc, it'll highlight those programming keywords ๐Ÿ™‚

vagrant surge
#

@zenith wyvern i mean about having tiny essentially work the same as "desktop" ecs stuff

#

not about standalone build, but about full editor support and the likes, or using tiny with extra non-tiny stuff for "normal" games

#

basically have tiny as the "pure 2d" mode of ecs

sour ravine
#

@stiff skiff basically 'kind of component you get from a variable'

zenith wyvern
#

I would like to be able to make 3d games using Tiny though

#

Which they are supporting

mint iron
#

@stiff skiff Those ArchetypeChunkType/Buffer etc structures are 99% about capturing the TypeIndex from TypeManager before it goes into burst context. I have been changing the component type dynamically in jobs by just putting any appropriate value of T (to get the other values populated, global version etc) then switching the TypeIndex undernearth inside the job. So i believe this Dynamic version is supposed to be that scenario, for people who just want to be able to specify the index/behavior themselves.

#
// Unity.Entities.ComponentSystemBase
public ArchetypeChunkComponentTypeDynamic GetArchetypeChunkComponentTypeDynamic(ComponentType componentType)
{
    AddReaderWriter(componentType);
    return EntityManager.GetArchetypeChunkComponentTypeDynamic(componentType);
}

// Unity.Entities.EntityManager
public unsafe ArchetypeChunkComponentTypeDynamic GetArchetypeChunkComponentTypeDynamic(ComponentType componentType)
{
    return new ArchetypeChunkComponentTypeDynamic(componentType, SafetyHandles->GetSafetyHandle(componentType.TypeIndex, componentType.AccessModeType == ComponentType.AccessMode.ReadOnly), GlobalSystemVersion);
}
loud matrix
#

Ok so i have a "how the hell should i do this" question.
I'm building a basic space sim game, Player controls a ship, there will be many NPC ships each deciding what they wanna do based on a simple utility AI, space stations to dock at and trade with, players and NPCs can make more stations. So I'm gonna end up with a database of locations and ships that will need to be spun up into entities. In my head I'm thinking the best way to do this and enable things like game saves and multiple scenarios easily would be to have a JSON file or similar that just keeps track of their data, position, rotation, current action etc. And on game load read all this in and create my entities of the required type and feed that data in. Which I can do easily enough. But I can't think of a good way to manage loading in the models and physics for this. Would I be best off doing something like creating prefabs and then creating game objects that I then puppet from the entities?

stiff skiff
#

@sour ravine @mint iron Thanks, clarifies things

coarse turtle
#

@mint iron interesting that answers my question about those missing apis

stiff skiff
#

I'm still on 0.1.0, so trying to keep up with all the changes from the logs has been interesting

sour ravine
#

I'm not sure what you'd actually use that for in a serious game

#

debugging aids, maybe

safe lintel
#

i guess the latest update always adds a companion gameobject for the camera?

dull copper
#

hmmmm

#

I tried enabling that hybrid v2 on my dots proto project

#

it does seems to work there

flat talon
#

ah good call, I forgot to test the camera in subscene. It should use a "hybrid entity" now

dull copper
#

at least it says it's enabled and it renders HDRP properly

flat talon
#

same with lights

mint iron
#

@sour ravine its relevant to the package im currently working, creates events from the new InputSystem, so you can create a mapping of InputAction to Component and then they show up as events in ECS. So all the all the creation of the entities, components and setting the data has to be done in a generic form without knowing the type.

dull copper
#

I'm testing this on latest SRP master

warped trail
#

can i add 9.0+ urp from manifest.json?

flat talon
#

subscene lights seem to be working now

#

@warped trail no the package isnt out yet. I believe @dull copper is grabbing the source from Github

warped trail
#

๐Ÿ˜‘

dull copper
#

@warped trail yeah I'm using this from github SRP

#

well, DX11 HDRP did render on hybrid v2

#

when I enabled DX12, converted meshes turned invisible

flat talon
#

did you try the sample scenes yet? or any of the features that weren't supported before

dull copper
#

I don't think the official samples are even out

#

I did test the testprojects for these tho

#

and those were bit wonky

flat talon
#

yeah samples arent out

opaque pilot
flat talon
#

@opaque pilot if the query returns 0 entities it skips the update

dull copper
#

I'm frankly bit bummed about that DX12

opaque pilot
#

The entire update @flat talon ?

#

Oh wow

flat talon
#

yes on that system

#

if you leave the update empty or without the lambda it runs as before

#

there is also an attribute and I believe a method you can override to override the default behavior of this

#

look at the SystemBase docs

opaque pilot
#

Thanks, that explains a lot

coarse turtle
#

@mint iron that sounds like something I might want to use - is there a repo I can follow?

mint iron
fallow mason
#

what happens when I do CreateEntity(MyGameArchetypes.PlayerArchetype) from a system that is not in the default world?
@worldly pulsar I don't know. I was trying to create my own world to test, but was unable to figure that out. My guess is that it would not work as I believe I've heard that cross-talk between worlds can't happen. So, sure, you want to make certain you're creating the archetype in and from the same world. Not necessarily a condemnation IMO, but a caveat ๐Ÿคทโ€โ™‚๏ธ

#

speaking of, has anyone created their own world yet?

worldly pulsar
#

I was only referring to the usage of World.DefaultGameObjectSomethingSomething, so something like
static EntityArchetype MakePlayerArchetype(EntityManager em) => em.CreateArchetype(/*components*/)
is perfectly fine if you want a common place to have the player components list in code

fallow mason
#

yeah, that would absolutely work

worldly pulsar
#

I tend to put this kind of stuff in a project-specific system base class, but I have very few archetypes I create from code and need in multiple places, usually only one system is interested in creating entities of a specific archetype

fallow mason
#

referencing the default world in the static property was silly

#

you're right, just pass in the entity manager you want to use and it will work ๐Ÿคฆโ€โ™‚๏ธ

opaque ledge
#

@dull copper thanks^^

opaque pilot
#

is there a way to find an entity or do an entity query in a monobehaviour to update things like UI?

zenith wyvern
#

World.DefaultGameObjectInjectionWorld.EntityManager.CreateEntityQuery

opaque pilot
#

Ta!

fallow mason
#
using Unity.Entities;
using Unity.Transforms;

public static class MyGameArchetypes
{

    public static EntityArchetype PlayerArchetype(EntityManager em) => em.CreateArchetype(new ComponentType[] {
        typeof(Translation),
        typeof(Rotation),
        typeof(Player)
    });

    public static EntityArchetype EnemyArchetype(EntityManager em) => em.CreateArchetype(new ComponentType[] {
        typeof(Translation),
        typeof(Rotation),
        typeof(Enemy)
    });

}```
#
using Unity.Entities;

public class EntitySpawnerSystem : SystemBase
{

    protected override void OnCreate()
    {
        EntityManager.CreateEntity(MyGameArchetypes.PlayerArchetype(EntityManager));
        for(int i = 0; i < 50; i++)
        {
            EntityManager.CreateEntity(MyGameArchetypes.EnemyArchetype(EntityManager));
        }
    }

    protected override void OnUpdate() { }

}```
#

There, now they'll create the archetype in the world the spawner runs in for sure

safe lintel
#

man this camera change for the latest release is pretty frustrating, gotta love undocumented changes

opaque ledge
#

what is the change ๐Ÿ‘€

safe lintel
#

a companion gameobject camera is made at the very least when using inject on the camera, means there are two cameras in scene, and it defaults to the companion one. it doesnt appear to add a listener if you happen to use destroy instead of inject, and it also doesnt have that postprocessing tickbox enabled by default, and from the api I am unsure if that bool is even accessible

#

ok mini crisis averted by enabling and disabling the camera which I guess sets it back as the main camera, but man just another silly hack on top of everything else..

junior fjord
#

I have my map covered in chunks, each chunk has a different mesh (allthough same material). Should I give each one a rendermesh component (but then each has an own archetype right?) or just use Graphics.draw to draw them?

south falcon
#

HI. I want to disable auto generation of default world while Unity Editor Playing. Where should I put this pieces of code?
#UNITY_DiISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP

south falcon
#

If I do new a world, how can I create those default systems as same as the default world?

dull copper
#

hmmmm, there is some weirdness on this hybrid renderer v2 (which could totally be because we are still missing some native code changes on current beta 1)

#

it drops 2 of my wheel meshes every time and both the visible wheel and the inivisible one have 1:1 same components on entity conversion & runtime, even checkedthe Translation and WorldToLocal being correct on the missing ones

south falcon
#

๐Ÿ˜‚

#

@pallid raven Because your field horizontalMovement is a Vector2

#

Vector2 don't has velocity field. Only x and y

#

maybe it is "playerRigidBody.velocity.y"?

solar spire
#

@pallid raven This is not a #archived-dots question. Please do not cross-post.

pallid raven
#

@pallid raven Because your field horizontalMovement is a Vector2
@south falcon ุฆุงุถู ุณุงุฎุนู…ูŠ ู‡ ูŠุฎ โ€™

#

what should i do*

solar spire
pallid raven
#

oh sorry

south falcon
#

oh sorry
@pallid raven try replace the horizontalMovement to playerRigidBody in the red cycle of the picture above.

pallid raven
#

thx i will try

south falcon
#

IJobForEachWithEntity is going to be removed in feature entities package??

#

Can I use local function inside Entities.Foreach now?

pallid raven
#

@south falcon am sooo thx for you're help forever

south falcon
#

๐Ÿ˜„

fallow mason
#

@south falcon Not at my computer right now, but pretty sure you can do cs Entities.ForEach((Entity entity, ref MyComponent myComponent)=>{...});

south falcon
#

@south falcon Not at my computer right now, but pretty sure you can do cs Entities.ForEach((Entity entity, ref MyComponent myComponent)=>{...});
@fallow mason I just update Entities package to 0.8.0 and get obsolete information. The reason why I use IJobForEachWithEntity is that I can use local function inside IJobForEachWithEntity to organize my code but Entities.forEcah can not.

#

If use Entities.ForEcah, I have to write a ton of code inside it ๐Ÿ™ƒ

fallow mason
#

Ah I see. Can that local function be converted to a function in the system?

#

How large is this local function? ๐Ÿ˜•

south falcon
#

Yes, the local function is the local function inside system.

#

And Dots consider those functions are reference type

#

Then I can't use burst and jobs

fallow mason
#

How were you using in IJobForEach? Same rules for burst and jobs apply there.

south falcon
#

There are about 100s lines of code inside Entities.Foreach if I use that.

#

Yeah, I use IJobForEachWithEntity as same as Entities.Foreach. However struct MyJob : IJobForEachWithEntity, I can use functions inside MyJob

gusty comet
#

hi

south falcon
#

๐Ÿ˜„

gusty comet
#

i have no idea how to code at all

south falcon
#

How were you using in IJobForEach? Same rules for burst and jobs apply there.
@fallow mason Maybe I should try IJobChunk in the feature.

#

instead of IJobForEachWithEntity

worldly pulsar
#

@south falcon why does it need to be a local function instead of a static one?

south falcon
#

@south falcon why does it need to be a local function instead of a static one?
@worldly pulsar get a point๐Ÿค”

#

I have never thought of that

#

maybe give a try๐Ÿ˜

odd cipher
#

@zenith wyvern So, I started changing my Tiles to structs but having this problem currently Tile used in native collection is not blittable, not primitive, or contains a type tagged as NativeContainer

low tangle
#

lets see next week, unreal gdc streams, with the rumors for unreal engine ecs
@vagrant surge
I love that I went to check into unreal engine ecs and your posts come right up

#

intresting work

#

really hope they go all in and make a framework like unity's

safe lintel
#

battle of the ecs systems ๐Ÿ‘€

low tangle
#

unity ecs is solid

#

I'd love for unreal to remove all the actor crap that was a nightmare to deal with

odd cipher
#

its good if you get it working, converting my scripts to work with Burst has been hell

low tangle
#

I spent more time learning the Unreal wayโ„ข๏ธ than actually writing the game

odd cipher
#

and its not even working yet so

low tangle
#

I've already shipped my game fully on unity ecs

#

it was fully worth it for a sandbox game

odd cipher
#

my game is pretty much sandbox so I'm trying to get all the performance I can get but getting Burst to work is hell for me

low tangle
#

you need to write things how ecs was intended to write

#

jobs, systems, value structs only

odd cipher
#

value structs is the worst part for me

#

since ive been only using classes

safe lintel
#

kinda wondering june how many ijobforeach's your game uses(with it being deprecated now)

low tangle
#

~180

safe lintel
#

im about half that, maybe its for the best and I cant see it for now but I like ijobforeach ๐Ÿ˜ฆ

low tangle
#

I've still got some componentsystem's I need to update

#

the gc from them is disgusting

odd cipher
#

christ, I've only used one IJobParallelFor and I'm having issues :p

safe lintel
#

well Ijobparallelfor is a different beast ๐Ÿ™‚

low tangle
#

well I think in your case you need to split what your doing and what you need to be doing more

#

jobs lend well to being small little operations

odd cipher
#

yeah, currently I've managed to reduce my world generation loop from 200ms to 70ms so it has been a worth-while time spent but I wish I could use Burst

low tangle
#

well you have to sort our whats just dealing with data

#

and whats dealing with unity apis

#

like meshes, sprites, audioclips

odd cipher
#

yeah I do kind of have that going, such as a class for Tile, Terrain Types, Building Types etc but they are classes and not structs, if I want to change them to structs I have to rewrite a lot

low tangle
#

well your gonna have to write code for this

#

your writing the equivalent of how it worked before, but in a data focused way

#

usually when refactoring I write in place next to it

#

then delete the old one after done

odd cipher
#

I suppose I just don't know if it's worth the hassle

low tangle
#

is that 70ms killing the fun?

#

is it making your game a worse product?

#

does it matter?

worldly pulsar
#

@low tangle FWIW I'd love to see a blog post or two on practical gameplay problems/solutions from people with shipped games in Unity ECS.
e.g. a few weeks ago I stumbled upon this problem description: https://takinginitiative.wordpress.com/2019/11/09/more-ecs-questions/
and I'm still not sure how I'd approach it with Unity implementation

low tangle
#

for me the first part that was hard to get used to

#

is the data is the gameplay logic you want to happen

#

its not objects

#

3 is far too low

#

expect more like 20+ in a real world case

odd cipher
#

Yeah.. I mean I do want to optimize that 70ms but I still have a lot to learn about how structs and reference / value types work.

low tangle
#

alright think I figured out what they are asking

worldly pulsar
#

well, he has 3 transforms he cares about in that example. It's more the system dependencies I'm having a problem with (turret rotation system needs the transform system to get the chassis l2w, but then it also sets turret rotation which should be applied to its l2w before the secondary turret rotation system runs)

low tangle
#

so the reason this is a pain, is because of jobs / async logic

#

so if you forget job systems, just main thread component systems

#

you simply need a order of operations, potentially calling the targeting system twice

#

once to get the base turret into the right location
then again to update the secondary turret to the correct location

worldly pulsar
#

I think you'd need both targetting and transform systems to run twice

low tangle
#

well yeah, if your targets need to actually update the transforms?

#

you don't though, the targeting system can just be creating the ray in it

#

the transform system can just apply the final data afterwards in one pass

worldly pulsar
#

no, I mean the rotation of the main turret changes the position of the secondary turret

low tangle
#

yeah right

#

I'm just saying you can make them calculate the actual matrix offset you need in this case

#

which can be derived from a editor created initial offset / socket on the start mesh, but thats just inital data which is easy to author

#

by handling the matrix yourself you end up ending the need on running a system twice
so your update order only needs to be
[targeting, targeting, transforms, ik]

worldly pulsar
#

so the first targetting writes directly to l2w (or the second reads parent position/rotation), essentially duplicating transform system logic?

low tangle
#

just the minimal amount of logic you need to produce the matrix

#

transform system does a lot of compound extra math that you dont need

#

you really don't want your visual meshes driving the rest of your gameplay anyways is what I'm trying to get at

#

your targeting doesn't need to deal with the real mesh, ik at all

#

its discrete logic that should only depend on the physics / movement position

#

ah, so another thing that could help, you can run though all turrets and figure out how many turrets on turrets you have, to get the max depth, so you know how many times you need to run the targeting system to make sure all are corrected

pliant pike
#

yeah I was just thinking why does the second turret need to be dependant on the first

low tangle
#

its mounted on top of the other one

pliant pike
#

on the real thing they would probably be on separate gimbals anyway surely

low tangle
#

sure, but the positional offset would still be there

worldly pulsar
#

Meshes stay out of it of course, it's the "put the transformation system parent-child logic into the targetting system" that still feels icky to me ๐Ÿ™‚
(I had a somewhat similar problem where I had to do steps A,B,C on one entity and those steps produced more entities to run A, B, C on... a pain to express in the job system)

low tangle
#

logic chaining was a pain at first yeah

#

I dont mean the whole parent child logic

#

I mean, what does a targeting system need?

#

base position of the turret, its pivot for the barrel, then the target float3

#

the base position your rotating is just a offset from the tank base platform l2w

#

so you just copy that over, or access it though a getcomponentfromentity

#

just details, then you correct your pivot, then create the ray from the point to point, with a up vector from the l2w

pliant pike
#

personally I would just treat them as separate and make it look like they are connected

low tangle
#

the only thing you have to do is multiple runs of the target system based on turret on turret depth, which is really nothing

#

this system would take nothing to run with burst

#

how many tanks have more than one turret on one turret

pliant pike
#

yeah that's just bad design in general

low tangle
#

how so?

#

simple problem, simple solution

worldly pulsar
#

more than one turret no, but then you have the tank moving, which writes to Translation/Rotation

low tangle
#

right, which you update your targeting passes after transforms move

worldly pulsar
#

so the targetting system for the first turret needs to already take that into account

low tangle
#

update transforms+physics, then update targeting, update targeting, ik pass, visual mesh update

pliant pike
#

the upper turret would have to nifty targetting systems no human could likely use if its at the end of turret pivot

low tangle
#

talking about the mg at the top

#

which in a tank game would probably be aiming at the same target as the main gun, within turret rotation limits

worldly pulsar
#

So systems that run are:
MoveTank (updates chassis Trans/Rot)
Transform
Targetting1 (reads chassis l2w, writes to Main Turret l2w)
Targetting2 (reads MainTurret l2w, writes to Child Turret l2w)
?

pliant pike
#

the upper turret would be moving in a circular rotation when the main turret is moving

#

that would surely make it difficult to aim

worldly pulsar
pliant pike
#

that looks as if its in the center of the turret though

worldly pulsar
#

there is another one behind it, at an offset

low tangle
#
[Turret, Targeting]
[Turret, Targeting, Parent]
[TurretStackMax]

(MoveTank)
(Transform+Physics)
(UpdateMaxStack)

0-TurretStackMax
    (UpdateTargeting)
    (UpdateTargeting)

//Can now be assumed all [Turret, Targeting] are pointing at the right location
(UpdateVisualMeshes) - writes out the modified transforms which is just a quaterion from the targeting system

#

if you know that there will only every be up to n stacks, just hard code a constant

worldly pulsar
#

And (UpdateTargeting) have to operate directly on LocalToWorld, since there will be no Transform system run after this, correct?

low tangle
#

update on the targeting which has the vectors / matrix / whatever you need in it

#

then have a system that runs after all update targeting

#

that writes the actual final L2W out

#

that way you can avoid running 1:1 extra passes you dont need

#

thats what (UpdateVisualMeshes) does

#

this whole update loop doesn't directly depend on each other, if you take any out, the rest work fine, except that the data ends up stale

#

oh I missed one system after the transform system

#

one that updates the data on the bottom turrets

#

just passes in the L2W to the [Targeting]

#

that way you have the updated base location

#

now that I'm thinking on it, I think theres some transform system stuff to utilize their DAG

worldly pulsar
#

Ok, feels like solid design for this situation
I was looking too hard for a solution where targetting systems only wrote to their translation/rotation and then let the Transform system somehow position everything correctly

low tangle
#

I think there is actually a transform system thing for that

#

writegroups

#

need to fully think though it, but I think you could use these to create a align pass transform

#

hm dont think so actually

worldly pulsar
#

Hmm, only use I can see is to tell the transform system to skip turrets because we write their l2w ourselves

fallow mason
#

i use writegroups to apply custom 2D translation and rotation components to the LTW

#

completely cuts built-in out of the picture if they are present on an entity

low tangle
#

yeah I pulled it up to read but I dont think it would work, I think in a tank game you should just solve tank logic yourself anyways

#

turrets have complex logic anyways

worldly pulsar
#

thanks a lot for the talk, gave me something to think about ๐Ÿ˜‰

onyx mist
#

did unity's rendering package change by a lot since 3 months ago? the changelog just says they updated dependencies. the work i had before that displayed hexes now just displays a black screen after i updated and idk how to begin to figure out why

odd cipher
#

so what does this mean? Tile used in NativeArray<Tile> must be unmanaged (contain no managed types) and cannot itself be a native container type.

odd cipher
#

ah so my tiles cant contain any strings?

sour ravine
#

yes, like I mentioned yesterday strings are instant deal killers for Burst

odd cipher
#

I'm just not gonna use Burst

low tangle
#

you can use fixedstrings

odd cipher
#

nah, I just wont bother with Burst

odd cipher
#

I would use it but I just find changing all my data classes into structs really annoying, and some parts I don't even know how to make work with Burst.

zenith wyvern
#

Well there's no shortcuts for the first part. If you want the cpu to go fast you need to structure your data properly. What is it you can't figure out how to make work with Burst?

odd cipher
#

Well, I figured out how to make my Tile a struct but a Tile also knows what World it is in, therefore I'd need to change the World to a struct, which doesn't work because how the World class works it cant be made a struct

zenith wyvern
#

Why would a tile need a reference to the world it's in?

odd cipher
#

for a function that checks its neighbor, which has to access the world's tiles array

#

I guess I could move that to the world itself instead of a tile

zenith wyvern
#

You presumably have the tiles array inside the job. Whatever's accessing neighbours can do it with the array rather than going through the tile

odd cipher
#

i think I'll move it to the world class itself and get rid of the world reference in the tile. that'll do

low tangle
#

smells like oop classes in classes

opaque ledge
#

it can be very hard to transition from OOP to DOD/ECS

odd cipher
#

how would you create a 2 dimensional array to be passed in job?

#

and yeah, its very hard but I'm trying :P

opaque ledge
#

one of the things you could do is have a DynamicBuffer of a struct that has owner tile field and neigbour tile field, and you can inherit from System.IEquatable<Tile> so you can have a dictionary like access to DyanmicBuffer. when you read from this DynamicBuffer you can do Dynamicbuffer.AsNativeArray, and then do IndexOf(ownerTile) to get the tile's neighbours.

odd cipher
#

actually nevermind (I think) I found some calculation to get it from a 1D array

#

so, what should I use instead of a string?

opaque ledge
#

FixedString if you want to put into a component

odd cipher
#

I dont use the component system

opaque ledge
#

then use normal string

low tangle
#

make a dictionary of int, string

#

hash all your possible strings

#

then in the job just use ints

odd cipher
#

wait so, can I use strings or not

low tangle
#

if you want to burst compile it no

#

I promise you, you dont need strings

zenith wyvern
#

If you mean for the key for your NativeHashMap just use an int or an enum

#

You can define your tile types in a static class like

public static class TileTypes
{
  public const int Dirt = 0;
  public const int Grass = 1;
  // etc
}

Gives you nice code completion and makes it readable

#

And since they're const they can be used anywhere

odd cipher
#

well each of my "TerrainTypes" have names

#

as string

zenith wyvern
#

In the code I just posted I'm pretty sure "Dirt" and "Grass" are names

opaque ledge
#

are you using this strings to identifty tile type or to show in UI ?

zenith wyvern
#

What's the difference to you between tilemap["Dirt"] and tileMap[TileTypes.Dirt]

#

The point is you want to use Burst. You need to give up on the idea of reference types and classes. Forget them, you don't need em, don't know em, never heard of em

odd cipher
#

@opaque ledge UI

opaque ledge
#

does this string change in runtime ?

zenith wyvern
#

You can use nameof(Variable) to convert a compile time constant to a string when needed

lusty otter
#

If it doesn't change then there's no point in having them as strings, just have them as ints and map the ints to strings when you display them in UI.

odd cipher
#

it does change

lusty otter
#

How does it change?

#

If it's just changing from one type to another, that's still a finite list of them and you can do the mapping as usual.

odd cipher
#

because the game is moddable

zenith wyvern
#

I'm pretty sure we already covered this. It doesn't matter how you represent it outside the job. Inside the job you can't use strings, period.

low tangle
#

you still just hash them to id's up front

zenith wyvern
#

Regardless of what the are outside the job, you need to convert them to a Burst-friendly format.

odd cipher
#

@zenith wyvern it does matter because a Tile has a Terrain Type and a Terrain Type cant contain a string because its used in a job

zenith wyvern
#

What is the job accessing inside the tile

lusty otter
#

I still don't see why you can't solve it by storing it internally as an int, and map the int to some display string when you need it for UI.

#

Even if it's moddable, the mod adds a "new tile", you just add "new tile" to your mapping and give it a new number, then internally represent "new tile" with that number.

low tangle
#

if you post the part of the code thats using strings, chunk of generation whatever is causing you trouble I'll rewrite it

lusty otter
#

It's not just about Burst, when you store a piece of information why store it as a string if you can store it as an int.

zenith wyvern
#

You seem to be way too caught up on this string thing, if you want help you need to better explain exactly why you need strings in your tiles. We've offered you plenty of alternative ways to represent your data

odd cipher
#

Yeah.. another problem is that the name of sprites for the terrain is also a string and not an int

#

but thats also because each terrain type has multiple sprites for different positions such as N, S, E, W and so on

opaque ledge
#

what is your job doing exactly ?

odd cipher
#

selecting the correct sprite based on the tiles current position. Though to do that it accesses a dictionary with the key being a s t r i n g which is a problem of course

opaque ledge
#

how do you represent tile's current position

odd cipher
#

x and y ints

opaque ledge
#

so how do you get the string that you use as a key to get correct sprite ?

odd cipher
#

with the terrain types name plus the string it came up with : for example "Dirt_SGLE_N"

opaque ledge
#

how do you assign that "Dirt_SGLE_N" to a tile ?

odd cipher
#

it doesnt; its just the rendering

zenith wyvern
#

So your dictionary values are tiles and your tiles contain all the variants?

lusty otter
zenith wyvern
#

Or every variant is a single tile in the dictionary?

odd cipher
#

the dictionary has a key which is the name + variant and then the value is the Color32[] array

zenith wyvern
#

What does SGLE mean?

odd cipher
#

just short of single

zenith wyvern
#

Meaning a tile with variants would have a larger array?

odd cipher
#

so like; if the top and both sides were a different terrain type and bottom wasnt a different terrain type then it would be a SGLE_N

zenith wyvern
#

I still don't understand what the "single" means in this context. Like a single side?

odd cipher
#

I just couldnt find a better term for it

zenith wyvern
#

I'm not trying to nitpick the name, just trying to understand how you're representing the data

odd cipher
#

ill just draw something real quick lol

#

so if the top and the sides are different types and the bottom is the same type then it would be a SGLE_N, theres probably a way better way to do this that you probably already know

zenith wyvern
#

I think you would normally use a bitmask

opaque ledge
#

So you do a bunch of if logics and based on that you create an access string and access your dictionary's key's values ?

odd cipher
#

@opaque ledge pretty much yes.

#

but I need to get rid of using strings

opaque ledge
#

So what i am trying to understand is, how do you know the type of the tiles around ?

zenith wyvern
#

Read this. Not gonna lie it's a bit complicated, especially if you're not great with math. But it's exactly what you want

#

It massively simplifies this exact problem

#

This is basically the "correct" way to do what you're trying to do

odd cipher
#

Alright, Ill take a look

opaque ledge
#

Anyway, general idea on how to handle strings in your data inside a job is mapping an int value(this could be Enum or Guid etc.) to a string, and instead storing string to your data, you store the int

#

also what June said is very important, you probably dont even need to handle strings in your job since they are generally used for UI

odd cipher
#

yeah thats my end goal to be honest

#

also, completely unrelated; what would be the math for getting value in a 1D array with 2D values (x, y)?

zenith wyvern
#

Google

#

Also I need to pass out soon but - once again the goal is to get your data in an array. Dictionaries are usually not needed, and definitely not needed in this case. In your case there are at most 16 variants. If you combine that with the code I posted above where you assign each of your tile types to an int, you can get the index of any variant by TileTypeIndex * 16 + variantIndex
That will make more sense once you read the article.

warped trail
#

@odd cipher cs i = x + y * max_x + z * max_x * max_y; x = i % max_x y = ( i / max_x ) % max_y z = i / ( max_x * max_y )i use this for 3D to 1D๐Ÿค”

odd cipher
#

Thank you Sark! This will work good (I think :P), Only problem is my lack of Math skills! :D

zenith wyvern
#

The article does a good job of explaining it step by step, just keep re-reading it until you get it. I believe in you!

odd cipher
#

@zenith wyvern I'm thinking of using an int2 for this, the X of the int2 would be the terrain type ID and Y would be the all the stuff from that link

#

so all possible directions

#

actually not sure that would work

#

dont know really

odd cipher
#

still not really sure :P

opaque ledge
#

๐Ÿ˜„

odd cipher
#

It's a little werid because you cant just set an int to 0000 or something like that

#

i guess it could be bools but not sure on that either

vagrant surge
#

@low tangle on that whole targetting thing, it smells to me of huge over-engineering

#

this thing is solved by mainBody->GetTargetPoint()->direction and you do a ray there. So... you can try to do the same on entities

#

make sure that the transforms of the target point are updated (is it possible to tell unity ecs to update transforms in one place?) and then just access the target point and do your raycast

low tangle
#

he was asking for a ECS only way of doing it

#

only though systems

#

I would just do it linear if I was in a hurry and not worry about it yeah

runic spire
#

Is this a place to ask about Unity Jobs system as well?

bright sentinel
#

@runic spire I'd say yes, people here are probably most experienced with it

runic spire
#

Alright, I'll move my post over

#

A little confused... I'm very new to the Unity Jobs system and it seems as though my IJobParallelFor is only running on the main thread in the profiler?
All workers are idle

#

I'm running the job with ```
JobHandle jobHandle = moveCalcJob.Schedule(GameData.starlets.Count, 100);

jobHandle.Complete();```
in Update()

meager pivot
#

Doesn't doing jobHandle.Completemake the main thread wait for the job to complete?

bright sentinel
#

Yes

#

You have to let Unity'

#

Unity's internal system complete the job

#

And then next frame (or at the end of the frame) read the output of the job

runic spire
#

wouldn't .Complete() be the same speed as checking at the end of frame? I mean... I really have no clue what I'm doing with this

#

In terms of how Unity handles everything

#

What are other methods of running the paralleljob without waiting for it to complete?

vagrant surge
#

@runic spire its about blocking execution or not

#

with a job system you want to avoid any sort of sync point. specially a main-thread sync point, so its better if you can do a lot of jobs and just check them next frame

runic spire
#

That makes sense, I just am at a loss because I don't know how to use the jobs in that way

#

I guess I'll keep looking for documentation

bright sentinel
#

@runic spire The thing is that you can schedule the job at the start of the frame, and then complete it at the end. It might have completed meantime, but you have to call complete on it before you use the contents

#

Does that make sense?

runic spire
#

That makes sense

bright sentinel
#

The job system will automatically execute the job when there are resources available, unless you call Complete on it, in which case it will complete it immediately if not already completed

runic spire
#

so you only have the amount of time that the main threat executes to complete the job before the job holds up the main thread?

#

assuming you are Complete()ing on the same frame

bright sentinel
#

Basically yes. But at least you're not executing all that work on the main thread, but split it into the various threads

#

I'm not sure if Unity will also use the main thread if available though

runic spire
#

How can I make sure it starts at the beginning of the frame and and completes at the end of the frame?

#

im only using tempjob allocation

#

for my nativearrays

#

I'm clearly misusing jobs since it is literally slower with my usejobs boolean set to true when comparing speeds

bright sentinel
#

@runic spire You can use script execution order

opaque ledge
#

jobs doesnt make your code run faster tho ๐Ÿค” Compiling with burst does ๐Ÿ˜„

runic spire
#

I do compile with burst

opaque ledge
#

is your job complex ?

#

can i see your code if not

runic spire
#

Decently yes

#

I mean, I probably need to rethink what I want to do with it

#

because it gets exponentially more taxing

opaque ledge
#

are you using any reference types inside your job ?

odd cipher
#

is there any System.Tuple alternative?

opaque ledge
#

yes, a struct ๐Ÿ˜„

runic spire
#

Not using any reference types

odd cipher
#

Blegh of course, those structs ๐Ÿ˜…

opaque ledge
#

it should be insanely fast then

runic spire
#

I'm sure it's something absolutely idiotic that I'm doing because I don't have any idea what I'm doing

opaque ledge
#

i felt the same btw pengweng ๐Ÿ˜„ not being able to use reference types which includes value tuples are kinda annoying, but its something we have to deal with it ๐Ÿ˜„

#

well not sure Danon, no one can guess why this happens if there is no code to inspect ๐Ÿ˜„

runic spire
#

should I make my own struct for all the data? I'm using multiple nativearrays of different types right now

opaque ledge
#

hmm probably not, it shouldnt matter

runic spire
#

like

#

9 native arrays

opaque ledge
#

i dont think it matters

#

Does your job actually moves the tranforms ? (since its named movecalc)

runic spire
#

yes

#

a position gets += a direction * speed * deltatime in it

opaque ledge
#

well, thats where your problem lies then ๐Ÿ˜„

runic spire
#

well I'm not actually accessing the transform

opaque ledge
#

there is a specific job type for manipulation transforms

runic spire
#

I guess I misunderstood

#

I'm editing a float3 and setting the transform equal to it on the main thread

#

once the job is completed

opaque ledge
#

i mean if you are only calculating where transforms should move by manipulating float3s, then there is something going wrong, that shouldnt take 20ms AT ALL.

#

are you sure your burst complition is active ?

runic spire
#

yes, but I realize now that it is probably just my main thread creating the horrible performance

#

although I don't know of a way around it with my goal in mind

#

basically, I have a list of circle objects, and I want to iterate through all objects that are within it's radius

#

I'm using Physics2D.OverlapCircleAll to get that list, but I can't use Physics2D functions inside of a job

#

so I'm stuck doing it on the main thread

#

iterating through all circles and calculating distance would be worse I think, even if I used jobs for that

#

because each circle would have to check every other circle, and more circles keep getting instantiated

#

Would manually calculating the distance with jobs actually increase that performance over Physics2D.OverlapCircleAll on the main thread?

opaque ledge
#

yeah probably, since it will be bursted

#

The thing is i never tried doing jobs in monobehaviours so i am not really experienced but perhaps this example can show you some good pointers

runic spire
#

Ah, that's a good example of how to split the job between update and lateupdate

bright sentinel
#

@runic spire Also, you might want to think about whether you really need all of this to work within a frame, or if you can delay it for a frame. The answer is in most cases that you can actually delay it, as the player will probably not notice it when running 60+ FPS

runic spire
#

Manually calculating the distances on the jobs instead of Physics2D.OverlapCircle massively increased performance. I'll keep working on it with this info

#

you guys were a huge help

#

I'll probably spread it out over frames eventually since the circles move slow, so it would definitely be unnoticeable

#

if I correctly start the jobs at the beginning of the frame, then use lateupdate to read the values it should be much better

odd cipher
#

trying to copy a dictionary to a nativemultihashmap but it seems to copy in the wrong order somehow cs NativeMultiHashMap<int2, Color32> _colorTerrainTiles = new NativeMultiHashMap<int2, Color32>(colorTerrainTiles.Count, Allocator.Persistent); foreach (KeyValuePair<int2, Color32[]> kvp in colorTerrainTiles) { for (int i = 0; i < kvp.Value.Length; i++) { _colorTerrainTiles.Add(kvp.Key, kvp.Value[i]); } }

#

or its the loading part that gives the wrong order ```cs
public Color32[] GetSprite(NativeMultiHashMap<int2, Color32> src, int2 name) {
Color32[] colors = new Color32[terrainSpriteSize * terrainSpriteSize];

        int i = 0;
        bool found = src.TryGetFirstValue(name, out Color32 item, out NativeMultiHashMapIterator<int2> it);
        while (found)
        {
            colors[i] = item;
            found = src.TryGetNextValue(out item, ref it);
            i++;
        }

        return colors;
    }
#

or is there a better way to do this

opaque ledge
#

order of keys is undefined. Pretty much same with Dictionary, they dont preserve order

odd cipher
#

well I mean the order of the color array in the Dictionary

mint iron
#

if you need to ensure a specific order you could have the dictionary provide an index into two arrays

odd cipher
#

I don't know.. it seems that the color array is just upside down

opaque ledge
#

oh hmm ๐Ÿค”

#

i never cared about the order, but maybe it appends to values instead of add as first ?

odd cipher
#

I'm not sure myself on that but in this case yeah, a order on the color array is needed

#

so the sprite isnt flipped :P

#

I need a break by now anyway, I've been trying to refractor my code to work with Burst for the past 15 hours straight so

junior fjord
#

I have my map covered in chunks, each chunk has a different mesh (allthough same material). Should I give each one a rendermesh component (but then each has an own archetype right?) or just use Graphics.draw to draw them?

runic spire
#

Okay, I've gotten to the point where the code that initializes my job's native arrays are slowing down the game. Is there a better way to get pre-existing data from a list without iterating through the entire thing every time?

#

maybe I need to switch to actual dots...

opaque ledge
#

you can allocate with Persistant and fill it and use it on your job everytime

runic spire
#

the only issue is that my amount of objects is dynamic

#

and removing the correct indexes can become tricky...

#

if I used nativelists, that is

opaque ledge
#

well if its changing then you have to create it everytime

runic spire
#

if only I could efficiently access static fields from inside a job

#

I would never have to iterate through my static lists on the main thread

opaque ledge
#

you can capture it locally, tho they need to not to have any reference type

runic spire
#

I wonder if I could create a secondary list of the value type field im trying to get and do that instead

#

although I'm exactly not sure what "capture it locally" means

#

can I directly set a nativearray's data in the initialization?

#

without iterating through and setting each index?

opaque ledge
#

sooo.. is your list changes during runtime ? or is it static ?

runic spire
#

well, it's changing during runtime. I just meant that it has the static keyword (irrelevant to issue)

#

I'm accessing it from another static class

opaque ledge
#

i mean if it changes then you have to create your native array everytime right ? you cant just make single initialization and send it to your job.

runic spire
#

correct, but NativeLists exist, I just don't know how to use them. I don't know how applicable it is in my situation

opaque ledge
#

it doesnt matter i think, you will be still iterating thru your list

#

if you can explain your case maybe people can help better

runic spire
#

I was thinking that I could have a NativeList of float3s, add my positions I want to access to that float3 NativeList, then use that NativeList as a parameter of the new NativeArray constructor by using NativeList.ToArray

#

that way there is no iteration happening

#

although I don't know how those functions work behind the scenes

#

so it might just be the same thing

opaque ledge
#

what are you iterating right now exactly ? You iterate your list to fill your native array/list right ?

runic spire
#

yeah

#

I was just wondering if there was a way to bypass the for loop iteration that fills the native array

#

something like what I described above

opaque ledge
#

yeah but on that example you will be still iterating your list to add values to your native list

#

it doesnt bypass loop iteration

runic spire
#

no, because a NativeList you can just use .Add(new data)

#

and I would use this overloaded constructor for my NativeArrays

#

NativeList has a .ToArray as well, so that's what the array parameter would be

opaque ledge
#

Well i am sorry, i didnt understand your problem, but hope that works out for you

#

also you can use AsNativeArray i think instead of ToNativeArray

runic spire
#

no problem, you helped a lot getting me to this point already

#

Also, I didn't really have a "problem" per se, I was mainly throwing around an idea I had incase somebody already knew it didn't work. It would take quite a bit of refactoring just to try so I was just trying to save some time

zenith wyvern
#

You want to copy a subsection of your array to another array without a for loop, is that right?

runic spire
#

I have an array of instantiated classes, and I want to copy just a certain field from each copy of the class into a new array of just that field's type

#

Right now I'm just doing this

#

readPositions being:

zenith wyvern
#

Yeah I don't think there's a better way to do that without restructuring how you're storing your original data

coarse turtle
runic spire
#

Sadly I also need another field that isn't part of the transform

#

so I'm doing two fields at once, I'm just using the position one as an example

#

public Vector2 targetDir;

#

I also need this from every copy of the class in the list

zenith wyvern
#

Right now you're working with your data in an OOP way. That's fine but it's definitely not going to be burst compatible. Ideally you would have separate flat arrays with your different kinds of source data (position and targetdir). That may or may not be practical for you so if you need to stick with an Array of Objects then what you're doing seems like the right way

junior fjord
#

if you want to edit some properties at runtime, how would you do that (for testing). In vanilla unity I could just edit the script variables on my gameobject. Should I now do the same and then use OnValidate to somehow propagate the properties to some systems or entities?

zenith wyvern
#

I think right now the idea is to use subscenes for tweaking things through the editor

vagrant surge
#

there is a "trick" you can do with this. Do not copy data

bright sentinel
#

@junior fjord You would use livelink with editing mode

vagrant surge
#

leave it on the native arrays, and have getters/setters for it on your monobehavior stuff that just access the nativearray

runic spire
#

It will take a while for me to figure everything out if switching to dots is the best alternative, but I'll explain my situation. I want (hundreds - thousands) of, essentially, boids that have a form of local avoidance on them. I have never worked with dots before this project, but that seems like something dots would be able to handle at high framerate. I just have no idea how monobehaviours interact with entity objects

zenith wyvern
#

Oh interesting, so the MB is like a proxy for the actual data in the native arrays

junior fjord
#

hmm I never used this livelink

zenith wyvern
#

I just have no idea how monobehaviours interact with entity objects They don't, pretty much

junior fjord
#

have no idea what it is ๐Ÿ˜„

runic spire
#

yeah, I'm very used to monobehaviours so I just went this route when trying to implement the job calculation

junior fjord
#

@vagrant surge yeah that is the idea I also had

vagrant surge
#

@zenith wyvern indeed. That is a classic

#

the monobehavior stores its "index" on the arrays

#

and on its getter-setter, it accesses those

zenith wyvern
#

While you're transitioning you might want to just design your system to work directly with your monobehaviours. If you use "convertandinject" on your monobehaviours you can access them directly in systems like

void OnUpdate()
{
  Entities.WithoutBurst().WithAll<SomeTag>().ForEach((Transform t)=>
{
  t.position = wahtever;
}.Run();
}
#

This will give you an idea of how things start to work once you use entities directly

#

Performance will not be great but yeah

runic spire
#

alright, I can also create some dummy projects for learning purposes

#

the small amount of documentation doesn't help though, but it seems fairly straightforward once you get it

zenith wyvern
#

Imo trying to force performance out of MB is not the right approach, better to just use the systems to operate on your MB then go from there

runic spire
#

So an entity cannot have any form of monobehaviour controlling it at all?

zenith wyvern
#

Technically you could, but it would be horrible code and is entirely contrary to how you're meant to do things

runic spire
#

I guess I'm just confused at how an entity relates to a gameobject. Like, in what way can I access any sort of gameobject data like a trailrenderer component (for example)

zenith wyvern
#

You should just treat your monobehaviours as entities until you're comfortable with the workflow, then you can transition to entities

#

If you do the ConvertAndInject like I suggested above all your components on that gameobject get attached to the entity behind the scenes. So you would access your trailrenderer in the same way you access the transform in the code I posted above

runic spire
#

alright, that makes sense

zenith wyvern
#

You pass it as an argument to the lambda

pliant pike
#

Does anyone know if this is the way I normalize a float3 in a job? math.normalize(Bezposvelocity)

#

the output doesn't seem to change

warped trail
#

if your input vector can be very small you better use normilizesafe๐Ÿค”

pliant pike
#

yeah I'll try that thanks, and as usual I'm being an idiot leahYTHO just noticed it returns a value

pliant pike
#

I don't suppose anyone knows why I get this error when trying to schedule a job

#

The previously scheduled job BezeirtestJobComp:<>c__DisplayClass_OnUpdate_LambdaJob0 writes to the NativeArray <>c__DisplayClass_OnUpdate_LambdaJob0.Data._lambdaParameterValueProviders.forParameter_moventy._type

opaque ledge
#

is there more to it ?

pliant pike
#

there's another error Missing Profiler.Endsample

warped trail
#

probably 2 jobs accessing same nativearray and they are not in dependency chain๐Ÿ˜…

opaque ledge
#

or you have to disable protection for parallel thingie, depending on what you are trying to do

zenith wyvern
#

It's a safety system error. Look at which jobs are accessing your component and where

pliant pike
#

yeah I thought it might be something like that but one is only using a readable translation and the other readable rotation

#

they are both reading from a blobasset but that shouldn't be the problem surely

opaque ledge
#

it says you are writing to some NativeArray

zenith wyvern
#

It's telling you what the problem is - the first parameter of your lambda

#

Whatever that component is, you're writing to it somewhere and the safety system can't resolve that dependency for some reason

pliant pike
#

you mean this Entities.WithAll<TestMoveojbectTag>()

#

does that tag have to be readable ๐Ÿค”

zenith wyvern
#

The ForEach, not the tag

#

What arguments are you passing to the ForEach

pliant pike
#

ForEach((ref Translation moventy)

#

just that

opaque ledge
#

are you using JobComponentSystem or SystemBase

pliant pike
#

JobComponentSystem

zenith wyvern
#

Are you properly returning your job handle? Do other systems that access that component do so properly through a query?

opaque ledge
#

are you doing the dependency properly ?

#

can you post your code if its small

pliant pike
#

the code is kind of a mess, theres a ton of commented out code leahYTHO

#

i think it must be a conflict with one of the GetSingletons, I had it on Alwaysupdatesystem turned that off now it doesn't run at all

zenith wyvern
#

You should only call GetSingleton through an entity query

#

Otherwise yeah you can end up with dependency errors

#

I don't know if it's a bug but I've had that too where calling system.GetSingleton<Component> doesn't properly resolve the dependency for Component. Doing it through an entity query lets you properly declare the read/write access as well

pliant pike
#

yeah I guess its running before they exist and then creating errors because of it

opaque ledge
#

@zenith wyvern how do you do it ? i am aware of that as well but was wondering how could i do otherwise

#

you make the entity query and do to entity array or something ?

zenith wyvern
#

entityQuery.GetSingleton

opaque ledge
#

oh hmm ๐Ÿค”

zenith wyvern
#

@pliant pike Create the entityquery to access your singleton, make sure you specify the proper read access, and pass your query to RequireForUpdate inside OnCreate

junior fjord
#

what is the easiest way to add a component if not existent?

if(!HasComponent<X>(e))
   ecb.AddComponent<X>(e);

?

zenith wyvern
#

This will prevent your system from running until the singleton exists

pliant pike
#

yeah, I'lll try that thanks

zenith wyvern
#

Err not inside OnUpdate

#

Inside OnCreate

#

RequireForUpdate only need to be called once

pliant pike
#

yeah I've used requireforupdate before

junior fjord
#

ah and also. Is there an easy way to make an entity follow a gameobject?
Basically what I am missing is something like transform.toLocalToWorldComponent, s.t. I can just use the transform of the MB to write the component of the entity

#

ah ok I can just use convert and inject GO

opaque ledge
#

you can also use CopyTranformToGameObject or FromGameObject, depending on what you want to do

junior fjord
#

after I injected the gameobject, how do I get the entity that was created?

#

ah ok probably I have to write this own script that adds components to the entity or something on conversion right

#

I remember something

#

@opaque ledge ah ok that is also good thank you

slim nebula
#

anyone know what package this junk is defined in?

#

how how I can find out that answer on my own?

#

I guess maybe this wasn't supposed to be released and I should just downgrade back

warped trail
#

0.8.0 works fine on 2020.1b

slim nebula
#

oh

#

I guess that makes sense... preview packages go with pre-release unity. Im dum thanks!

bright sentinel
#

@slim nebula For now, actually most packages should work with 2019.3

#

Although I'm unsure if 0.8 was updated

slim nebula
#

it def doesn't work for me. I just grabbed 2019.3.5f1 and got those errors

#

it's fine tho, I can use preview unity. I assume it wont crash every 5 seconds

#

every hour or 2 is fine

zenith wyvern
#

Did you try deleing your library folder and restarting?

slim nebula
#

I mean...

zenith wyvern
#

I know, it's stupid. But a sometimes it does fix things like that. Not all the time, but sometimes

slim nebula
#

would deleting my library folder make the class definition appear somewhere?

#

I'm not sure how this all works

zenith wyvern
#

Unity may not have imported the package properly if there was an earlier version existing

slim nebula
#

sorry if that's a dum question

#

oh ok

#

alright I can try that

#

thanks!

#

yeah looks like I still get the errors with 2020. I'll try the library folder thing

#

ยฏ_(ใƒ„)_/ยฏ

#

I have no idea what I'm supposed to do here

#

deleting the library folder made it regen some stuff but problem still happens

#

any chance someone could put "IVisitAdapter" in their code, right click go to definition, then tell me what assembly it's supposed to be in?

warped trail
#

Unity.Properties

slim nebula
#

thanks bud

#

I can't find that assembly

#

is that in a package? or should that be in the editor?

safe lintel
#

its a package, technically it should be automatically grabbed as a dependency

slim nebula
#

what is the package name?

safe lintel
#

properties, i think its hidden but click the entities package it shows you what it depends on

#

im seeing 0.10.4-preview needed for 0.8

slim nebula
#

where/how do you see that?

warped trail
slim nebula
#

how do I get to that UI?

warped trail
#

this is from package.json in Entities package folder

slim nebula
#

oh I see in the inspector there

#

so ok.... thonk

warped trail
#

but it should be installed automatically๐Ÿค”

#

but do you have this package installed? ๐Ÿ˜…

slim nebula
#

I tried downgrading then upgrading. maybe I try uninstall reinstall of the package

#

that checkbox should mean it's installed right?

warped trail
#

i mean properties package

slim nebula
#

1.1.0

#

so... it's not updating it

#

and it's not in package manager, so... I guess I have to manually review the dependencies of every package I have and update some packages file manually with a text editor?

safe lintel
#

just delete the folder(not the entire library) and see if it reimports the correct version

#

shouldnt need to manually edit the manifest, also unity might just override them when you run it

slim nebula
#

yeah unity.properties is not in the manifest

safe lintel
#

the properties folder that is

#

yeah its not in mine either, its just a dependency of entities

slim nebula
#

maybe some other package requires some other version and it's picking that one

#

oh

#

1.1 is higher than 0.10

#

I'm not entirely clear on the dependency tree

safe lintel
#

i do think were approaching or in package dependency hell ๐Ÿ˜„

slim nebula
#

yeah

#

what does unity.platforms do

#

rofl I know I should know this if it's in my project

#

I think I need to downgrade this so other dependencies don't break

#

anywho

#

I think I have all the info to solve the issue now

#

thank you guys so much

safe lintel
#

i think platforms is related to building the project

slim nebula
#

kk

#

I"m thinking I dont need that right now

#

I can add it back once they merge the 0.10.4 changes into 1.1+

#

no wait

#

wtf

#

entities requires platforms 0.2.1p4

#

no that's right never mind

#

yeah platforms 0.2.1.x is fine

#

0.2.2 breaks it

#

yeah downgrading that made all the errors go away

#

unity automatically downgraded unity.properties

#

im so happy

karmic pilot
#

yeah platforms 0.2.1.x is fine
@slim nebula thanks a lot! had the same problem and was looking through all the packages, somehow missed that one though!

slim nebula
#

๐Ÿ˜„

#

glad I"m not the only one getting hit here

odd cipher
#

still dont understand why my color32 arrays in a dictionary become "upside down" when transferred to a NativeMultiHashMap

zenith wyvern
#

Nmhm is unordered by design. Any order you notice might change at any time for any reason.

#

Basically it's not the right container to use if you need your values in a certain order

odd cipher
#

when doing this cs NativeMultiHashMap<TerrainSprite, Color32> _colorTerrainTiles = new NativeMultiHashMap<TerrainSprite, Color32>(colorTerrainTiles.Count, Allocator.Persistent);

#

the struct is this ```cs
public struct TerrainSprite {
public int terrainID;
public int variantID;
public bool[] bitMask;

    public TerrainSprite(int _terrainID, int _variantID = 0, bool[] _bitMask = null) {
        terrainID = _terrainID;
        variantID = _variantID;
        bitMask = _bitMask;
    }
}
fallow mason
#

Pretty much what the error says. You need to implement IEquatable for TerrainSprite.

bright sentinel
#

@zenith wyvern If nmhm is unordered, then what uses does it actually have?

mint iron
#

mmm do i need to explicitly dispose Temp allocations?

bright sentinel
#

@mint iron You need to explicitly dispose any allocation in DOTS

#

Temp allocations should be disposed within the function call though

mint iron
bright sentinel
#

Interesting

#

I was not aware

#

I mean, you could always just test it

zenith wyvern
#

@bright sentinel When you need to store list of something you can access by key but the order of the list isn't important.

#

And no you dont need to dispose temp containers

#

They get disposed automatically at the end of the frame

odd cipher
#

so bools arent blittable? what do I use instead

zenith wyvern
#

A bool is blittable. An array is not

odd cipher
#

alright but i switched that array to a NativeArray

#

still doesnt work though

#
public struct TerrainSprite : IEquatable<TerrainSprite> {
    public int terrainID;
    public int variantID;
    public NativeArray<bool> bitMask;

    public TerrainSprite(int _terrainID, int _variantID = 0, NativeArray<bool> _bitMask = default) {
        terrainID = _terrainID;
        variantID = _variantID;
        bitMask = _bitMask;
    }

    public bool Equals(TerrainSprite other) {
        if (other.terrainID == terrainID && other.variantID == variantID && other.bitMask == bitMask) return true;
        return false;
    }
}```
#

never used IEquatable so that might be wrong

bright sentinel
#

@zenith wyvern So the best option if you have a 2D array structure is that you would probably just flatten it to a 1D array?

zenith wyvern
#

A NativeArray is not blittable either. You cant have nested NativeArrays

odd cipher
#

so what else then

zenith wyvern
#

@bright sentinel Yes

fallow mason
#

If you're doing a bitmask, why not store as int instead of bool array?

zenith wyvern
#

Why are you trying to store an array of books in your Sprite?

bright sentinel
#

Why are you all writing 'book'? ๐Ÿ˜‚

zenith wyvern
#

Wow phones really dont like that word

odd cipher
#

well for the bitmask, but yeah I could use ints

fallow mason
#

Lol phone

odd cipher
#

or do you suggest just having a variable for each bitMask value

zenith wyvern
#

Yes any variant is a single value of the mask that's the point

#

So a single int should tell you which variant it is. That article explains how to calculate the value based on the state of a tiles neighbors

odd cipher
#

well you cant just set a int to "0000"

fallow mason
#

Sure you can: int i = 0;

odd cipher
#

ig

zenith wyvern
#

Just try going over the article again, you're on the right track

odd cipher
#

alright thank you, only one thing I want to solve before doing all that, the color array still seems to be added up side down

#

which I need to fix

zenith wyvern
#

Ditch nmhm, store your data in a collapsed array

#

Since you're storing colors of a bunch of tile varisnts it could end up being a very large array but the math to get the proper index is pretty straightforward

#

Tiletype * (TileSize * NumVariants) + (Tilesize * Variant)

#

Gotta go back to work, good luck

odd cipher
#

well the variant is not what you think it is; each terrain type has a secondary color array, which I get at random and then theres the bitMask, all the bitMask ones have some sort of transparent part which gets replaced with the variant

odd cipher
#

but yeah, I should probably use something else than NativeMultiHashMap since its pretty slow

odd cipher
#

@zenith wyvern yeah I have to change to something else than a NativeMultiHashMap because it just picks it really randomly. both these sprites are the same (though different colors) but the NativeMultiHashMap has them rotated weirdly somehow

odd cipher
#

still not sure what to do about this

zenith wyvern
#

Like I said the order values are stored in is basically random so theres no point trying to reason about it. I'm not sure what the best alternative is, your variants are a lot more complicated than I thought compared to that first picture you showed.

odd cipher
#

yeah.. cant figure out a good way to store the colors where they are not random

north bay
#

There is no container that can hold other native containers or is there?

odd cipher
#

soo yeah

opaque ledge
#

you could try adding your keys to native list, and when you are reading from native multi has map you could iteratave over that keys

#

something like multihash[keys[i]]

odd cipher
#

well you cant access a mutlihashmap with []

opaque ledge
#

ah right i mean, multihash.GetValuesFromKey(keys[i])

odd cipher
#

also though its not the key part that gets messed up, its the colors in the values

opaque ledge
#

well just reverse it then ?

#

create a new native list and iterate from orignal list's end to start

odd cipher
#

I'm guessing its this part that messes it up ```cs
public Color32[] GetSprite(NativeMultiHashMap<TerrainSprite, Color32> src, TerrainSprite name) {
Color32[] colors = new Color32[terrainSpriteSize * terrainSpriteSize];

        int i = 0;
        if (src.TryGetFirstValue(name, out Color32 item, out NativeMultiHashMapIterator<TerrainSprite> it)) {
            do {
                colors[i] = item;
                i++;
            } while (src.TryGetNextValue(out item, ref it));
        }

        return colors;
    }```
opaque ledge
#

seems fine to me

odd cipher
#

well then, I guess its the part what converts the dictionary to the nativemultihashmap ```cs
nativeColorTerrainTiles = new NativeMultiHashMap<TerrainSprite, Color32>(colorTerrainTiles.Count, Allocator.Persistent);
foreach (KeyValuePair<TerrainSprite, Color32[]> kvp in colorTerrainTiles) {
for (int i = 0; i < kvp.Value.Length; i++) {
nativeColorTerrainTiles.Add(kvp.Key, kvp.Value[i]);
}
}

opaque ledge
#

that also seems fine to me

odd cipher
#

well I dont know then

#

its weird

opaque ledge
#

are you writing to it again somewhere ?

odd cipher
#

no, it only gets made at the start of the game

#

and disposed at the application quit

opaque ledge
#

i will do some testing soon about this

odd cipher
#

alright thank you

opaque ledge
#

by soon i mean it can take a while, since i am downgrading my project ๐Ÿ˜„

odd cipher
#

how long we talkin? ๐Ÿ˜…

opaque ledge
#

well 10 mins if everything goes well, 2 hours if not xD

odd cipher
#

ah thats fine

opaque ledge
#

in meanwhile, while you are retrieving values from the multi hash map, can you use GetValuesForKey(key) instead of TryGetNextValue ?

odd cipher
#

so get rid of the whole loop?

opaque ledge
#

yeah, but ofc dont remove that function, just do GetSprite2 function ๐Ÿ˜„

odd cipher
#

yeah yeah, just commented :P

#

tried just doing colors = src.GetValuesForKey(name); but thats a lil too simple I think :P

opaque ledge
#

should be something like

var valueEnumarator = multihash.GetValuesFromKey(key);
int i = 0;
while(valueEnumarator.MoveNext()){
  color[i] = valueEnumarator.Current;
  i++;
}
#

yeah because it doesnt return an array, it returns a enumarator ๐Ÿ˜„

odd cipher
#

Yeah, I'm not quite used to the whole native thing yet

opaque ledge
#

yeah, maybe they will make a function to return native array instead of enumarator

odd cipher
#

that would probably help :p

#

but no, didnt change anything

opaque ledge
#

hmm okay

#

my testing will start soon, fortunately everything went well ๐Ÿ˜„

odd cipher
#

alright!

opaque ledge
#

its either there is something weird going on in your code or order is not guaranteed in values of a key

odd cipher
#

im guessing its the order but can only wait and see your results :P

opaque ledge
#

huh i found your problem i think ๐Ÿ˜„

#

This is actually kinda weird behaviour

#

if allocation size is exceeded then order is not guaranteed

#

if not then its guaranteed

#

@odd cipher

odd cipher
#

not sure what you mean

opaque ledge
#

nativeColorTerrainTiles = new NativeMultiHashMap<TerrainSprite, Color32>(colorTerrainTiles.Count, Allocator.Persistent);

#

you are exceeding colorTerrainTiles.Count, just give it to some arbitary number, lets say 5000, then see the results if its fixed or not

odd cipher
#

nope, still the same problem

opaque ledge
#

hmm are you sure ? well i am still getting reversed array, so its somekind of a FILO structure

#

This is when allocation is not exceeded

odd cipher
#

actually yeah, youre right, it does change but its still reversed

opaque ledge
#

yeah its FILO

odd cipher
#

havnt heard of the term

opaque ledge
#

so you have to reverse it ๐Ÿ˜„

#

First in Last out

#

have you ever worked with stack structure ? stack is FILO

#

And this is when allocation is exceeded

odd cipher
#

You did it! ๐Ÿ˜„ it works now

opaque ledge
#

\o/

odd cipher
#

though I would rather not have a hardcoded size

opaque ledge
#

yes ofc^^ but the thing is that allocation is for key+values i think, not just keys

odd cipher
#

yeah

opaque ledge
#

so lets say, if you think you will have 10 keys with 10 values each, you should have 110 i think

#

well, i am going to have a happy breakfast now ๐Ÿ˜„

#

gl out there

odd cipher
#

so, I'd just do a loop to count, as this is only done at the start of the game I think that is fine

#
int count = 0;
        foreach (KeyValuePair<TerrainSprite, Color32[]> kvp in colorTerrainTiles) {
            for (int i = 0; i < kvp.Value.Length; i++) {
                count++;
            }
        }

        nativeColorTerrainTiles = new NativeMultiHashMap<TerrainSprite, Color32>(count, Allocator.Persistent);
        foreach (KeyValuePair<TerrainSprite, Color32[]> kvp in colorTerrainTiles) {
            for (int i = 0; i < kvp.Value.Length; i++) {
                nativeColorTerrainTiles.Add(kvp.Key, kvp.Value[i]);
            }
        }

thatll do

#

little tedious I suppose

odd cipher
#

Even if it's moddable, the mod adds a "new tile", you just add "new tile" to your mapping and give it a new number, then internally represent "new tile" with that number.
@lusty otter heyo, wondering if you are able to talk more about your suggestion?

#

since I'm gonna need it

remote coyote
#

Anyone got entities 0.8 working? I'm having some errors after upgrading.
com.unity.entities@0.8.0-preview.8\Unity.Entities\Serialization\BinaryPrimitiveAdapter.cs(10,11): error CS0246: The type or namespace name 'IVisitAdapterPrimitives' could not be found (are you missing a using directive or an assembly reference?)

#

is just the first

#

so I guess there's some kind of package version alignment I've got wrong

opaque ledge
#

is your platforms package 0.2.2 ?

remote coyote
#

yes

opaque ledge
#

downgrade to 0.2.1 ๐Ÿ˜„

remote coyote
#

haha

#

thanks man

opaque ledge
#

this is like.. 2nd this happening, for some reason latest platfroms package isnt actually compatiable with current packages for some reason ๐Ÿคท

remote coyote
#

yeah, its the downside to all these packages

#

hopefully they'll figure it out

#

they talked about a verification/testing thing that would ensure we got correct version compatibility

bright sentinel
#

I've seen some threads that they are quite aware of the package problems that are present and are trying to figure out a way to solve this

#

But it will probably take a bit of time before that solution is rolled out

odd cipher
#

only one more thing until I can use burst with my code, and thats the fact that I use string names in the Terrain Type / Building Type / Item Types