为什么我无法从内部脚本访问?

时间:2019-07-06 19:49:22

标签: c# unity3d

我的脚本带​​有一些变量:

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不存在。

0 个答案:

没有答案