Action Browser Window

Look, the editor now has an action browser and can add actions into the tree!

Action Browser Window!

This thing took a long time to create. I wanted actions to be added into the editor automatically after compilation. It uses reflection to look for those classes. I also studied attributes and how to access them so I could add grouping attributes to the action class like the one in the image. Attributes are so cool! This is my ActionGroup attribute:

using System;

namespace BananaTree {
     * An attribute used for grouping actions
    public class ActionGroup : Attribute {

        private string name;

         * Constructor
        public ActionGroup(string name) {
   = name;

        public string Name {
            get {
                return name;


This class can be used like this:

    public class BntMoveToByDuration : BntAction {

Unity does not have a built in “selection list” GUI where an item is highlighted when it is selected. That took a while as well. My implementation used GUI event handling and GUIStyle.

Completing the action browser made me excited. I thought it would take me more days to complete this. Now it’s done, I’m moving closer to having a data driven AI. My next task is to serialize the tree data into a Unity object. I’ve decided to use Unity objects instead of text files like XML or JSON so I could easily implement features like assigning Unity objects (GameObject, component, prefab) as parameters.


One thought on “Action Browser Window

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s