#archived-dots

1 messages ยท Page 60 of 1

rustic rain
#

then should work as intended

#

index in inmanaged component should be valid

#

because internally they are used to render your mesh/material pair

devout prairie
#

exactly

#

not sure why i'm getting this

rustic rain
#

can you make a screenshot

#

of what component you even use

devout prairie
#

so when i run this code on for example my terrain object, which is baked inside the subscene, it returns the mesh

#

whereas these objects are baked to prefabs inside a baker, pulled from a scriptable

#

ie they don't 'exist' in the runtime until i explicitly spawn the prefabs

rustic rain
#

but they should be converted

#

and registered properly

#

because they will exist as entity prefabs

#

I need screenshot

#

of what you use

#

to tell you exactly

#

whether it's correct one

#

because it was really missleading when I first encountered this

devout prairie
#

this is one of the entities after spawn, at runtime

#

so the mesh index of 311 looks ok

rustic rain
#

yeah, this should be right one

#

how do you get try to get mesh

#

again?

devout prairie
#

and this is the target mesh in the shared managed component

rustic rain
#

no no no

#

you don't obtain it from this array component

#

it's wrong one

#

it doesn't match runtime indices

#

it's for import only

#

and export

devout prairie
#

this is how, same as we discussed, with reflection:

rustic rain
#

irrelevant, whatever indices it has, are not meant to match MMI component

devout prairie
rustic rain
#

well

#

it's unclear

#

what MethodInfo is that

#

what is HybridRenderer

#

and etc

#

besides

#

you don't need reflection in runtime

#

just use reflection to get BRG reference

#

and that's all

devout prairie
#

look at the commented line

#

as explained, i've tested this with both methods

rustic rain
#

just use brg one

#

it works and it's faster

#

and show what error does it even give you

devout prairie
#

yeah the brg is faster, but i tested with both, and both throw this error

rustic rain
#

๐Ÿค”

#

try to debug and inspect BRG

#

maybe that will give some insight

devout prairie
#

and as mentioned, both work fine for objects that are already 'spawned' ie active within the baked subscene

rustic rain
#

hopefully it shows all registered assets

devout prairie
#

yeahhhhhhhhhhhhh figured i'd ask if you'd had this

#

have you tried brg.GetRegisteredMesh on a runtime spawned entity?

rustic rain
#

yeah

#

besides

#

runtime spawned entity

#

is no different than non-runtime

#

they use same index

#

and in my case

#

I stored prefabs

#

and they worked fine

devout prairie
#

that's exactly what i'm doing

rustic rain
#

just debug it and see what's going on exactly

#

your error mentions

#

some out of bounds error

devout prairie
#

i think possibly i might be hitting GetRegisteredMesh too soon after spawn or something

rustic rain
#

with very huge number

devout prairie
#

or maybe need an updated reflection reference to the brg or something

rustic rain
#

potentially there is smth else behind this error ๐Ÿ˜…

rustic rain
#

because from what I remember, BRG is created in OnCreate

#

actually

#

let me lookup that code

devout prairie
#

it could actually be where my system is positioned in relation to init or presentation

rustic rain
#

[CreateAfter(typeof(EntitiesGraphicsSystem))]

#
    [UpdateInGroup(typeof(EarlySimulationSystemGroup), OrderFirst = true)]
    [CreateAfter(typeof(EntitiesGraphicsSystem))]
    public partial class EntitySelectionTool : SystemBase
#

EarlySimulationGroup is Simulation

#
            // Obtain BRG from graphics system to get Meshes through ID
            var sys = World.GetExistingSystemManaged<EntitiesGraphicsSystem>();
            var fieldInfo = typeof(EntitiesGraphicsSystem)
                .GetFields(BindingFlags.Instance | BindingFlags.NonPublic)
                .First(x => x.FieldType == typeof(BatchRendererGroup));
            _brg = (BatchRendererGroup)fieldInfo.GetValue(sys);
devout prairie
#

yeah i'll try reposition where the system actually runs

#

CreateAfter could be useful though thanks, i actually had to delay my system and create the reference in OnStartRunning

#

This is me trying both methods:

rustic rain
#

var meshInd = aspect.mmi.ValueRO.MeshID;

#

this is how I obtain meshID

#

MaterialMeshInfo.MeshID

devout prairie
#

practically the same

rustic rain
#

BatchMeshID
I store it as this type though

#

and then like this var mesh = _brg.GetRegisteredMesh(pair.Key);

devout prairie
#

k going to grab some food and then try out repositioning my system, it might be that i'm trying to get the mesh id before it has been fully initialized by the graphics system, or something along those lines

rustic rain
#

you can ensure your system runs after all subscenes are loaded

#

allthough nvm

#

seems like your case is different from mine

devout prairie
#

yeah it's not that

#

yep, it's more i think trying to get the mesh id too soon after spawning, ie same frame but before graphics initialization of the entity, or something

#

for example its as if - i spawn the entity, my system reads the mmi which has been added but not yet initialized somehow

rustic rain
#

doubt that's the case

#

but you can see

#

by trying to create your system on demand

#

on click of some button for example

#

after you know for sure everything is loaded and runed at least once

misty wedge
#

Anyone know what this Unknown block of memory is for?

devout prairie
#

Couldn't resist trying, so i moved my system to ensure it runs after this system:

#

And it works.. So i was obviously able to read the MMI component from the newly spawned entity, before it had actually been initialized by the graphics system

devout prairie
#

where it keeps all it's dodgy mp4's

proud jackal
rotund token
#

Could you just get all scenes and exclude any in build scene list

coarse turtle
#

yea i was thinking about that since the scene list won't include those subscenes

#

and I can ignore certain directories for prototyping scenes too

misty wedge
#

How can I force the inspector select a specific entity? Create an EntitySelectionProxy and set Selection.activeObject to it?

rotund token
#

You don't need to create it yourself

#

But hmm, probably easiest way

misty wedge
#

I guess the only downside is that the objects are only cleaned on Resources.UnloadUnusedAssets iirc

#

unless you manually destroy it on unselection

rotund token
#

You can just create 1 copy in your tool

#

Don't need to create it new every time

misty wedge
#

It's all static, I guess I'll just store a static instance

#

How does unity do it? Do they have a static instance too? Since then I could just use that

rotund token
#

I'm still not sure why this was all made internal, it's like they don't want us writing custom tooling

#

Entity selection proxy, property inspector etc

misty wedge
#

There's actually a EntitySelectionProxy.Select(World, Entity) method that I missed

rotund token
#

Yeah I was going to suggest that

#

I just didn't recall what it did

#

Does it actually set it to selection?

#

(not at pc)

misty wedge
#

Yes

#

EntitySelectionProxy has a Select instance method that just sets the active selection to the object if it isn't already that

#

(Which the static method calls after creating the scriptable object)

#
public void Select()
{
    // Don't reselect yourself
    if (Selection.activeObject == this)
        return;

    // Don't reselect the same entity
    if (Selection.activeObject is EntitySelectionProxy selectionProxy && selectionProxy.World == World && selectionProxy.Entity == Entity)
        return;

    // Can only be Runtime if directly selected
    SelectionBridge.SetSelection(this, null, DataMode.Runtime);
}
rotund token
#

๐Ÿ‘

#

There you go then

#

I know I had used this method in the past exposed but I know my current wrapper doesn't expose it for some reason

#

But I think that's just because I haven't needed to select something in a while, just get current selection

misty wedge
#

Yeah I wanted to be able to select the entity for a hybrid entity when selecting it in the scene

#

Since it's so annoying to always have to search for it

#

Seems you need to delay the selection by a frame though

hybrid jay
#

Am i right in thinking that in an ISystem you can't access any of the managed command buffer systems?

#

when burst compiled

#

var ecb = state.World.GetExistingSystemManaged<EndInitializationEntityCommandBufferSystem>().CreateCommandBuffer();

#

