Eye of the Nile Docs
Everything you need to know to get started!
Loading...
Searching...
No Matches
ObjectInteractable Class Reference

Detailed Description

Put this script on an object you want the player to be able to interact with. Put the function you want triggered when the player interacts in the InvokeOnInteract section in the Unity Editor. If you want the function to trigger after the interact button has been held for a certain amount of time, use the InvokeOnLongPress section. If you want the function to trigger when the player enters the interaction range, use the InvokeOnProximityEnter section. If you want the function to trigger every frame the player is still in the interaction range, use the InvokeOnProximityStay section. If you want the function to trigger when the player exits the interaction range, use the InvokeOnProximityExit section. If you want the function to trigger when the player melee attacks the object, use the InvokeOnMelee section.

Documentation updated 4/6/2025

Author
Stephen Nuttall
Note
for InvokeOnMelee to work, the object needs a Collider2D AND be on the interactable layer (set in the top right corner of the inspector).

Public Member Functions

void triggerInteraction ()
 Add the function you want to run when the player interacts with this object to this event in the Unity Editor.
 
void triggerLongPress ()
 If you want the function to run after a long press, add it to this event in the Unity Editor.
 
void triggerProximityEnter ()
 If you want the function to run when the player enters the interaction range, add it to this event in the Unity Editor.
 
void triggerProximityStay ()
 If you want the function to run when the player stays in interaction range, add it to this event in the Unity Editor.
 
void triggerProximityExit ()
 If you want the function to run when the player exits the interaction range, add it to this event in the Unity Editor.
 
void triggerMelee ()
 If you want the function to run after the object is meleed, add it to this event in the Unity Editor.
 

Public Attributes

UnityEvent InvokeOnInteract
 Invokes any functions added to the InvokeOnInteract event.
 
UnityEvent InvokeOnLongPress
 Invokes any functions added to the InvokeOnLongPress event.
 
UnityEvent InvokeOnProximityEnter
 Invokes any functions added to the InvokeOnProximityEnter event.
 
UnityEvent InvokeOnProximityStay
 Invokes any functions added to the InvokeOnProximityStay event.
 
UnityEvent InvokeOnProximityExit
 Invokes any functions added to the InvokeOnProximityExit event.
 
UnityEvent InvokeOnMelee
 Invokes any functions added to the InvokeOnMelee event.
 

Member Function Documentation

◆ triggerInteraction()

void ObjectInteractable.triggerInteraction ( )

Add the function you want to run when the player interacts with this object to this event in the Unity Editor.

◆ triggerLongPress()

void ObjectInteractable.triggerLongPress ( )

If you want the function to run after a long press, add it to this event in the Unity Editor.

◆ triggerMelee()

void ObjectInteractable.triggerMelee ( )

If you want the function to run after the object is meleed, add it to this event in the Unity Editor.

◆ triggerProximityEnter()

void ObjectInteractable.triggerProximityEnter ( )

If you want the function to run when the player enters the interaction range, add it to this event in the Unity Editor.

◆ triggerProximityExit()

void ObjectInteractable.triggerProximityExit ( )

If you want the function to run when the player exits the interaction range, add it to this event in the Unity Editor.

◆ triggerProximityStay()

void ObjectInteractable.triggerProximityStay ( )

If you want the function to run when the player stays in interaction range, add it to this event in the Unity Editor.

Member Data Documentation

◆ InvokeOnInteract

UnityEvent ObjectInteractable.InvokeOnInteract

Invokes any functions added to the InvokeOnInteract event.

◆ InvokeOnLongPress

UnityEvent ObjectInteractable.InvokeOnLongPress

Invokes any functions added to the InvokeOnLongPress event.

◆ InvokeOnMelee

UnityEvent ObjectInteractable.InvokeOnMelee

Invokes any functions added to the InvokeOnMelee event.

◆ InvokeOnProximityEnter

UnityEvent ObjectInteractable.InvokeOnProximityEnter

Invokes any functions added to the InvokeOnProximityEnter event.

◆ InvokeOnProximityExit

UnityEvent ObjectInteractable.InvokeOnProximityExit

Invokes any functions added to the InvokeOnProximityExit event.

◆ InvokeOnProximityStay

UnityEvent ObjectInteractable.InvokeOnProximityStay

Invokes any functions added to the InvokeOnProximityStay event.


The documentation for this class was generated from the following file: