记录一下自己工作中写的代码段,可以提高工作效率:
1.Debug.Log()
{
"Debug.Log(Something)" :{
"scope": "",
"prefix": "De",
"body": [
"Debug.Log($0);"
],
"description": "快速Debug"
}
}
2.等待协程
{
"Create IEnumerator" :{
"scope": "",
"prefix": "IE",
"body": [
"public IEnumerator IE_temp$0(float duration)",
"{",
"\tyield return new WaitForSeconds(duration$1);",
"}",
] ,
"description" : "协程快速使用"
}
}
3.开启协程
{
"Print to console": {
"scope": "",
"prefix": "SC",
"body": [
"StartCoroutine($2);",
],
"description": "开启协程的快速代码段"
}
}
4. 协程中yield return null
{
"yiled return null" :{
"scope": "",
"prefix": "yie",
"body": [
"yield return null$0;"
] ,
"description" : "协程中使用"
}
}
下面是一些vs上的代码段
代码片段的位置:菜单栏->工具->代码片段管理器。
1.Debug.Log()
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>DebugLog</Title>
<Shortcut>De</Shortcut>
<Description>Debug.Log的快速循环的代码片段</Description>
<Author>yabaozi</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[Debug.Log($selected$$end$);]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
2.Debug.LogError()
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>DebugLogError</Title>
<Shortcut>Dee</Shortcut>
<Description>Debug.LogError的快速循环的代码片段</Description>
<Author>yabaozi</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[Debug.LogError($selected$$end$);]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
3.Debug.LogWaring()
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Debug.LogWarning</Title>
<Shortcut>DeW</Shortcut>
<Description>Debug.LogWaring的快速循环的代码片段</Description>
<Author>yabaozi</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[Debug.LogWaring($selected$$end$);]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
4.Debug.Assert()
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Debug</Title>
<Shortcut>DeA</Shortcut>
<Description>Debug.Assert的快速循环的代码片段</Description>
<Author>yabaozi</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[Debug.Assert($selected$$end$);]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>
5.GetComponent<>()
<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>GetComponent</Title>
<Shortcut>Ge</Shortcut>
<Description>GetComponent的快速循环的代码片段</Description>
<Author>yabaozi</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
<SnippetType>SurroundsWith</SnippetType>
</SnippetTypes>
</Header>
<Snippet>
<Code Language="csharp">
<![CDATA[GetComponent<$selected$$end$>();]]>
</Code>
</Snippet>
</CodeSnippet>
</CodeSnippets>