ReSharper 2022.2 Help

Predefined Live Templates for Unity

This topic lists all predefined live templates for Unity in ReSharper 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 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 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 - Show basic code completion list at the point where the variable is evaluated

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

  • ORDER - Show 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 - Show 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 - Show 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 - Show basic code completion list at the point where the variable is evaluated

  • NAME - Show 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 variable declaration (where variable name should stand), suggests 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 - Show 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 - Show 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 - Show 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 variable declaration (where variable name should stand), suggests name for the variable.

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

  • 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 - Show basic code completion list at the point where the variable is evaluated

Last modified: 03 August 2022