tertle / com.bovinelabs.core Goto Github PK
View Code? Open in Web Editor NEWLicense: MIT License
License: MIT License
Just wanna mention Object Management does not work in Unity2022.3 starting with version 1.2.13 as 'StableTypeHashAttribute' is only available to Unity6
Even though the package was imported through scoped registery the tests are still showing up in testing window which shouldn't happen. My assumption is that the assembly definition for BovineLabs.Core.Tests is missing UNITY_INCLUDE_TESTS define.
Hello,
So today I've spent trying to figure out the States core principles and usage.
Somewhat works, but not sure if components shouldn't be changing or I setup something wrong. From the source, I see there's an AddComponent
and RemoveComponent
inside StateModel.cs
under the StateJob
, so I would assume that the component should be changed as well, depending on the State (i.e. "CameraState").
The question arises in lack of example and explanation on how to setup the components. Let's say I've got a Baker, so should I only add State components like so?:
Entity entity = GetEntity(TransformUsageFlags.Dynamic);
AddComponent(entity, new GridCellVisualState());
SetComponent(entity, new GridCellVisualState { Value = (byte)clearState });
AddComponent(entity, new GridCellVisualStatePrevious { Value = (byte)clearState });
Or I should also add all of the states that I would register in the system?
StateAPI.Register<GridCellVisualState, ArenaGridCellVisualState>(ref state, (byte)GridCellVisualStates.Arena, false);
StateAPI.Register<GridCellVisualState, WorkshopGridCellVisualState>(ref state, (byte)GridCellVisualStates.Workshop, false);
StateAPI.Register<GridCellVisualState, BarracksGridCellVisualState>(ref state, (byte)GridCellVisualStates.Barracks, false);
//... the whole list of states to register
So then the Baker would look like so:
Entity entity = GetEntity(TransformUsageFlags.Dynamic);
AddComponent(entity, new GridCellVisualState());
SetComponent(entity, new GridCellVisualState { Value = (byte)clearState });
AddComponent(entity, new GridCellVisualStatePrevious { Value = (byte)clearState });
AddComponent(entity, new ArenaGridCellVisualState());
AddComponent(entity, new WorkshopGridCellVisualState());
AddComponent(entity, new BarracksGridCellVisualState());
TBH I tried both, but neither work, hence my issue post here.
To be more precise, here's the problem:
When I trigger the change for all components in query (in my case via):
ecb.SetComponent(selectedEntity, new GridCellVisualState { Value = OrderToState(order.ValueRW) });
I can see the Byte value in GridCellVisualState
change, but not the actual components. If I understand correctly, the whole purpose for this Core submodule is to change components as well. So what am I doing wrong?
For context StateModel
is setted up almost identically as in the example:
public partial struct GridCellStateSystem : ISystem, ISystemStartStop
{
private StateModel impl;
[BurstCompile]
public void OnStartRunning(ref SystemState state)
{
this.impl = new StateModel(ref state, ComponentType.ReadWrite<GridCellVisualState>(),
ComponentType.ReadWrite<GridCellVisualStatePrevious>());
}
[BurstCompile]
public void OnStopRunning(ref SystemState state)
{
this.impl.Dispose(ref state);
}
[BurstCompile]
public void OnUpdate(ref SystemState state)
{
var ecb = new EntityCommandBuffer(state.WorldUpdateAllocator); // This can't be CommandBuffer System if prefered
this.impl.Run(ref state, ecb);
ecb.Playback(state.EntityManager);
}
}
Cool library BTW, gonna try other stuff as well. Tried SpacialMap, complicated, but works great :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.