playMaker

Author Topic: How do you get an action to appear in the drop down menu when dragging a compone  (Read 1047 times)

Tholde

  • Playmaker Newbie
  • *
  • Posts: 1
When you drag a game object into your playmaker state and mouse over the GameObject component, the Activate GameObject action appears at the top of the context menu.

I have a custom action for moving the player camera to certain locations, and when I drag in an object with this CameraLocation component attached, I want my change view action to appear in the context menu just as ActivateGameObject does when you drag in a GameObject component. Problem is, I can't see anywhere in the ActivateGameObject action code how that action does it, so I don't know how to replicate it.

sabrina

  • Playmaker Newbie
  • *
  • Posts: 1
    • Slope Game
In your project, create a new C# script named something like CameraLocationInspector.cs.
Code: [Select]
using UnityEngine;
using UnityEditor;

[CustomEditor(typeof(CameraLocation))]
public class CameraLocationInspector : Editor
{
    public override void OnInspectorGUI()
    {
        base.OnInspectorGUI();

        if (GUILayout.Button("Change View"))
        {
            // Your code to change the camera location based on the CameraLocation component
        }
    }
}