(0,0): Burst error BC1016: The managed function Unity.Entities.SystemState.get_World(Unity.Entities.SystemState* this) is not supported

#

I wanted to avoid the sync point in using a command buffer manually but if thats the only option then it'll do

rotund token
#

You should access command buffer systems via singletons in 1.0

hybrid jay
#

ahh, got an example anywhere?

#

the docs only use the old way

rotund token
#

var system = SystemAPI.GetSingleton<EndInitializationEntityCommandBufferSystem.Singleton>();
var ecb = system.CreateCommandBuffer();

#

you don't need AddHandleForProducer when doing it this way

hybrid jay
#

cool thx

covert lagoon
#

I can't have a MonoBehaviour inside a namespace anymore?

rotund token
#

sure you can

#

my ide is setup to not even allow something to exist outside a namespace will just auto add it

#

so i'd definitely run into issues if this changed

covert lagoon
#

What the fuck.

#

Is this random?

#

I make an authoring MonoBehaviour in a namespace, Unity recompiled, did something domain something blablabla, I tried to add it to a GameObject in a subscene, couldn't find it in the "Add Component" menu, tried to add it to a GameObject outside the subscene, couldn't find it in the "Add Component" menu either.

rotund token
#

is the Filename exactly the same as the MonoBehaviour name?

covert lagoon
#

Removed the namespace block around the MonoBehaviour, Unity recompiled, etc, and this time I could find it in the menu.

#

Well, I commented the namespace block out.

#

Then I un-commented it, and again I couldn't find it anymore.

rotund token
#

What's your namespace

covert lagoon
#

Then I removed it entirely, could find it again.

delicate swan
#

All of my author monobehaviors are in nested namespaces, but there is an issue on whatever build I've been on that occationally it like, 'misses' monobehaviors during a recomple

covert lagoon
#

Then I added it back, and now I can still find it.

covert lagoon
delicate swan
#

Try looking at the script in the inspector, if it says something like 'can't find behavior', try reimporting the script by right-clicking it

#

That usually fixes it for me

covert lagoon
#

It didn't appear here the first time Unity recompiled after I created the script, I tried to refresh and nothing happened.

#

Then when I commented out the namespace block for the first time, it appeared.

#

When I un-commented it, it was still there but I couldn't find it in the "Add Component" menu anymore.

#

I don't have [DisallowMultipleComponent] or whatever on it, and I tried to add it on GameObjects that didn't have it anyway.

devout prairie
#

I've had similar a few times, in fact a couple of days ago.. basically just have to mess around with it to trick it into recognizing and showing up in the editor again

#

I think normally i'd just create a new script with slightly different name and copy the contents over, ensuring i update the class name to match

misty wedge
#

Weird, I don't think I've ever had this issue

#

All of my scripts are in namespaces as well

devout prairie
#

I've always had a sneaking suspicion it's VisualStudio related tbh

hushed lichen
#

Rider from JetBrains is very enjoyable to work in with Unity. Just a random recommendation ๐Ÿ˜›

rotund token
#

A lot of users here use rider, but it is a little rough if you are not a student or don't have an employee to pay for a license

hushed lichen
#

Not wrong.

rotund token
#

sigh Unity.Logging why do you not respect my authority

rustic rain
#

๐Ÿฅฒ 20 mins

rotund token
#
                .SyncMode.FatalIsSync()
                .MinimumLevel.Set(MinLogLevel)
                .CaptureStacktrace()
                .WriteTo.JsonFile(
                    absFileName: Path.Combine(logDir, "Output.log.json"),
                    outputTemplate: $"[{{Timestamp}}] {{Level}} | {world} | {{Message}}")
                .WriteTo.UnityDebugLog(
                    minLevel: this.currentLogLevel,
                    outputTemplate: $"{world} | {{Message}}{{NewLine}}{{Stacktrace}}")
                .CreateLogger(LogMemoryManagerParameters.Default);```
It writes the UnityDebugLog output template to the json file for some reason
rotund token
#

on forums, logging in via hub

rustic rain
#

yeah

rotund token
#

it's not good

rustic rain
#

but failing build because of it?

#

jeez

rotund token
#

i'm quite tempted to install a second pirated copy of unity editor just to avoid this shit... (i have 2 licenses so i feel no guilt)

rustic rain
#

I am lucky it built after that fast

rotund token
#

yeah thankfully incremental will rebuild fast

devout prairie
rotund token
#

if someone can offer me a better service, I am going to be tempted to take it

devout prairie
#

got so tired of media encoder / ae / etc breaking when i needed it to work

#

๐Ÿดโ€โ˜ ๏ธ ๐Ÿฆœ

#

arrrrr

#

with adobe, you basically threaten to end your subscription every 18 months or so and they drop the monthly price to keep you in the loop

misty wedge
#

oof 20 minutes for a build

devout prairie
#

the loop being, of course, a perpetual loop of utterly needless updates that achieve nothing and give you nothing

hybrid jay
#

Whats the best way to generate a seed for a random inside an ISystem?

rotund token
#

hmm good question

hybrid jay
#

actually nvm, can just not burst the OnCreate and use DateTime?

rotund token
#

maybe just generate a seed in OnCreate and increment it each frame (or power prime or something) [what you said]

covert lagoon
#

It's not readonly in the real source code:

[CreateProperty]
public float3 LocalPosition

And I can reassign it just fine.

#

Is it a DocFX bug?

late mural
#

is there anyway to get read write access to a singleton component in a monobehaviour?

late mural
late mural
rotund token
late mural
#

trying to find a good way of doing ui, everything seems to be a pain though, using a system for the ui makes getting the ui gameobjects really challenging, but if i use a monobehaviour for the ui then i have the nightmare of trying to get access to components in a monobehaviour, which is not fun, ughh

rotund token
#

i use a system but i use UI toolkit instead of ugui

#

i think it works much nicer with entities

late mural
#

haven't heard of either of them, so ill look into them, thanks

viral sonnet
#

i had high hopes that the new unity.physics wouldn't have this quirk that sphere casts have hits on the edge but it's pretty much the same. oh well, on to sorting out best hits ^^

coarse turtle
# late mural trying to find a good way of doing ui, everything seems to be a pain though, usi...

https://assetstore.unity.com/packages/tools/gui/nimgui-a-1-draw-call-ui-209126 (sorry my shameless plug - can remove if unnecessary) - I was using my own thing although more more for debugging directly in systems using OnUpdate because I figured an immediate mode gui works decently w/ data oriented design. Still using it and working on it to get the static API burst friendly and working decently with ISystem structs + have a few more widgets ironed out

tribal pollen
#

I fixed all the errors with upgrading to entities pre15 now, but most of my entities aren't visible in the game screen anymore, even though they've been intantiated from a prefab. was there some change regarding this?

#

all the entities exist still, and my game is playing out, Just my once-visible versions of them aren't visible anymore.

rotund token
#

you updated from 1.0 exp to pre right?

#

hmm not sure

#

i didn't think much changed here graphic wise

tribal pollen
#

yeah.

viral sonnet
#

huh, unity physics treats a plane as double sided. meaning, it gets the same raycast hits from front and back. that is very different to legacy physics where a back raycast doesn't have any hits. that's really annoying to deal with

rotund token
#

interesting

#

did not know old physics didnt do this

#

(or that unity physics did)

viral sonnet
#

yeah pretty odd tbh. i mean it likely will stay that way and i just to rewrite my algorithm to deal with it (calculating thickness of objects that obscure the view to the player)

#

makes it pretty complicated though tbh. look at this mess to evaluate the thickness of the edge. those rays are point+normal. red is from target -> camera position green is camera pos -> target. i guess i have to evaluate against the real surface normal or smth to figure out if i'm inside

#

my old method was just raycasts but that was pretty unstable in any game environment

#

does anyone know how i'd get the real colliding triangle? i'd guess with ColliderKey but i have no idea how to use that

#

hm, when i rethink this and apply some basic trigonometry i can get away with just one raycast. fingers crossed this will hold up in more complex situations ๐Ÿ˜„

viral sonnet
#

i don't feel useless yet for high level programming, architecture and optimization but for basic math problem chatGPT can replace my brain haha

#

wanted to find the intersection point of a direction vector through a plane and chatGPT just staight up told me the math. i mean, it's nothing new but googling wasn't helping much

#

(might have to do with the horrible SEO on math sites)

rustic rain
rotund token
#

i should probably have a look at this at some point

rustic rain
#

you can login with google account

#

his knowledge is limited up to 2021 though

#

which is obvious dealbreaker for dots

rotund token
#

more like effort and lack of need atm

rustic rain
#

ask him about modding some kind of old game you like

#

kek

#

Sadly, he doesn't know about new version in rimworld, but he answered old one correctly

rustic rain
#

@rotund token btw sir, have you tried to tie New Input System with UI toolkit?

#

keybinds for UI and etc?

rotund token
#

yes i only use inputsystem/uitoolkit

rustic rain
rotund token
#

it has built in support

rustic rain
#

wait what?

rotund token
#

don't really need to do anything

rustic rain
#

how?

rotund token
rustic rain
#

I want basic Cancel event registration

rotund token
#

just add a input system ui input module

#

to your ui document

rustic rain
#

and then?

rotund token
#

it just works

#

those are input system bindings

#

in the drop downs

rustic rain
#

I know

#

but I mean

#

I want my window to close on Cancel event

#

as one of examples

#

have you done similiar stuff?

rotund token
#

yeah actually

#

i wrote a stack history system into my state like 2 weeks ago

rustic rain
#

yeah, I remember

#

damn

rotund token
#

i just call
ClientState.UICloseAllPopupsOrPop(ref systemState)

rustic rain
#

I used to do it with stack as well, but I didn't like the approach

rotund token
#

names a bit of a mess atm

#

but it will close all popups OR close a window to the previous

#

alternatively just ClientState.UIPop(ref systemState)

#

to pop back just 1 window

rustic rain
#

but I guess if you did it, there is no better option

#

๐Ÿ˜…

rotund token
#

haha wouldnt go that far

#

we have a lot of UI issues at work though

#

so i've been trying to design a system that avoids them

#

(at least the complaints i hear our UI guys complain about)

rustic rain
#

I have come up with one way

#

that uses Model-View-Presentation pattern

#

and uses URL global events to manipulate UI

#

and I also have a plan to burst compile it

rotund token
#

i consider my implementation a variation of mvp

rustic rain
#

Here's what I mean

    [StateUri(URLUtility.BuildMenu)]
    public class BuildMenuPresentation : BasePresentation, IComponentData
    {
    }
#

Where

    public static class URLUtility
    {
        public const string OpenMainMenu = "MainMenu";

        public const string OpenMainGameScreen = "OpenGameMain";

        public const string UpdateUI = "UpdateUI";

        public const string HireMenu = "HireMenu";

        public const string BuildMenu = "BuildMenu";
    }
#

so if event with that string comes up (which can be called with EntityManager from any point in World)

#

UI will be enabled

#

with this, my presentations never have to rely on any other presentation

#

or even know about them

rotund token
#

neither does mine

#

except i use my K system

#
        private struct KeyWindow
        {
            [K("UIStates")]
            public byte Key;```
