示例#1
0
 private void MakeSingleton()
 {
     if (instance != null)
     {
         Destroy(gameObject);
     }
     else
     {
         instance = this;
         DontDestroyOnLoad(gameObject);
     }
 }
    private void Awake()
    {
        if (sharedInstance == null)
        {
            sharedInstance = this;
        }
        else if (sharedInstance != this)
        {
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);

        PlayerPrefs.DeleteAll();
    }
    public override void OnInspectorGUI()
    {
        DrawDefaultInspector();

        tutorialManager script = (tutorialManager)target;

        GUILayout.ExpandWidth(false);

        EditorGUILayout.BeginHorizontal();
        EditorGUILayout.LabelField("[TAG]", GUILayout.Width(100));
        EditorGUILayout.LabelField("[Texto]");
        EditorGUILayout.EndHorizontal();

        script.startRead();

        //Draw
        foreach (var item in script.texts)
        {
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.LabelField(item.Key, GUILayout.Width(100));
            EditorGUILayout.LabelField(item.Value);
            EditorGUILayout.EndHorizontal();
        }
    }