A Unity package that aggregates reusable code from various Unity projects, providing essential utilities, systems, and extensions for game development.
- Input Management: Device type detection with automatic sprite asset switching for UI controls (Xbox, PlayStation, Keyboard)
- Haptic Feedback: Advanced controller vibration system with multi-effect support and intensity control
- Scene Loading: Flexible scene management with different scene types (Dynamic, Constant, ConstantReload) and transition effects
- SceneLoader - Main scene management class
- SceneEntry - Scene configuration data
- SceneType - Scene behavior types
- SceneMask - Scene type filtering
- Inactivity Timer: Configurable user activity monitoring with automatic timeout actions
- UI Group: Convenient wrapper for CanvasGroup operations with opacity and offset control
- Device Controls Listener: Automatic UI control icon updates based on active input device
- MonoBehaviour Extensions: Cached component access for improved performance
- Vector Utilities: Mathematical operations for Vector2/3 and Vector2Int/3Int including projections, rotations, and Manhattan (L₁) distance calculations
- Vector2Utils - 2D vector operations and rotations
- Vector2IntUtils - 2D integer vector operations
- Vector3Utils - 3D vector projections
- Vector3IntUtils - 3D integer vector operations
- UniTask Utilities: Async operation helpers including delays, interpolation, and conditional execution
- Enum Utilities: Generic enum operations for counting and enumeration
- Gizmos Extensions: Additional debug drawing utilities for scene visualization
This package can be installed via Unity Package Manager using Git URL:
- Open Unity Package Manager (Window → Package Manager)
- Click the "+" button and select "Add package from git URL"
- Enter:
https://github.com/ereldebel/CCC.git
For more detailed instructions, see the Unity Documentation.
- Unity 2021.3 or later
- UniTask package (for async utilities)
- TextMeshPro (for UI components)
// Access the singleton InputManager
var deviceType = InputManager.Instance.CurrentDeviceType;
// Listen for device changes
InputManager.Instance.DeviceTypeChanged += OnDeviceChanged;
// Control haptic feedback
InputManager.Instance.Haptics.StartHaptics(new Haptics.HapticsReference(0.5f, 0.3f, 2f));// Switch to a specific scene with transitions
await sceneLoader.SwitchScene(sceneIndex);
// Load scenes additively
sceneLoader.LoadScene(sceneEntry);
// Get active scenes of a specific type
var dynamicScenes = sceneLoader.GetActiveScenes(SceneType.Dynamic);// Project 3D vector to XZ plane
Vector3 projected = myVector3.ToVector3XZ();
// Rotate 2D vector
Vector2 rotated = myVector2.Rotate(45f);
// Calculate Manhattan distance
int distance = vectorA.L1Distance(vectorB);// Delay with seconds
await UniTaskUtils.Delay(2.5f);
// Interpolate over time
await UniTaskUtils.Interpolate(t => transform.position = Vector3.Lerp(start, end, t), 1f);This project is licensed under the MIT License - see the LICENSE.md file for details.
This package aggregates useful code patterns from Unity projects. Contributions are welcome for additional utilities that follow the established patterns and documentation standards.