I have a 3D model, that is a child of a world space Canvas. How can I make it interactable, using the UI system? So far I’ve tried adding the button component, in addition to a box collider. I’ve also tried making it a child of a button prefab. No luck, am I missing something, or is it simply not possible, without using an event in a custom script?
2019 edit: Here’s what I ended up creating and using back in 2016/2017:
You can use a UnityEvent to get the nice pretty editor event system just like a Button component.
using UnityEngine.Events;
[RequireComponent(typeof(Collider))] //A collider is needed to receive clicks
public class Interact : MonoBehaviour {
public UnityEvent interactEvent;
private void OnMouseDown() {
interactEvent.Invoke();
}
}