#Help with ScriptableObject
1 messages · Page 1 of 1 (latest)
namespace Entity.Dialogue
{
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
[Serializable]
[CreateAssetMenu (fileName = "Data", menuName = "Dialogue Script")]
public class DialogueScript : ScriptableObject
{
[SerializeField]
public DialogueCommand[] commands;
public DialogueScript (DialogueCommand[] commands)
{
this.commands = commands;
}
}
}
Show DialogueCommand
I tried adding [Serializable] and SerializeField but neither worked
also you don't need both [SerializeField] and public on a fiekld
only one or the other
public struct DialogueCommand
{
public Command command;
public string arg;
public AudioClip clip;
public DialogueCommand (Command command, string arg = "", AudioClip clip = null)
{
this.command = command;
this.arg = arg;
this.clip = clip;
}
}
you need [Serializable] on the struct declaration
also Command needs to also be serializable
gotcha
seems to be working
oh, command isn't serialized
Command is an enum
Now to do some fancy stuff with odin inspector and maybe I can hide the "clip" property when the command isn't Command.Say