Skip to content

Serializable unity events added to a scriptable object.

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta
Notifications You must be signed in to change notification settings

luisoliveiras/scriptable-events

Repository files navigation

Scriptable Events

GitHub package.json version

What is this?

The Scriptable Events are serializable unity events added to a ScriptableObject. Create scene independent and reusable events with just a few lines of code.


Installation:

On Unity 2018.4:

Download this package to your disk. Open the package manager on Window > Package Manager and select the + button and click on the Add package from disk... option. Add the ScriptableEvents package.

On Unity 2019.1 and above:

Open the project manifest file under the Packages folder and add these lines to the dependencies:

"dependencies": {
  ...
    "com.loophouse.scriptable-events":"https://github.com/luisoliveiras/scriptable-events.git",
  ...
}
On Unity 2019.3 and above:

Open the package manager on Window > Package Manager and select the + button and click on the Add package from git URL... option.

** You can also add it from disk if you want, just follow the steps from 2018.4 install guide.


How to Use

Events and Listeners:

Create a scriptable event asset from the Scriptable Events option on the Create menu. With this event you are able to register other scriptable objects to listen to the event from the inspector. You can also create a reference to it in a MonoBehaviour class and trigger the event using the method Invoke() or Invoke(T parameter).

Scriptable event asset example

Add a ScriptableEventListener component of the corresponding event type to your gameobject to be able to register your components' methods as listeners to the event.

Scriptable event asset example

You can also create events for your own types just following the examples in the samples folder.


Samples

Basic Events and Listeners:

What: This sample contains events and listeners to int, float, string, bool, Vector2 and Vector3.

How: Import the sample and move the scripts to a folder of your preference. The "Scriptable Events" option will become available the Create menu.

Basic Events and Listeners Example

About

Serializable unity events added to a scriptable object.

Topics

Resources

License

MIT, Unknown licenses found

Licenses found

MIT
LICENSE
Unknown
LICENSE.meta

Stars

Watchers

Forks

Languages