Skip to content

Instantly share code, notes, and snippets.

@eral
Last active August 29, 2015 14:05
Show Gist options
  • Select an option

  • Save eral/0929e8f14d1dfc763798 to your computer and use it in GitHub Desktop.

Select an option

Save eral/0929e8f14d1dfc763798 to your computer and use it in GitHub Desktop.
Original Material
// Created by ERAL
// This is free and unencumbered software released into the public domain.
using UnityEngine;
public class OriginalMaterial : ScriptableObject {
public string m_data;
#if UNITY_EDITOR
private const string menuName = "Original Material";
private const string fileName = "New Original Material.asset";
[UnityEditor.MenuItem("Assets/Create/" + menuName)]
public static void Create() {
var asset = ScriptableObject.CreateInstance<OriginalMaterial>();
UnityEditor.ProjectWindowUtil.CreateAsset(asset, fileName);
}
#endif
}
@eral

eral commented Jun 12, 2015

Copy link
Copy Markdown
Author

Unity5.1以降は組み込み関数で出来る様に為りました。
UnityEngine.CreateAssetMenuAttribute

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment