I recently got into experimenting with implementing my own Custom Action classes. Most notably I created a Custom Action class that extends the functionality of the built in ActionSpeech class. I basically just extended the functionality of ActionSpeech to include 2 additional editor options: a simple boolean editor toggle field, and a Vector3 editor field. I then created a little dummy cutscene inside my test unity scene. In my dummy little cutscene I open up the ActionList editor and add one single action to the action list (i.e. one action that is my custom action). I then configure all the options of the custom action and then save the scene and quit completely out of unity. When I reopen unity and reopen my scene and look at the cutscene only the options that were already part of the base class of my custom action (i.e. ActionSpeech) retain their configured values; however, none of the new editor fields/options that I added as an extension of my custom class retained their value (i.e. the boolean editor toggle field and the Vector3 editor toggle field didn't retain their value)
I tried to look at the documentation but unfortunately it wasn't very helpful, only offering super vague examples relating to utilizing constant Ids, parameter ids, or something like that. This seems like something pretty basic that should just work as part of the contract of creating a custom action that extends the functionality of a base action.
Is there anyone that can provide a more concrete example to help resolve the issue I am experiencing?
It looks like you're new here. If you want to get involved, click one of these buttons!
Comments
Constant IDs and Parameter IDs are both AC concepts. Simply exposing a Vector3 or Toggle field doesn't involve AC - only Unity's API.
Are your variables public or marked as [SerializeField]? Unity won't serialize (save) private variables otherwise.
Without seeing the code itself, though, I can only guess generally. If you'd like specific help, share the code itself below and I'll take a look.
using UnityEngine;
using System.Collections.Generic;
if UNITY_EDITOR
using UnityEditor;
endif
namespace AC
{
if UNITY_EDITOR
}
In C#, variables are private by default - they won't be serialized unless you tell them to be.
Make chosenSpeechBubbleTypeIndex, applyPortraitSpriteRotation and rotationVector public for their values to be saved.
Yea that was the trick. Thanks so much for the assist on that; I forgot that little tidbit/gotcha about unity's serialization mechanism