public static bool OnOpenAsset(int instanceID, int line) { //check if object is of type to be opened in custom editor if (Selection.activeObject as ActivityCard != null) //open character editor { ActivityCardEditor.Init(Selection.activeObject as ActivityCard); return(true); //catch open file } //no matches for custom editors, let unity open file as normal return(false); }
List <int> choicePrerequisitesIndices; //list of indices for popups //List<string> choicePrerequisitesOptions; public static void Init(ActivityCard activityCard) { ActivityCardEditor window = EditorWindow.GetWindow <ActivityCardEditor>(typeof(ActivityCardEditor)); //init editor values window.activityCard = activityCard; //set up choicePrerequisites indices to point to the correct choice index in the card window.choicePrerequisitesIndices = new List <int>(); foreach (var prerequisite in activityCard.choicePrerequisites) { window.choicePrerequisitesIndices.Add(prerequisite.choiceIndex); } window.Show(); }
public static bool OpenActivityCardEditor() { ActivityCardEditor.Init(Selection.activeObject as ActivityCard); return(true); }