Linked Questions

Popular Questions

VS Code Snippets

Asked by At

I'm trying to write my own snippets in vscode. I was wondering, if it is possible to add variables such as Rigidbody and Animator and reference them with GetComponent() method all inside Start() function separately at any time during development without creating the Start() function repeatedly (See the code below). Does anybody know?

"Rigidbody": {
    "prefix": "rb",
    "body": ["Rigidbody $1;",
        "",
        "",
        "void Start(){",
                "\t$1 = GetComponent<Rigidbody>();",

        "}"]
},

"Animator":{
    "prefix": "anim",
    "body": ["Animator $1;",
    "",
    "",
    "void Start(){",
        "\t$1 = GetComponent<Animator>();",
    "}"]
}

Related Questions