unity3d - VS 代码片段
问题描述
我正在尝试在 vscode 中编写自己的代码段。我想知道,是否可以在开发过程中的任何时候添加 Rigidbody 和 Animator 等变量并在函数GetComponent()
内部的方法中单独引用它们,而无需重复创建函数(参见下面的代码)。有人知道吗?Start()
Start()
"Rigidbody": {
"prefix": "rb",
"body": ["Rigidbody $1;",
"",
"",
"void Start(){",
"\t$1 = GetComponent<Rigidbody>();",
"}"]
},
"Animator":{
"prefix": "anim",
"body": ["Animator $1;",
"",
"",
"void Start(){",
"\t$1 = GetComponent<Animator>();",
"}"]
}
解决方案
推荐阅读
- sql - SQL 多对多
- jquery - 使用 Jquery 将 TD 宽度更改为 %
- nms - 连接丢失或任何异常后的 ActiveMQ 恢复
- python-3.x - Matplotlib X-ticks 没有正确分布
- jenkins - Groovy - Jenkins Pipeline - Groovy CPS 没有通过 .eachLine 方法
- struct - C:访问具有奇数编号的结构时出现地址陷阱错误。成员
- jquery - JQuery 选择符合给定条件的 HTML 元素,并更改其 CSS 样式
- java - spring.controller.pageController 中的字段 statusUpdateService 需要一个无法找到的“service.StatusUpdateService”类型的 bean
- anylogic - 如何模拟运输机的故障(在运输机车队中)?
- flutter - 试图在颤动中检索文件长度,但出现以下异常-“FileSystemException:无法检索文件长度”