public void SetEnum() { spawnPointEnum = Resources.Load <ScriptableUSEnumList>("ConfigFiles/EnumLists/SpawnPointEnum"); positionEnum = Resources.Load <ScriptableUSEnumList>("ConfigFiles/EnumLists/PositionEnum"); Fixed = Resources.Load <ScriptableUSEnum>("ConfigFiles/EnumValues/Fixed"); RandomFixed = Resources.Load <ScriptableUSEnum>("ConfigFiles/EnumValues/RandomFixed"); RandomRange = Resources.Load <ScriptableUSEnum>("ConfigFiles/EnumValues/RandomRange"); }
// [MenuItem("Tools/UltimateSpawner/Create Enums File")] static void CreateBasicEnums() { string path = "Assets/UltimateSpawner/Core/Resources/ConfigFiles/EnumValues/"; string extension = ".asset"; foreach (var defaultEnum in defaultEnums) { if (AssetDatabase.LoadAssetAtPath(path + defaultEnum + extension, typeof(ScriptableUSEnum)) == null) { ScriptableUSEnum scriptableEnum = ScriptableObject.CreateInstance<ScriptableUSEnum>(); scriptableEnum.name = defaultEnum; AssetDatabase.CreateAsset(scriptableEnum, path + defaultEnum + extension); // Print the path of the created asset Debug.Log(AssetDatabase.GetAssetPath(scriptableEnum)); } } }
void OnEnable() { Fixed = Resources.Load <ScriptableUSEnum>("ConfigFiles/EnumValues/Fixed"); RandomFixed = Resources.Load <ScriptableUSEnum>("ConfigFiles/EnumValues/RandomFixed"); RandomRange = Resources.Load <ScriptableUSEnum>("ConfigFiles/EnumValues/RandomRange"); }