SensorToolkit is a powerful abstraction over the built-in Unity functions like Raycasts, Overlaps and Trigger Colliders. You can add standalone sensor components to your game objects and configure them as needed. The sensors can be queried to determine what they detect and provide additional information, such as the visibility or shape of the target.
Features:
• Works in both 2D and 3D.
• Many sensor types available: Raycasting, Overlaps, Steering, Line of Sight and more.
• Lightweight and modular. Sensors are independent components that feel native to Unity.
• Easy to integrate with your project: simply add a sensor component and configure it.
• Flexible and unopinionated, allowing you to design your game as desired.
• Many filtering options and querying functions for precise detection.
• Capable of detecting individual colliders or rigid bodies made up of multiple colliders.
• Advanced line-of-sight implementation can calculate partial visibility.
• Performance is a key focus, with many options available to control performance.
• Test sensors in the editor and confirm their configurations before running the game.
• Upgraded steering behaviour based on 'Context-Based Steering' method.
• All source code is included.
• Zero garbage generated.
Who is this for:
SensorToolkit is designed to be user-friendly and easy to use, regardless of your level of programming experience. Non-programmers will appreciate the ability to create complex detection behaviors without writing code, as the kit is integrated with Playmaker and additional integrations are planned. Programmers will find SensorToolkit to be a powerful foundation for building AI behaviors, as it manages the complexities of object detection and provides a clean and simple interface. The widgets and debugging inspectors also help you quickly identify any configuration issues, allowing you to reduce boilerplate and keep your code lean and neat.
Integrations:
- Playmaker
- Behavior Designer
- Game Creator 2
- Adventure Creator
- AI Tree
Difference from v1:
This is a significant update from the first version of SensorToolkit. While it may seem familiar, there are a significant number of changes. The first version's code was difficult to extend, making it hard to add new sensors or extend existing ones without blowing out complexity. SensorToolkit 2, on the other hand, has a new architecture and philosophy that makes it easier to add new features. Some of the major new features include:
• Sensors capture the bounding box of detected objects, allowing for easy targeting of an object's center of mass.
• Ray sensor supports all Physics.Raycast shapes including 'ray', 'sphere', 'box' and 'capsule'.
• Range sensor supports all Physics.Overlap shapes including 'sphere', 'box' and 'capsule'.
• Sensors do not implement the 'Update' method, meaning that if a sensor is not pulsing, it has no performance impact when this function is called each frame. This is especially useful for the TriggerSensor, allowing you to create many static trigger zones with good scalability while still being able to use the toolkit's comprehensive API.
• Line of Sight is now a separate sensor. It's been significantly extended, including the ability to smooth visibility scores over multiple frames, so it's possible to calculate fractional visibility using a single ray per pulse. It can scale visibility by distance and view angle so it's no longer necesassary to use a FOVCollider.
• Sensor pulses are randomly staggered so they don't fall on the same frame when they have the same pulse interval.
• Steering sensor that replaces the old Steering Rig and is based on the more advanced "Context Based Steering" method, which should work better and be easier to use.
• New arc sensor that allows for raycasts over a parabola.
• New boolean sensor lets you combine the results of multiple other sensors. For example: 'What are the things that I can hear and also see'.
• Ability to inject custom code into sensor detection logic for custom filtering needs.
• New Navmesh sensor for analyzing a navmesh.
• More robust codebase that has eliminated all outstanding bugs.
2.5.17 - Can trigger OnNoDetection from initial pulse. SensorToolkit/Settings can toggle user-comments on sensor inspectors
2.5.16 - Adds GetNavMeshHit() to NavMeshSensor, to expose the underlying NavMeshHit struct.
2.5.15 - Fix il2cpp build failure, Quality point generation on LOSSensor, and a couple of other small bugs.
2.5.14 - Fix for domain reload optimization. LOSSensor allows > 180 horizontal angle.
2.5.13 - Fix boxcast shape on RaySensor2D, add setters for OnClear and OnObstruction events on raycasting sensors.
2.5.12 - Fix CollectionModifiedException when a detection event handler causes the sensor to update its list of detections.
2.5.11 - Fix 'Specific GameObject' issue in new versions of playmaker. Remove deprecation warnings in Unity 2023. 'GetDetectedComponents' allocates a list of storeIn is supplied null.
2.5.10 - Fixes an issue on the NavMeshSensor where area ids are not all consecutive.
2.5.9 - SteeringSensor has configurable Up-Direction in circular mode. 'Test' button stays visible after testing sensor in editor. Tag filter runs before signal processors. Tweak some default gizmo colours.
2.5.8 - Update GC2 integration
2.5.7 - Fix for UserSignals displaying incorrectly in the inspector.
2.5.6 - Fix for error when changing pulse interval in response to a detection event.
2.5.5 - Fix GC2 integration for latest version
2.5.4 - Fix for LOS generating invalid points in rare cases when running Quality mode.
2.5.3 - Fix NRE when pulse mode is set before it has initialized.
2.5.2 - Sensor UpdateFunction exposed via C#. Boolean sensor supports XOR. Sensors link to their doc pages from inspector.
2.5.1 - Fix error when Examples directory removed. Renamed Examples/resources to Examples/assets so its not included in builds.
2.5.0 - Big update to SteeringSensor which adds Velocity Obstacles support (Breaking changes). Most sensors will take a list of SignalProcessors. Laid a foundation to jobify the sensors, currently only the steering sensor is jobified. Many small performance fixes and improvements.
2.4.7 - RaySensor ignores intersections at distance 0 for consistency between [...]Cast and [...]CastNonAlloc. Some small performance improvements. Functions that order detections by signal strength.
2.4.6 - Bugfix for Playmaker action SensorGetDetections.
2.4.5 - LOS test points generated with Sobol sequences to reduce variance.
2.4.4 - Increased minimum Unity version to 2020.3.
2.4.3 - Better list rendering in component editors.
2.4.2 - Behaviour Designer Actions converted to Conditionals so they support 'Conditional Abort'. Fixed some cases where duplicate Sensor.OnChange events might occur.
2.4.1 - Add some helper functions so visual scripting tools can dynamically set the shapes of the ray and range sensors.
2.4.0 - **Attention** delete old SensorToolkit folder before upgrading. Adds integration package for AdventureCreator. Adds assembly definitions and reorganises scripts. Some internal refactoring to support future work.
2.3.7 - Quickfix, prev update would have compilation error in projects using Odin.
2.3.6 - Bring in latest changes to Observables. No functional difference.
2.3.5 - Fixes an issue with the TriggerSensor when it uses multiple colliders for its sensing volume
2.3.4 - Added a new component 'SignalProxy' for cases where you want to detect objects composed of many Rigidbodies. Such as a ragdoll character.
2.3.3 - Remove compiler warnings
2.3.2 - New LOSColliderOwner component can instruct LOSSensor which colliders to ignore when testing an object for LOS
2.3.1 - Replaced FOVCollider.BaseSize with 'NearDistance'. Made widget colours configurable. Fix a bug where RaySensor.Clear() won't reset 'isObstructed'.
2.3.0 - Added integration for Game Creator 2
2.2.11 - Removed shaders causing compilation errors for some users
2.2.10 - Sensor has new events 'OnSomeDetection' and 'OnNoDetection'
2.2.9 - Sensor can be Cleared. Sensor.PulseAll will also pulse any input sensors.
2.2.8 - Simplified and improved the built-in locomotion used by the Steering Sensor.
2.2.7 - Small fix to previous update.
2.2.6 - PlayMaker actions will take either a GameObject owner or specific Sensor to target.
2.2.5 - New 'Sensor' type in PlayMaker variable-type dropdown. PlayMaker actions all take 'BasePulsableSensor'.
2.2.4 - Small improvement to Observable<T> class.
2.2.3 - Small tweaks to filtering functions. Slightly improved performance.
2.2.2 - LOSSensor has new prop 'PointGenerationMethod', which can be 'fast' or 'quality'. The 'quality' mode will restrict the test points to the fov, 'fast' will not.
2.2.1 - Small fix for LOSSensor. It should detect a signal when it's inside its bounds.
2.2.0 - Big improvements to LOSSensor. It will now generate test points within its defined angle constraints.
2.1.3 - Sensor pulses can now optionally be run in FixedUpdate. Fixed issue causing sensor pulses not to be staggered.
2.1.2 - Small bugfix. Signal.Bounds no longer throws NRE when Signal.Object is null.
2.1.1 - Small bugfixes for Playmaker actions.
2.1.0 - Added integration for Behavior Designer.
2.0.3 - Bugfix for LOSSensor so it will generate proper test points on rotated objects.
2.0.2 - Removed a List.AddRange which had slipped through and caused GC.
2.0.1 - No functional changes. Improved formatting and comments of all the sensors code.