You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.3 KiB
40 lines
1.3 KiB
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEditor;
|
|
using System.IO;
|
|
using UnityEditor.ProjectWindowCallback;
|
|
using System;
|
|
|
|
namespace IronHorse
|
|
{
|
|
public class CreateIronHorseDataHolder
|
|
{
|
|
[MenuItem("Assets/Create/IronHorseDataHolder", priority = 201)]
|
|
static void CreateDataAsset()
|
|
{
|
|
var icon = EditorGUIUtility.FindTexture("ScriptableObject Icon");
|
|
|
|
ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<DoCreateIronHorseProfile>(), "IronHorseDataHolder.asset", icon, null);
|
|
|
|
}
|
|
|
|
internal static IronHorseDataHolder CreateIronHorseDataHolderProfileAtPath(string path)
|
|
{
|
|
var profile = ScriptableObject.CreateInstance<IronHorseDataHolder>();
|
|
profile.name = Path.GetFileName(path);
|
|
AssetDatabase.CreateAsset(profile, path);
|
|
return profile;
|
|
}
|
|
}
|
|
|
|
|
|
class DoCreateIronHorseProfile : EndNameEditAction
|
|
{
|
|
public override void Action(int instanceId, string pathName, string resourceFile)
|
|
{
|
|
IronHorseDataHolder holder = CreateIronHorseDataHolder.CreateIronHorseDataHolderProfileAtPath(pathName);
|
|
ProjectWindowUtil.ShowCreatedAsset(holder);
|
|
}
|
|
}
|
|
}
|
|
|