Unity

유니티 - C# 파일 생성시 괄호 위치 변경하기

정글(Jungle) 2021. 8. 16. 18:29
반응형

 

자바나 플러터를 많이 사용하다 보니 유니티의 C#파일 생성 시 괄호의 위치가 달라 변경해 보았습니다.

유니티에서 C# 파일을 생성하면

public class Test : MonoBehaviour 
{
    // Start is called before the first frame update
    void Start() 
    {
        
    }

    // Update is called once per frame
    void Update() 
    {
        
    }
}

이렇게 나옵니다.

 

이걸 아래 코드처럼 변경해 보겠습니다.

public class Test : MonoBehaviour {
    // Start is called before the first frame update
    void Start() {
        
    }

    // Update is called once per frame
    void Update() {
        
    }
}

 

탐색기에서 유니티가 설치된 곳에서

저 같은 경우 설치된 경로는 다음과 같습니다.

C:\Program Files\Unity\Hub\Editor\2020.3.16f1\Editor\Data\Resources\ScriptTemplates

ScriptTemplates 폴더 까지 들어오시면 

81-C# Script-NewBehaviourScript.cs.txt 파일이 있습니다.

메모장으로 해당 파일을 여신 후

 

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

    #ROOTNAMESPACEBEGIN#
public class #SCRIPTNAME# : MonoBehaviour {
    // Start is called before the first frame update
    void Start() {
        #NOTRIM#
    }

    // Update is called once per frame
    void Update() {
        #NOTRIM#
    }
}
#ROOTNAMESPACEEND#

이렇게 변경해 주시면 됩니다.

 

변경 후 저장을 바로 하시면 관리자 권한이 필요하다 합니다. 그래서 다른 곳에 일단 저장하신 후 탐색기에서 복사 후

다시 현재 위치로 저장하기 하신 후 관리자 권한으로 변경해 주시면 됩니다.

 

이제 새로운 C# 파일 생성시 변경된 형식으로 나옵니다.

반응형