FastCast | Job System Raycast Framework/ Fast Raycast

$4
Publisher Golem Kin Games
File size 68.08kB
Number of files 10
Latest version 1
Latest release date 2024-10-08 01:05:12
First release date 2024-10-08 01:05:12
Supported Unity versions 2018.4.2 or higher

FastCast is a cutting-edge raycasting system built for Unity, designed to maximize performance by leveraging Unity's Job System. Whether you need single or multiple raycasts, FastCast provides a powerful and easy-to-use Singleton API for both cases. Perfect for games or simulations requiring real-time raycast calculations, this system is optimized for speed and flexibility.


Key features include:

  • High-performance raycasting with the Job System
  • Support for both single and multiple raycasts
  • Customizable parameters such as hitBackfaces, hitTriggers, and hitMultiFace
  • Built-in Gizmo visualization to debug raycasts in the Editor, with color-coded hit and miss results
  • Editor integration to set max raycasts per frame and track raycast performance in real-time

FastCast is ideal for developers looking to improve raycast performance while maintaining a user-friendly, flexible API for their project.


. Mobile Optimization via Unity's Job System

FastCast takes full advantage of Unity's Job System, which allows tasks like raycasting to run in parallel across multiple threads. On mobile devices, where CPU resources are more limited, this multi-threaded approach ensures that performance is optimized. By offloading raycasting to separate threads, the main game loop remains responsive, ensuring smooth gameplay even when performing large numbers of raycasts.

2. Batch Processing for Reduced Overhead

On mobile, processing power is a precious resource, and FastCast addresses this by allowing batch processing of multiple raycasts in a single job. Instead of performing multiple raycasts individually, FastCast groups them into a single batch, reducing overhead and enhancing performance. This batch processing is especially useful in scenarios where many raycasts are needed, such as physics-based games, enemy detection systems, or interactive object selection.

3. Configurable Raycast Limits for Mobile Devices

Mobile devices vary greatly in their processing power, from high-end smartphones to budget devices. FastCast’s maxRaycastsPerFrame parameter allows you to configure the number of raycasts performed per frame. You can easily adjust this setting based on the target device's capabilities to ensure the raycasting system remains performant across a wide range of mobile hardware.

For example, on lower-end devices, you can reduce the number of raycasts per frame, while high-end devices can handle more, all while maintaining smooth performance.

4. Efficient Memory Management

FastCast uses NativeArrays for efficient memory allocation and processing during raycasts, which is particularly important for mobile devices with limited memory. By using NativeArray to store raycast commands and results, FastCast minimizes garbage collection (GC) overhead and keeps memory usage low, which is essential to preventing performance spikes or frame drops on mobile.

5. Battery-Friendly

Raycasting can be computationally expensive if not optimized, which can impact battery life on mobile devices. FastCast’s optimization strategies, such as batch processing and multi-threaded execution, help reduce the overall computational load, making your game more energy-efficient. With FastCast, you can ensure your raycasting operations are not a drain on mobile battery life.

6. Gizmo-Free Mobile Builds

While FastCast includes a powerful Gizmo visualization system for debugging raycasts in the Editor, this functionality is automatically disabled in mobile builds, ensuring no unnecessary performance impact in your final mobile game. You can still use the Gizmo system during development to visualize raycasts in the Editor, but when the game is built and deployed to mobile, these features are omitted to ensure optimal runtime performance.

Key Benefits for Mobile Projects:

  • Job System integration ensures optimized performance for multi-threaded CPUs on mobile.
  • Batch raycasting reduces overhead, making it perfect for real-time physics or complex interactions in mobile games.
  • Configurable raycast limits allow you to tailor performance based on device capability.
  • Low memory footprint and optimized garbage collection keep the app running smoothly on devices with limited resources.
  • Battery-friendly by minimizing CPU usage and keeping resource consumption low.

Best Use Cases on Mobile:

  1. Physics-heavy mobile games: Ideal for games that require a lot of raycasts for things like collision detection, enemy line-of-sight calculations, or physics simulations.
  2. AR/VR mobile experiences: Use FastCast to efficiently handle ray-based interaction in AR (Augmented Reality) and VR (Virtual Reality) experiences on mobile.
  3. Mobile FPS games: Perfect for fast-paced first-person shooters where fast, accurate raycasting is essential for bullet tracing or hit detection.

With FastCast, you can ensure that your mobile game maintains high performance, even when performing a large number of raycasts, without sacrificing battery life or memory efficiency.

Top Publisher Assets