Interactable Object
Adds an Interaction Menu to any 3D GameObject. This component handles the UI logic when a player looks at or approaches an object.
Fields
message(string): The text displayed on the UI when the interaction is rendered (e.g., "Open Door").interactionState(EInteractableState): The current state of the interaction logic.onInteractionStart(UnityEvent): Event triggered immediately when the player presses the interaction key.
Interaction States
Default
Invalid
Disabled
Label
Code Example
Below is a standard implementation using MelonLoader.
using MelonLoader;
using UnityEngine;
using Il2CppScheduleOne.Interaction; // Needed For Interactable Objects
public class MyClass : MelonMod
{
// Set To 3D GameObject In Current Scene
public GameObject myGameObject;
// Called On Scene Load
public override void OnSceneWasLoaded()
{
InteractableObject myInteractableObject = myGameObject.AddComponent(); // Adds An Interaction Menu To The Gameobject
myInteractableObject.message = "Press E To Interact"; // Sets Message On Interaction Menu
}
}