#
    {
        [SerializeField]
        [K("UIStates")]
        private byte[] defaultStates;```
rustic rain
#

key could work as well

#

internally

#

I want to use it as Hash of string

rotund token
#

just appears like that in UI

rustic rain
#

nnah, I don't want to rely on indices in any way

rotund token
#

you dont reply on indices

#

its a dictionary string -> int

#

it's all data driven

#

you never use the index yourself

rustic rain
#

well anyway, my plan is to create a huge int array for each URL that exists and then when event comes up - get hash and do comparison in Burst

rotund token
#

we used hashes in our project

#

and it's a bit of a nightmare

#

to debug

rustic rain
#

๐Ÿค”

rotund token
#

you have an issue debugging all you get is a hash

rustic rain
#

that could be release only

rotund token
#

break point you see -234568234

#

we have 8016 hashes

#

someone ended up code genning an enum then duplicating it on a component so they could inspect it...

#

so gross

#

so we have an enum anyway..........

#

anyway this might not apply to you

#

it's a totally legit strategy but this is why i've been a bit burnt by it

#

i only use this K indexing for UI/states which I don't expect to be that many

#

and they shouldn't be changing once created

#

i have a scriptable object auto indexing system for actual objects in the game

#

with protection against git merges

#

basically unbreakable as far as i can tell

rustic rain
rotund token
#

which part?

#

it's all in my core library

#

K is just a FixedHashMap stored in a SharedStatic

#

so it can be accessed from burst or mono

rustic rain
rotund token
#

oh i have this whole generic settings UI going

#

basically just inherit from : Settings in my project

#

and it'll generate a settings asset for you

#

and it'll setup this window

#

actually just ISettings + scriptable object

#

it's really nice

#

I have a specific base settings object for K settings so literally all i implement is this

    {
    }```
#

and the whole thing is done

#

i have a new K usable value

#

attribute via
[K("UIStates")]
[SerializeField] private byte value;
for serialized data

use it in code via if you want a LayerMask similar API
K<UIStates>.NameToKey("menu");
even in burst

#

i'm all about the usability and tooling

hushed lichen
#

I was sitting with an issue yesterday and I can't think of any other channel to mention it - not that I'm expecting much visibility here from Unity devs, simply too much activity.
But in MonoBehaviour land, it's fairly simple to get a GO's properties in a new window which is really useful for comparing different GOs. In DOTS land, I haven't found a way of getting an entity's properties in a separate window so comparing different entities, or entities to the contents of a dynamic buffer, is very much an exercise in frustration. Would be nice to have a pop-out properties window like GOs have ๐Ÿ™‚

rotund token
#

you can also pin 2 inspectors still

hushed lichen
#

OK, I might just be a little bit blind and made a big ol' box of text lol. Egg on my face ๐Ÿ™‚

rotund token
#

like you can also still pin entities in the inspector to compare side by side

#

i do wish there was a bit of a better workflow for multiple inspector windows

hushed lichen
#

Thanks tertle โค๏ธ

rotund token
#

its always been a bit of a pain to pin and unpin stuff

#

i've been meaning to write a nicer way of doing this at some point

#

just not sure what i want

#

i should probably google around and see if anyone has done something, not exactly dots related

#

so i'm sure someone has wanted something more before

#

(for the record i don't disagree with your original point, i'm sure everyone would like better tooling but they do seem to be doing work on this. just pointing out a way you can do a comparison for now)

hushed lichen
#

I thought we had no tooling for it hence the egg on my face. Having something is vastly better than having nothing.

rustic rain
rustic rain
#

So, basically it's runtime enum?

rotund token
#

yeah K is basically an enum replacement as well as a UnityEngine.LayerMask replacement in 1

#

converting a string to an int via a static method from anywhere even in burst

#

reading from a settings file

#

it just evolved to be generic and support unlimited types

rustic rain
#

interesting

rotund token
#

i'm not suggesting you implement this in your project or anything

#

no one's really ever shown much interesting in it except for the couple of users testing my Game framework

#

but that's because they've used it via the framework

#

i'm just kind of showing off how i'm trying to make things data driven

rustic rain
#

yeah, I get it

#

I'm interested

#

just currently extremely busy with little windows of free time ๐Ÿ˜…

rotund token
#

yeah i know the feeling

#

i was hoping to get a bunch of personal project work done over xmas

#

barely did anything

#

(also a bit mentally exhausting finally getting some time to work on project only to spend a day trying to debug why burst is corrupting)

devout prairie
#

just realised i don't seem to be getting collision events

#

since upgrading to 1.0

#

anything obvious i might not be aware of?

#

i did port my stateful collision system code over to reflect the updates in the physics samples version

#

but it seems it's not running ( ie i'm guessing not seeing any of the required StatefulCollisionEvent's )

rustic rain
#

for example by loading new assembly?

#

to specific settings I mean

rotund token
#

you'd have to be careful about thread safety - load them before you start using any in a job

#
        private static void LoadAll()
        {
            var kvSettings = Resources.LoadAll<KSettings>(string.Empty);

            foreach (var setting in kvSettings)
            {
                setting.Init();
            }
        }```
#

atm i just load them via Resources - they're not baked or anything

#

its not the greatest approach and something i want to consider at some point

#

but yeah there's nothing stopping you loading new values at runtime

#

it's just a hashmap

rustic rain
rotund token
#

K<T>.Initialize(this.Keys);

#

is all it does

rustic rain
rotund token
#

because shared statics are inherently generic

#
    {
        private static readonly SharedStatic<KMap> Map = SharedStatic<KMap>.GetOrCreate<KMap, T>();```
#

this code here is basically the trick to the entire thing

#

turns out shared static just naturally work perfectly for this

rustic rain
#

I mean, how do you use it in Burst code?

rotund token
#

var key = K<UIStates>.NameToKey("menu");

#

var key = K<UIStates>.NameToKey(config.menu);

#

etc

#

shared statics work in burst

#
    {
        private static readonly SharedStatic<KMap> Map = SharedStatic<KMap>.GetOrCreate<KMap, T>();

        /// <summary> Given a name, returns the user defined value. </summary>
        /// <param name="name"> The name. </param>
        /// <returns> The value. </returns>
        public static byte NameToKey(FixedString32Bytes name)
        {
            if (!Map.Data.TryGetValue(name, out var key))
            {
#if ENABLE_UNITY_COLLECTIONS_CHECKS
                Debug.LogError($"{name} does not exist");
#endif
            }

            return key;
        }```
#

this is basically the entire code

rustic rain
#

I see

#

I don't like the idea of using string in code though

#

I prefere to wrap all around const

rotund token
#

you can pass a const

#

thats fine

#

or pass in a config

rustic rain
#

I know, just similiar thing basically

#

of what I use atm

rotund token
#

it's actually a MiniString (16byte non null terminated string)

#

because FixedString32Bytes is a tad too big

#

so max string size is 15

#

i thought that was long enough i'd rather double the state size

rustic rain
#

I wonder if Burst can convert to Hash during compilation

rotund token
#

(since I used a fixed hash map so i don't have to worry about allocations)

rustic rain
#

smth like

#

"string".GetHashCode()

rotund token
#

if each 'string' was a Type

#

it oculd

#

not sure you'd want to do that though

rustic rain
#

I'm fine with hash

#

in my implementation there is going to be an array

#

with real strings

rotund token
#

burst just has type -> hash

#

Unity.Burst.BurstRuntime.GetHashCode32(type)

rustic rain
#

which index will equal index of hash in array

rotund token
#

hence the random suggestion

rustic rain
#

nah, hash of specific string

#

not type

#

anyways, I'm looking forward some simple code gen instead

#

for now I have this little editor window which shows all existing URLs

rotund token
#

there are built in burst compiled fixedstring -> hashcode methods

#

if you needed

#

but it sounds like you're more going for compile time version of it

rustic rain
#

it is indeed using reflection

#

but only on system creation

#

so basically

#

it queries for all Attributes in UI specific classes

#

and parses them as URLs

#

this way I can load as many assemblies

#

in runtime

#

and all URLs will be parsed

#

but I'd rather want

#

so it works more like input system

#

where I create asset with values

#

and then use their definitions in code

#

I'v yet to figure a way to do it. One way I can codegen C# code with all const strings

#

not sure if that's the way though

rotund token
rustic rain
#

or whether I should even use stirng at this point

warm panther
#

Q: When do I use ISystem, when do I use SystemBase? I... don't get the difference anymore, other than some API calls differing.

rustic rain
#

if you use burstcompile attribute

#

SystemBase can store managed references, ISystem can't

misty wedge
#

I don't think I've tried it though

misty wedge
#

What happens?

rustic rain
#

it throws error on init

#

ISystem's are stored in unmanaged way

#

managed struct will break it

misty wedge
#

Weird that they don't have a compile error for that

#

I guess I never tried it ๐Ÿคทโ€โ™€๏ธ

warm panther
rustic rain
#

while bursted too

warm panther
#

kk, thanks!

misty wedge
#

When will this ever go away pensive

warm panther
#

I have given up. ๐Ÿ™‚

#

Q: Are there equivalents to:
Bounds.Encapsulate
and
Bounds.IntersectRay
in DOTS / Unity Mathematics? (for Unity.Mathematics.AABB)

warm panther
#

Question: The Query in this is empty, but such an entity definitely exists. Is there something I'm doing wrong?
I suppose this is run before the subscene is loaded.

        public void OnCreate(ref SystemState state)
        {
            Debug.Log("Building Mesh List");
            _meshes = new NativeHashMap<uint, NavMesh>(100, Allocator.Persistent);
            foreach (var (mesh, world) in SystemAPI.Query<NavMesh, PhysicsWorldIndex>())
            {
                Debug.Log("Bound mesh");
                _meshes[world.Value] = mesh;
            }
        }
#

I'll try some require for update shit or something.

misty wedge
#

The scenes are also loaded via systems, so the scene (usually) hasn't loaded in the OnCreate of another method

#

The easiest thing to do is just RequireForUpdate a component that is in the scene

#

Then you can do your initialization in OnStartRunning

warm panther
#

Yeah.

misty wedge
#

If it's performance critical initialization I would add a bool or something to check if you have initialized already, unless your system never stops running

warm panther
#

Got it to work.

#

It is literally copying a few pre-generated NavMesh components into a native array.

#

For easier lookup.

#

(and later, for some extra processing)

misty wedge
#

Why not just store the entity reference to the navmesh and use a component lookup?

warm panther
#

The entity holding the NavMesh and the entity that the pathfinding operates on are separate.

misty wedge
#

Yes, that's what the component lookup is for

warm panther
#

So I save a lot of boilerplate this way.

#

(I think)

misty wedge
#

I'd argue it's actually more boilerplate ๐Ÿ˜…

warm panther
misty wedge
#

But it depends on how your project is setup

#

Ah, you are using the physics world index

#

Then it's fine I suppose

warm panther
#

I can work on consolidating this later, still not sure how to add dynamic avoidance data and all. (could be that there's a system that edits a dynamic representation of the nav meshes). These are just the pre-baked ones from static geometry.

It's all I need for now.

#

I already dislike BlobAssets. ๐Ÿ˜›

misty wedge
#

I recommend you eventually move this to a job though, since pathfinding is usually computation heavy

misty wedge
warm panther
#

Yes I will jobify this.

#

This is just a step so I can test my new pathfinding algorithm, should be much faster thanks to how much more sparse and precise the nav mesh data is.

warm panther
misty wedge
#

It depends on how you have it set up. I use blobs to convert authoring time scriptable object to runtime blob assets for use in jobified code, and it's really not that bad

#

This is the method the scriptable objects implement

#

The blob builder part exists only once

#

and the scriptable objects can just write their data to the struct

warm panther
#

Yeah I don't like this pattern at all. ๐Ÿ˜…

misty wedge
#

I love it, so much easier to make nice editors and then still have incredibly fast runtime data

#

And blob assets give you much more complex data layout than native containers

warm panther
#

I'll probably end up writing some extension or utility function to convert IEnumerable<T> to BlobArray<T> or something.

#

This should be at best 1 line in the Baker.

misty wedge
#

It already kind of exists, but it wants an array

warm panther
#

Omg.

#

Do I still need a Root first?

misty wedge
#

Yes, since it wants a ref to a BlobArray

#

(which can only exist on a constructed root)

warm panther
#

M'kay. ๐Ÿ™‚ But this is very helpful.

misty wedge
#

I didn't like them at first too, but now I basically use it for all immutable data

#

A big upside of them is also that they are very easy to serialize

warm panther
#

So I guess it can look like this. It's somewhat better.

How do you get your scriptable objects at bake time? Or do you keep a reference on the GameObject that the Baker's Behaviour is on?

misty wedge
#

I don't bake the blobs, I convert them at runtime

#

The scriptable objects can be overwritten by mods

warm panther
#

That's... kind of amazing, not gonna lie.

#

Sweet idea!

misty wedge
#

I don't think it's that special of an idea ๐Ÿ˜…

warm panther
#

So you have a System that Resource.LoadAll<T>'s the SOs and turns them into Blobs?

misty wedge
#

They are loaded via addressables, then converted

warm panther
#

Even better.

misty wedge
#

all the blobassetreferences are added to their respective dictionaries

warm panther
#

Cool!

misty wedge
#

which can be indexed by a GUID type which just stores 4 ints

warm panther
#

Yeah that's kind of how I do it with my nav meshes, but the ID is literally the physicsworld for now.

misty wedge
#

The more "out there" part of the system is the dependency injection to more easily pass them to jobs

#

the Blobs then have a dictionary-esque indexer that takes the GUID

#

and returns the blobassetreference

warm panther
#

This injects into what?

misty wedge
#

Into a system

warm panther
#

A Mono Behaviour or a Syst... ok ๐Ÿ˜„

misty wedge
#

SystemBase or ISystem

rustic rain
#

what is this?

misty wedge
#

It's a custom attribute

#

basically injects a NativeHashMap<GUID, BlobAssetReference<T>> into the system

#

(for a specific scriptable object type)

warm panther
#

Q: What may be possible causes of this? I can't find the entity in question, so it's really weirding me out a bit.

misty wedge
#

It's 50/50 if the error actually matters

#

I think I also get this but nothing broke, not sure though

warm panther
misty wedge
#

It just uses reflection

#

If that ever becomes a bottleneck I'll switch to something else, but at the moment it takes less than a millisecond

#

Since you don't have a million systems lying around

warm panther
#

Ok, seems like I'm kind of unaware when the code relating to attributes is actually executed. (despite having written a couple myself)

misty wedge
#

The attribute doesn't do anything, it's just there for the reflection to find the fields it needs to inject

warm panther
#

So where and when do you run the reflection/injection? ๐Ÿ˜„

#

Just looking around for ideas and best practices.

misty wedge
#

It runs in a system after having loaded the scene for the the server / client

warm panther
#

I see. ๐Ÿ™‚

misty wedge
#

What's nice with runtime conversion is you can also reconvert the blobs at runtime so you don't always have to re-run the game if a scriptable object changes

warm panther
#

How would you serialize a HashMap in a BlobAsset?
var lookup = new NativeHashMap<float3, Node>(nodes.Length, Allocator.TempJob);

This is also one of the reasons why my pathfinding system copies all the components, it's a postprocessing step it needs to do, but I'd love to just have this stored in the asset.

misty wedge
#

I made some changes to it though since it violates some parts of blob usage

warm panther
#

(and later turn it into half3 or something depending on whether that speeds stuff up - but the meshes are super small now, but there will be about 200~1000 in parallel use by up to ~10k agents - not all exactly at the same time, fortunately)

misty wedge
#

A half3 will be slower than a float3 iirc, since it needs to be convert back. It just saves some memory

warm panther
#

Yeah there's no distance metric for it... or even basic arithmetic. But memory transfer speed is usually the bound here.

#

I need to see how the GetHashCode works though, thanks for "reminding" me.

#

It's fast (maybe), uses ushort representations.

misty wedge
#

Yes, but it converts those to floats for calculations. If you are truly memory bound it might make a difference

warm panther
#

I wonder if I need it at all, I could use mesh index with these new data structures.

#

In modern computing, at least as Unity ECS has taught me, recalculating is often way faster than storing and loading.

misty wedge
#

It depends on the calculation and the amount of memory stored ๐Ÿ˜…

warm panther
#

Talking an order of magnitude or more.

misty wedge
#

That's one performance advantage of blob assets too, you are less likely to have cache misses

#

at least compared to data layed out with pointers

warm panther
#

Yes if it all fits into one or two cache lines, you are cool.
But these mesh structures don't fit into the L2 cache very well, so I'd rather keep them as small as possible so as much of it as possible fits.

hybrid jay
#

Anyway to turn off burst outside the editor?

#

The editor keeps crashing on startup

misty wedge
hybrid jay
#
    Managed Stacktrace:
=================================================================
      at <unknown> <0xffffffff>
      at System.Buffer:InternalMemcpy <0x00077>
      at System.Buffer:Memcpy <0x00052>
      at System.String:memcpy <0x00022>
      at Unity.Entities.Editor.ComponentDataDiffer:CanWatch <0x00052>
      at Unity.Entities.Editor.ComponentDataDiffer:.ctor <0x0006a>
      at Unity.Entities.Editor.HierarchyEntityChangeTracker:.ctor <0x00112>
      at Unity.Entities.Editor.HierarchyUpdater:SetWorld <0x000ca>
      at Unity.Entities.Editor.Hierarchy:SetWorld <0x000ba>
      at Unity.Entities.Editor.HierarchyWindow:OnWorldSelected <0x00032>
      at Unity.Entities.Editor.DOTSEditorWindow:Update <0x000e7>
      at Unity.Entities.Editor.HierarchyWindow:OnBackgroundUpdate <0x0007a>
      at UnityEditor.EditorApplication:Internal_CallUpdateFunctions <0x000df>
      at System.Object:runtime_invoke_void <0x00084>```
hybrid jay
misty wedge
#

It's in the project settings

hybrid jay
#

yeah but is that easily accessible?

warm panther
#

Yes.

misty wedge
#

It's two clicks, so I'm not sure what you mean

#

You'll need to rebuild the project though

hybrid jay
warm panther
#

There is a ProjectSettings directory. You can open the asset for the respective setting there.

misty wedge
#

Tried clearing the library folder?

#

It's unusual for the editor to immediately crash like that

warm panther
#

BurstAotSettings_StandaloneWindows.json for example

#

@misty wedge Thanks so much once more for the inspiring conversation and advice. ๐Ÿ™‚ I'll take a break and get back to coding.

hybrid jay
misty wedge
misty wedge
hybrid jay
misty wedge
#

Odd

#

This is the contents of the file

#
{
  "MonoBehaviour": {
    "Version": 4,
    "EnableBurstCompilation": true,
    "EnableOptimisations": true,
    "EnableSafetyChecks": false,
    "EnableDebugInAllBuilds": false,
    "CpuMinTargetX32": 0,
    "CpuMaxTargetX32": 0,
    "CpuMinTargetX64": 0,
    "CpuMaxTargetX64": 0,
    "CpuTargetsX32": 6,
    "CpuTargetsX64": 72,
    "OptimizeFor": 0
  }
}

#

It will probably not help you though, since that only disabled burst for builds

#

(afaik)

#

Not sure where unity stores the enable compilation flag for burst, maybe in editor prefs or something

hybrid jay
#

just doing a library deletion

#

will try adding the json after

#

though yeah, probably wont help if its only for builds

#

oh, good the library fix worked

hybrid jay
#

This is actually the most useless error

#
guid = 29242:0:00000000:00002710, count = 1, obj = StarBase (UnityEngine.GameObject)
#

The prefab has unique components that none of the other ones have (including a baker with a unique tag component)

#

So i've got no idea how theres something with the same guid

#

and its not a subscene object issue as that prefab is not even in a scene and is only spawned later

hybrid jay
#

Anyone have any idea why this bit of the Netcode Package is producing this error?

InvalidOperationException: The BlobAssetReference is null.
Unity.Entities.BlobAssetReferenceData.ValidateNotNull () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/Blobs.cs:279)
Unity.Entities.BlobAssetReference`1[T].get_Value () (at Library/PackageCache/com.unity.entities@1.0.0-pre.15/Unity.Entities/Blobs.cs:385)
Unity.NetCode.GhostCollectionSystem.RuntimeStripPrefabs (Unity.Entities.SystemState& state, Unity.NetCode.NetDebug& netDebug) (at Library/PackageCache/com.unity.netcode@1.0.0-pre.15/Runtime/Snapshot/GhostCollectionSystem.cs:594)
Unity.NetCode.GhostCollectionSystem.OnUpdate (Unity.Entities.SystemState& state) (at Library/PackageCache/com.unity.netcode@1.0.0-pre.15/Runtime/Snapshot/GhostCollectionSystem.cs:234)
#

I havent touched any of the prefabs and i've got no idea how these blob assets are being made

#

Weird errors like those i seem to always get when using Dots

#

for future reference for anyone else dont add the ghost authoring component on gameobjects before making them prefabs

#

apparently that breaks random stuff

#

the DOTS experience in a nutshell

rotund token
barren scaffold
hybrid jay
hybrid jay
barren scaffold
rotund token
#

anyone ever looked at editor iteration profiler?

#

i really wanted to know what the slow domain was about

#

death by 10000 cuts

#

1.7seconds on burst and job init, 1 second on InitializeOnLoad editor stuff

#

approaching a second to reload 5 tiny subscenes

#

was hoping for some low hanging fruit

#

setup type cache another second

#

loading assemblies themselves 1.8 seconds

#

repaint all UI, 900ms

covert lagoon
#

I want to know why after creating an empty project by manually creating a directory with Assets and ProjectSettings subdirectories, installing URP doubles Unity's after-start-up RAM usage and installing ECS packages doubles the time Unity takes to start up.

stone osprey
#

Since burst code can not reference classes n stuff... what do you think about bevy handles approach ?

It works kinda like this:

public class Handle<T>{
    public static List<T> items;
    public Handle<T> Add(in T t){ return new Handle<T>{ Index = items.Add(t); } }
    public T Get(in Handle<T> t){ return items[t.Index]; }
}

var goHandle = Handle<GameObject>.Add(new GameObject()); // Handle stores a List of all gameobjects and basically returns their index
myEntity.AddComponent(goHandle);

Entities.ForEach(ref Handle<GameObject> handle) => {
   var gameObject = handle.Get();   // 
   gameObject.... // Do something with gameobject and its burst compatible since the entity itself does not contain references :) 
});

So each entity basically manages their managed resources with handles. Handles point towards a list entry where the pointer/class is stored at. And when we need to acess it, it can be easily acessed in a burst friendly way.

Is this usefull ? Or does this have disadvantages ?

rotund token
#

i don't get what this has achieved?

#

gameObject.... // Do something with gameobject and its burst compatible since the entity itself does not contain references :)

#

you can't use a gameobject in burst

#

this hasn't changed anything

#

entities are allowed to reference gameobjects, burst is not

#

you can literally just do this
EntityManager.AddComponentObject<GameObject>(entity, go)

#

Entities.ForEach((GameObject go) => {}).WithoutBurst().Run();

#

this is legal code

stone osprey
#

Hmmm alright... i think i missunderstood that.

Besides that, would this make sense for ECS in general ? I saw bevy ( rust engine/ecs ) use something like this. And i wondered if its considered usefull or good.

Like it basically means that each entity requires one more additional lookup and the list that stores the handles is also loaded into cache each acess... I also wondered if its compatible with ECS terms.

rustic rain
#

GameObject class is managed

#

But some internal cpp parts aren't

#

There is ptr to them, but I dout it's any use

strange wagon
#

Hi! I have netcode error when trying to connect my client to server, even if server not running
https://monosnap.com/file/V4AJxq8Lgzpz1rcADOamLwWDVfKC5Y
var networkEndpoint = NetworkEndpoint.Parse(ip, ParsePortOrDefault(port));
{
using var drvQuery = client.EntityManager.CreateEntityQuery(ComponentType.ReadWrite<NetworkStreamDriver>());
drvQuery.GetSingletonRW<NetworkStreamDriver>().ValueRW.Connect(client.EntityManager, networkEndpoint);
}

rustic rain
#

Unity made tranform access job to burst transform code, so that's as far as it can go

rotund token
#

this should be created/called in your Connect method

winter depot
#

What is SystemAPIQueryBuilder? Is it something not yet utilized?

covert lagoon
#

Looks like it's like EntityQueryBuilder but you won't have to pass the system's this to the Build method.

winter depot
#

That's what it looks like to me, but incomplete?

rotund token
#

How so?

#

What's missing from it

winter depot
#

Maybe I am initializing it wrong or something, but I get a crash every time I attempt. One attempt that didn't crash said something about failing code generation

covert lagoon
#

I see SourceGenTests.CheckForNoError<SystemGenerator>.

winter depot
#

To be fair my unity crashes 50% of the time on domain reload anyway so could be anything

rotund token
#

Hmm I nearly use it exclusively

#

and not had an issue

winter depot
#

Do you mind showing a code example?

rotund token
#

sure

#

i have 41 of them, here are a few examples

winter depot
#

Hmm, looks exactly like what I've attempted. Maybe ill try regenerating some files or something

covert lagoon
#

So I'm supposed to use SystemAPI.QueryBuilder() instead of new EntityQueryBuilder(Allocator.Temp), in system OnCreate()s at least?

rotund token
#

you don't even need to use it in oncreate

#

you can just use it directly in OnUpdate then and not cache the query

#

as it'll cache it for you

covert lagoon
#

Oh right that's the point of SystemAPI.

#

Why do the manuals not show SystemAPI.QueryBuilder() instead then?

winter depot
#

Ok.. Its worked fine now. Sorry for the trouble,

covert lagoon
#

Well the Netcode for Entities manual also shows Entities.ForEach.

#

Wait no.

#

I'm confusing it with something else I think.

#

Yeah it's not the Netcode for Entities manual that uses Entities.ForEach in examples.

#

It's the Entities manual that uses Entities.ForEach in some examples.

winter depot
#

Well, its still usable. lol

#

They got some catching up to do on manuals and what have you. Having a nice holiday ๐Ÿ˜„

#

Btw do I still need to be on 2022.2.0b16? Or is there a more stable build that can work with the current packages

covert lagoon
#

Here the queried NetworkIdComponent is left unused. Should use .WithAll<NetworkIdComponent>() instead.

covert lagoon
#

I'm on 2022.2.1f1.

winter depot
#

Thank god

covert lagoon
#

I tried one of the 2022.2 betas, forgot which one, but I remember it being pretty buggy yeah.

#

You should try 2022.2.1f1, hopefully your problem of Unity crashing on 50% of domain reloads will disappear.

winter depot
#

Installing now, this is great news

covert lagoon
rotund token
#

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

covert lagoon
#

More typing for no benefit.

viral sonnet
#

RefRO for a single int is indeed not that great. it can have its purpose when the access can get vectorized but in this case i doubt it

covert lagoon
winter depot
#

Entities that use manually registered IDs don't need to have a RenderMeshArray component, while entities that use array indices must have one. Entities Graphics 1.0 entity baking uses RenderMeshArray. This is nice, as it should speed up the inspector window and make things more manageable. The confusing part for me is that RenderMeshUtility.AddComponents() requires a render mesh array by default. You can pass an empty one, but I would think the method would have an option where its unnecessary to pass.

viral sonnet
#

oh what, math.slerp only has quaternion as parameter.

#

that's great when the Vector3 source consists of a call to Vector3.INTERNAL_CALL_Slerp(ref a, ref b, t, out vector3);

#

oh well, gonna have to go in a roundabout way through a lookAt quaternion

void girder
#

I'm noticing that calling SetSharedComponentFilter() on an EntityQuery adds that shared component data to the EntityManager.GetAllUniqueSharedComponents() nativelist output. Anyone getting this behavior? Is it a bug?

rotund token
#

this seems expected

#

GetAllUniqueSharedComponents just returns all unique components an EntityManger is aware of atm

#

regardless an entity has the component or not

tribal pollen
#

Whatโ€™s a good way to profile your game performance and figure out out where the slowness is?
Besides looking at the milliseconds of the systems as they run

rotund token
#

the profiler

deft ridge
#

Handles.zTest is invalid in DOTS ScreenView, has anyone encountered it?

#

I guess it's a problem with different rendering pipelines?

#

I use entities.graphics

tawdry mulch
#

anyone knows why my default capsule game object isnt showing up in playmode?

tawdry mulch
deft ridge
# tawdry mulch i mean what else can u use besides entities.graphics

I tested it myself again, and it was a problem with my custom shader. Compared with URP lit, lit supports ztest, but my custom shader doesnโ€™t work. I didnโ€™t find any problems. My zwrite on ztest is on. Now judge the point in Screenview temporarily distance to optimize my debug display

#

Also, I use Handles.DrawAAPolyLine /lit shader, Handles.zTest is available, but Handles.Label doesnโ€™t work

#

SceneView.currentDrawingSceneView.camera.transform.position

tawdry mulch
#

gameview

deft ridge
#

in subScene?

tawdry mulch
#

wdym? there's a special gameview for subscenes?

covert lagoon
#

Can you show what it looks like in the inspector?

deft ridge
#

Can you check the baker process

tawdry mulch
#

SceneView

#

GameView

deft ridge
#

camera pos?

tawdry mulch
#

camera is fine

deft ridge
#

what material shader use

tawdry mulch
#

default for capsule

#

they werent kidding when they said not yet production ready

deft ridge
#

what it looks like in the inspector?

tawdry mulch
deft ridge
#

runtime

tawdry mulch
#

still the same when set to runtime

covert lagoon
#

Show all the components it has

tawdry mulch
deft ridge
#

this i am fine

tawdry mulch
deft ridge
#

frameDebuger

tawdry mulch
#

haha when i remove the objects from the subscene, there are 36 calls but this one has 6

#

it's completely ignoring whatever is in the subscene

covert lagoon
tawdry mulch
#

nope

covert lagoon
#

Universal RP/Lit?

tawdry mulch
#

not installed

covert lagoon
#

You need the SRP.

#

Either URP or HDRP.

#

Built-in render pipeline won't work.

tawdry mulch
#

christ

deft ridge
#

๐Ÿคฃ

tawdry mulch
#

oops i thought entities graphics is a render pipeline

#

this is my bad

#

because i remembered we used hybrid renderer

rustic rain
scarlet inlet
rustic rain
#

or roll your own runtime creation pipeline (slow)

scarlet inlet
#

in the last post I showed a not perfect yet code to load a subscene in a custom world

rustic rain
#

Try using ICustomBootstrap

scarlet inlet
#

but I have asked if there is a better way to do so

rustic rain
#

to create your own default world

scarlet inlet
#

the code I pasted in the thread shows that I have already a custom world

rustic rain
#

you don't need either of those directives

scarlet inlet
#

I need to update the custom world myself, the point is that I am using UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP and no explicit update must be done (unless I do it manually)

rustic rain
#

You can simply use ICustomBootstrap and not add any systems

#

except for scene systems for example

scarlet inlet
#

but then I have to call Update() manually to run the scene system

rustic rain
#

I wonder if Unity has enum to filter SceneSystem

scarlet inlet
#
while (SceneSystem.IsSceneLoaded(customWorld.Unmanaged, sceneEntity)
                == false)
            {
                customWorld.Update();
                await Task.Yield();
            }
rustic rain
#

they exist in InitializationSystemGroup

#

which you can create manually

#

or automatically

#

such main system groups are attached directly to GameLoop

scarlet inlet
#

anyway I had some troubles, i.e. the code works, but not with IL2CPP for example. For some reason the scene doesn't load in an IL2CPP client but it does in a mono client

rotund token
#

i would be very doubtful if you could do runtime baking properly, , but even if you could it would be so much slower than just writing your own quick conversion system without the tracking overhead

#

I am not really sure about how to create entities from unity prefabs without needing a subscene
you're not really meant to

#

anyway how are you creating your worlds?

#

even if you UNITY_DISABLE_AUTOMATIC_SYSTEM_BOOTSTRAP you should generally still call
DefaultWorldInitialization.Initialize("worldName")

#

and implement ICustomBootstrap to manage the world

#

this is required to setup Entities Journaling, profiler and other tools

#
        {
#if ENABLE_PROFILER
            EntitiesProfiler.Initialize();
#endif

#if (UNITY_EDITOR || DEVELOPMENT_BUILD) && !DISABLE_ENTITIES_JOURNALING
            EntitiesJournaling.Initialize();
#endif```
#

personally if you have an existing project with custom workflow like this, i would recommend just sticking with 0.51 (that's what we've done) as you are not really benefiting from the pain of upgrading

#

Anyway I guess up answer your question, il2cpp is probably stripping your bakers as there will be no references to them

mild ledge
#

If I create a NativeCollections with a temp allocator inside a method, do I need to dispose it at the end of the method or no?

rotund token
#

No

#

Temp does not need disposing

mild ledge
#

Thanks for confirming

olive kite
#

I'm using a collisionWorld.CalculateDistance(pointDistanceInput, ref targetsFound) and trying to determine if a target has a particular collider tag, would collider tags need to be queried and passed in the system to access that information or is there any way to get that from the DistanceHit?

#

oh, CustomTags in Material, i see

strange wagon
# rotund token where are you calling this code?

I call it via UI from client. I trying to use Manually Listen/Connect but also I have custom NetCodeBootstrap : ClientServerBootstrap class. Should I delete my bootstrap if I use manually connect?

#

I'm looking at the Network Racing Sample and it has both an override of NetCodeBootstrap and a manual connection to ServerConnectionUtils

covert lagoon
#

There's no default world with Netcode anymore? Just the client and server worlds?

#

What does ClientServerBootstrap's Initialize method do with defaultWorldName then?

#

Oh it just does nothing with it.

tawdry mulch
#

how are we integrating the new InputSystem into ISystem?

rustic rain
#

and call managed code in OnCreate

#

or don't use ISystem at all

viral sonnet
#

just sample inputs in SystemBase and save them in a struct. InputSystem generates a managed class or has managed calls so no real way around it that i'm aware of.

tawdry mulch
#

๐Ÿ˜ญ okay thank u

#

Send Messages doesn't seem to work on objects in a subscene :/

viral sonnet
#

why would it? GOs and MBs are not present in subscenes. it would only work in editor when the scene is open

tawdry mulch
#

I am even trying it on a MonoBehaviour component and it still isn't working

#

Oh it seems MB doesn't start at all in a subscene. SystemBase works.

#

unsurprisingly, it doesn't work in ISystem either

tawdry mulch
rustic rain
#

So can you

tawdry mulch
#

I get this error

ArgumentException: The system Controller cannot contain managed fields. If you need have to store managed fields in your system, please use SystemBase instead. Reason: Controller.<TestPlaygroundInput>k__BackingField is not blittable because it is not of value type (TestPlaygroundInput)
rustic rain
#

public class Lul : IComponentData { public InputActionsAsset kek;}

tawdry mulch
#

hurh.. okay ill try that

tawdry mulch
rustic rain
#

ComponentObject

tawdry mulch
rustic rain
#

AddComponentObject

#

ManagedComponents are managed separately

viral sonnet
tawdry mulch
viral sonnet
#

so? there's not much use for a non-burst compiled ISystem

rustic rain
tawdry mulch
rustic rain
#

EntityManager.AddComponentObject

tawdry mulch
rustic rain
tawdry mulch
# rustic rain I fixed typo

that method takes a componentData
public void AddComponentObject(Entity entity, object componentData)

how do i even give it that from inside ISystem?

rustic rain
#

create it

tawdry mulch
tawdry mulch
void girder
#

Look at past messages it seems like it's difficult to spawn additional entities with Baking Systems. How are most people doing it atm then?

rustic rain
tawdry mulch
#

like this

tawdry mulch
rustic rain
#

new DefaultInputActions();

tawdry mulch
# rustic rain `new DefaultInputActions();`

As in these callbacks though

}
  PlatformerInputActions inputActions = new PlatformerInputActions();
  inputActions.Enable();
  inputActions.Player.SetCallback(this);
}

