The MIS-LockOn extension provides a modular targeting solution designed to integrate with third-person character controllers, AI systems, and camera frameworks such as Cinemachine. At its architectural core, the asset separates spatial target identification, input processing, camera orientation, and UI rendering into distinct, loosely coupled systems. This design prevents hard dependencies on specific controller implementations, allowing technical artists and developers to attach lock-on mechanics to custom or third-party character solutions.
Target identification relies on spatial query algorithms rather than continuous global scene searches. By utilizing Physics.OverlapSphereNonAlloc combined with frustum checks and dot-product angle calculations (Vector3.Dot), the system filters valid targets based on distance, line-of-sight visibility, and viewport alignment. The lock-on manager tracks active targets through a dynamic priority queue, allowing effortless switching between nearest targets along horizontal or vertical screen axes.
Camera.WorldToScreenPoint or RectTransformUtility, updating HUD reticles without breaking batching.In high-density combat scenarios featuring numerous active AI entities, continuous physics queries and matrix operations can introduce performance bottlenecks if unoptimized. MIS-LockOn addresses these constraints through disciplined memory management and configurable execution intervals.
Physics.OverlapSphereNonAlloc and array-based raycasting buffers to prevent Garbage Collection (GC) allocations during gameplay ticks.Update ticks. Developers can configure target scanning frequencies (e.g., 0.1s to 0.2s intervals) to distribute CPU workload without sacrificing input responsiveness.LateUpdate to eliminate visual jitter caused by execution-order discrepancies between character movement and camera updates.Configuring MIS-LockOn requires establishing target identification parameters, attaching tracking components to character setups, and wiring up UI reticle prefabs.
Any character or entity intended to be lockable must possess a Collider and be assigned to a designated layer (e.g., Enemy). Add the target anchor component to specify the exact point where the reticle aligns, such as a character's chest or head bone, rather than the root transform position.
Attach the primary lock-on controller component to the player character or main camera rig. Set the following inspector properties:
Default, Environment) that block line-of-sight.Use C# event listeners to drive custom camera behaviors or combat mechanics when a target is locked or released. Below is an example demonstrating event subscription and custom targeting execution:
using UnityEngine;
using UnityEngine.Events;
namespace MIS.LockOn.Documentation
{
public class LockOnIntegrationExample : MonoBehaviour
{
[SerializeField] private LayerMask targetLayers;
[SerializeField] private float maxLockDistance = 20f;
[SerializeField] private Transform currentTarget;
public delegate void TargetChangedHandler(Transform newTarget);
public event TargetChangedHandler OnTargetAcquired;
public event UnityAction OnTargetLost;
public void AcquireTarget(Transform candidateTarget)
{
if (candidateTarget == null) return;
float distance = Vector3.Distance(transform.position, candidateTarget.position);
if (distance <= maxLockDistance)
{
currentTarget = candidateTarget;
OnTargetAcquired?.Invoke(currentTarget);
}
}
public void ClearTarget()
{
currentTarget = null;
OnTargetLost?.Invoke();
}
private void Update()
{
if (currentTarget != null)
{
// Validate distance and occlusion during active lock
if (Vector3.Distance(transform.position, currentTarget.position) > maxLockDistance)
{
ClearTarget();
}
}
}
}
}
| Category | Add-Ons / Extensions |
|---|---|
| Latest Version | v1.2.12 (2 tracked releases) |
| File Size | 1.18 MB |
| Added to Platform | February 6, 2026 |
| Views | 9 views |
| Downloads | 1 downloads |
| Favourites | 1 favourites |
| Official Store | Buy Original License on Unity Asset Store → |
| Issue with Package? | Report Broken Link → |