Skip to content

Configure button

Koretsky Konstantin edited this page Oct 21, 2021 · 3 revisions

Create own ScriptableObject asset

Plugins system uses ScriptableObjects behaviour. You need to create new one that will control all your custom marking menu actions.

There are some restrictions:

  1. Class has to inherit from ScriptableObject to be able to use its functionality
  2. Class should have public methods to be able to get hooked to UnityEvent via the Editor

Simple script view

image

Using the CreateAssetMenu attribute helps to create ScriptableObject using your class.

[CreateAssetMenu(fileName = "Action", menuName = "ScriptableObjects/CustomActions", order = 1)]

image

This will create an “Action” ScriptableObject in your currently opened folder.

Hook up

Navigate back to MarkingMenuModelContainer. Choose your created new button in list.

  1. Add UnityEvent, then drag & drop your created ScriptableObject on it.
  2. Select method which will do something
  3. Use marking menu on scene view and choose your button.

image

Clone this wiki locally