Last active
February 11, 2018 06:29
-
-
Save lynxelia/24aaaf4696610ee8c53e0046cde9ed86 to your computer and use it in GitHub Desktop.
A replacement base class to use instead of MonoBehaviour. Inheriting from this class will allow you to validate properties without encountering the OnValidate garbage collection bug. OnValidateProperty is also guaranteed to only execute when a change is made in the Inspector Window. It doesn't run when loading an asset into memory or loading a s…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class BaseMonoBehaviour : MonoBehaviour | |
{ | |
public virtual bool OnValidateProperty(string propertyName) | |
{ | |
return false; | |
} | |
// Remember to include the OnDestroy code from Step 3 as well | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment