Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

Honestly, I thought it would be, but it turns out that most of the supplemental mechanics didn't actually rely on any core mechanics beyond "character can move into this space when s/he wasn't before." UnityEvent is a beautiful thing, and I have absolutely been underutilizing it.

...Then again, I stayed up until about 5 in the morning struggling to add in the softball throwing, build out all the character abilities, and make enough levels to properly utilize at least three of the characters, so yeah, there was definitely a drawback to it :)

Huh. I said "completely different," didn't I....

I haven't actually tried using UnityEvent yet, does it work OK out of the box or do you have to modify it a lot to get it do what you want vs. rolling with your own event system?

(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....)