Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags
(2 edits)

I've never used another event system, actually. Just so we're on the same page, what exactly is an event system in your book?

It works fine, I believe--I didn't have trouble with it for a small-scale game like this--but there are copious replacements out there to fix problems, and I know several caveats have stopped me before:

  • Callbacks don't run in a particular order, and in fact may be outright non-deterministic.
  • Methods to call must be public void. No idea if this is standard; all I know is, it's tripped me up at least twice.
  • To pass multiple parameters, or even a single parameter if it's not static in the editor, you have to create a class which inherits from UnityEvent<T0...T3> and use that for your UnityEvent field. To make it accept parameters when you Invoke() it, you have to explicitly select the dynamic variant from the dropdown menu.
  • Oh yeah also you get four parameters max, but I've never run up against that barrier (but I've also never used UnityEvent to link together whole gameplay systems before).

Again, I've no idea what other event systems are like--all I know is, UnityEvent lets me use the editor to connect systems~

Pretty much just any system where you push out events, and they get picked up by any listeners subscribed to listen for those events.

Definitely sounds like it's worth me having a look at though, it would be nice to not have to make my own on projects if Unity has one that's robust.

Glad it worked for you!

Ah, okay, simple enough.

With UnityEvent, you can add listeners from the editor, complete with up to (I think) one static, unchangeable-at-runtime parameter. I've no idea if that's common (it is among replacements), but I know I love it to death~

(Actually, it's the very same thing the GUI system uses for buttons and the like. Maybe you knew that already....)