Unity And C# (2) 썸네일형 리스트형 Unity Editor 정리(Label, text, bool, GameObject array, enum 등 정리) 시작하기 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEditor; public class EditorBasic : EditorWindow { #if UNITY_EDITOR [MenuItem("Tools/SubTitle")] public static void ShowWindow() { GetWindow("SubTitle"); } #endif } class를 하나 만든 후, 위 형식으로 작성합니다. 위 형식은 Tools 메뉴바에 SubTitle(자신이 원하는 제목)을 눌려 창을 열 수 있도록 합니다. Label private void OnGUI() { GUILayout.Label("Label.. C# 참조해야 할 때 사용할 수 있는 ref와 out 유니티로 게임을 개발하고 있던 중 함수 매개변수를 참조형 변수로 사용을 했어야 했습니다.. 저는 평소 C++에서 사용하는 참조형 변수(&)를 사용하여 문제를 해결하려 했습니다. class Program { static void Fun(int& num) { num = 3; } static void Main(string[] args) { int a = 5; Fun(a); Console.WriteLine(a); } } 위 코드처럼 쓰니 프로그램이 정상적으로 작동하지 못하고 오류가 발생했습니다. 그래서 저는 C#의 참조형 변수를 선언하는 방법을 찾아보니 ref 또는 out을 사용하면 된다고 하였습니다. ref와 out의 공통점 class Program { static void Fun(ref int num) { .. 이전 1 다음