This package provides basic 3D interaction wrappers with events such as Hover, UnHover and Interact. The interaction logic via raycasts targeted at colliders is included as well, though you need to implement your own input mechanics to trigger the interactions and update the hover callbacks at your own pace/ liking.
Checkout the Features section below for more information about the specific use cases and available helper scripts.
Since I am developing and maintaining this asset package in my spare time, feel free to support me via paypal, buy me a coffee or check out my games or other published assets.
The current dependency is a fork with performance improvements (https://github.com/nikodemgrz/NaughtyAttributes) of the original open-source project NaughtyAttributes by dbrizov: https://github.com/dbrizov/NaughtyAttributes.
Note, that the original NaughtyAttributes package is also compatible with this package in case you already have it installed!
Add the following git urls in the Unity PackageManager:
"https://github.com/nikodemgrz/Unity3DHelperTools.git#upm"
"https://github.com/nikodemgrz/NikosAssets.PauseHandler.git"
"https://github.com/nikodemgrz/NikosAssets.Interactions.git"
For my NaughtyAttributes performance improvements fork:
"https://github.com/nikodemgrz/NaughtyAttributes.git#upm"
The original branch:
"https://github.com/dbrizov/NaughtyAttributes.git#upm"
You can also choose specific releases and tags after the "#" instead of "upm".
In short:
- The
BaseInteractableis the object you want to interact with. Inherit from this and/ or subscribe to the interaction events (OnInteracted,OnHovered,OnUnhovered) to execute your custom logic. - The
InteractableGroupredirects the interaction calls to it's assignedBaseInteractables. - If you want to interact with a
BaseInteractabledirectly, it must have a collider alongside this component! - To actally call the hover and interaction functions, you must add the
BaseRaycastingPlayercomponent to your player and call it'sHandleHover()function repeatedly (for example every Update or FixedUpdate frame) and theInteract()function whenever an interaction should or could happen, for example when pressing the left mouse button.