#archived-dots
1 messages · Page 40 of 1
the only problem i see is that hierarchies are usually discouraged
you dont need a hierarchy though
but at some point there needs to be a good way of splitting up mega entities
ah true!
static optimize would remove the hierarchy
my abilities deparent themselves anyways because of physicsbody
what do i need to put into the entityquerymask parameter to not filter out anything?
EntityManager.UniversalQuery.GetEntityQueryMask()
thanks! i feel like that should be default
huh. every entity in the LEG needs to have the component else it throws an exeption. that means you need to have a querymask that contains the component at the very least.
hmm how and when are queries updated nowadays? everytime a system runs? would be quite a waste if it was always updated even if the system does not need to run
queryMask = new EntityQueryBuilder(Allocator.Temp).WithAll<AbilityHolderRef>().Build(this).GetEntityQueryMask();
doesnt the "this" register the query to the system?
might want to dispose query
should i do it diffrently?
you can pass EntityManager
yeah what issue said, dont use this, use entitymanager
and that wouldnt store the query? i just need to get the mask and not have the query registered anywhere. do it via entityquerydesc?
so the query isn't registered to the system
create query from EM, create mask, dispose query
win!
i assume at some point post 1.0 they'll probably add a nice SystemAPI get mask call
but for now what you got to do
got it! thanks
that and for the new ECB.SetComponentForLinkedEntityGroup(). as with setcomponentdata you need to make sure that all entities do have the component you want to set.
One of most underused features
No one really uses them but unity uses them a lot internally
so... it is filtering?
it's a very efficient way to check if an entity has X components
instead of like hascomponent & hascomponent & hascomponent
interesting. it seems like SetComponentForLinkedEntityGroup() ignores the "mainentity".
@rotund token ecb.ReplaceComponentForLinkedEntityGroup(); is the actual thing i want. same as SetComponentForLEG but skips entities that dont have the component. so no mask needed
im a little sad it doesnt work in parallel. i dont think youd need an ecb in every case.
thinking about it it would probably just lead to bad patterns
is there a way to see the bakingworld in the systems window?
Hmm if selecting show advanced worlds doesn't work then probably not
i can only see loadingworlds with advanced worlds enabled
just wanted to see the actual order of baking systems.
are there any standart commandbuffersystems in the baking world or should i just play back my buffers myself
play them back yourself
how are bakingsystems actually updated? do they only run over entities that have changed or do they run over all entities whenever i change any entity?
I basically wanna know if i should generally use bakingsystems more than bakers since they can be bursted and run in parallel. it wouldnt make sense to run bakingsystems if they'd rebake all entities on every single change.
i think you should do as much as possible in Bakers
Hello everyone, how can I set breakpoints in a .ForEach lambda?
I upgraded to burst 1.8.1 but the breakpoints aren't hit.
Using .WithoutBurst or disabling burst compilation entirely doesn't make a difference for me
Debug.Log statements work fine but it's time consuming
ForEach is obsolete
I use ECS 0.51 with 2021.3.10f1
huh? i thought they just removed it from ISystem
will it be removed from SystemBase too?
not a big issue since i slowly want to migrate to ISystem anyways but its news to me
when i instantiate an entity is the disabled component removed like the prefab component? i cant find it in source.
nvm . problem was i didnt include prefabs in the query where i added the Disabled component. you didnt have to include prefabs in conversionsstems so i got confused there
Lambda ForEach are still supported in SystemBase but probably will be on life support rather than any additional functionality. In ISystem, it's dead and buried.
Unity devs while not directly saying it seemed to make it pretty clear EFE is unlikely to be around forever
Yea. ISystem seems to be the future moving forward and a feature not supported in it is definitely on the chopping block.
Wait, how is this possible, burst compiled add managed component? Lets see if it works in playmode
Wait no, it didnt compile yet. There's the managed c# error
So, a day or two ago I've updated my project to entities 1.0 in hopes to fix some shader incompatibility on my linux machine, which it did (for built executables), but now I've tried to open my project in unity editor on said machine and I see this:
Any idea if it could be fixable or do I have to wait for a fix in later version of unity and/or packages?
it is possible
you need to modify archetype
and then simply change component data
which is int
index of managed component array
as long as managed component already exists in world
you can set it burst compiled
That's the thing, it doesnt exist. I'm instantiating and applying new managed components to new entities.
ehhhhh, it's a system that runs on startup that creates entities. it's not that performance critical
What's in the subscene?
just saying of possibilities, kek
2 cubes, a plane, and a character model from unity asset store with attached camera
temporarily remove the model, move it outside the subscene
then restart unity, is there any errors?
No errors but the graphical artifacts still persist
Also just to be clear, I'll add that on windows everything works fine without graphical issues and I only have a warning that a shader doesn't support skinning
Maybe submit this as a bug report? If it's a very small project, might be reproducible on unity's end.
Also, I've tried to make a new project from URP template and I still have graphical issues, so at least that part is not related to DOTS
Hello !
Could someone explain me what is "nested containers" in Unity Job / Burst ? I have a issue with "nested containers are illegal", but don't understand how to fix it. Thanks !
array in array
That's what I thought, but it's strange because I don't have it anywhere... (I had it but I remove it, and the compiler continue to complain about this)
The error should be specific to nested [NativeContainer]s which is an attribute applied to types that managed native memory and provide job safety checks. This is a bit subtle as it means there can be NativeContainers that don't necessarily start with Native in their name like NativeList does
For instance, ComponentLookup<T> is a NativeContainer, which can mean if you use a lookup to read a component that contains a NativeContainer like NativeList (in a job), then you can also see errors. We are currently working on improving the error message clarity as it's not as clear as we'd like it to be.
Longer term we are trying to better support these workflows without jeopardizing performance for all codepaths using containers but that won't be before 1.0
If you have something like NativeArray<NativeArray<>>() or NativeArray<NativeHashSet<>>(), the nested nativeX does not work.
Thanks all for the answers !
Saw this just now. Not sure I can post all my code. If I can pinpoint the problem maybe I can post the offending code. The problem is that the erorr does not give me any hints as I am not using jobs.
How one would go about creating entity in monobehaviour?
I am trying this in Start()
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager; var playerInputEntity = entityManager.CreateEntity(); entityManager.SetComponentData<PlayerInputComponent>(playerInputEntity, new PlayerInputComponent());
but I get ArgumentException: A component with type:PlayerInputComponent has not been added to the entity. Entities Journaling may be able to help determine more information. Please enable Entities Journaling for a more helpful error message.
Nevermind, I had to add it first to set the data. I was missing entityManager.AddComponent<PlayerInputComponent>(playerInputEntity);
You can use EntityManager.AddComponentData(playerInputEntity, new Component(Data)); as well if you want to add and also set the component being added.
But in this case where you're just adding a default component, the AddComponent<>() works best
@robust scaffold How do I persist changes to component in monobehaviour?
var entityManager = World.DefaultGameObjectInjectionWorld.EntityManager; var eq = entityManager.CreateEntityQuery(typeof(PlayerInputComponent)); var playerInput = eq.GetSingleton<PlayerInputComponent>(); playerInput.MousePosition = _mousePos; playerInput.MoveInput = _inputVector; playerInput.Shoot = _shoot; playerInput.Frame = Time.frameCount;
This does not seem to do it
You need to write it back to the singleton.
eq.SetSingleton(playerInput); ?
Yep
It seem it works! Thank you @robust scaffold
The only way you can write directly to components without having to Get/SetComponents is those returning RefRW<>().
Yeah but I need to use SystemAPI which does not seem to work outside of a system. Correct?
Yea, it's a code gen tag.
Not sure what you mean by "code gen tag"
it's empty method
not actually ever gets called
instead used by compiler to generate correct code
A method that immediately throws an error if run normally. However, between the code and compilation, there's a step known as code generation that takes the code written as strings and then selectively replaces sections of code with other code. In this case, SystemAPI is replaced with actual code instead of the immediate throw new exception(). And then that is compiled into code. Which is why all Systems need the partial.
Ok, I understand. So this code gen is not possible in other places but partial Systems?
If I do partial MonoBehaviour would it work?
SystemBase can also use SystemAPI.
No, partial MBs are not detected by the code gen.
thank you for your clarification
@gusty comet I just want to add another bug if not already known, with play mode options disabled (as in pressing play will reload domain before entering playmode) entering play mode with multiplayer tools simulator disabled kicks the player out of play mode on the second frame. Simulator must be [ON] for playmode to work.
Entities v1 changed so much since last time i dipped toe!!
I am struggling getting this raycast to work as show in this code example: https://docs.unity3d.com/Packages/com.unity.physics@1.0/manual/collision_queries.html#ray-casts
I am creating a plane like that:
You dont need the convert to entity in a subscene
Then I am trying to raycast from scree mouse position to try to hit the hidden plane for input purposes:
`[UpdateInGroup(typeof(FixedStepSimulationSystemGroup))]
[UpdateBefore(typeof(PhysicsSimulationGroup))]
public partial class PlayerMoveLookSystem : SystemBase
{
protected override void OnUpdate()
{
var camera = Cameratone.Instance;
var collisionWorld = GetSingleton<PhysicsWorldSingleton>().CollisionWorld;
var eq = EntityManager.CreateEntityQuery(typeof(PlayerInputComponent));
var playerInput = eq.GetSingleton<PlayerInputComponent>();
var mousePos = new UnityEngine.Vector3(playerInput.MousePosition.x, playerInput.MousePosition.y, 0);
UnityEngine.Ray ray = camera.ScreenPointToRay(mousePos);
UnityEngine.Debug.DrawLine(ray.origin, ray.direction * 100, UnityEngine.Color.green, 1 / 60f);
RaycastInput input = new RaycastInput()
{
Start = ray.origin,
End = ray.direction * 100,
// Filter = new CollisionFilter()
// {
// BelongsTo = 4,
// CollidesWith = 4, // all 1s, so all layers, collide with everything
// GroupIndex = 0
// }
};
float3 lookAt = float3.zero;
var hit = new RaycastHit();
bool haveHit = collisionWorld.CastRay(input, out hit);
if (haveHit)
{
lookAt = hit.Position;
UnityEngine.Debug.Log("hit");
}
foreach (var transform in SystemAPI.Query<TransformAspect>().WithAll<PlayerComponent>())
{
if (haveHit)
transform.LookAt(lookAt);
}
}
}`
Oh... ok. Didn't know, thank you.
And the collision response should be Collide. I think. All of mine are collide and raycasts work.
Does it not hit?
Nope, the drawing looks pretty good also:
Mouse is not seen but its on top left corner of game view
Filter needs to be set probably
You cant just comment it out.
Hmmm I am not sure how to use this filter
I understand that. I do not understand why raycast asks me for both "BelongsTo" and "CollidesWith"
What does it mean in context of raycasting?
The raycast itself is a collider as well.
Oh.. so it is the raycast "BelongsTo" ? Ok, that kinda make sense.
So as it traverses the BVH tree, it checks all the colliders for IsCollisionEnabled() using the logic in that documentaion.
HIT! YEAH! Thank you ❤️
So if the raycast doesnt have a filter set, it defaults to 0, which means it wont collide with anything.
Well, I would not have written an API that default state is basically not working but hey...
It's all unmanaged. You cant set default variables.
It's the price to have 10x better-ish performance.
Just know you cant leave things unset because the defaults are hardcoded by C# themselves. Although in C#9 or 10, it'll change.,
So, if I have the plane I want to hit in Category A
To hit it what do I need to put in raycast filter?
CollidesWith = Catergory A?
Yep, and make sure the plane can also CollidesWith the BelongsTo of the raycast filter.
Ill put the plane "BelongsTo" and "CollidesWith" in the same category. Ill do the same to the raycast
yeap, works, thank you @robust scaffold
Has anyone figured out how to do optional components in a SystemAPI.Query<> without aspects?
Finally done it, a duplicate kinematic body that is overlaid on player entities to prevent them from being pushed.
It's 5% smaller so the dynamic rigidbody gets priority.
Unfortunately, it is still possible to player - object - player collide and very stuttery movement when doing so. But this is good enough.
use buffer lookup
ugh
if you want it super optimized
iterate chunks manually
and do query mask comparison only once per chunk
using type handle
to obtain optional array
I just stuck an em.hasComponent<>().
that's quick solution, but slow runtime though
It's just some authoring stuff anyways. Not performance critical.
I wouldnt use .Query<> for performance critical work anyways
can be used though
for iterating event entities for example
that require structural changes
Anyone using the TransformAspect with transforms v1? Might be missing something but it seems like there is a bug in UpdateLocalToWorld():
void UpdateLocalToWorld()
{
if (HasParent())
{
var newParentToLocal = float4x4.TRS(LocalPosition, LocalRotation, new float3(1, 1, 1));
var newLocalToParent = math.fastinverse(newParentToLocal);
var newLocalToWorld = math.mul(ParentToWorldMatrix, newLocalToParent);
m_LocalToParent.ValueRW.Value = newLocalToParent;
m_LocalToWorld.ValueRW.Value = newLocalToWorld;
}
else
{
m_LocalToWorld.ValueRW.Value = float4x4.TRS(LocalPosition, LocalRotation, new float3(1, 1, 1));
}
}
Isn't the line var newParentToLocal = float4x4.TRS(LocalPosition, LocalRotation, new float3(1, 1, 1)); calculating the LocalToParent, not the ParentToLocal?
allthough, I'm leaning towards using enabled component state instead
No parent, thus the local position and rotation are in world space.
No I mean when there is a parent. The first line of that branch calculates ParentToLocal using the local position and rotation. Isn't this backwards?
Translation
and Rotation
they are local space
So if you have Parent, then it'll be LocalToParent
I understand that part
If an entity has a parent, doesn't float4x4.TRS(LocalPosition, LocalRotation, new float3(1, 1, 1)); describe the localToParent?
Child has pos of (1, 1). Parent has pos of (2, 2). Local to Parent is still (1, 1) and the parent's local to world is (2, 2). Combined, local to world for the child used in rendering will be (3, 3).
that would describe LocalToParent without scale
Uh, yes.
Right, but the code calls it the ParentToLocal, then inverses it and sets the LocalToParent to that
huh, no clue.
yea, no clue
Well the last line says the LTW is float4x4.TRS(LocalPosition, LocalRotation, new float3(1, 1, 1)) when there is no parent, so I'm assuming that LTP would be the same thing when there is a parent
I think it's because of math magic
See, this is why you never have a hierarchy. Matrix math more than 1 level deep is pain
I don't see inversion
it simply gets LTP
and then multiplies it with LTW of parent
This part:
var newParentToLocal = float4x4.TRS(LocalPosition, LocalRotation, new float3(1, 1, 1));
var newLocalToParent = math.fastinverse(newParentToLocal);
Ugh, and then there is this: https://forum.unity.com/threads/float4x4-trs-does-tsr-instead.1327422/
Which makes me want to avoid TRS entirely.
The transform systems don't really use TRS, they manually multiply stuff. Like the TRSToLocalToParentSystem uses this to calculate LTP: math.mul(new float4x4(rotation, translation), scale)
I'm getting a crash on every build with 1.0, anyone else dealing with this? I submitted a bug report already. This is using the build configurations and multiplayer
I should add: this is happens AFTER the build successfully completes.
Personally, unity crashes after every build for me but I'm using hybrid components and it's obvious that 1.0 doesn't support hybrid atm
What am I missing for creating a new world + system in Edit mode?
You need to add the world to the update loop
Thanks, do I need to call AppendSystemToPlayerLoop also or should AppendWorldToPlayerLoop take care of it?
I remember PlayerLoop stuff from years ago, surprised we still need to do low level stuff in 1.0
Hrm, looks like you havent set up the 3 default system groups so append world wont work. append system probably will
okay, i added the default system groups, and I've got an OnCreate() called, but Im not seeing the test system present under the Simulation system group
Then you need to add that to one of them. If you created the world manually, adding systems must also be manual
public World CreateLocalWorld(string defaultWorldName)
{
// The default world must be created before generating the system list in order to have a valid TypeManager instance.
// The TypeManage is initialised the first time we create a world.
var world = new World(defaultWorldName, WorldFlags.Game);
if (World.DefaultGameObjectInjectionWorld == null)
World.DefaultGameObjectInjectionWorld = world;
var systems = DefaultWorldInitialization.GetAllSystems(WorldSystemFilterFlags.Default);
DefaultWorldInitialization.AddSystemsToRootLevelSystemGroups(world, systems);
#if !UNITY_DOTSRUNTIME
ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop(world);
#endif
return world;
}```
Any additional thoughts on this?
is it transparent? lol
Thank you for the guidance. I'm getting a reproducible editor crash so I have to write that up first but I understand now what I must do
Ya know, i've downloaded HR myself and ya, i can reproduce that with my own rendering system. I think it's because HR skips directly to writing to camera texture and sidesteps a lot of the layering and filtering code.
It's annoying because this flat overlay breaks my own light renderer.
Dots and crashing, name a more iconic duo.
Ya know, I wanted features back in 0.51. Now in 1.0, I want things to just work.
i jumped into the netcode samples last night
to test my change filtering proof of concept if it still worked
any code change would invalidate my subscenes
and required an editor restart
was not a fun experience
i think subscene invalid header biggest issue in dots atm, kills workflow
same experience. but why do subscene headers break when you dont change baking process?
🤷♂️
I hate my life right now
i noticed something in 0.51 when i was doing some random testing
im not sure if it's still true but let me grab the code
it has gotten to the point where i have to restart after every single minor code change
assemblies ??= UnityEditor.Compilation.CompilationPipeline.GetAssemblies().ToDictionary(r => r.name, r => r);```
{
if (!AssembliesMap.TryGetValue(asm.GetName().Name, out var uAssembly))
{
return false; // this happens in sub scene conversion process if a new assembly is added after loading unity...
}```
I just spent 2 hours debugging jittery movement in multiplayer. Editor crashed and suddenly everything worked just fine. I guess I'll move "restart Unity" to the front of the to-try list when I'm not sure why things aren't working.
creating an assembly in 0.51/2021.3 would not add it to the UnityEditor.Compilation.CompilationPipeline that the conversion system process had access to until an editor restart
it's like it had a cached domain at startup
no idea if it's still a 1.0 issue
was just something i randomly stumbled upon a while back
I've turned off the play mode settings to see if it helped, it didnt
in editor the assembly would be found, in conversion process it would not
beware that open subscenes can have effect on behaviour
oh yeah open subscenes cause all sorts of issues
highly recommend keeping them closed before entering playmode
I'm no longer seeing the issue even with the subscene open/closed, but that's a good tip nonetheless
Although parallel import turned off seems to have helped with async corruption.
huh, i had it everywhere
https://docs.unity3d.com/2022.2/Documentation/Manual/ParallelImport.html
- Image file types imported by the Texture Importer
- Model file types imported by the Model Importer
Other types of asset are always imported sequentially during an asset database refresh.```
Jesus christ. I add a debug log and boom, subscenes no work
didn't know this was a feature
but im curious why its a project setting not a preference
the number of workers i want on a 24 core machine is probably different to someone with 4...
still never seen that log
{
// These types cannot be instantiated
if (type.IsAbstract || type.ContainsGenericParameters)
return false;
// Only derivatives of ComponentSystemBase and structs implementing ISystem are systems
if (!type.IsSubclassOf(typeof(ComponentSystemBase)) && !typeof(ISystem).IsAssignableFrom(type))
throw new System.ArgumentException($"{type} must already be filtered by ComponentSystemBase or ISystem");```
seems to throw in here
It's just the most random section of code "must already be filtered..." and then it breaks.
{
var systemType = s_SystemTypes[i];
if (FilterSystemType(systemType, lookupFlags))```
somehow a system type isn't a system type
I've seen IComponentData on there, IL temp code, sprites, random stuff.
can you show me the full stack
does it come from the ConstructSystem path
or the InitializeAllSystemTypes
path
Ugh, already closed editor and it's not in the appdata local editor logs
Definitely easy enough to cause, give me a sec
looking at code there's only 1 path i could potentially see a bad system gets added to this list
without user mistake / malice
which is basically the CreateSystem(Type) path
but no even that is checked
if (!typeof(ComponentSystemBase).IsAssignableFrom(systemType))
hmm
That error occurs on play, not during build.
I think, It appears when I enter playmode
well that's when typemanager would be initialized
it's initialized in first EM initialization
[Worker0] Exception thrown during SubScene import: System.ArgumentException: Multiplayer.Authoring.Systems.BakingKinematicToggle+Container_331747650_0+ResolvedChunk must already be filtered by ComponentSystemBase or ISystem Just random things
i haven't seen anyone else report this specific one which is concerning for you 😅
ugh
it's nearly reproducible by modifying a baking system. Ya know what, fuck baking systems. I'll just do this runtime.
Baking is just so broken. I cant use it.
you know what's nice and pretty stable?! 0.51! on 2020.3
im so tempted
but then my rendering stack relying on RT handles will just die
God, i was so spoiled on how stable the baking was in 0.51. It looked rock solid compared to this
I think in 0.51 there was no baking 😄
have you tried turning off live baking @robust scaffold ?
no idea if it'll help but anything is worth a try!
live baking is off.
Thats probably why it's error'ing out when I press play instead of when I make edits to the code
There was, it's GOCS and the other alphabet soup things
this new in b13?
or i just been blind
or is this my internal mode i didn't realize
With internal? yea that's always been there
ah ok i just turned it on for a second
first time opening b13
to check my live baking setting
thats a shame, that's a useful feature all the time!
probably costs a lot of performance
it's basically profiler on constantly
Unity, I really really wish for [GenerateAuthoringComponent]
True
Jesus christ these bog standard empty MB and then a baker inside just to add one component is so pain
Imagine mapping 1:1 🤣
b13? is there new version? there was exp.14 for b11 why b13?
2022.2.0b13
2022.2B13. No change on our side honestly
Is moving up to B13 worth it if im on b8,
If you're using netcode and want to view the netcode samples yes. B8 has a major bug that crashes the netcode samples.
At least B12 for the samples. Otherwise, no.
ok ty
when we build now, do we have to add all the subscenes to the "Scenes in Build" list
No
ok ty, so much have changed since 0.17
I dont know what I've done wrong but the baker just never works anymore. Ugh.
Time to start removing stuff until it works 🙃
Do you have these issues on the samples?
Maybe you just need a library wipe
Good idea, been a while since I deleted lib
oof, it's big, 15GB
😭
That one I believe is known and I've reported myself
I think it only happens if you have multiple subscenes
Which is very common
Though that's based off a sample size of like 3 projects
At least I'm back in territory of commonly reported bugs rather than esoteric unique bugs
Ya know, i think this might be because of hybrid components.
you mean using AddComponentObject?
No, just the built in sprite renderer baking
public class SpriteRendererAuthoring : Baker<SpriteRenderer>
{
public override void Bake(SpriteRenderer authoring)
{
AddComponentObject(authoring);
}
}```
im not getting that error with my sprite renderers
I dont know, I dont use any other managed component anywhere
This is the only managed component in the entire code
The warning doesnt specify where it happens right?
TransformSys V2 is still not working with physics?
nope
Probably gonna wait until 1.0 pre for that
Are SubScenes supposed to only be in once Scene?
i cannot add the same subscene to multiple different scenes
No? You should be able to subscenes anywhere. And multiple per scene
Huh
I cant. That's odd.
if i try to add a subscene to a scene then it only gets added as a normal scene
i havent tried to do it in 0.51 so i cant say if that is expected behaviour
seems like a bug to me
You need to make an empty GO then add the subscene component
Then move the subscene asset into the box for "subscene"
It's incredibly annoying I know
AAAH! thank you so much
You have to literally duplicate the subscene asset in order to add it again, cant use the same asset
but can you load the same scene twice at runtime at different locations?
Otherwise yea, you kinda can use the subscene twice or more per scene, just gotta keep copy pasting the actual asset
The scene itself has no position data, only the GOs inside of it will be converted to entities
hm. say i have a subscene thats a Setpiece i want to randomly spawn multiple times into my world. can i do that?
Make that SetPiece a GO prefab, make a spawner entity containing it, then use that singleton prefab spawner to instantiate your setpiece and randomly distribute it.
It's a really roundabout way and annoying but it works, most of the time. Until the baker dies and you need to restart the editor again
yes true. there is no real advantage in having a subscene compared to prefabs.
i always forget to include Prefabs in my BakingSystems.
outside of ECS, is there a struct or something that encapsulates position and rotation? I need to have copy of GO transform values, and I wonder if I need to keep separate float3 and quaternion or is there something for this.
Transform V2 has TRS merged into 1 component
Alternatively, you can just use the raw 4x4 L2W. Merged TRS.
is UnityEngine.Plane Burstable?
Yea, it's fully unmanaged, as far as I can see
well i'm not crashing (this is without editing entities package)
i'm more interesting in timings and the ability to edit meta data before initialization for the sake of modding than LEG in particular, just though it'd be an interesting test case due to current discussions here
and works fine in a build, interesting
cap 0?
how are you doing this?
A magician never reveals his tricks!
then this is clearly shopped!
before and after magic
the actual code for this is really easy
where T : struct, IBufferElementData
{
TypeManager.Initialize();
var typeInfoPointer = TypeManager.GetTypeInfoPointer();
var index = TypeManager.GetTypeIndex<T>().Index;
ref var typeInfo = ref typeInfoPointer[index];
typeInfo = new TypeManager.TypeInfo(
typeInfo.TypeIndex,
typeInfo.Category,
typeInfo.EntityOffsetCount,
typeInfo.EntityOffsetStartIndex,
typeInfo.MemoryOrdering,
typeInfo.StableTypeHash,
bufferCapacity, // bufferCapacity
sizeof(BufferHeader) + (bufferCapacity * typeInfo.ElementSize), // sizeInChunk
typeInfo.ElementSize,
typeInfo.AlignmentInBytes,
typeInfo.MaximumChunkCapacity,
typeInfo.WriteGroupCount,
typeInfo.WriteGroupStartIndex,
hasBlobAssetReferences, // _HasBlobAssetRefs is private so we need to set this manually (TODO use reflection to not need to pass info in)
typeInfo.BlobAssetRefOffsetCount,
typeInfo.BlobAssetRefOffsetStartIndex,
typeInfo.WeakAssetRefOffsetCount,
typeInfo.WeakAssetRefOffsetStartIndex,
typeInfo.FastEqualityIndex,
typeInfo.TypeSize);
}```
the pain is figuring out how to get this to run before anything uses it
good lord
so I just put it everywhere 😄
[UnityEditor.InitializeOnLoad]
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.AfterAssembliesLoaded)]
[UpdateInGroup(typeof(PreBakingSystemGroup), OrderFirst = true)]
[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
turns out baking system domain runs before InitializeOnLoad and RuntimeInitializeOnLoadMethod only good for runtime
but there you have it
a way to change buffer capacities in other packages
and also i now know at what timing i need to inject new types! potentially from loading dlls for modding etc
jesus christ
What wizardry is this
Unity is already crashing from their own code, this cant possibly do any worse.
oops extra initialize in there, no harm
The one inside SetBufferCapacity?
technically it's public so i wanted it in there
so if i called it from elsewhere
so the one in initialize
but yeah it doesn't really matter
typemanager.initialize is safe to call
it earlies out of already setup
{
if (s_Initialized)
return;```
Did you hammer that entire chunk of code out yourself or is what unity is doing?
that's just the constructor for TypeManager.TypeInfo
fields are readonly
so i couldn't just update them i had to just clone it
all i'm doing is updating the TypeInfo stored for the buffer and changing the bufferCapacity and sizeInChunk fields
and doing this before anything accesses it =S
It's a struct, nothing a little bit of sizeof() and memcopy cant do.
sure but honestly more effort
and if the signature changes in the future
it will break
this will give me a compile error instead
I guess finding the proper offset for the buffer capacity to inject our own count would be difficult.
Oh yea, ugh
I mean, using field offset maybe to dynamically get the fields of BufferCapacity and SizeInChunk.
So long as those variables dont get refactored out, a memcopy can support changes in the underlying structure signature.
@robust scaffold thanks for the help with hooking up the system into Update, its working now
Ugh, UNITYYYYYYY
How did you get Unity.Physics reference if you're already assemblyref inside Unity.Entities?
I cant get both physics and entities in the same script together
what are you doing with your asmref?
all my asmref does is inject internal access
i just inject an assemblyinfo file which gives me internal access
Oh wait, an actual assembly info script, that makes more sense
so my core library (and core.editor) are the only things with internal access
and if any of my other libraries want it i just add a small wrapper for it
https://gitlab.com/tertle/com.bovinelabs.core/-/tree/0.9/BovineLabs.Core/Internal
all here if you want to see actual setup
If only unity made everything public, we wouldnt need to do this nonsense
i'm pretty happy most of it is internal
i don't think a lot of it should be public
that's just asking for trouble
But trouble is great! What's the use of all these neat tools if I cant shoot myself in the foot with it?
I guess I should be happy they aren't private and we'll be tearing these out by reflection
exactly, being internal lets me access it while most normal uses don't shoot themselves in the foot
private would mean reflection or memory reinterpretation which is just slow or painful
How did you get your IDE to recognize these? Rider is complaining yet Unity compiles with no errors.
Yep. That was it
VICTORY:
Suck it unity, Wont make IBC 0? Fine, we'll do it ourselves.
@viral sonnet No need to wait for unity to set IBC to 0 anymore. We can do it ourselves.
Hrm, I should make some error checks for the one hardcoded section of that code.
Well, it works in play mode, no crashes, no errors.
Tertle's version is actually burstable. Although I dont think this section of code is performance critical. Mine uh, less copying?
But has reflection
Yours
Yea, mine does have reflection.
And thus is slower, but if you're running this every frame, something's wrong.
No need to specify blob asset ref?
oh fair
But yea, mine is just my flavor of it
though that one itself is not that hard to fix up i just cbf
Yea, yours is objectively superior. I just want to go do the slower way.
i was wrong
typeInfo.HasBlobAssetRefs,
typeInfo.TypeIndex,
typeInfo.Category,
typeInfo.EntityOffsetCount,
typeInfo.EntityOffsetStartIndex,
typeInfo.MemoryOrdering,
typeInfo.StableTypeHash,
bufferCapacity, // bufferCapacity
sizeof(BufferHeader) + (bufferCapacity * typeInfo.ElementSize), // sizeInChunk
typeInfo.ElementSize,
typeInfo.AlignmentInBytes,
typeInfo.MaximumChunkCapacity,
typeInfo.WriteGroupCount,
typeInfo.WriteGroupStartIndex,
typeInfo.HasBlobAssetRefs,
typeInfo.BlobAssetRefOffsetCount,
typeInfo.BlobAssetRefOffsetStartIndex,
typeInfo.WeakAssetRefOffsetCount,
typeInfo.WeakAssetRefOffsetStartIndex,
typeInfo.FastEqualityIndex,
typeInfo.TypeSize);
}```
Ha
i just realized there is a property for it
public bool HasBlobAssetRefs => _HasBlobAssetRefs != 0;
anyway i do not advocate this, it was a simply an experiment to see if i could do it
as i mentioned before, i'm more interested in seeing if i can inject new types from dynamically loaded dlls
If the intention is to only patch the TypeInfo you can use the TypeInfoPtr and some unsafe casting to write to it directly to avoid the new constructor call:
TypeInfo* pTypeInfo = ((TypeInfo*)s_TypeInfos.GetUnsafePtr()) + index;
*(&pTypeInfo->SizeInChunk) += newValue;
yeah but if you go make changes to the struct layout
and i update
oh wait hmm
no that would work actually
My approach should work even if we change it, as long as we don't remove the field you use
well there you go kornflaks, a better version of yours
See, gotta let the professionals show us how it's done. Instead of stumbling around in the dark.
This type of overwriting of the type system is fine as long as it's certain to run before EntityManager creation. If anyone has made chunks afterwards you're gonna have a bad day
the biggest issue i had when testing this was
[WorldSystemFilter(WorldSystemFilterFlags.BakingSystem)]
partial class LinkedEntityGroupBakingCleanUp : SystemBase
{
private EntityQuery query;
protected override void OnCreate()
{
query = GetEntityQuery(typeof(LinkedEntityGroup));
}
protected override void OnUpdate()
{
EntityManager.RemoveComponent<LinkedEntityGroup>(query);
}
}```
i had to get my change in before this triggered when baking
and this triggers before
[UnityEditor.InitializeOnLoad]
i just realized @robust scaffold this should probably be
[CreateBefore(typeof(LinkedEntityGroupBakingCleanUp))]
not updatefirst
Exactly. Archetypes rely on the type info to know how many elements forward to look when iterating over buffers in chunks. If you change that value after a chunk is made we'll barf. Worse, if you change it after baking has serialized data you'll crash at runtime
We do want to offer a bunch more configurability over a lot of these params currently done via attributes. It just requires work to provide a nice UX for such a config file, and a nice way of making such a config system behave as users make changes to it (since almost no one wants a system where you can only set it before boot)
as weird as it sounds considering how hacky this is, something just seems wrong to me about updating a readonly field 😅
I have no clue how *&ptr allows one to bypass readonly keyword in setting variables. Literal magic.
You see, this is why I'm not a programmer. This stuff is wild.
This is the result of C programmers working in C#. 🙂
I do agree. I suppose theoretically the JIT could do some optimizations around such a statement where stores of a readonly value happen out of order to written order and would miss your update, but I don't actually have proof of that beyond stripping const and writing to those vars being undefined behaviour in other languages
But, you're likely fine 😄
Cant be any worse than my usual shit-code anyways. This is pristine in comparison.
Well, no errors, no crashes. Cant build because hybrid components are broken so dont know about that.
#if UNITY_PHYSICS
[assembly:BufferCapacity(typeof(Unity.Physics.PhysicsColliderKeyEntityPair), 2)]
#endif
updated how mine works
can now just define an assembly level attribute now
to override the InternalBufferCapacity attribute
If this is implemented by adding the overridden BufferCapacity in BuildComponentType() in the TypeManager, you'll have no problems in Editor or at Runtime and honestly if this ends up being a big enough concern it isn't unreasonable to fold in to the package proper
Yes yes yes PLZ
i very specifically avoid making any changes to any package
it's too painful to maintain
Fair enough, makes perfect sense
Is it using the same logic as the code above? I prefer just tacking more SetBufferCapacity() on the initialize list rather than another file
yeah pretty much
public static void Initialize()
{
foreach (var attr in ReflectionUtility.GetAllAssemblyAttributes<BufferCapacityAttribute>())
{
SetBufferCapacity(attr.Type, attr.Capacity);
}
}
Neat. Yea, big feature to ya package if you're willing to test this out for any edge cases.
I'll consider it and discuss it a bit more internally. I do hate having yet another global attribute for folks to sprinkle through their code. It's not nice to deal with, hard to gather who is doing what via attributes (hopefully you own all the code doing so) and ultimately it requires some reflection, or ilweaving to resolve both of which are not very speedy
ideally this would be handled through some UI but i'm not putting the effort into that
Netcode's synchronized components view is actually extremely nice.
I have no clue what virgins they had to sacrifice to get it to work but it does and does so quite well.
Netcode's component inspector UI can modify the attribute properties of components so, from a very laymen view, it's possible?
oh i could make it work from UI, instead of iterating attributes i could just load the data from disk
Or it could just be their inputs into their sync codegen'ed systems.
and i'm sure if i actually edited package i could make it work a lot nicer
Yea, setting IBC to 0 increased chunk capacity for my entities by at least 12 across the board. Over 50% increase over not using that system. I only have 12 entities though so no benchmarks.
I wonder if we can name archetypes. The auto-gen'ed alphanumerical soup is not helpful.
Noooooo, it's not burst-able. Curses.
Everything must be bursted.
TypeManager.Initialize() cant be bursted but the stuff after can
Yea, the function pointer calling is probably costing more than actually writing... 2 values.
yeaaaaaaaaaa
One final wish into the void to any physics guys lurking around: please separate collider filter from the greater collider blob. I am forced to clone a bunch of blob asset refs because I need to designate unique collider indices per body. All of them share exact body composition except for the collider filter.
https://gitlab.com/tertle/com.bovinelabs.core/-/blob/0.9/BovineLabs.Core/Utility/BufferCapacityAttribute.cs
final version made the library
left in ability to set capacity without attribute
Why struct type instead of unmanaged?
I've been using unmanaged everywhere for things I know can't be a managed component.
good point but it doesn't matter
cant have a valid ibufferelement that isn't unmanaged
Yea, who knows though.... yea. That's impossible for it to be managed.
@rotund token is there some readme/thread in the forums to your core library? just an overview of what you got in there for people who dont fully understand the code?
im afraid im missing out on some great tools
not really
i posted a random list of things in there on the forums
but its far from comprehensive
haha okay then ill better not get it. no use in tools i dont even find ^^
oh you'll just find a lot of random extension methods
people at work always are just using extensions they think are part of the core entities ^_^'
the point of core though is anyone can add it and it won't affect anything
(well except i've included the remove LEG stuff which i am considering separating because the library shouldn't do anything)
you should add it purely for assembly builder though
still the best tool i've ever built
at some point you really need to list all features somewhere. even if you dont explain them. atleast i can then search for them if i know they exists ^^
80% is just extensions
whats the StateSystem?
think bit array on a component
256 states for unique (8bits) or 256 flags (256 bits)
each bit maps to a component (usually tag)
so it kinda falls in the same usecase as enable components?
yeah sure
i was considering switching it from add/remove to enable/disable
but i decided to keep it add/remove
it's more for longer term states
i use it for UI states, game level states (menu, starting server, in game, etc)
but also for say, certain movement states
follow, flee, etc
works best when combined with K imo
so you set a certain state and a system automatically adds/removes all components defined for the state?
for UI/game states
yes
well it's 1 component
i only use it for tag components
any data component always exists
oh i guess my camera is a really good example
my cinemachine/camera system uses it
FollowCamera = 252
FreeCamera = 254
ThirdPersonCamera = 251
etc
its useful because you can set states
without knowing components
or have 3rd party libraries add new states
the main issues of states is removing old components etc, you have to check every state component and remove them
like if i have 256 states, and i want to go to start 9
sounds great. ill keep it in the back of my mind for the next time im doing a statemachine. And K basically would take "FollowCam" and convert it to say 3 and thus you wouldnt need to know the numbers for the States in Editor?
i have to check 247 states to remove
yeah
it's still kind of hard coded
but "Follow" is easier to remember than 252
and you can always change your digits without breaking code
(K works in burst as well)
state used to be just a base class
but i rewrote it recently to be a helper struct
a little more effort to setup (not a lot)
but now works with ISystem
[WorldSystemFilter(WorldSystemFilterFlags.ClientSimulation)]
public partial struct CameraStateSystem : ISystem
{
private StateSystemImpl impl;
public void OnCreate(ref SystemState state)
{
this.impl = new StateSystemImpl(ref state, typeof(CameraState), typeof(CameraStatePrevious));
}
public void OnDestroy(ref SystemState state)
{
this.impl.Dispose();
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var bufferSystem = SystemAPI.GetSingleton<EndSimulationEntityCommandBufferSystem.Singleton>();
this.impl.Update(ref state, bufferSystem.CreateCommandBuffer(state.WorldUnmanaged).AsParallelWriter());
}
}```
the core system just looks like that
i am thinking about usecases just now and realized that somehow with ECS i have less systems that use exclusive states than in oop
oh yeah states are unnatural in ECS
and historically hard to implement
{
State = TypeManager.GetTypeIndex<CameraState>(),
StateKey = this.StateKey,
StateInstanceComponent = this.StateInstanceComponent,
});```
and you just register a state by adding a system component now
removed all the generic code
and it uses dynamic type handles now
yeah most of my states are singletons
state of game (client/server), UI, camera
are the main ones i use atm
hmmm
that looks really easy to use! nice
I just had an idea of singleton with only purpose - state of specific hash
so, basically you create singleton tag, IEnableble
and every time you want to track specific state in System
you create query for that tag
check it's value (it's not actually tag, it stores hash)
for example String to hash
and if you got your entity you obtain entity and it's enabled state ptr
or simply enabled state ptr
oh also, it's not actually singleton
what would be the diffrence to a enum stored on your singleton?
the whole point of it - reduce amount of singletons and store them in single chunk
😅
conveniently my StateSystemInstance is the same between all cases
so it's same chunk
hmm i remember someone doing something like that. mb it was dreamingimlatios. WorldBlackBoardEntities or sth like that
that said i really don't get your idea issue or what it's used for
and how do you transition between states?
state.value = 5
or for my flag ones i store a bitarray as the state
so it's just like
state.value[123] = true
(but instead of magic numbers I use K or settings files/other config)
btw very confusing to have SystemState and StateSystem^^
i dont have statesystem anymore
(if you're looking at core look at the 0.9 branch not master)
(master will work but it's basically just, the state after 1.0 update)
i was looking at your camera system
oh
u sure? in dependencies it said 0.51
hmm maybe it won't 😄
maybe i branched 0.9 when 1.0 came out
thought i got it to work then branched but yeah you are probably right
huh how do i actually get the right link from gitlab to get the 0.9 branch?
until now i did it in manifest manually
tbh, now I don't really think there's a purpose with it too
might as well just create NativeArray
i did but the clone link still only gives me : https://gitlab.com/tertle/com.bovinelabs.core.git
or are you pulling this via package manager
duuuuud
ooo i haven't done git manifest pull in ages
I now get what we need
there is a way though
without editing manifest
we need a method in SystemState
smth like
RequireForUpdate(bool* boolPtr)
that would make thing so much easier and faster
haha i would have managed
done
usually at some point i'll put my library on openupm
id do it more frequently but openupm doesn't support gitlab -_-
well gitlab is changing / has changed its pricing anyways?
is there still a real reason to stay there^^
gitlab?
yes. afaik the free repo size got much smaller now
i don't know how anyone can use github with their 1GB LFS limit
it's still 10GB
vs 1GB on github
huh im pretty sure they went way down. or will soon
well it's gone down to 5GB
according to their faq
my primary repo is above github storage limits
and it's tiny
like 8 models...
so yeah sure, i'll still take the 5x lfs limit over github ^_^'
true. do they still have private repos with 5GB too?
hmm strange i really thought i read some changes that made me go wtf
i will say that if you were paying for storage
github is much cheaper
their 50GB storage is only $5/month i think
$5 will only get you 10GB on gitlab
$5 for 50GB is pretty good...
oh on the topic of packages i need some workflow advise:
right now in my main Project i got everything split up in small assemblies. i want to reuse parts in another project. So i thought ill make packages out of it. How would i have to set it up so that i can modify the package in my main project and get the changes in my other projects and vice versa? or is that generally a bad idea and i should only work on my packages in isolation?
i think i read on the forums that its not working atm
if you edit local package on disk it should just work
i use sub-modules or just duplicate repos
i have a lot of projects i work on at same time that share packages
so if i want a change in another repo
i just pull
oh man, I really now want this feature
RequireForUpdate(bool* ptr)
it also seems like it's super easy to implement, assuming you modify package
daaamn
you really don't like the default entities flow do you 😅
you don't even need RequireForUpdate(bool* ptr)
I feel bad for creating a whole archetype just for one boolean
@rotund token and i have to push changes in those submodules seperately from the project they are in?
but that breaks workflow
because goal is not modification of System
it's modification of data
Enable literally is just a bool ptr that stops system running
yeah i can just push changes to each module separately
yeah, but what if I want some system to run depending on 2 booleans
and another only on one?
yep, your solution is broken already
but i only use submodules in my major project where all the libraries come together
individually i dont include unity in my library so i dont use submodules
i just have like 4 separate git repos
this sounds exactly like what i need. thanks! ill read into it
If I have multiple IJobEntity inside ISystem. Will it auto update in order? Or I need to manually JobHandle?
it will update in the order you schedule them
if you don't specify dependency by default it'll schedule linear
(within the system)
new Job1().Schedule();
new Job2().Schedule();
new Job3().Schedule();
codegens into
state.Depedency = new Job1().Schedule(state.Depedency);
state.Depedency = new Job2().Schedule(state.Depedency);
state.Depedency = new Job3().Schedule(state.Depedency);
*this is only true for IJobEntity, normal jobs that don't do codegen need to be dependency scheduled
I see so when I want combine dependency only need to manually write JobHandle 👀
basically i have a separate unity project with it's own simpy sample/test scene for every library
all these libraries depend on core so have at least a git repo for that included
some have multiple dependencies
and yeah i have my main game which is a full unity project with submodules on all my libraries
ooof I don't know what I'm missing here but I cant get my entity to render on android build. Any suggestion/common pitfalls 😦
what render pipeline
How are you building?
buid setting window
0.51?
1.0
cube in a subscene i assume?
Ah, haven't done much with 1.0...
i thought 1.0 brought much wider android support
though i don't do mobile dev anymore so haven't tested
mmm
Could you screen capture your settings?
Maybe I can spot something similar to 0.51...
oh quest 2?
yea
Also, Player settings...
👀 Yes but getting a working build is still so damn hard
ive seen other people compain about quest 2 not rendering
in fact david777 was one of them
I finally got it to build with just the right Unity version
graphic api ?
but mine was on 0.51 though...
thats very different unfortunately
You should set your symbols to 'Debug'.
might give you some info...
but rendering
What do the rest of the settings look like?
Does it still need to be Vulkan?
Do you have ENABLE_HYBRID_V2 set...
NO !!!
Could be it....
is that still a thing
Not sure...
Vulkan
Do you have the rest of your settings?
IL2CPP?
Do I understand correctly that you don't need to use the special build package for 1.0?
yeah
You could try Mono, but
it's deprecated
not sure if it would help...
bugger
IL2CPP is deprecated???
BUild package is
no the scriptble build thing
Ah
k
Also, have you looked at your logcat?
nah there is no alternative anymore
didnt see anything there
Can you share it?
yea, one sec it thinking hard
🙂
@rotund token do you happen to know whether there's a way to tie entity created in BakingSystem to a gameobject?
same as Scene reference
do you want a reference to the gameobject on the entity?
or do you want to just tie an entity to the same game object authoring
yeah, I create a several entities
just add a reference to it on a class icomopnentdata?
no, that's now what I meant
I meant
same way as conversion does it
whether it's main entity
or CreateAdditionalEntity in Baker
I want to reimplement same behavior Baker does during Entity creation
oh
i got you now
you want CreateAdditionalEntity
in bakingsystem
i believe just add it to the DynamicBuffer<AdditionalEntitiesBakingData>()
and set AdditionalEntityParent on the new entity
slightly unsure of a nice way to get the authoringInstanceId id though
🤔
eh
Don't think it's worth it then
too much boilerplate that might get invalid on next update
what is required for for simple entity creation btw?
what component name?
just need scenesection
yep
@rotund token i imported your Core lib. had to throw out your old EventSystem. EventSystem does not exist anymore. whats the replacement now?
can i not use mono backend with OpenXR?
it auto set me back to IL2CPP when I hit the "fix problems" button in openxr tab
What was the problem it was fixing?
my event system still exists
i just moved the nativeeventstream into the core library
and my event system now depends on Core because of this
you'll need the 2.2.0 branch though
https://gitlab.com/tertle/com.bovinelabs.event/-/tree/2.2.0
ah i thought the whole eventsystem is in core
Only arm64 is supported on Android with OpenXR. Other architectures are not supported.
I actually don't use my event system anymore
Are you sure? I'm sure I used ARMv7... I'll check once I get my project open...
My 2 libraries that used it now use custom singleton instead
(why I needed the event stream in core)
In still maintaining it though
But at some point I'll probably make a generic singleton api alternative
What Unity Version?
Maybe it's deprecated...
im using it in one place. so feel free to cull it 😄 i wont die
2022.2.b13
holy molly
internal word were not that
words
what can I look for in log
in log no errors one war during play
2022/10/29 02:41:15.433 7680 7680 Warn UnityMain type=1400 audit(0.0:2556): avc: denied " {" read" } for " name="u:object_r:vendor_board_init_prop:s0" dev="tmpfs" ino=14955 scontext=u:r:untrusted_app:s0:c114,c256,c512,c768 tcontext=u:object_r:vendor_board_init_prop:s0 tclass=file permissive=0
No idea...
@rotund token
i cannot install 2.2.0
manifest file is correct but package manager always get me 2.1.0
it worked fine with #1.2.5
Got error
What error?
- ArgumentException: Cannot find TypeIndex for type hash 7881543491081840453. Check in the debug file ExportedTypes.log of your project Logs folder (<projectName>/Logs) the corresponding Component type name for the type hash 7881543491081840453. And ensure your runtime depends on all assemblies defining the Component types your data uses.
- at Unity.Entities.Serialization.SerializeUtility.ReadTypeArray (Unity.Entities.Serialization.BinaryReader reader, Unity.Entities.Serialization.DotsSerializationReader dotsReader) [0x000c2] in E:\Work\RoughSpaghettiStudio\Projects\Occipital-Project\unity\occipital-ecs-build\Library\PackageCache\com.unity.entities@1.0.0-exp.8\Unity.Entities\Serialization\SerializeUtility.cs:520
- at Unity.Entities.Serialization.SerializeUtility.EndDeserializeWorld (Unity.Entities.ExclusiveEntityTransaction manager, Unity.Entities.Serialization.DotsSerializationReader dotsReader, Unity.Entities.Serialization.SerializeUtility+WorldDeserializationStatus& status, Unity.Entities.Serialization.Ser
something getting stripped ?
Mine didn't work with subscene added...
@rotund token package.json version is not updated
Got a mess of FenceChecker errors:
Is this on compile?
no on device
during loading scene
the non subscene object load
as a control
can i do a build w no stripping
ok appreciate the help
No worries! If you figure it out I would Love to know what it is..
Have a good night @light mason!
GN !!
Yeah I know
I just quickly split off the 2.2 branch
It depends on core now which is very different to previous
And not sure what to do about this
Maybe I'll include native event stream in the package conditionally compile out if core exists
But yeah this is why it's a branch atm not merged to master
Jeeez. Why Dispose is still getting called on those? What else can I add to avoid disposed collections.
It causes Editor to flood with errors, until I restart
ref var val = ref UnsafeUtility.As<NativeReferenceUntyped, NativeReference<int>>(ref copy.Value);
if (val.IsCreated && val.m_AllocatorLabel.IsValid)
{
val.Dispose();
}
What is the problem?
even if i have core it wont work with package manager because it pulls 2.1.0 it seems
IsCreated is a local field if you make a copy of a struct, dispose(), all other copies of the struct will still be considered IsCreated = true
after stopping play mode I get error every frame
you need to pull via gitlab i haven't pushed to upm because of above stuff
don't dispose multiple times then ^_^'
i just prefer to not have the files in the project itself. for now ill just wait. i have so many things to fix that are broken due to baking. no time to refactor stuff with your nice tools anyways
idk what disposes it
"com.bovinelabs.event": "https://gitlab.com/tertle/com.bovinelabs.event.git#2.2.0"
yeah i mean pull it git with the branch
it'll still be pulled into library
oh you mean what i need to put into the manifest file. yes i did that
well you're doing something really weird issue so it's hard to say
"com.bovinelabs.event": "https://gitlab.com/tertle/com.bovinelabs.event.git#2.2.0"
this in manifest still pulls in 2.1.0.
i think it is because the package.json file is wrong
hmm
it'll appear as 2.1 but it should pull the 2.2.0 branch
versioning has nothing to do with git dependencies
hmm ill try again
no i see same issue
oh i renamed stuff in core
namespaces
and haven't pushed it to event
ah okay that explains the errors im seeing
ok should be fixed though i haven't updated my testing for 1.0 yet so i can't say for certain
this works now (just tested)
clear from your packages-lock.json to redownload it
i wish package.json supported git repos
would make things so much easier for me
thank you for instant support!
seems like this is outdated now :
var writer = eventSystem.CreateEventWriter<DamageEvent>();
CreateEventWriter doesnt exist anymore?
i used the 1.2.5 version of eventsystem
Oh
Yeah 2.0 is a huge rework
To work with isystem
public struct SampleSystem : ISystem
{
private EventProducer<DamageEvent> producer;
public void OnCreate(ref SystemState state)
{
this.producer = state.World.GetExistingSystemManaged<EventSystem>().RegisterProducer<DamageEvent>();
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
NativeEventStream.Writer writer = this.producer.CreateWriter();
this.producer.AddJobHandle(state.Dependency);
}```
as i understood it from the forum thread you wont maintain version 1 for much longer so i though i might as well switch now.
yeah i updated 1.X to 1.0
but i don't intend to update it again
i didn't want to break people who were updating
i don't expect it'll break anytime soon/ever
unless there's an unexpected API change
but yeah i think ISystem is the future and it doesn't work with that
Is that possible to GetSingleton / GetSingletonEntity inside IJobEntity?
no