#archived-dots
1 messages ยท Page 60 of 1
index in inmanaged component should be valid
because internally they are used to render your mesh/material pair
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
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
this is one of the entities after spawn, at runtime
so the mesh index of 311 looks ok
and this is the target mesh in the shared managed component
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
yeah i'm not, i'm just showing that it does match up with that list
this is how, same as we discussed, with reflection:
irrelevant, whatever indices it has, are not meant to match MMI component
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
just use brg one
it works and it's faster
and show what error does it even give you
yeah the brg is faster, but i tested with both, and both throw this error
and as mentioned, both work fine for objects that are already 'spawned' ie active within the baked subscene
hopefully it shows all registered assets
yeahhhhhhhhhhhhh figured i'd ask if you'd had this
have you tried brg.GetRegisteredMesh on a runtime spawned entity?
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
that's exactly what i'm doing
just debug it and see what's going on exactly
your error mentions
some out of bounds error
i think possibly i might be hitting GetRegisteredMesh too soon after spawn or something
with very huge number
or maybe need an updated reflection reference to the brg or something
potentially there is smth else behind this error ๐
I use [CreateAfter]
because from what I remember, BRG is created in OnCreate
actually
let me lookup that code
it could actually be where my system is positioned in relation to init or presentation
[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);
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:
var meshInd = aspect.mmi.ValueRO.MeshID;
this is how I obtain meshID
MaterialMeshInfo.MeshID
practically the same
BatchMeshID
I store it as this type though
and then like this var mesh = _brg.GetRegisteredMesh(pair.Key);
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
you can ensure your system runs after all subscenes are loaded
allthough nvm
seems like your case is different from mine
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
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
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
i think this is DOTS' secret pr0n stash..
where it keeps all it's dodgy mp4's
๐
Could you just get all scenes and exclude any in build scene list
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
How can I force the inspector select a specific entity? Create an EntitySelectionProxy and set Selection.activeObject to it?
I guess the only downside is that the objects are only cleaned on Resources.UnloadUnusedAssets iirc
unless you manually destroy it on unselection
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
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
There's actually a EntitySelectionProxy.Select(World, Entity) method that I missed
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)
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);
}
๐
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
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
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
You can you're accessing them the legacy way
You should access command buffer systems via singletons in 1.0
var system = SystemAPI.GetSingleton<EndInitializationEntityCommandBufferSystem.Singleton>();
var ecb = system.CreateCommandBuffer();
you don't need AddHandleForProducer when doing it this way
cool thx
I can't have a MonoBehaviour inside a namespace anymore?
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
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.
is the Filename exactly the same as the MonoBehaviour name?
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.
What's your namespace
Then I removed it entirely, could find it again.
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
Then I added it back, and now I can still find it.
EcsTutorial.Authoring.
Yes.
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
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.
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
Weird, I don't think I've ever had this issue
All of my scripts are in namespaces as well
I've always had a sneaking suspicion it's VisualStudio related tbh
Rider from JetBrains is very enjoyable to work in with Unity. Just a random recommendation ๐
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
Not wrong.
sigh Unity.Logging why do you not respect my authority
๐ฅฒ 20 mins
.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
i've been seeing unity api services fall over a lot recently
on forums, logging in via hub
yeah
it's not good
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)
I am lucky it built after that fast
yeah thankfully incremental will rebuild fast
i came to a similar conclusion with adobe software
if someone can offer me a better service, I am going to be tempted to take it
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
oof 20 minutes for a build
the loop being, of course, a perpetual loop of utterly needless updates that achieve nothing and give you nothing
Whats the best way to generate a seed for a random inside an ISystem?
hmm good question
actually nvm, can just not burst the OnCreate and use DateTime?
maybe just generate a seed in OnCreate and increment it each frame (or power prime or something) [what you said]
Why does TransformAspect.LocalPosition appear as readonly in the docs? https://docs.unity3d.com/Packages/com.unity.entities@1.0/api/Unity.Transforms.TransformAspect.LocalPosition.html#Unity_Transforms_TransformAspect_LocalPosition
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?
is there anyway to get read write access to a singleton component in a monobehaviour?
wait a second, does the SystemAPI work in monobehaviours?
no, sadly they do not
no as you discovered it's 'System' API
i was hopeful atleast...
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
i use a system but i use UI toolkit instead of ugui
i think it works much nicer with entities
haven't heard of either of them, so ill look into them, thanks
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 ^^
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
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.
you updated from 1.0 exp to pre right?
hmm not sure
i didn't think much changed here graphic wise
yeah.
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
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 ๐
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)
let's pray they don't remove this chat from public
i should probably have a look at this at some point
just do
you can login with google account
his knowledge is limited up to 2021 though
which is obvious dealbreaker for dots
more like effort and lack of need atm
nah, just a little bit of fun
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
@rotund token btw sir, have you tried to tie New Input System with UI toolkit?
keybinds for UI and etc?
yes i only use inputsystem/uitoolkit
mind explaining how you tied them?
it has built in support
wait what?
don't really need to do anything
how?
I want basic Cancel event registration
and then?
I know
but I mean
I want my window to close on Cancel event
as one of examples
have you done similiar stuff?
i just call
ClientState.UICloseAllPopupsOrPop(ref systemState)
I used to do it with stack as well, but I didn't like the approach
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
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)
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
i consider my implementation a variation of mvp
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
neither does mine
except i use my K system
private struct KeyWindow
{
[K("UIStates")]
public byte Key;```
{
[SerializeField]
[K("UIStates")]
private byte[] defaultStates;```
nnah, I don't want to rely on indices in any way
you dont reply on indices
its a dictionary string -> int
it's all data driven
you never use the index yourself
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
๐ค
you have an issue debugging all you get is a hash
that could be release only
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
how do you manage states this way anyway?
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
I'm talking about editor window in which they appear and you can edit them
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
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 ๐
there are some tools for this, like this will popup a window in a query
you can also pin 2 inspectors still
OK, I might just be a little bit blind and made a big ol' box of text lol. Egg on my face ๐
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
Thanks tertle โค๏ธ
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)
I thought we had no tooling for it hence the egg on my face. Having something is vastly better than having nothing.
I don't really get it. So you create generic type. but what is KSettings?
can't find it in your Core/Settings folder
So, basically it's runtime enum?
yeah K is basically an enum replacement as well as a UnityEngine.LayerMask replacement in 1
it came about as a challenge of creating a way with burst I could replicate this
https://docs.unity3d.com/2022.2/Documentation/ScriptReference/LayerMask.NameToLayer.html
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
interesting
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
yeah, I get it
I'm interested
just currently extremely busy with little windows of free time ๐
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)
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 )
is it possible to add more values to settings in runtime?
for example by loading new assembly?
to specific settings I mean
the values are loaded at runtime
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
any example of Init implementation?
K<T>.Initialize(this.Keys);
is all it does
which just creates a hashmap
Map.Data = new KMap(kvp);
https://gitlab.com/tertle/com.bovinelabs.core/-/blob/0.11/BovineLabs.Core/Keys/K.cs
so, for each generic implementation of K<T>
there is SharedStatic assoiciated
And how is it used in Burst then?
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
I mean, how do you use it in Burst code?
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
I see
I don't like the idea of using string in code though
I prefere to wrap all around const
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
I wonder if Burst can convert to Hash during compilation
(since I used a fixed hash map so i don't have to worry about allocations)
I'm fine with hash
in my implementation there is going to be an array
with real strings
which index will equal index of hash in array
hence the random suggestion
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
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
not really
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
ah i see why you were interested in the above
or whether I should even use stirng at this point
Q: When do I use ISystem, when do I use SystemBase? I... don't get the difference anymore, other than some API calls differing.
https://forum.unity.com/threads/isystem-vs-systembase.1357655/ Seems like I am not alone ๐
ISystem gets bursted, SystemBase doesn't
if you use burstcompile attribute
SystemBase can store managed references, ISystem can't
I think you can store managed references in a non-burst compiled ISystem?
I don't think I've tried it though
no
What happens?
it throws error on init
ISystem's are stored in unmanaged way
managed struct will break it
Weird that they don't have a compile error for that
I guess I never tried it ๐คทโโ๏ธ
Can I schedule jobs from ISystem?
kk, thanks!
I have given up. ๐
Q: Are there equivalents to:
Bounds.Encapsulate
and
Bounds.IntersectRay
in DOTS / Unity Mathematics? (for Unity.Mathematics.AABB)
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.
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
Yeah.
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
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)
Why not just store the entity reference to the navmesh and use a component lookup?
The entity holding the NavMesh and the entity that the pathfinding operates on are separate.
Yes, that's what the component lookup is for
I'd argue it's actually more boilerplate ๐
But it depends on how your project is setup
Ah, you are using the physics world index
Then it's fine I suppose
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. ๐
I recommend you eventually move this to a job though, since pathfinding is usually computation heavy
I love them โค๏ธ
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.
Only a mother can love this code. ๐
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
Yeah I don't like this pattern at all. ๐
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
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.
Yes, since it wants a ref to a BlobArray
(which can only exist on a constructed root)
M'kay. ๐ But this is very helpful.
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
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?
I don't bake the blobs, I convert them at runtime
The scriptable objects can be overwritten by mods
I don't think it's that special of an idea ๐
So you have a System that Resource.LoadAll<T>'s the SOs and turns them into Blobs?
They are loaded via addressables, then converted
Even better.
all the blobassetreferences are added to their respective dictionaries
Cool!
which can be indexed by a GUID type which just stores 4 ints
Yeah that's kind of how I do it with my nav meshes, but the ID is literally the physicsworld for now.
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
This injects into what?
Into a system
A Mono Behaviour or a Syst... ok ๐
SystemBase or ISystem
It's a custom attribute
basically injects a NativeHashMap<GUID, BlobAssetReference<T>> into the system
(for a specific scriptable object type)
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.
It's 50/50 if the error actually matters
I think I also get this but nothing broke, not sure though
Very cool, where in the PlayerLoop or Systems do you do this actual injecting? Or is it code generation?
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
Ok, seems like I'm kind of unaware when the code relating to attributes is actually executed. (despite having written a couple myself)
The attribute doesn't do anything, it's just there for the reflection to find the fields it needs to inject
So where and when do you run the reflection/injection? ๐
Just looking around for ideas and best practices.
It runs in a system after having loaded the scene for the the server / client
I see. ๐
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
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.
I made some changes to it though since it violates some parts of blob usage
(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)
A half3 will be slower than a float3 iirc, since it needs to be convert back. It just saves some memory
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.
Yes, but it converts those to floats for calculations. If you are truly memory bound it might make a difference
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.
It depends on the calculation and the amount of memory stored ๐
Talking an order of magnitude or more.
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
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.
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>```
is that in a file outside the editor?
It's in the project settings
yeah but is that easily accessible?
Yes.
It's two clicks, so I'm not sure what you mean
You'll need to rebuild the project though
i cant open Unity
There is a ProjectSettings directory. You can open the asset for the respective setting there.
Tried clearing the library folder?
It's unusual for the editor to immediately crash like that
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.
huh, cant find that
No worries, glad it helped you ๐ Note that this is just an approach that I came up with so your mileage may vary
What ECS version are you on?
latest
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
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
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
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
Are you trying to instantiate during baking?
im so new to dots idk what dots even is.
https://hatebin.com/cemepquqmk
can you tell me what this script does and how it works?
nope, was just a very weird bug
Thats more of a question for PraetorBlue since they gave you it. But not gonna lie since you didnt even know what a dictionary was in #๐ปโcode-beginner any explaining just wouldnt make sense to you. I'd recommend learning more of the C# basics first.
ik c# i just forget everything until i have to use it and then i have to learn it again lol
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
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.
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 ?
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
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.
Burst can only work with native unmanaged memory
GameObject class is managed
But some internal cpp parts aren't
There is ptr to them, but I dout it's any use
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);
}
Unity made tranform access job to burst transform code, so that's as far as it can go
where are you calling this code?
this should be created/called in your Connect method
What is SystemAPIQueryBuilder? Is it something not yet utilized?
Looks like it's like EntityQueryBuilder but you won't have to pass the system's this to the Build method.
That's what it looks like to me, but incomplete?
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
The code in this test is supposed to work apparently.
I see SourceGenTests.CheckForNoError<SystemGenerator>.
To be fair my unity crashes 50% of the time on domain reload anyway so could be anything
Do you mind showing a code example?
Hmm, looks exactly like what I've attempted. Maybe ill try regenerating some files or something
So I'm supposed to use SystemAPI.QueryBuilder() instead of new EntityQueryBuilder(Allocator.Temp), in system OnCreate()s at least?
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
Oh right that's the point of SystemAPI.
Why do the manuals not show SystemAPI.QueryBuilder() instead then?
Ok.. Its worked fine now. Sorry for the trouble,
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.
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
Here the queried NetworkIdComponent is left unused. Should use .WithAll<NetworkIdComponent>() instead.
You can use stable 2022.2 now that it was released.
I'm on 2022.2.1f1.
Thank god
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.
Installing now, this is great news
And NetworkIdComponent only stores a single int, why ever take it as RefRO instead of taking it by value?
why not ๐คทโโ๏ธ
More typing for no benefit.
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
Oh wait I don't want to cache the query when I'm creating it just to pass it to RequireForUpdate in OnCreate.
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.
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
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?
this seems expected
GetAllUniqueSharedComponents just returns all unique components an EntityManger is aware of atm
regardless an entity has the component or not
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
the profiler
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
anyone knows why my default capsule game object isnt showing up in playmode?
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
GameView or SceneView
gameview
in subScene?
wdym? there's a special gameview for subscenes?
Can you show what it looks like in the inspector?
Can you check the baker process
camera pos?
camera is fine
what material shader use
runtime
Show all the components it has
frameDebuger
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
URP default?
nope
Universal RP/Lit?
not installed
christ
๐คฃ
oops i thought entities graphics is a render pipeline
this is my bad
because i remembered we used hybrid renderer
Hybrid Renderer relied on SRP as well
Anyone would be so nice to share their thoughts about my problem here? https://forum.unity.com/threads/examples-of-using-dots-ecs-1-0-with-unity_disable_automatic_system_bootstrap_runtime_world.1380765/#post-8698701
well, you are meant to create import entities only through subscene
or roll your own runtime creation pipeline (slow)
in the last post I showed a not perfect yet code to load a subscene in a custom world
Try using ICustomBootstrap
but I have asked if there is a better way to do so
to create your own default world
the code I pasted in the thread shows that I have already a custom world
you don't need either of those directives
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)
You can simply use ICustomBootstrap and not add any systems
except for scene systems for example
but then I have to call Update() manually to run the scene system
I wonder if Unity has enum to filter SceneSystem
while (SceneSystem.IsSceneLoaded(customWorld.Unmanaged, sceneEntity)
== false)
{
customWorld.Update();
await Task.Yield();
}
they exist in InitializationSystemGroup
which you can create manually
or automatically
such main system groups are attached directly to GameLoop
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
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
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?
Thanks for confirming
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
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
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.
how are we integrating the new InputSystem into ISystem?
either store input actions map on component or somewhere else
and call managed code in OnCreate
or don't use ISystem at all
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.
why would it? GOs and MBs are not present in subscenes. it would only work in editor when the scene is open
Well, I've tried Send Messages, Invoke C# Event and generating the action script class. In every case, I can't retrieve the input :/
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
which means this isn't possible
how'd u do it?
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)
public class Lul : IComponentData { public InputActionsAsset kek;}
hurh.. okay ill try that
it says the input actions has to be non-nullable :/
ComponentObject
how? there's no monobehaviour
@tawdry mulch take a look at how Rival does it: https://github.com/Unity-Technologies/rival-samples/blob/master/Platformer/Assets/Scripts/Player/PlatformerPlayerSystems.cs
that one uses systembase
the errors dropped but are u doing something like this?
so? there's not much use for a non-burst compiled ISystem
AddComponentObject
yeah but i thought its cool haha, ill use systembase as a last resort
EntityManager.AddComponentObject
Entity has no AddComponentObject
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?
create it
do i put the input action callbacks in my authoring script?
this way kinda sucks too. he's if chaining all of his input actions
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?
no, you can create them out of anywhere
the same as how you do it always
like this
do you have an example? im at my wits end :/
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);
}
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'
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
ah i thought so
the only way is that shitty if chain :/
like inputActions.UI.Cancel.performed += MyMethod;
because its cool, thats all
like I mentioned, you can't use it this way
there are tons of default built in ones
lol
besides
nothing wrong with SystemBase
I have tons of them for UI stuff
):
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
but can't you partially use Burst on this implementation?
not OnCreate but some other method?
You can read the values and feed them into a Job
so ISystem is viable and useful?
do you even know what ECS is?
yeah u split ur usual OOP stuff into entities, components, and system
well, ISystem is system
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.
sounds good
oh and another reason to use ISystem is reduced SourceGen compilation time
SystemBase goes through the same codegen
the docs says otherwise
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
Enzi is right :3
yay ๐ can you maybe relay that information for the docs? increased SourceGen compilation time. to increased SourceGen compilation time when using Entities.ForEach (or something like that) here: https://docs.unity3d.com/Packages/com.unity.entities@1.0/manual/systems-comparison.html
i see, thanks!
Do you happen to know why they needed to create a uint fixedTick = SystemAPI.GetSingleton<FixedTickSystem.Singleton>().Tick; when they have already set this attribute [UpdateInGroup(typeof(FixedStepSimulationSystemGroup)]?
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
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?
LTS is a likely target
but apart from a different version number, does it matter if it's called pre or not
I hope for critical bug fix (mat override) very soon and then I'll switch over to Latios Transforms
oh yeah, I suppose so
Can't bother waiting so much
besides patches there shouldn't be anything major
they've been doing their major updates every 3months
and last i heard there would be a minor update end of jan
can I use released 2022.2 with current pre15 version of ECS?
yes
whats the issue? and what are you wanting from latios transforms
issue material overrides don't work
Latios is making his own transforms
so I want to switch to it once he is done (late jun/early feb)
im aware but why the hell would you use it
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
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?
I don't like Transform aspect
Aspect where you can
Transforms generally are much easier to use now
which I like
sadly Latios won't support them
because they don't fit his animations
his whole framework doesn't fit entities design
the whole reason his framework exists is because he doesn't agree with the unity packages
does it?
I never dug into it, but judging from his own description and thought process (which is part of manual)
what he does is designed around pure ECS
as he points out some bad OOPish design choices with physics
but once again
TL;DR โ Unity.Physics and I donโt get along.
his summary of why he wrote his own physics
I never really dug in
I see two conflicting answers ๐ any comments on why should I use certain approach?
and then goes on a 234 page rant about it
use aspect especially since the transform system might completely change
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
atm no
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
ok then TransformAspect it is
should I make "everything" into aspect or they have a downside?
you mean your own stuff?
yes
not really, but you can if you want to
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
but I assume I shouldn't abuse it because of getting data I don't need?
definitely has downsides of bringing in extra components/dependencies/etc if you don't need them
dont go away then
I wish ๐
I can't bother working with OOP, so I never leave
I hope I find a job which includes ECS
