Skip to content

Instantly share code, notes, and snippets.

@0V
Last active December 21, 2017 08:04
Show Gist options
  • Save 0V/f631c035c22abd7603245d6daa326bf7 to your computer and use it in GitHub Desktop.
Save 0V/f631c035c22abd7603245d6daa326bf7 to your computer and use it in GitHub Desktop.
Unity でインスペクター操作可能なプロパティを作るスニペット
[SerializeField]
private int _Score;
public int Score
{
get { return _Score; }
set { _Score = value; }
}
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2008/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Unity SerializeField プロパティ</Title>
<Shortcut>uprop</Shortcut>
<Author>G2</Author>
<Description>Unityのインスペクターで操作可能なプロパティを作成します</Description>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Declarations>
<Literal>
<ID>type</ID>
<ToolTip>プロパティの型</ToolTip>
<Default>int</Default>
</Literal>
<Literal>
<ID>name</ID>
<ToolTip>プロパティ名</ToolTip>
<Default>MyProperty</Default>
</Literal>
</Declarations>
<Code Language="csharp">
<![CDATA[
#region $name$ Unity SerializeField プロパティ
[SerializeField]
private $type$ _$name$;
public $type$ $name$
{
get
{ return _$name$; }
set
{ _$name$ = value; }
}
#endregion
]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment