Skip to content

Commit

Permalink
Add blocking of OnEnable, OnDisable, and OnDestroy events for proxies
Browse files Browse the repository at this point in the history
- OnDisable and OnDestroy get called when switching play mode regardless of the enabled state of the object, also block OnEnable to stay consistent.
  • Loading branch information
MerlinVR committed Sep 20, 2020
1 parent 8a43485 commit f7dbc21
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Assets/UdonSharp/Editor/UdonSharpEditorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ void InjectEvent(System.Type behaviourType, string eventName)
// Transforms
InjectEvent(udonSharpBehaviourType, "OnTransformChildrenChanged");
InjectEvent(udonSharpBehaviourType, "OnTransformParentChanged");

// Object state, these can get called regardless of the enabled state of the component
InjectEvent(udonSharpBehaviourType, "OnEnable");
InjectEvent(udonSharpBehaviourType, "OnDisable");
InjectEvent(udonSharpBehaviourType, "OnDestroy");
}
}

Expand Down

0 comments on commit f7dbc21

Please sign in to comment.