문서의 이전 판입니다!
Static variable
using System.Collections; using System.Collections.Generic; using System.Threading; using UnityEngine; public class Dog : MonoBehaviour { public string nickName; public float weight; // 전역변수 지정 public static int count = 0; // 외부 오브젝트에서도 접근이 가능함. Dog.count private void Awake() { count += 1; } public void Bark() { Awake(); Debug.Log("count : " + count + " " + nickName + "Bark!"); } private void Start() { Bark(); } public static void ShowDog() // 이 함수도 역시 외부에서 접근이 가능함. Dog.ShowDog() { Debug.Log("Dog"); } }