Pimeko

Untitled

Oct 23rd, 2020
703
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.58 KB | None | 0 0
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using Sirenix.OdinInspector;
  5. using UnityEditor;
  6. using UnityEngine;
  7.  
  8. public class TestSO : ScriptableObject
  9. {
  10.     void OnEnable()
  11.     {
  12.         EditorApplication.playModeStateChanged += OnPlayModeStateChanged;
  13.         OnInit();
  14.     }
  15.    
  16.     void OnPlayModeStateChanged(PlayModeStateChange _)
  17.     {
  18.         OnInit();
  19.     }
  20.  
  21.     void OnInit()
  22.     {
  23.         // Init stuff..
  24.     }
  25.  
  26.     void OnDisable()
  27.     {
  28.         EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;    
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment