我的脚本带有一些变量:
using System;
using UnityEngine;
using Random = UnityEngine.Random;
namespace UnityEditor.TreeViewExamples
{
[Serializable]
internal class MyTreeElement : TreeElement
{
public float floatValue1, floatValue2, floatValue3;
public Material material;
public string text = "";
public bool enabled;
public MyTreeElement (string name, int depth, int id) : base (name, depth, id)
{
floatValue1 = Random.value;
floatValue2 = Random.value;
floatValue3 = Random.value;
enabled = false;
}
}
}
我想从此脚本保存/加载此变量值:
using UnityEngine;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
public class SaveData
{
public static void Save()
{
}
public static void Load()
{
}
}
但是当尝试像这样在Save()中键入MyTreeElement时:
public static void Save(MyTreeElement)
MyTreeElement不存在。