• We are looking for a content creator to help market our assets and a future unannounced project. More details are on this page.

External script to trigger Interactable


New member
Are there any tutorials or examples of how to get an external object to trigger an interactable (such as the Shop or Crafting Stable in the demo scene) from a c# script without using a collider trigger?

Looking to open both via a keypress instead of by colliding.

The interact method takes a IInteractor interactor, but how would one invoke this if not using an actual gameobject.


New member
Ok, I figured it out. I'll share it here in case anyone else is interested. Not great naming, but hopefully it makes sense.

GameObject OpsiveObjectWithInteractable; 
GameObject playerInteracting;
var opsiveGameObject = OpsiveObjectWithInteractable.GetComponent<Interactable>();
var interactor = playerInteracting.GetComponentInParent<IInteractor>();

It could be done without referencing the object externally, but in my use case I wanted it as generic as possible.

playerInteracting = the main player
OpsiveObjectWithInteractable = the game object inside the Shop or Crafting Stable that contains the Interactable script.

This works on any object that uses the Interactable script, so could be used for doors, etc.

This simply allows me to bind a keypress to open the Shop whenever I want, anywhere in the scene.


Staff member
I'm glad you found a solution
If you want you can bypass the interactable comonenet and directly open the menu using the ShopMenuOpener and CraftingMenuOpener components (Use can check out the source if you are curious, they are super simple). The result will be the same.
But as you said your solution would work with any interactable making it more generic