protected override OnMouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var menu = new CustomMenu(); menu.Location = PointToScreen(e.Location); menu.Show(this); } }
private void Form1_MouseUp(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Right) { var menu = new CustomMenu(); menu.Location = PointToScreen(e.Location); menu.Show(this); } }
static void Init() { // Get existing open window or if none, make a new one: CustomMenu window = (CustomMenu)EditorWindow.GetWindow(typeof(CustomMenu)); if (File.Exists(FilePath)) { // read the file content var json = File.ReadAllText(FilePath) // If the file exists deserialize the JSON and read in the values // for only one value ofcourse this is overkill but for multiple values // this is easier then parsing it "manually" JsonUtility.FromJsonOverwrite(json, window); // pass the values on into the static field(s) id = window._id; } window.Show(); }