forked from zxl/LaboratoryProtection
36 lines
819 B
C#
36 lines
819 B
C#
using System.Collections.Generic;
|
|
using Sirenix.OdinInspector;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
namespace UnityTest.ZXL
|
|
{
|
|
public class Test : SerializedMonoBehaviour
|
|
{
|
|
#if UNITY_EDITOR
|
|
|
|
public List<DialogueData> dialogueData;
|
|
|
|
[Button("AddData")]
|
|
void Add(DialogueData data)
|
|
{
|
|
this.dialogueData.Add(data);
|
|
}
|
|
|
|
[ReadOnly] [FolderPath] public string folderPath;
|
|
|
|
public string assetName;
|
|
|
|
[Button("Create Asset")]
|
|
void AA()
|
|
{
|
|
string path = $"{folderPath}/{assetName}.asset";
|
|
|
|
DialogueAsset dialogueAsset = ScriptableObject.CreateInstance<DialogueAsset>();
|
|
dialogueAsset.datas = dialogueData;
|
|
|
|
AssetDatabase.CreateAsset(dialogueAsset, path);
|
|
}
|
|
#endif
|
|
}
|
|
} |