JetBrains Rider 2022.3 Help

Predefined Live Templates for Unity

This topic lists all predefined live templates for Unity in JetBrains Rider 2022.2. For more information about live templates, see Create source code using live templates.

Template

Details

ctx

Current file context

Scope Everywhere

Body

$CTX$

Parameters

  • CTX - Provides a list of items describing current context. This includes file name, containing type name, namespace name, etc.

nguid

Insert new GUID

Scope Everywhere

Body

$GUID$

Parameters

  • GUID - Generates a new Globally Unique Identifier (GUID)

assetmenu

Unity CreateAssetMenu attribute

Scope C# 2.0+ types and namespaces, Unity C# file

Body

[UnityEngine.CreateAssetMenu(fileName = $FILENAME$, menuName = $MENUNAME$, order = $ORDER$)]

Parameters

  • FILENAME - Shows basic code completion list at the point where the variable is evaluated

  • MENUNAME - Shows basic code completion list at the point where the variable is evaluated

  • ORDER - Shows basic code completion list at the point where the variable is evaluated

logwarn

Unity log warning

Scope C# 2.0+ statements, Unity C# file

Body

UnityEngine.Debug.LogWarning($VAR$);

Parameters

  • VAR - Shows basic code completion list at the point where the variable is evaluated

logex

Unity log exception

Scope C# 2.0+ statements, Unity C# file

Body

UnityEngine.Debug.LogException($VAR$);

Parameters

  • VAR - Shows basic code completion list at the point where the variable is evaluated

menuitem

Unity menu item handler

Scope C# 2.0+ type members, Unity C# file

Body

[UnityEditor.MenuItem($MENUNAME$)] public static void $NAME$() { $END$ }

Parameters

  • MENUNAME - Shows basic code completion list at the point where the variable is evaluated

  • NAME - Shows basic code completion list at the point where the variable is evaluated

  • END - The caret position after the template is applied.

sfield

Unity serialized field

Scope C# 2.0+ type members, Unity serializable type members

Body

[UnityEngine.SerializeField] private $TYPE$ $NAME$;$END$

Parameters

  • TYPE - no macro

  • NAME - When executed in a variable declaration (where variable name should stand), suggests a name for the variable

  • END - The caret position after the template is applied.

logerr

Unity log error

Scope C# 2.0+ statements, Unity C# file

Body

UnityEngine.Debug.LogError($VAR$);

Parameters

  • VAR - Shows basic code completion list at the point where the variable is evaluated

log

Unity log object/message

Scope C# 2.0+ statements, Unity C# file

Body

UnityEngine.Debug.Log($VAR$);

Parameters

  • VAR - Shows basic code completion list at the point where the variable is evaluated

reqcomp

Unity RequireComponent attribute

Scope C# 2.0+ types and namespaces, Unity C# file

Body

[UnityEngine.RequireComponent(typeof($TYPE$))]

Parameters

  • TYPE - Shows basic code completion list at the point where the variable is evaluated

sprop

Unity property with serialized backing field

Scope C# 2.0+ type members, Unity serializable type members

Body

[UnityEngine.SerializeField] private $type$ $fieldName$; public $type$ $propertyName$ { get { return this.$fieldName$; } }$END$

Parameters

  • type - no macro

  • propertyName - When executed in a variable declaration (where variable name should stand), suggests a name for the variable

  • fieldName - Decapitalizes string value (i.e. changes the case of the first letter to lowercase)

  • END - The caret position after the template is applied.

cor

Unity coroutine method

Scope C# 2.0+ type members, Unity C# file

Body

private System.Collections.IEnumerator $NAME$() { $END$yield break; }

Parameters

  • NAME - no macro

  • END - The caret position after the template is applied.

logvar

Unity log variable

Scope C# 2.0+ statements, Unity C# file

Body

UnityEngine.Debug.Log("$VAR$ = " + $VAR$);

Parameters

  • VAR - Shows basic code completion list at the point where the variable is evaluated

Last modified: 28 December 2022