public void OnThrottle(InputActions.CallbackContext ctx) {
  Debug.Log(ctx);
}
rustic rain
#

What about them? You store them on your inputActions asset

tawdry mulch
# rustic rain What about them? You store them on your inputActions asset

But this is how it's usually done?

public class Controller : MonoBehaviour, TestPlaygroundInput.IPlayerActions {
    TestPlaygroundInput TestPlaygroundInput { get; set; }

    void Start() {
        print('start');
        this.TestPlaygroundInput = new TestPlaygroundInput();
        this.TestPlaygroundInput.Enable();
        this.TestPlaygroundInput.Player.SetCallbacks(this);
    }

    public void OnThrottle(InputAction.CallbackContext context) {
        Debug.Log(context.ReadValue<float>());
    }
}
#

the asset contains the TestPlaygroundInput class

#

you create an instance of that class in your MonoBehaviour script and tell it which methods to call'

rustic rain
#

store you managed objects on managed component

#

that LulKek example I send earlier

#

btw

#

the exact way you use it

#

is not possible with ISystem

#

neither with SystemBase

tawdry mulch
#

ah i thought so

rustic rain
#

you can only register them

#

manually

tawdry mulch
#

the only way is that shitty if chain :/

rustic rain
#

like inputActions.UI.Cancel.performed += MyMethod;

