예제 #1
0
        static void CreateAsset()
        {
            var exampleAsset = CreateInstance <CursorAsset>();

            AssetDatabase.CreateAsset(exampleAsset, string.Format("{0}/{1}", ProjectPath.FileDirectory(ProjectPath.RelativePath(typeof(CursorAsset))), "CursorAsset.asset"));
            AssetDatabase.Refresh();
        }
예제 #2
0
        private void LoadCursorAsset()
        {
            cursorAsset = Resources.Load <CursorAsset>("CursorAsset");

            if (cursorAsset == null)
            {
                throw new Exception(string.Format("Under the path \"{0}\". Resources \"CursorAsset.asset\" is empty!", ProjectPath.FileDirectory(ProjectPath.RelativePath(typeof(Cursors)))));
            }
            else
            {
                if (cursorAsset.Original != null && cursorAsset.Original.Length >= 1)
                {
                    Texture2D[] original = cursorAsset.Original;

                    for (int i = 0; i < original.Length; i++)
                    {
                        Original.Add(original[i].name, original[i]);
                    }
                }
                if (cursorAsset.Custom != null && cursorAsset.Custom.Length >= 1)
                {
                    Texture2D[] custom = cursorAsset.Custom;

                    for (int i = 0; i < custom.Length; i++)
                    {
                        Custom.Add(custom[i].name, custom[i]);
                    }
                }
            }
        }
예제 #3
0
 public string RelativePath()
 {
     return(ProjectPath.RelativePath(this));
 }