D
D
Dmitry Korolev2018-04-30 03:45:22
Unity
Dmitry Korolev, 2018-04-30 03:45:22

How do I know if the UI editor is no longer visible in the inspector?

I have a task to save the properties settings of the custom editor.

#define NONTRAIL
using UnityEngine;
using System.Collections;
using UnityEditor;
using System;
[CustomEditor(typeof(PhotoPoser))]
public class PhotoPoserGUI : Editor
{	
  private bool run = false;
  private object[] tab;
  public override void OnInspectorGUI()
  {
    PhotoPoser pp = (PhotoPoser)target;
    if (run == false) 
    {
      DataReadWriter.ReadParams (this.GetType().ToString(), out tab);
      DataReadWriter.ReadParams (pp.GetType().ToString(), out pp.sizes);
      run = true;
    }
...

here is the variable run always when I switch to this editor false
it helps me to read the data
it remains to be saved when I stop rendering this editor
Advise in which direction to dig.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daniil Basmanov, 2018-04-30
@adressmoeistranici

You can try using OnDisable .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question