tawdry mulch
#

oh that can work?

#

on ISystem?

rustic rain
#

yes

#

I don't get

#

why you need ISystem here

#

though

tawdry mulch
#

because its cool, thats all

rustic rain
#

But you don't use ISystem

#

at all

#

doing that

tawdry mulch
#

yeah but the class uses the interface

#

imagine a codebase with 0 SystemBase

rustic rain
#

like I mentioned, you can't use it this way

rustic rain
#

lol

#

besides

#

nothing wrong with SystemBase

#

I have tons of them for UI stuff

tawdry mulch
#

):

rustic rain
#

use them properly

#

ISystem is good when you work with unmanaged data

#

because it can be easily bursted

#

SystemBase is good when you work with managed data, because you can store some references inside

tawdry mulch
#

not OnCreate but some other method?

rustic rain
#

when exactly do you want to use burst?

#

You don't even need ISystem to use burst

tawdry mulch
#

u dont?

#

then whats the point of ISystem

mystic mountain
tawdry mulch
rustic rain
#

do you even know what ECS is?

tawdry mulch
#

yeah u split ur usual OOP stuff into entities, components, and system

rustic rain
#

well, ISystem is system

tawdry mulch
#

yup

#

more [BurstCompile] = better yes

mystic mountain
# tawdry mulch so ISystem is viable and useful?

