단일 샘플
3706 단어 열
using UnityEngine;
using System.Collections;
public class wht : MonoBehaviour {
static wht myInstance;
public int x = 0;
static int instances = 0;
// Use this for initialization
//Returns the instance
public static wht Instance
{
get
{
if (myInstance == null)
myInstance = FindObjectOfType(typeof(wht)) as wht;
return myInstance;
}
}
void Start () {
instances++;
if (instances > 1)
Debug.Log("Warning: There are more than one Level Generator at the level");
else
myInstance = this;
}
// Update is called once per frame
void Update () {
}
}
using UnityEngine;
using System.Collections;
public class wht1 : MonoBehaviour {
// Use this for initialization
void Start () {
wht.Instance.x = 20;
Debug.Log(wht.Instance.x.ToString());
}
// Update is called once per frame
void Update () {
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
피보나치 수열 구해피보나치 수열의 정의는 다음과 같다. n=0일 때 F[n]=0; n=1일 때 F[n]=1; n>1일 때 F[n]=F[n-1]+F[n-2]; 해법1(동적 기획 사상): 시간의 복잡도는 O(n)이다. 해법2: 분치 전략...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.