private void CreatePath() { string AssetPath = "Assets/Path/Path.asset"; PathAsset ps = ScriptableObject.CreateInstance <PathAsset>(); ps.way = path.Points; UnityEditor.AssetDatabase.CreateAsset(ps, AssetPath); UnityEditor.AssetDatabase.SaveAssets(); UnityEditor.AssetDatabase.Refresh(); }
public override void OnInspectorGUI() { base.OnInspectorGUI(); pa = (PathAsset)EditorGUILayout.ObjectField(pa, typeof(PathAsset), false); if (pa != null) { path.Points = pa.way; } if (GUILayout.Button("Finsh")) { CreatePath(); } }
void SavePath() { PathData pathAsset = new PathData(waypoints); PathAsset SO = CreateInstance <PathAsset>(); SO.SetPath(pathAsset); SO.name = creator.bundle.name + "_" + PathID; AssetDatabase.CreateAsset(SO, "Assets/" + SO.name + ".asset"); creator.createPath(); instance = creator.pathData; waypoints = new List <Vector2>(); Debug.Log("AssetSaved"); }
public static void EditCollectionAsset(PathAsset pathAsset) { PathEditor pathEditor; if (PathLibrary.Editor.Instance == null) { pathEditor = new PathEditor(); PathLibrary.Editor.Init(pathEditor); pathEditor.Init(); } PathLibrary.Editor.Instance.Asset = pathAsset; ShowBrowser(); }
public static void CreateCollection() { PathAsset asset; string name = "NewPathCollection"; int nameIdx = 0; while( System.IO.File.Exists( Application.dataPath + "/" + name + nameIdx + ".asset" ) ) { nameIdx++; } asset = new PathAsset(); asset.Data = ( new CollectionAsset() ).GetData(); AssetDatabase.CreateAsset( asset, "Assets/" + name + nameIdx + ".asset" ); EditorUtility.FocusProjectView(); Selection.activeObject = asset; EditCollection(); }
public static void CreateCollection() { PathAsset asset; string name = "NewPathCollection"; int nameIdx = 0; while (System.IO.File.Exists(Application.dataPath + "/" + name + nameIdx + ".asset")) { nameIdx++; } asset = new PathAsset(); asset.Data = (new CollectionAsset()).GetData(); AssetDatabase.CreateAsset(asset, "Assets/" + name + nameIdx + ".asset"); EditorUtility.FocusProjectView(); Selection.activeObject = asset; EditCollection(); }
public static void EditCollectionAsset( PathAsset pathAsset ) { PathEditor pathEditor; if( PathLibrary.Editor.Instance == null ) { pathEditor = new PathEditor(); PathLibrary.Editor.Init( pathEditor ); pathEditor.Init(); } PathLibrary.Editor.Instance.Asset = pathAsset; ShowBrowser(); }
public void SetPath(PathAsset pathasset) { path = pathasset; }
public static void EditCollectionAsset( PathAsset pathAsset ) { PathEditor pathEditor; if( PathLibrary.Editor.Instance == null ) { pathEditor = ScriptableObject.CreateInstance(typeof(PathEditor)) as PathEditor; PathLibrary.Editor.Init( pathEditor ); pathEditor.Init(); } PathLibrary.Editor.Instance.Asset = pathAsset; ShowBrowser(); }
private bool HasPrefix(PathAsset obj) { return(obj.name.Contains(this.name)); }
public void SetPath(PathAsset path) { this.path = path; }