Since you're writing from the input actions values, it needs to access managed memory, thus it needs to be in a SystemBase. But you read the values and put it into a job that is bursted if you want ๐Ÿ˜… Then everything doesn't need to be bursted either.

tawdry mulch
#

oh and another reason to use ISystem is reduced SourceGen compilation time

viral sonnet
#

SystemBase goes through the same codegen

tawdry mulch
viral sonnet
#

no idea what they are referring to. it's very likely it's because of Entities.ForEach codegen which is indeed a problem. but that's totally optional.

#

just checked to confirm. there's no difference between ISystem/SystemBase codegen when all you do is have a queryBuilder and schedule a few jobs. apart from a few single lines the output is the same.

#

but with a single Entities.ForEach in SystemBase codegen takes longer. it's the reason why idiomatic foreach was introduced

proud jackal
#

Enzi is right :3

viral sonnet
tawdry mulch
viral sonnet
#

to get the actual tick which is used for some inputs. it prevents double jumping in case more FixedUpdate ticks are occuring in a single frame

#

remember that FixedUpdate can happen multiple times in a frame unlike Update

hot basin
#

do we know when 1.0 will be released? I thought it would be when 2022.2 will come out

#

is 2022.3 LTS the target?

rotund token
#

LTS is a likely target

#

but apart from a different version number, does it matter if it's called pre or not

