Last active
February 3, 2023 11:41
-
-
Save barleymalt/2ed8a690a76ea4093d775a10ee87d979 to your computer and use it in GitHub Desktop.
Rider Live Templates
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
================================================================= | |
A LIST OF LIVE TEMPLATES FOR UNITY | |
TO MAKE THINGS EASIER, OR JUST BECAUSE, WHY NOT? | |
================================================================== | |
================================================================== | |
UNITY | |
================================================================== | |
------------------------------------------------------------------ | |
:customeditor: [create a custom editor nested inside a class file] | |
------------------------------------------------------------------ | |
$TYPE$ macro: current file without extension | |
#if UNITY_EDITOR | |
[CustomEditor(typeof($TYPE$))] | |
public class $TYPE$_Editor : UnityEditor.Editor | |
{ | |
$TYPE$ script; | |
private void OnEnable() | |
{ | |
script = ($TYPE$)target; | |
} | |
public override void OnInspectorGUI() | |
{ | |
base.OnInspectorGUI(); | |
} | |
} | |
#endif | |
------------------------------------------------------------------ | |
:persistent_bool: [create a bool variable saved in the player prefs] | |
------------------------------------------------------------------ | |
$PREFS_VAR_NAME$ macro: value of $VAR_NAME$ with the first letter uppercase | |
private bool $VAR_NAME$ | |
{ | |
get => PlayerPrefs.GetInt("$PREFS_VAR_NAME$") == 1; | |
set => PlayerPrefs.SetInt("$PREFS_VAR_NAME$", value ? 1 : 0); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment