Table of Contents

CyberEntityGames

CyberEntity Core

Table of Contents


Overview

The Core system provides a set of tools to help developers:

  • Improve Inspector usability with custom attributes like [ReadOnly] and [ShowIf].
  • Implement performant cooldown logic using a Burst-compatible ECS system.
  • Utilize common math operations missing from standard Unity Mathematics, such as MoveTowards for float3.
  • Manage application performance through centralized frame rate and VSync control.
  • Ensure unique manager instances with a robust, thread-safe Singleton pattern for MonoBehaviours.

Requirements

Unity

Requirement Version
Unity Editor 6000.3.20 or newer recommended

Dependencies

The Core system depends on the following project packages:

Dependency Purpose
com.unity.entities Required for the ECS-based cooldown system.
com.unity.test-framework Required for running package tests.

Installation

1. Add the Package

Add the package to your project's manifest.json:

{
  "dependencies": {
    "com.cyberentt.core": "1.0.0"
  }
}

2. (Optional) Import Samples

The package includes a FrameRate Controller prefab. To import it:

  1. Open Window > Package Manager.
  2. Select CyberEntity Core.
  3. Expand Samples and click Import.

Key Features

Attributes

The package includes custom attributes to improve the Unity Inspector experience. These can be found in the CyberEntt.Attributes and CyberEntt.Editor.Attributes namespaces.

  • ReadOnly: Prevents a field from being edited in the Inspector while still allowing it to be visible.

    using CyberEntt.Attributes;
    
    public class MyComponent : MonoBehaviour
    {
        [ReadOnly] public float speed;
    }
    

    AttributeReadOnly

  • ShowIf: Conditionally shows or hides a field based on another field's value.

    using CyberEntt.Attributes;
    
    public class MyComponent : MonoBehaviour
    {
        public bool enableFeature;
        [ShowIf("enableFeature", true)] public int featureValue;
    }
    

    AttributeShowIf-1

    AttributeShowIf-2

Cooldown System

Located in CyberEntt.Cooldown_Impl. A highly performant, Burst-compatible system for managing timers in ECS.

  • Cooldown: An IEnableableComponent used to track remaining time.
  • CooldownSystem: A system that automatically handles the lifecycle of cooldown components.
  1. Add CooldownAuthoring to your GameObject

    CooldownAuthoring

    // In a System:
    if (SystemAPI.IsComponentEnabled<Cooldown>(entity))
    {
        // Cooldown is active
        var cooldown = SystemAPI.GetComponent<Cooldown>(entity);
        float remaining = cooldown.time;
    }
    

Extensions

Found in the CyberEntt.Extensions namespace. Provides extra functionality:

  • ColorExtensions: Includes RandomColorFromString

    using CyberEntt.Extensions;
    string name = "someText";
    
    ColorExtensions.RandomColorFromString(name)
    
  • FixedString: Conversion and comparison utilities for Unity's fixed-size strings.

    using CyberEntt.Extensions;
    
    var names = new FixedString512Bytes("string1.string2.string3");
    var results = new NativeList<FixedString128Bytes>(Allocator.Temp);
    FixedStringExtensions.Split(in names, '.', ref results);
    results.Dispose();
    
  • float3: Includes MoveTowards, constants (Up, Forward, etc.).

    using CyberEntt.Extensions;
    
    float3 currentPos = new float3(0, 0, 0);
    currentPos.MoveTowards(new float3(10, 0, 0), 1.0f);
    
  • float4: Conversion utilities.

    using CyberEntt.Extensions;
    
    float4 float4Color = new float4();
    Color color = float4Color.ToColor();
    
    float4Color = color.ToFloat4();
    
  • quaternion: Includes RotateTowards, ToEulerAngles

    using CyberEntt.Extensions;
    
    float3 direction = new float3(10, 0, 0);
    float deltaInDegrees = 90f;
    quaternion q = new();
    
    q.RotateTowards(direction, deltaInDegrees);
    float3 eulerAngles = q.ToEulerAngles();
    

Frame Rate Management

Located in CyberEntt.FrameRate.

  • FrameRateController: A utility to manage Application.targetFrameRate and QualitySettings.vSyncCount consistently.

    using CyberEntt.FrameRate;
    
    FrameRateController.SetTargetFrameRate(60);
    

    or

    1. Open Window > Package Manager
    2. Select CyberEntity Core.
    3. Expand Samples and click Prefabs Import.

    FrameRateController

Singletons

Located in CyberEntt.Singleton_Impl.

  • Singleton<T>: A base class for MonoBehaviour singletons that handles instance creation, thread safety, and persistence across scenes.
    using CyberEntt.Singleton_Impl;
    
    public class MySingletonMonoBehaviour : MonoSingleton<MySingletonMonoBehaviour>