Unity

[Unity] 네임스페이스 사용법

성엽이 2019. 10. 31. 18:17

example.cs

========================================================

using UnityEngine;

using System.Collections;

 

namespace exampleNS{

public class example : MonoBehaviour{

public static bool DoSomething(int abc){

bool somebool = false;

if(abc == 1){

somebool = true;

}

return somebool;

}

 

 

}

 

public class example2 : MonoBehaviour{

public static bool DoSomthing2(int abb){

// do something....

}

 

}

}

========================================================

 

sample.cs

========================================================

using UnityEngine;

using System.Collections;

using exampleNS;

 

public class sample: MonoBehaviour{

int somesome = 3;

void Start(){

if(example.DoSomething(somesome)){

Debug.Log("true");

}else{

Debug.Log("false");

}

}

 

}

 

 

https://funfunhanblog.tistory.com/80

 

C#) 네임스페이스 / 유니티 네임스페이스

C#) 네임스페이스 가끔 "네임스페이스에 형식또는 네임스페이스 이름이 없습니다."라는 문구를 볼때가 있다. 네임스페이스를 알아보기 전에 작업 하다가 생긴 오류를 살펴보자 Define클래스 인터페이스나 enum같..

funfunhanblog.tistory.com