Forum rules - please read before posting.

Custom Action Scripts + Wwise / Unity integration

Hi everybody, I hope you're doing well.

I need some help finding out what could be the source of the following error:

"The script '/[PATH]/ActionLoadSoundBank.cs' must derive from AC's Action class in order to be available as an Action."

So here's the situation so far.
I was able to successfully create and use the provided script on this post:

https://adventurecreator.org/forum/discussion/9807/ac-wwise-any-integration-to-easily-trigger-events-in-action-lists#latest

using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif

namespace AC
{

    [System.Serializable]
    public class ActionPlayWWiseEvent : Action
    {

        public string WwiseEvent;
        public GameObject gameobject;

        public ActionPlayWWiseEvent()
        {
            this.isDisplayed = true;
            category = ActionCategory.Custom;
            title = "Play WWise Event";
            description = "Plays an event from WWise";
        }

        override public float Run ()
        {
            AkSoundEngine.PostEvent(WwiseEvent, gameobject);

            return 0f; //Action only happens on one frame
        }

        #if UNITY_EDITOR

        override public void ShowGUI ()
        {
            // Action-specific Inspector GUI code here
            WwiseEvent = EditorGUILayout.TextField("Wwise Event:", WwiseEvent);
            gameobject = (GameObject)EditorGUILayout.ObjectField("Game Object:", gameobject, typeof(GameObject), true);

            AfterRunningOption ();
        }

        #endif
    }
}

But now, trying to do the same with these Wwise integration scripts:

https://adventure-creator.fandom.com/wiki/WWise_integration

I get the "...must derive from AC's Action class in order to be available as an Action." error

Do these scripts need tome adjustments to work properly on more recent versions of AC?

Im currently using:
AC 1.78.4x
Unity 2022.3.6f1 (MAC)

Comments

  • The script you've posted doesn't match the filename of the first error - are these two different scripts, or is ActionLoadSoundBank.cs the script you've shared?

    The Action API has been updated (you can see the new format in the second link), but older Actions such as the one above should still be compatible. Make sure that the filenames match, only Actions are in the folder you point to in the Actions Manager, and that there isn't a script conflict (i.e. a non-AC script named "Action" in your project without its own namespace).

  • The script you've posted doesn't match the filename of the first error - are these two different scripts, or is ActionLoadSoundBank.cs the script you've shared?

    Hi Chris, yes, the posted script works just fine! I just wanted to show it as an example of a custom action script I was able to use properly. Sorry if my message was confusing.

    Make sure that the filenames match

    Anyways, this was it! total noob mistake. The correct name for that script was "AK_LoadSoundbank", not "ActionLoadSoundBank".

    And besides, the new Wwise custom actions didn't appear within the "Custom" tab in the ActionList Editor, instead, they appeared under the "Sound" tab.

    So if I got it right at some point I didn't even found out 🙃

    GRACIAS.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.