rustic rain
#

I hope for critical bug fix (mat override) very soon and then I'll switch over to Latios Transforms

rustic rain
#

Can't bother waiting so much

hot basin
#

besides patches there shouldn't be anything major

rotund token
#

they've been doing their major updates every 3months

#

and last i heard there would be a minor update end of jan

hot basin
#

can I use released 2022.2 with current pre15 version of ECS?

rotund token
#

yes

rotund token
rustic rain
#

Latios is making his own transforms

#

so I want to switch to it once he is done (late jun/early feb)

rotund token
#

im aware but why the hell would you use it

rustic rain
#

Animations

#

And Physics

#

his Physics are much less boilerplate (allthough I haven't tried it in actual project)

#

also

#

no hybrid

#

which I am done with

#

I literally began to making sprite renderer using Entities graphics, but stuck because material overrides don't work

hot basin
#

OK sorry for silly questions but I'm coming back to ECS after some time. Should I use Transform aspect or any of the Transform component?

rustic rain
#

I don't like Transform aspect

rustic rain
#

Transforms generally are much easier to use now

#

which I like

#

sadly Latios won't support them

#

because they don't fit his animations

rotund token
#

his whole framework doesn't fit entities design

#

the whole reason his framework exists is because he doesn't agree with the unity packages

rustic rain
#

what he does is designed around pure ECS

#

as he points out some bad OOPish design choices with physics

#

but once again

rotund token
#

TL;DR โ€“ Unity.Physics and I donโ€™t get along.
his summary of why he wrote his own physics

rustic rain
#

I never really dug in

hot basin
#

I see two conflicting answers ๐Ÿ˜„ any comments on why should I use certain approach?

rotund token
#

and then goes on a 234 page rant about it

rotund token
#

whole point is it wraps the components

#

you need a lot of manual checks if you use components

#

does world component exist? if not use local otherwise use world

#

the only time i use components is when i want to do low level memory operations on them

#

like memcpystride

#
    ? transforms.WorldTransforms().Slice().SliceWithStride<float3>(0)
    : transforms.LocalTransforms().Slice().SliceWithStride<float3>(0);``` for example
hot basin
#

so entity can have one and not the other component

#

strange

rotund token
#

atm world is always added

#

but in theory it doesn't need to

#

the aspect has world transform marked as option

#

and the design of the baker overrides implies it should be optional

#

(the overrides dont work atm except manual)

#

if you are a root object, having worldtransform is just wasted chunk space and processing power

hot basin
#

ok then TransformAspect it is

hot basin
rotund token
#

you mean your own stuff?

hot basin
#

yes

rustic rain
#

Aspect is just a layer between Logic and Data

#

which you can use for convinience

#

so use it as you like

#

I only use them when amount of components is large or reusable

hot basin
#

but I assume I shouldn't abuse it because of getting data I don't need?

rotund token
#

definitely has downsides of bringing in extra components/dependencies/etc if you don't need them

hot basin
#

๐Ÿ˜„

#

thanks a lot!

#

hate coming back to ECS after a while

rotund token
#

dont go away then

hot basin
#

I wish ๐Ÿ˜„

rustic rain
#

I can't bother working with OOP, so I never leave

hot basin
#

I hope I find a job which includes ECS