Assign mouse events for gameobject/collider at runtime


I have a gameobject created at runtime, is there any way to assign the the OnMouseEnter dynamically (without having a pre-written script), so the evens can be handled by a global script?


What you could do is add a script to the game object which has a C# delegate function in it. The gameobject creating this object + script then adds itself to the delegate trigger. The scripts onMouseEnter script fires the delegate instead of running custom code.

but you didn’t want to attach a script to it.