【发布时间】:2020-11-02 08:31:12
【问题描述】:
所以,我一直在尝试访问名为“ModulesList”的脚本中的枚举类。我尝试了以下方法:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ModuleIdentifier : MonoBehaviour
{
public string CurrentSongModule;
ModulesList moduleList = new ModulesList();
// Start is called before the first frame update
void Start()
{
}
}
但它不起作用。如何引用此枚举?
【问题讨论】:
-
请提供定义枚举的代码。你是什么意思“它不起作用”?你有什么样的错误?
-
不要将枚举视为类,将它们视为带有名称的数字。像数字一样使用它们,例如
MyEnumType variableName = MyEnumType.NamedValue;