Last active
September 17, 2018 09:08
-
-
Save quizcanners/b80c32594c650b394570ace34bec0216 to your computer and use it in GitHub Desktop.
PEGI wrapper for EditorGUILayout
This file contains 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
// How it would have been written with standard functions. Class palced inside Editor Folder. | |
EditorGUILayout.BeginHorizontal(); | |
int before = target.transparency; | |
target.transparency = EditorGUILayout.IntField("Transparency:", target.transparency); | |
if (target.transparency != before) | |
target.RecalculateShaderParameters(); | |
EditorGUILayout.EndHorizontal(); | |
// How the same code is written with PEGI wrapper, function is placed inside class. | |
if ("Transparency:".edit(ref transparency).nl()) | |
RecalculateShaderParameters(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment