Is there an example of Unity Events?

E.g. a script that has some unity events that can be added (like the buttons have) so I can set some events up that can happen for example when the script enables/disables

Original Post on Discord

by user 103054507105067008

The samples contain a little script for physics collisions: https://github.com/needle-tools/needle-engine-samples/blob/main/assets/Runtime/_Shared/SampleScripts~/PhysicsCollision.ts

you need this basically:

@serializeable(EventList)
yourEventName?: EventList;```

Codegen will build a UnityEvent from it (and vice versa a Unity event will be an EventList in typescript runtime)

Thanks that’s perfect

by user 103054507105067008