검색결과 리스트
전체글보기에 해당되는 글 44건
- 2017.07.27 Unity2D : Unable to convert classes into dexformat 오류
- 2017.06.07 유니티 싱글톤
- 2017.04.03 C++ 소멸자에 Virtual을 쓰는 이유
- 2017.04.02 두점의 선형보간
글
Unity2D : Unable to convert classes into dexformat 오류
Unity2D : Unable to convert classes into dexformat 오류
해결방법: Plugin의 Android 폴더에 android-support-v4.jar등의 다양한 파일들이 중복(때로는 IAP관련 파일들이 중복으로 문제를 야기시키는 경우도 있습니다.)되어서 발생되는 경우가 있습니다.
같은 파일의 다양한 버전이 공존할 경우 classes를 dex파일로 변환시 충돌이 발생됩니다.
따라서 불필요한 jar파일들을 삭제해주면 정상적으로 빌드되어 배포가 됩니다.
설정
트랙백
댓글
글
유니티 싱글톤
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | public class Singleton<T> : MonoBehaviour where T : MonoBehaviour { protected static T instance = null; public static T GetInstance { get { if(instance == null) { instance = FindObjectOfType(typeof(T)) as T; if(instance == null) { Debug.Log("Nothing" + instance.ToString()); return null; } } return instance; } } } | cs |
만약에 씬이 변환 되어도 파괴되지 않은 싱글톤을 만들고 싶을 때에는 상속받은 클래스의 awake 함수에 아래와 같이 선언한다.
1 | DontDestroyOnLoad(this.gameObject); | cs |
참고한곳: http://vallista.tistory.com/entry/Unity3D-Singleton-%EC%8B%B1%EA%B8%80%ED%86%A4
설정
트랙백
댓글
글
C++ 소멸자에 Virtual을 쓰는 이유
예제 코드
#include <iostream>
using namespace std;
class classA
{
public:
classA();
virtual ~classA();
};
class classB : public classA
{
public:
classB();
~classB();
};
classA::classA()
{
cout << "A" << endl;
}
classA::~classA()
{
cout << "~A" << endl;
}
classB::classB()
{
cout << "B" << endl;
}
classB::~classB()
{
cout << "~B" << endl;
}
int main()
{
cout << "Start" << endl;
classB* B = new classB;
classA* A = B;
delete A;
return 0;
}
결과1
classA 소멸자에 virtual을 쓰지 않았을 때
Start
A
B
~A
결과2
classA 소멸자에 virtual을 사용했을 때
Start
A
B
~B
~A
설정
트랙백
댓글
글
두점의 선형보간
CurrentPosition = StartPosition * (1.0 - TickTime) + EndPosition * TickTime
CurrnetPosition == 결과값
StartPosition == 출발지
EndPosition == 목적지
TickTime == 보간위치 (0.0 ~ 1.0 사이의 값)
■------------------------■
S E
두점 사이의 중간 위치를 알고 싶으면 TickTime 을 0.5로 주면 된다