Skip to content

niguiecandy/omni-events

Repository files navigation

Omni Events

Description

This is an Event System that is implementing 'Observer Pattern' using ScriptableObject.

Ref : 3 cool ways to architect your game with Scriptable Objects

You can create event 'asset's in the project folder, and reference it from any GameObjects in any Scenes. This is especially useful if you want to connect UIs and GameObject instances throughout the scenes.

This pattern has the following advantages :

  1. Modular No direct references are needed between GameObject instances. This makes GameObjects easy to be saved as prefabs.
  2. Editable Change in one script doesn't affect others.
  3. Debuggable Modularized scripts are easy to be debugged.

This is a Plus

Designer-friendly : Exposed in the inspector and no scripting is needed.

Import

This repo can be imported to your project as a submodule. In Unity, This will be treated as a custom package.

  • Add this repo as a submodule to your project. Clone at YourProject/Packages/Omni-Events. If you are not familiar with submodule, modify YourProject/Packages/manifest.json file as follows :
	"dependencies": {
		...
		"com.ngc6543.omnievents": "https://github.com/niguiecandy/omni-events.git",
		...
  },

Usage

  1. OmniEvent Assets
    • Right-click on the Project panel, and Select 'Omni Events/...' to create an event asset.
    • Various types of parameters are supported.
  2. OmniEventListener Components
    • Add an OmniEventListener component of matching parameter to a GameObject, and assign event asset(s).
    • Add any public method or property of the same parameter to Invoked UnityEvent.
  3. OmniEventInvoker Components
    • Inspector helper components for debugging / easy invoking.

About

ScriptableObject Event solution for Unity

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages