### GameInitSystem Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/sub-system.md An example of a SubSystem used for game initialization, specifically within the InitializationSystemGroup. It demonstrates requiring a configuration component and initializing game state. ```csharp // SubSystem with multiple update stages [UpdateInGroup(typeof(InitializationSystemGroup))] public partial class GameInitSystem : SubSystem { protected override void OnCreate() { base.OnCreate(); RequireForUpdate(); } protected override void OnUpdate() { if (!SystemAPI.HasSingleton()) { var config = worldBlackboardEntity.GetComponentData(); // Initialize game state var state = new GameState { difficulty = config.defaultDifficulty, score = 0, isRunning = false }; worldBlackboardEntity.AddComponentData(state); } } } ``` -------------------------------- ### LatiosWorld Initialization and System Injection Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/bootstrap-tools.md Example demonstrating how to initialize a LatiosWorld, retrieve all system types, and inject them using BootstrapTools. Includes marking a custom system with NoGroupInjection. ```csharp public partial class MyBootstrap : ICustomBootstrap { public void Initialize(string defaultWorldName) { // Create the Latios World var latiosWorld = new LatiosWorld("GameWorld"); // Get all available systems var allSystems = TypeManager.GetAllSystemTypes(); var systemList = new NativeList(Allocator.Temp); foreach (var system in allSystems) { systemList.Add(system); } // Inject systems in order BootstrapTools.InjectUnitySystems(systemList, latiosWorld); // Inject your own root systems BootstrapTools.InjectRootSuperSystems(systemList, latiosWorld, latiosWorld.simulationSystemGroup); // Finally inject user gameplay systems BootstrapTools.InjectUserSystems(systemList, latiosWorld, latiosWorld.simulationSystemGroup); systemList.Dispose(); } } // Mark a system to prevent default injection [NoGroupInjection] [UpdateInGroup(typeof(InitializationSystemGroup))] public partial class CustomSystem : SystemBase { protected override void OnUpdate() { } } ``` -------------------------------- ### PlayerMovementSystem Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/sub-system.md A simple SubSystem example for handling player movement logic. It demonstrates accessing blackboard entities and querying for player entities to update their state. ```csharp // Simple SubSystem for gameplay logic public partial class PlayerMovementSystem : SubSystem { protected override void OnCreate() { base.OnCreate(); // Any initialization code here } protected override void OnUpdate() { // Access blackboard entities var gameConfig = worldBlackboardEntity.GetComponentData(); var sceneState = sceneBlackboardEntity.GetComponentData(); // Update player entities foreach (var (transform, velocity, entity) in SystemAPI.Query, RefRO>().WithEntityAccess()) { // Apply movement based on velocity } } public override void OnNewScene() { // Initialize scene-specific data sceneBlackboardEntity.AddComponentData(new PlayerSpawnData { active = true }); } } ``` -------------------------------- ### Initialize Baking for All Worlds Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/StandardExplicitBootstrap.txt Installs Latios-specific bakers for various subsystems during the baking process. This is used for custom baking setups. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Unity.Entities; [UnityEngine.Scripting.Preserve] public class LatiosBakingBootstrap : ICustomBakingBootstrap { public void InitializeBakingForAllWorlds(ref CustomBakingBootstrapContext context) { //Latios.Authoring.CoreBakingBootstrap.ForceRemoveLinkedEntityGroupsOfLength1(ref context); Latios.Transforms.Authoring.TransformsBakingBootstrap.InstallLatiosTransformsBakers(ref context); Latios.Psyshock.Authoring.PsyshockBakingBootstrap.InstallUnityColliderBakers(ref context); Latios.Kinemation.Authoring.KinemationBakingBootstrap.InstallKinemation(ref context); Latios.Unika.Authoring.UnikaBakingBootstrap.InstallUnikaEntitySerialization(ref context); } } ``` -------------------------------- ### Bootstrap for Injecting Root Systems Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/root-super-system.md Example of a bootstrap class that initializes the LatiosWorld and automatically injects all discovered RootSuperSystems. ```csharp using Latios.Frameworke; using Unity.Collections; using Unity.Entities; // In your bootstrap public partial class MyBootstrap : ICustomBootstrap { public void Initialize(string defaultWorldName) { var world = new LatiosWorld("GameWorld"); // Inject root systems var allSystems = TypeManager.GetAllSystemTypes(); var systemList = new NativeList(Allocator.Temp); foreach (var sys in allSystems) { systemList.Add(sys); } // Inject all RootSuperSystems automatically BootstrapTools.InjectRootSuperSystems(systemList, world); systemList.Dispose(); } } ``` -------------------------------- ### LatiosWorld Usage Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/latios-world.md Demonstrates the basic creation and usage of a LatiosWorld, including accessing blackboard entities and system groups. ```csharp // Create a LatiosWorld for a game var world = new LatiosWorld("GameWorld", WorldFlags.Simulation); // Access blackboard entities for shared data world.worldBlackboardEntity.AddComponentData(new GameSettings { difficulty = 2 }); // Access system groups var simGroup = world.simulationSystemGroup; // Create scene blackboard entity when a new scene loads world.ForceCreateNewSceneBlackboardEntityAndCallOnNewScene(); // Set exception tolerance world.zeroToleranceForExceptions = true; ``` -------------------------------- ### Install Transforms Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeQvvsExplicitBootstrap.txt Installs the Transforms system, which is part of the Latios framework for efficient transform handling. ```csharp Latios.Transforms.TransformsBootstrap.InstallTransforms(world); ``` -------------------------------- ### Initialize NetCode Singletons Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeQvvsExplicitBootstrap.txt Initializes NetCode singletons on the world's blackboard entity. This is a common setup step for NetCode integration. ```csharp NetCodeBootstrapTools.InitializeNetCodeSingletonsOnTheWorldBlackboardEntity(world); ``` -------------------------------- ### Blackboard Entity Usage Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/blackboard-entity.md Demonstrates how to add, set, and retrieve component data using a BlackboardEntity in a SuperSystem and a SystemBase. Includes checking for component existence. ```csharp // In a SuperSystem public override void OnNewScene() { // Create scene configuration var config = new SceneConfig { timeScale = 1f, isPaused = false }; sceneBlackboardEntity.AddComponentData(config); } // In a system public partial class GameSystem : SystemBase { private Entity worldBlackboardEntity; protected override void OnCreate() { // Store reference to blackboard entity worldBlackboardEntity = SystemAPI.QueryBuilder() .WithAll() .Build() .GetSingletonEntity(); } protected override void OnUpdate() { // Read config var config = sceneBlackboardEntity.GetComponentData(); // Update config config.timeScale = 2f; sceneBlackboardEntity.SetComponentData(config); // Check if component exists if (sceneBlackboardEntity.HasComponent()) { var pause = sceneBlackboardEntity.GetComponentData(); } } } ``` -------------------------------- ### HealthSystem Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/sub-system.md An example of a SubSystem for managing health. It shows how to query for health components, regenerate health, check for death, and update global game statistics. ```csharp // SubSystem with specialized logic public partial class HealthSystem : SubSystem { protected override void OnUpdate() { var deltaTime = SystemAPI.Time.DeltaTime; // Regenerate health over time foreach (var health in SystemAPI.Query>()) { if (health.ValueRO.isAlive && health.ValueRO.current < health.ValueRO.max) { health.ValueRW.current += health.ValueRO.regenRate * deltaTime; health.ValueRW.current = math.min(health.ValueRW.current, health.ValueRO.max); } } // Check for death var deadCount = 0; foreach (var (health, entity) in SystemAPI.Query>().WithEntityAccess()) { if (!health.ValueRO.isAlive && health.ValueRO.current <= 0) { deadCount++; } } // Update stats in blackboard var stats = worldBlackboardEntity.GetComponentData(); stats.deadCount = deadCount; worldBlackboardEntity.SetComponentData(stats); } } ``` -------------------------------- ### EntityWithBuffer Query Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/entity-with.md Demonstrates querying entities with a dynamic buffer using EntityWithBuffer and accessing its contents. ```csharp // Query entities with a dynamic buffer foreach (var inv in SystemAPI.Query>()) { // Access buffer contents for (int i = 0; i < inv.buffer.Length; i++) { var item = inv.buffer[i]; // Process item... } } ``` -------------------------------- ### ForceCreateNewSceneBlackboardEntityAndCallOnNewScene Method Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/latios-world.md Forces the creation of a new scene blackboard entity and calls OnNewScene() for relevant systems, especially when the Scene Manager is not installed. ```csharp public BlackboardEntity ForceCreateNewSceneBlackboardEntityAndCallOnNewScene() ``` -------------------------------- ### Allocator Usage Examples Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/configuration.md Demonstrates how to use different allocators for temporary, persistent, and default memory allocations. Choose the allocator based on the data's lifetime and disposal requirements. ```csharp // Temporary allocations (disposed within frame) var buffer = new DestroyCommandBuffer(Allocator.TempJob); // Persistent allocations (require manual disposal) var hashMap = new DynamicHashMap(10, Allocator.Persistent); // Default allocations (matches world allocator) var list = new NativeList(Allocator.World); ``` -------------------------------- ### Start FluentQuery from ILatiosSystem Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/fluent-query.md Initiates the FluentQuery builder using an ILatiosSystem. This is the entry point for creating queries within a Latios system context. ```csharp internal static unsafe FluentQuery Fluent(this ILatiosSystem system) ``` -------------------------------- ### Single-Threaded Command Recording Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/sync-point-playback-system.md Shows how to use the sync point to record commands for entity deletion within a single-threaded context. ```csharp public partial class DeletionSystem : SubSystem { protected override void OnUpdate() { var destroyBuffer = worldBlackboardEntity.GetComponentData(); foreach (var (health, entity) in SystemAPI.Query>().WithEntityAccess()) { if (health.ValueRO.current <= 0) { destroyBuffer.Add(entity); } } } } ``` -------------------------------- ### DestroyCommandBuffer Usage Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/destroy-command-buffer.md Demonstrates how to use DestroyCommandBuffer to record and play back entity destruction in a single-threaded system. ```csharp [BurstCompile] public partial struct DestructionSystem : ISystem { [BurstCompile] public void OnUpdate(ref SystemState state) { var destroyBuffer = new DestroyCommandBuffer(Allocator.TempJob); // Single-threaded destruction recording var query = SystemAPI.QueryBuilder() .WithAll() .Build(); foreach (var entity in query) { destroyBuffer.Add(entity); } // Play back immediately destroyBuffer.Playback(state.EntityManager); destroyBuffer.Dispose(); } } ``` -------------------------------- ### Inject User Systems Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/bootstrap-tools.md Injects systems that are not from Unity and not part of a module installer. Recommended for use after installing modules via module installers. ```csharp public static void InjectUserSystems(NativeList systems, World world, ComponentSystemGroup defaultGroup) ``` -------------------------------- ### Custom SuperSystem Implementation Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/super-system.md Demonstrates how to define a custom SuperSystem, GameLogicGroup, by overriding CreateSystems to add specific managed systems like MovementSystem and CollisionSystem. It also shows overriding OnNewScene and ShouldUpdateSystem for custom logic. ```csharp // Define a custom SuperSystem public partial class GameLogicGroup : RootSuperSystem { protected override void CreateSystems() { GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); } public override void OnNewScene() { // Reset game state when scene loads sceneBlackboardEntity.AddComponentData(new SceneState { isLoaded = true }); } public override bool ShouldUpdateSystem() { // Only update if game is running var gameState = worldBlackboardEntity.GetComponentData(); return gameState.isRunning && base.ShouldUpdateSystem(); } } // In a system within the SuperSystem public partial class MovementSystem : SystemBase { protected override void OnCreate() { // Access Latios utilities from within a standard system // via the world or through component dependencies } protected override void OnUpdate() { // Process entities } } ``` -------------------------------- ### Latios Baking Bootstrap Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeQvvsExplicitBootstrap.txt Implements ICustomBakingBootstrap to install Latios-specific bakers for the baking process. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Latios.Compatibility.UnityNetCode; using Unity.Entities; using Unity.NetCode; [UnityEngine.Scripting.Preserve] public class LatiosBakingBootstrap : ICustomBakingBootstrap { public void InitializeBakingForAllWorlds(ref CustomBakingBootstrapContext context) { Latios.Authoring.CoreBakingBootstrap.ForceRemoveLinkedEntityGroupsOfLength1(ref context); Latios.Transforms.Authoring.TransformsBakingBootstrap.InstallLatiosTransformsBakers(ref context); Latios.Psyshock.Authoring.PsyshockBakingBootstrap.InstallUnityColliderBakers(ref context); Latios.Kinemation.Authoring.KinemationBakingBootstrap.InstallKinemation(ref context); } } ``` -------------------------------- ### Latios Baking Bootstrap Initialization Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/DreamingBootstrap.txt Initializes the Latios framework for the baking process. This includes installing core Latios systems and specific module bakers. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Unity.Entities; [UnityEngine.Scripting.Preserve] public class LatiosBakingBootstrap : ICustomBakingBootstrap { public void InitializeBakingForAllWorlds(ref CustomBakingBootstrapContext context) { Latios.Authoring.CoreBakingBootstrap.ForceRemoveLinkedEntityGroupsOfLength1(ref context); Latios.Transforms.Authoring.TransformsBakingBootstrap.InstallLatiosTransformsBakers(ref context); Latios.Psyshock.Authoring.PsyshockBakingBootstrap.InstallUnityColliderBakers(ref context); Latios.Kinemation.Authoring.KinemationBakingBootstrap.InstallKinemation(ref context); Latios.Unika.Authoring.UnikaBakingBootstrap.InstallUnikaEntitySerialization(ref context); } } ``` -------------------------------- ### Game Initialization Group Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/root-super-system.md Example of a RootSuperSystem used for initialization tasks. It specifies systems to be created and managed within the InitializationSystemGroup. ```csharp using Latios.Frameworke; using Unity.Entities; // Root system group for initialization [UpdateInGroup(typeof(InitializationSystemGroup))] public partial class GameInitializationGroup : RootSuperSystem { protected override void CreateSystems() { GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); } } ``` -------------------------------- ### NetCode Server Latios Bootstrap Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeStandardInjectionBootstrap.txt Implements ICustomServerWorldBootstrap for initializing a server LatiosWorld. It sets up NetCode singletons, injects NetCode generated systems, and installs user systems. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Latios.Compatibility.UnityNetCode; using Unity.Entities; using Unity.NetCode; #if !LATIOS_TRANSFORMS_UNITY #error The currently active Latios Framework Bootstrap requires LATIOS_TRANSFORMS_UNITY to be defined for correct operation. #endif [UnityEngine.Scripting.Preserve] public class NetCodeServerLatiosBootrap : ICustomServerWorldBootstrap { public World Initialize(string defaultWorldName, WorldFlags worldFlags, WorldSystemFilterFlags worldSystemFilterFlags) { var world = new LatiosWorld(defaultWorldName, worldFlags, LatiosWorld.WorldRole.Server); UnityEngine.Application.runInBackground = true; NetCodeBootstrapTools.InitializeNetCodeSingletonsOnTheWorldBlackboardEntity(world); var systems = DefaultWorldInitialization.GetAllSystemTypeIndices(worldSystemFilterFlags); NetCodeBootstrapTools.InjectUnityAndNetCodeGeneratedSystems(systems, world, world.simulationSystemGroup); //NetCodeBootstrapTools.EnableDynamicAssembliesList(world.Unmanaged); BootstrapTools.InjectUserSystems(systems, world, world.simulationSystemGroup); world.initializationSystemGroup.SortSystems(); world.simulationSystemGroup.SortSystems(); return world; } } ``` -------------------------------- ### Example of Namespaced System Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/errors.md Illustrates how to define a system within a namespace for proper injection. Ensure all system types have a namespace when using namespace-based injection. ```csharp namespace MyGame.Systems { public partial class MySystem : SystemBase { } } ``` -------------------------------- ### Rendering Presentation Group Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/root-super-system.md Example of a RootSuperSystem for the presentation (rendering) phase. It defines the systems responsible for camera and UI updates. ```csharp using Latios.Frameworke; using Unity.Entities; // Root system group for presentation [UpdateInGroup(typeof(PresentationSystemGroup))] public partial class RenderingGroup : RootSuperSystem { protected override void CreateSystems() { GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); } } ``` -------------------------------- ### NetCode Client Latios Bootstrap Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeStandardInjectionBootstrap.txt Implements ICustomClientWorldBootstrap for initializing a client LatiosWorld. It sets up NetCode singletons, injects NetCode generated systems, and installs various Latios modules. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Latios.Compatibility.UnityNetCode; using Unity.Entities; using Unity.NetCode; #if !LATIOS_TRANSFORMS_UNITY #error The currently active Latios Framework Bootstrap requires LATIOS_TRANSFORMS_UNITY to be defined for correct operation. #endif [UnityEngine.Scripting.Preserve] public class NetCodeClientLatiosBootrap : ICustomClientWorldBootstrap { public World Initialize(string defaultWorldName, WorldFlags worldFlags, WorldSystemFilterFlags worldSystemFilterFlags) { var world = new LatiosWorld(defaultWorldName, worldFlags, LatiosWorld.WorldRole.Client); UnityEngine.Application.runInBackground = true; NetCodeBootstrapTools.InitializeNetCodeSingletonsOnTheWorldBlackboardEntity(world); var systems = DefaultWorldInitialization.GetAllSystemTypeIndices(worldSystemFilterFlags); NetCodeBootstrapTools.InjectUnityAndNetCodeGeneratedSystems(systems, world, world.simulationSystemGroup); //NetCodeBootstrapTools.EnableDynamicAssembliesList(world.Unmanaged); Latios.Myri.MyriBootstrap.InstallMyri(world); Latios.Kinemation.KinemationBootstrap.InstallKinemation(world); Latios.Calligraphics.CalligraphicsBootstrap.InstallCalligraphics(world); Latios.LifeFX.LifeFXBootstrap.InstallLifeFX(world); BootstrapTools.InjectUserSystems(systems, world, world.simulationSystemGroup); world.initializationSystemGroup.SortSystems(); world.simulationSystemGroup.SortSystems(); world.presentationSystemGroup.SortSystems(); return world; } } ``` -------------------------------- ### Fluent Query Usage Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/fluent-query.md Demonstrates how to use the FluentQuery API to build various entity queries, including simple component inclusion, filtering by enabled/disabled states, and using OR clauses. ```csharp public partial class MovementSystem : SystemBase { private EntityQuery m_movingEntities; protected override void OnCreate() { base.OnCreate(); // Simple query: entities with Transform and Velocity m_movingEntities = this.Fluent() .With() .With() .Build(); } protected override void OnUpdate() { // Complex query with enabled/disabled filtering var dangerousEntities = this.Fluent() .With() .With() .WithEnabled() .Without() .Build(); // Query with multiple exclusions var passiveEntities = this.Fluent() .With(readOnly: true) .WithoutEnabled() .WithoutDisabled() .Build(); // Query with OR clause var visualEntities = this.Fluent() .With() .Any() .Any() .Build(); } } ``` -------------------------------- ### Multiple EntityWith Queries Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/entity-with.md Shows how to use multiple EntityWith queries in a single system to update entity positions based on velocity. ```csharp // With multiple EntityWith queries [BurstCompile] public partial struct MovementSystem : ISystem { [BurstCompile] public void OnUpdate(ref SystemState state) { float dt = SystemAPI.Time.DeltaTime; foreach (var (moving, velocity) in SystemAPI.Query, RefRO>()) { moving.component.ValueRW.value += velocity.ValueRO.value * dt; } } } ``` -------------------------------- ### NetCode Local Latios Bootstrap Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeStandardInjectionBootstrap.txt Implements ICustomLocalWorldBootstrap for initializing a local LatiosWorld. It installs Myri, Kinemation, Calligraphics, and LifeFX systems. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Latios.Compatibility.UnityNetCode; using Unity.Entities; using Unity.NetCode; #if !LATIOS_TRANSFORMS_UNITY #error The currently active Latios Framework Bootstrap requires LATIOS_TRANSFORMS_UNITY to be defined for correct operation. #endif [UnityEngine.Scripting.Preserve] public class NetCodeLocalLatiosBootrap : ICustomLocalWorldBootstrap { public World Initialize(string defaultWorldName, WorldFlags worldFlags, WorldSystemFilterFlags worldSystemFilterFlags) { var world = new LatiosWorld(defaultWorldName, worldFlags); var systems = DefaultWorldInitialization.GetAllSystemTypeIndices(worldSystemFilterFlags); BootstrapTools.InjectUnitySystems(systems, world, world.simulationSystemGroup); Latios.Myri.MyriBootstrap.InstallMyri(world); Latios.Kinemation.KinemationBootstrap.InstallKinemation(world); Latios.Calligraphics.CalligraphicsBootstrap.InstallCalligraphics(world); Latios.LifeFX.LifeFXBootstrap.InstallLifeFX(world); BootstrapTools.InjectUserSystems(systems, world, world.simulationSystemGroup); world.initializationSystemGroup.SortSystems(); world.simulationSystemGroup.SortSystems(); world.presentationSystemGroup.SortSystems(); return world; } } ``` -------------------------------- ### EntityWith Query Example Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/entity-with.md Demonstrates a simple single-component query using EntityWith to update entity positions. ```csharp [BurstCompile] public partial struct PositionUpdateSystem : ISystem { [BurstCompile] public void OnUpdate(ref SystemState state) { // Simple single-component query foreach (var entityWithPos in SystemAPI.Query>()) { entityWithPos.component.ValueRW.value += new float3(1, 0, 0); } } } ``` -------------------------------- ### Start FluentQuery from EntityManager Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/fluent-query.md Initiates the FluentQuery builder using an EntityManager. Use this when you need to construct queries directly from the entity manager. ```csharp public static FluentQuery Fluent(this EntityManager em) ``` -------------------------------- ### Latios Baking Bootstrap for Custom Baking Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeStandardInjectionBootstrap.txt Implements ICustomBakingBootstrap to install Latios Kinemation bakers during the baking process. This is used for custom baking scenarios. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Latios.Compatibility.UnityNetCode; using Unity.Entities; using Unity.NetCode; #if !LATIOS_TRANSFORMS_UNITY #error The currently active Latios Framework Bootstrap requires LATIOS_TRANSFORMS_UNITY to be defined for correct operation. #endif [UnityEngine.Scripting.Preserve] public class LatiosBakingBootstrap : ICustomBakingBootstrap { public void InitializeBakingForAllWorlds(ref CustomBakingBootstrapContext context) { //Latios.Authoring.CoreBakingBootstrap.ForceRemoveLinkedEntityGroupsOfLength1(ref context); //Latios.Psyshock.Authoring.PsyshockBakingBootstrap.InstallUnityColliderBakers(ref context); Latios.Kinemation.Authoring.KinemationBakingBootstrap.InstallKinemation(ref context); } } ``` -------------------------------- ### Start FluentQuery from SystemState Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/fluent-query.md Initiates the FluentQuery builder using a SystemState. This is useful for constructing queries within the scope of a system's state. ```csharp public static unsafe FluentQuery Fluent(this ref SystemState state) ``` -------------------------------- ### Gameplay Simulation Group Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/root-super-system.md Example of a RootSuperSystem for the simulation phase. It includes a custom ShouldUpdateSystem implementation to pause the game logic when the game state is paused. ```csharp using Latios.Frameworke; using Unity.Entities; // Root system group for simulation [UpdateInGroup(typeof(SimulationSystemGroup))] public partial class GameplayGroup : RootSuperSystem { protected override void CreateSystems() { GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); } public override bool ShouldUpdateSystem() { // Pause entire game when needed var gameState = worldBlackboardEntity.GetComponentData(); return !gameState.isPaused && base.ShouldUpdateSystem(); } } ``` -------------------------------- ### ForceCreateNewSceneBlackboardEntityAndCallOnNewScene Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/latios-world.md Manually destroys the old scene blackboard entity, creates a new one, and invokes the OnNewScene() method for all ILatiosSystem implementations. This is useful when the Scene Manager is not installed. ```APIDOC ## ForceCreateNewSceneBlackboardEntityAndCallOnNewScene() ### Description When the Scene Manager is not installed, call this method to destroy the old sceneBlackboardEntity, create a new one, and invoke the OnNewScene() method for all systems implementing ILatiosSystem. ### Signature ```csharp public BlackboardEntity ForceCreateNewSceneBlackboardEntityAndCallOnNewScene() ``` ### Returns - **BlackboardEntity** - The newly created scene blackboard entity. ``` -------------------------------- ### Initialize LatiosWorld and Add Component Data Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/README.md Demonstrates how to create a new LatiosWorld instance with specific flags and add component data to its blackboard entity. ```csharp var world = new LatiosWorld("GameWorld", WorldFlags.Simulation); world.worldBlackboardEntity.AddComponentData(new GameSettings { difficulty = 2 }); ``` -------------------------------- ### InjectUserSystems Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/bootstrap-tools.md Injects all systems that are not made by Unity and not part of a module installer. It is recommended to use this after installing modules. ```APIDOC ## InjectUserSystems ### Description Injects all systems not made by Unity and not part of a module installer. It is recommended to use this after installing modules with module installers. ### Method `public static void InjectUserSystems(NativeList systems, World world, ComponentSystemGroup defaultGroup)` ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters - **systems** (NativeList) - Required - List of systems to filter and inject - **world** (World) - Required - The world to inject systems into - **defaultGroup** (ComponentSystemGroup) - Required - Default group for systems without UpdateInGroup attributes ### Remarks It is recommended to use this after installing modules with module installers. ``` -------------------------------- ### Get LatiosWorldUnmanaged from WorldUnmanaged (non-ref) Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/latios-world-unmanaged.md Extension method to get the LatiosWorldUnmanaged from a WorldUnmanaged using a non-ref parameter. ```csharp public static LatiosWorldUnmanaged GetLatiosWorldUnmanaged(this WorldUnmanaged worldUnmanaged) ``` -------------------------------- ### Get LatiosWorldUnmanaged from WorldUnmanaged (ref) Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/latios-world-unmanaged.md Extension method to get the LatiosWorldUnmanaged from a WorldUnmanaged using a ref parameter. ```csharp public static LatiosWorldUnmanaged GetLatiosWorldUnmanaged(this ref WorldUnmanaged worldUnmanaged) ``` -------------------------------- ### Create and Manage Systems in a SuperSystem Group Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/README.md Illustrates how to define a RootSuperSystem that creates and manages other systems, with conditional updating based on world blackboard data. ```csharp [UpdateInGroup(typeof(SimulationSystemGroup))] public partial class GameplayGroup : RootSuperSystem { protected override void CreateSystems() { GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); } public override bool ShouldUpdateSystem() { var gameState = worldBlackboardEntity.GetComponentData(); return gameState.isRunning && base.ShouldUpdateSystem(); } } ``` -------------------------------- ### Create a LatiosWorld Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/README.md Demonstrates how to create a new LatiosWorld instance. This is the entry point for setting up your game world. ```csharp public partial class MyBootstrap : ICustomBootstrap { public void Initialize(string defaultWorldName) { var world = new LatiosWorld("GameWorld"); // Inject your systems... } } ``` -------------------------------- ### GetLatiosWorldUnmanaged(ref WorldUnmanaged) Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/latios-world-unmanaged.md Gets the LatiosWorldUnmanaged from a WorldUnmanaged instance. ```APIDOC ## GetLatiosWorldUnmanaged(this ref WorldUnmanaged worldUnmanaged) ### Description Gets the LatiosWorldUnmanaged from a WorldUnmanaged. ### Method static ### Parameters #### Path Parameters - `worldUnmanaged` (ref WorldUnmanaged) - The world to extract from. #### Returns The LatiosWorldUnmanaged for the given world. ``` -------------------------------- ### GetLatiosWorldUnmanaged(WorldUnmanaged) Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/latios-world-unmanaged.md Gets the LatiosWorldUnmanaged from a WorldUnmanaged instance (non-ref version). ```APIDOC ## GetLatiosWorldUnmanaged(this WorldUnmanaged worldUnmanaged) ### Description Gets the LatiosWorldUnmanaged from a WorldUnmanaged (non-ref version). ### Method static ### Parameters #### Path Parameters - `worldUnmanaged` (WorldUnmanaged) - The world to extract from. #### Returns The LatiosWorldUnmanaged for the given world. ``` -------------------------------- ### Initialize Latios Editor Systems Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/UnityTransformsInjectionBootstrap.txt Sets up a Latios World for the Unity editor, injecting Unity systems and then specific Latios modules like Kinemation and Calligraphics. ```csharp [UnityEngine.Scripting.Preserve] public class LatiosEditorBootstrap : ICustomEditorBootstrap { public World Initialize(string defaultEditorWorldName) { var world = new LatiosWorld(defaultEditorWorldName, WorldSystemFilterFlags.Editor); var systems = DefaultWorldInitialization.GetAllSystemTypeIndices(WorldSystemFilterFlags.Default, true); BootstrapTools.InjectUnitySystems(systems, world, world.simulationSystemGroup); Latios.Kinemation.KinemationBootstrap.InstallKinemation(world); Latios.Calligraphics.CalligraphicsBootstrap.InstallCalligraphics(world); BootstrapTools.InjectUserSystems(systems, world, world.simulationSystemGroup); return world; } } ``` -------------------------------- ### AsParallelWriter Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/instantiate-command-buffer.md Gets the ParallelWriter for this InstantiateCommandBuffer, allowing for parallel writing to the buffer from jobs. ```APIDOC ## AsParallelWriter() ### Description Gets the ParallelWriter for this InstantiateCommandBuffer. ### Returns The ParallelWriter which shares this buffer's backing storage ``` -------------------------------- ### Sequential Instantiation with InstantiateCommandBuffer Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/instantiate-command-buffer.md Records entities to instantiate using a query and then plays them back to the EntityManager. Ensure the buffer is disposed after playback. ```csharp [BurstCompile] public partial struct SpawnerSystem : ISystem { [BurstCompile] public void OnUpdate(ref SystemState state) { var instantiateBuffer = new InstantiateCommandBuffer(Allocator.TempJob); // Record entities to instantiate var query = SystemAPI.QueryBuilder() .WithAll() .Build(); foreach (var (request, entity) in SystemAPI.Query>().WithEntityAccess()) { instantiateBuffer.Add(request.ValueRO.prefabEntity); } // Play back all instantiations instantiateBuffer.Playback(state.EntityManager); instantiateBuffer.Dispose(); } } ``` -------------------------------- ### BlackboardEntity Operators Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/blackboard-entity.md Implicit conversion operator to get the underlying Entity from a BlackboardEntity. ```APIDOC ## implicit operator Entity(BlackboardEntity entity) ### Description Implicitly converts a BlackboardEntity to its underlying Entity. ### Method Implicit Conversion ### Parameters #### Path Parameters - **entity** (BlackboardEntity) - Required - The BlackboardEntity to convert ``` -------------------------------- ### Integrate Unity Profiler Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/configuration.md Demonstrates how to use Unity's Profiler API to profile system updates. This is useful for identifying performance bottlenecks within your systems. ```csharp #if UNITY_EDITOR using UnityEngine.Profiling; public partial struct MySystem : SystemBase { protected override void OnUpdate() { Profiler.BeginSample("MySystem.Update"); // Work here Profiler.EndSample(); } } #endif ``` -------------------------------- ### Get Parallel Writer Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/add-components-command-buffer.md Obtains a ParallelWriter instance for this AddComponentsCommandBuffer, enabling concurrent writes from jobs. ```csharp public ParallelWriter AsParallelWriter() ``` -------------------------------- ### ISystem Interface Implementation Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/ISystem.txt This snippet shows a basic implementation of the ISystem interface. It includes the necessary methods for system creation, destruction, and updating. ```csharp using Latios; using Unity.Burst; using Unity.Collections; using Unity.Entities; using Unity.Jobs; using Unity.Mathematics; using Latios.Transforms; #ROOTNAMESPACEBEGIN# [BurstCompile] public partial struct #SCRIPTNAME# : ISystem { LatiosWorldUnmanaged latiosWorld; [BurstCompile] public void OnCreate(ref SystemState state) { latiosWorld = state.GetLatiosWorldUnmanaged(); } [BurstCompile] public void OnDestroy(ref SystemState state) { } [BurstCompile] public void OnUpdate(ref SystemState state) { #NOTRIM# } } #ROOTNAMESPACEEND# ``` -------------------------------- ### NetCodeThinClientLatiosBootrap Initialization Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeStandardInjectionBootstrap.txt Initializes a thin client world for NetCode, injecting necessary systems and configuring application settings. ```csharp [UnityEngine.Scripting.Preserve] public class NetCodeThinClientLatiosBootrap : ICustomThinClientWorldBootstrap { public World Initialize(string defaultWorldName, WorldFlags worldFlags, WorldSystemFilterFlags worldSystemFilterFlags) { var world = new LatiosWorld(defaultWorldName, worldFlags, LatiosWorld.WorldRole.ThinClient); UnityEngine.Application.runInBackground = true; NetCodeBootstrapTools.InitializeNetCodeSingletonsOnTheWorldBlackboardEntity(world); var systems = DefaultWorldInitialization.GetAllSystemTypeIndices(worldSystemFilterFlags); NetCodeBootstrapTools.InjectUnityAndNetCodeGeneratedSystems(systems, world, world.simulationSystemGroup); //NetCodeBootstrapTools.EnableDynamicAssembliesList(world.Unmanaged); BootstrapTools.InjectUserSystems(systems, world, world.simulationSystemGroup); world.initializationSystemGroup.SortSystems(); world.simulationSystemGroup.SortSystems(); return world; } } ``` -------------------------------- ### Count Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/instantiate-command-buffer.md Gets the number of entities currently stored in this InstantiateCommandBuffer. Note that this method performs a summing operation on every invocation. ```APIDOC ## Count() ### Description Gets the number of entities stored in this InstantiateCommandBuffer. This method performs a summing operation on every invocation. ### Returns The number of elements stored in this buffer ``` -------------------------------- ### Get Aabb for Collider Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/psyshock-collision-world.md Retrieves the axis-aligned bounding box (Aabb) for a collider at a given index within the collision layer. ```csharp public Aabb GetAabb(int index) ``` -------------------------------- ### Configure SuperSystem System Creation Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/configuration.md Override `CreateSystems` in a `RootSuperSystem` to define the order in which systems are created and added. Systems are added in order for explicit ordering. ```csharp protected override void CreateSystems() { // Systems are added in order for explicit ordering GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); GetOrCreateAndAddManagedSystem(); } ``` -------------------------------- ### Initialize Latios Baking Systems Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/UnityTransformsInjectionBootstrap.txt Initializes specific Latios Framework baking systems for use during the Unity build process. This includes Kinemation and Unika entity serialization. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Unity.Entities; #if !LATIOS_TRANSFORMS_UNITY #error The currently active Latios Framework Bootstrap requires LATIOS_TRANSFORMS_UNITY to be defined for correct operation. #endif [UnityEngine.Scripting.Preserve] public class LatiosBakingBootstrap : ICustomBakingBootstrap { public void InitializeBakingForAllWorlds(ref CustomBakingBootstrapContext context) { //Latios.Authoring.CoreBakingBootstrap.ForceRemoveLinkedEntityGroupsOfLength1(ref context); //Latios.Psyshock.Authoring.PsyshockBakingBootstrap.InstallUnityColliderBakers(ref context); Latios.Kinemation.Authoring.KinemationBakingBootstrap.InstallKinemation(ref context); Latios.Unika.Authoring.UnikaBakingBootstrap.InstallUnikaEntitySerialization(ref context); } } ``` -------------------------------- ### NetCodeThinClientLatiosBootrap Initialization Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/NetCodeQvvsExplicitBootstrap.txt Implements the ICustomThinClientWorldBootstrap interface for initializing a thin client world with NetCode and Latios framework components. ```csharp public class NetCodeThinClientLatiosBootrap : ICustomThinClientWorldBootstrap { public World Initialize(string defaultWorldName, WorldFlags worldFlags, WorldSystemFilterFlags worldSystemFilterFlags) { var world = new LatiosWorld(defaultWorldName, worldFlags, LatiosWorld.WorldRole.ThinClient); world.useExplicitSystemOrdering = true; UnityEngine.Application.runInBackground = true; NetCodeBootstrapTools.InitializeNetCodeSingletonsOnTheWorldBlackboardEntity(world); var systems = DefaultWorldInitialization.GetAllSystemTypeIndices(worldSystemFilterFlags); NetCodeBootstrapTools.InjectUnityAndNetCodeGeneratedSystems(systems, world, world.simulationSystemGroup); //NetCodeBootstrapTools.EnableDynamicAssembliesList(world.Unmanaged); Latios.Transforms.TransformsBootstrap.InstallTransforms(world); BootstrapTools.InjectRootSuperSystems(systems, world, world.simulationSystemGroup); world.initializationSystemGroup.SortSystems(); world.simulationSystemGroup.SortSystems(); return world; } } ``` -------------------------------- ### Latios Runtime Bootstrap Initialization Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/UnityTransformsExplicitBootstrap.txt Initializes the default LatiosWorld for runtime, enabling explicit system ordering and injecting various Latios modules including Transforms, Myri, Kinemation, Calligraphics, Unika, and LifeFX. It also sorts systems and appends the world to the player loop. ```csharp using System; using System.Collections.Generic; using Latios; using Latios.Authoring; using Unity.Entities; #if !LATIOS_TRANSFORMS_UNITY #error The currently active Latios Framework Bootstrap requires LATIOS_TRANSFORMS_UNITY to be defined for correct operation. #endif [UnityEngine.Scripting.Preserve] public class LatiosBootstrap : ICustomBootstrap { public bool Initialize(string defaultWorldName) { var world = new LatiosWorld(defaultWorldName); World.DefaultGameObjectInjectionWorld = world; world.useExplicitSystemOrdering = true; var systems = DefaultWorldInitialization.GetAllSystemTypeIndices(WorldSystemFilterFlags.Default); BootstrapTools.InjectUnitySystems(systems, world, world.simulationSystemGroup); //Latios.Transforms.TransformsBootstrap.InstallGameObjectEntitySynchronization(world); Latios.Myri.MyriBootstrap.InstallMyri(world); Latios.Kinemation.KinemationBootstrap.InstallKinemation(world); Latios.Calligraphics.CalligraphicsBootstrap.InstallCalligraphics(world); Latios.Unika.UnikaBootstrap.InstallUnikaEntitySerialization(world); Latios.LifeFX.LifeFXBootstrap.InstallLifeFX(world); BootstrapTools.InjectRootSuperSystems(systems, world, world.simulationSystemGroup); world.initializationSystemGroup.SortSystems(); world.simulationSystemGroup.SortSystems(); world.presentationSystemGroup.SortSystems(); ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop(world); return true; } } ``` -------------------------------- ### Manual DestroyCommandBuffer Creation (Not Recommended) Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/sync-point-playback-system.md Demonstrates direct creation of a DestroyCommandBuffer without automatic dependency tracking. Manual JobHandle management is required and generally not recommended. ```csharp [BurstCompile] public partial struct ManualDepSystem : ISystem { [BurstCompile] public void OnUpdate(ref SystemState state) { // Direct creation without automatic dependency tracking var buffer = new DestroyCommandBuffer(Allocator.TempJob); // You must manually handle JobHandle dependencies // This is not recommended - use SyncPointPlaybackSystem instead buffer.Dispose(); } } ``` -------------------------------- ### Bulk Entity Operations with Command Buffers Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/README.md Demonstrates using command buffers for efficient bulk entity operations like destruction. This is more performant than individual entity manager calls. ```csharp // Instead of multiple EntityManager calls var destroyBuffer = new DestroyCommandBuffer(Allocator.TempJob); foreach (var entity in entities) { destroyBuffer.Add(entity); } destroyBuffer.Playback(em); destroyBuffer.Dispose(); ``` -------------------------------- ### BlackboardEntity Constructor (SystemHandle, LatiosWorldUnmanaged) Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/blackboard-entity.md Creates a BlackboardEntity by wrapping a SystemHandle and its associated LatiosWorldUnmanaged. This is useful for managing the entity associated with a system. ```csharp public BlackboardEntity(SystemHandle systemHandle, LatiosWorldUnmanaged latiosWorld) ``` -------------------------------- ### Build and Query Collision World Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/psyshock-collision-world.md Demonstrates how to build a collision world from entities with Colliders and LocalToWorld components, access its properties, retrieve AABBs, create query masks, and perform spatial queries. Remember to dispose of the collision world when done. ```csharp [BurstCompile] public partial struct CollisionWorldBuildingSystem : ISystem { [BurstCompile] public void OnUpdate(ref SystemState state) { // Create a collision world from all entities with Collider and LocalToWorld var collisionWorld = Physics.BuildCollisionWorld(state); // Access collision world properties UnityEngine.Debug.Log($ ``` -------------------------------- ### Configure Exception Handling Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/latios-world-unmanaged.md Sets or gets a value indicating whether the World should stop updating systems if an exception is caught by LatiosWorld. Defaults to false. ```csharp public bool zeroToleranceForExceptions { get; set; } ``` -------------------------------- ### Playback (EntityManager, BufferLookup, EntityStorageInfoLookup) Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/destroy-command-buffer.md Plays back the command buffer using a custom batching strategy. ```APIDOC ## Playback(EntityManager entityManager, BufferLookup legLookup, EntityStorageInfoLookup esil) ### Description Plays back the DestroyCommandBuffer using a custom batching strategy. ### Parameters #### Path Parameters - **entityManager** (EntityManager) - Required - The EntityManager to use for destruction - **legLookup** (BufferLookup) - Required - A ReadWrite lookup of LinkedEntityGroup dynamic buffers - **esil** (EntityStorageInfoLookup) - Required - A lookup for info about an entity's chunk and position in it ``` -------------------------------- ### Add Simple Components with AddComponentsCommandBuffer Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/add-components-command-buffer.md Demonstrates adding simple components without data to entities queried by a specific component marker. Ensure to playback and dispose of the command buffer. ```csharp [BurstCompile] public partial struct BuffInitializationSystem : ISystem { [BurstCompile] public void OnUpdate(ref SystemState state) { var addBuffer = new AddComponentsCommandBuffer(Allocator.TempJob); // Add simple components without data var query = SystemAPI.QueryBuilder() .WithAll() .Build(); foreach (var entity in query) { addBuffer.Add(entity); } // Playback all additions addBuffer.Playback(state.EntityManager); addBuffer.Dispose(); } } ``` -------------------------------- ### Initialize Latios Runtime Systems Source: https://github.com/dreaming381/latios-framework/blob/master/Core/Editor/ScriptTemplates/UnityTransformsInjectionBootstrap.txt Initializes the default Latios World for runtime, injecting Unity systems and then a comprehensive set of Latios modules including Transforms, Myri, Kinemation, Calligraphics, Unika, and LifeFX. ```csharp [UnityEngine.Scripting.Preserve] public class LatiosBootstrap : ICustomBootstrap { public bool Initialize(string defaultWorldName) { var world = new LatiosWorld(defaultWorldName); World.DefaultGameObjectInjectionWorld = world; var systems = DefaultWorldInitialization.GetAllSystemTypeIndices(WorldSystemFilterFlags.Default); BootstrapTools.InjectUnitySystems(systems, world, world.simulationSystemGroup); //Latios.Transforms.TransformsBootstrap.InstallGameObjectEntitySynchronization(world); Latios.Myri.MyriBootstrap.InstallMyri(world); Latios.Kinemation.KinemationBootstrap.InstallKinemation(world); Latios.Calligraphics.CalligraphicsBootstrap.InstallCalligraphics(world); Latios.Unika.UnikaBootstrap.InstallUnikaEntitySerialization(world); Latios.LifeFX.LifeFXBootstrap.InstallLifeFX(world); BootstrapTools.InjectUserSystems(systems, world, world.simulationSystemGroup); world.initializationSystemGroup.SortSystems(); world.simulationSystemGroup.SortSystems(); world.presentationSystemGroup.SortSystems(); ScriptBehaviourUpdateOrder.AppendWorldToCurrentPlayerLoop(world); return true; } } ``` -------------------------------- ### Add Components with Data using AddComponentsCommandBuffer Source: https://github.com/dreaming381/latios-framework/blob/master/_autodocs/api-reference/add-components-command-buffer.md Shows how to add components that contain data to entities. The component data is initialized before being added. Remember to playback and dispose of the command buffer. ```csharp // Adding components with data [BurstCompile] public partial struct PowerUpSystem : ISystem { [BurstCompile] public void OnUpdate(ref SystemState state) { var addBuffer = new AddComponentsCommandBuffer(Allocator.TempJob); foreach (var (powerUp, entity) in SystemAPI.Query>().WithEntityAccess()) { // Add component with initialized data addBuffer.Add(entity, new PowerUpActive { duration = powerUp.ValueRO.duration, strength = powerUp.ValueRO.strength }); } addBuffer.Playback(state.EntityManager); addBuffer.Dispose(); } } ```