Forum rules - please read before posting.

Custom Remember Script - save ActionList Asset?

Hi!

I've created a custom Remember Script to save custom code.
One problem I've ran into is that I can't seem to save ActionList Assets.

My script looks something like this: pasteall.org/1452077/csharp

When I'm saving variables, it all works fine, but the Remember Script crashes each time I'm trying to run the line with ActionList Asset. I get an error:
"SerializationException: Type UnityEngine.ScriptableObject is assembly UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null is not marked as serializable."

I update the actionList field on CustomScript at runtime, so it needs to be saved. What would be the best approach to get this saved?

Comments

  • What is it about the asset you're trying to save? Just a reference to it?

    You can only do this by recording the ActionList's name, and retrieving it via Resources.Load.

    First place the ActionList asset into a Resources asset folder, and give it a unique filename. In your RememberData class, instead create a string variable, and use it to record that asset's name when saving.

    When loading, you can then use Unity's Resources.Load method to retrieve the asset using its name.

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.