본문 바로가기

프로그래밍/Unity95

유니티 5.6.x android 빌드 시 android studio / jdk 버전 일단 안드로이드 스튜디오와 자바 SDK 를 설치해야 되는데 안드로이드 스튜디오는 3.1.4 버전과 자바 SDK 는 8 버전을 추천... 11, 12 버전은 인식을 못한다 ㅠㅠ Android Studio (약관에 동의 하면 들어갈 수 있음) https://developer.android.com/studio/archive 자바 SDK https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html 2019. 3. 27.
Steam ISteamMicroTxnSandbox InitTxn 그냥 쉽게 할 수 있는 방법인 [실패1]은 이상하게도 파라메터 missing 이 난다 Bad RequestRequired parameter 'orderid' is missing 혹시나 URL Encoding 문제일 수도 있으니 Uri.EscapeUriString 을 써봤지만 역시나 위와 같은 현상. 마지막으로 WWWForm 을 사용해봤더니 아주 잘 된다 성공의 Uri.EscapeUriString("ko") 를 따라할 필요는 없다. 그냥 "ko" 로 해줘도 됨 예제 IEnumerator TestPost() { // 실패1 //UnityWebRequest www = UnityWebRequest.Post("https://partner.steam-api.com/ISteamMicroTxnSandbox/InitTx.. 2019. 1. 30.
마우스 화면 밖으로 나가지 않게 하기 Cursor.lockState = CursorLockMode.Confined; 를 해주면 됨... 2018. 12. 10.
Steam 웹 api 키로 AuthTicket 인증하기 테스트 백문이 불어일견 -_- 국내에선 검색도 안되냐 이런 중요한게 예제 using System.Collections; using System.Collections.Generic; using UnityEngine; using Steamworks; using System.Text; public class Main : MonoBehaviour { const string MY_WEBAPI = "your web api"; const int MY_APPID = 0; // your app id HAuthTicket m_AuthSessionTicket; byte[] m_Ticket = new byte[1024]; uint m_pcbTicket; protected Callback m_GetAuthSessionTicketRes.. 2018. 12. 4.
cannot mark assets and scenes in one assetbundle 에셋 번들을 구울 때 cannot mark assets and scenes in one assetbundle 하면서 해당 번들 이름을 표시해주는데 이 문제의 해결 방법은 한 번들 안에 같은 이름의 파일이 없어야 된다.. 는 것 예를 들면 test/1/a.jpgtest/2/a.jpg 라는 경로의 파일이 있다면 test 라는 번들로 묶을 때 a.jpg 가 중복이 되서 위와 같은 애러 표시가 뜬다는 것 물론 번들로 직접 묶을 때 저렇고 간접적으로 참조할 경 우에는 괜찮다 2018. 10. 4.
m_AssetBundleManifest 이 null 일 때 [어플리케이션]과 [PC버전] 멀티 플랫폼에서 에셋 번들을 사용하려고 하는데 에디터 상에서는 잘 되던 에셋 번들 패치가 [PC버전] 에서는 되지 않는 것이었다 아오 짜증나 왜 안되는거여 그래서 [PC버전] 에서는 에셋 번들을 안쓰는건가? 별에별 생각 다 들다가 힘겹게 원인을 찾아보니 IEnumerator Initialize() { var request = AssetBundleManager.Initialize(); if (request != null) yield return StartCoroutine(request); } 이 코드를 실행 했음에도 불구하고 AssetBundleManager.m_AssetBundleManifest가 null 이었던 것이다... 허미... [PC버전] 에서 그렇다 http://.. 2018. 9. 28.
FPS (Frame Per Sec) Display 표시, 출력하기 이미 많이 올라와있는 소스지만 F9 를 누르면 표시되는 기능에지역변수 사용을 줄여 가비지 덜 생기게 개조한 버전 입니다 예제 using UnityEngine; public class FPSChecker : MonoBehaviour { /// /// for Check /// float m_fDeltaTime = 0.0f; /// /// for Display /// bool m_bGUI = false; float m_fStartX; Rect m_Area; GUIStyle m_UIStyle = new GUIStyle(); public Color m_Color = Color.green; private void Awake() { m_fStartX = (Screen.width - 100) * 0.5f; m_Area.. 2018. 9. 10.
Snapshot / Screenshot 생성 문답무용! 스크린샷, 스냅샷 F12로 찍기 :) 예제 private void Update() { #if UNITY_STANDALONE_WIN if (Input.GetKeyDown("f12")) Screenshot(); #endif } /// /// 스냅샷 /// /// /// public void Screenshot() { StartCoroutine(MakeSnapshot()); } byte[] m_ImageByte; IEnumerator MakeSnapshot() { yield return new WaitForEndOfFrame(); Texture2D tex = new Texture2D(Screen.width, Screen.height, TextureFormat.RGB24, true); tex.Read.. 2018. 7. 27.
Super ScrollView Super ScrollView for UGUI 2.2 Overview LoopListView2 is a component attaching to the same gameobject of UGUI ScrollRect. It helps the UGUI ScrollRect to support any count items with high performance and memory-saving. For a ScrollRect with 10,000 items, LoopListView2 does not really create 10,000 items, but create a few items based on the size of the viewport. When the ScrollRect moving up, for .. 2018. 1. 24.
[Unity3D] Singleton using System.Collections;using System.Collections.Generic;using UnityEngine; public class YourClassName : Singleton { public YourClassName() : base(false, true) { } protected override void OnDestroy() { base.OnDestroy(); } } 2018. 1. 3.
[Unity3D] Enable 과 Awake Hierarchy 에 배치 된 한 GameObject 에 어떤 컴포넌트가 있다 이 컴포넌트에는 Awake() 가 있는데 Awake() 에 들어와지는 상황은 GameObject 가 Disable = 컴포넌트의 Awake() 에 들어오지 않음GameObject 가 Enable 인데 컴포넌트가 Disable = 컴포넌트의 Awake() 에 들어옴 그렇다면 GameObject 가 Disable 이면 Awake 는 거르나? 아니다 Enable 되면 Start 타이밍에 들어간다.. 아마 Start 보다는 먼저 불리우겠지.. 2018. 1. 3.
public 변수를 컴포넌트에서 읽기 전용으로 하기 https://gist.github.com/MattRix/9fb45606bfbc16254641e4d462117737 링크로 가면 있음 2017. 11. 16.
Unirx - ObservableWWW.LoadFromCacheOrDownload Unirx 로 에셋 번들 다운받기를 써봅시다네이버 구글 다 뒤져도 없어서 직접 제작.. 이 내용에 대한 튜토리얼은 -_- 전세계 최초라고! 예제 #if !(UNITY_METRO || UNITY_WP8) using UnityEngine; using System.Collections; using UniRx; public class TestWWW : MonoBehaviour { void Start() { //StartCoroutine (DownLoadState ()); StartCoroutine (DownLoadState_Unirx ()); } // unirx 로 다운 받기 IEnumerator DownLoadState_Unirx() { while (!Caching.ready) yield return null.. 2016. 10. 14.
UniRx - 튜토리얼 2 그림 UniRx 튜토리얼 2 using UnityEngine; using UniRx; using UniRx.Triggers; // Triggers Namepsace using System; public class TestTrigger : MonoBehaviour { void Start() { // Get the plain object //var obj = GameObject.CreatePrimitive(PrimitiveType.Cube); // 원래 예제는 위에 꺼지만 아래 처럼 그냥 새로운 오브젝트 하나를 생성하는 것으로도 족하다... var obj = new GameObject (); // var 이지만 실은 GameObject 인 obj 에 컴포넌트 ObservableUpdateTrigger 를 부.. 2016. 9. 9.
[]배열 꿀 ArrayUtillity FileInfo[] Bytesfiles = directory.GetFiles("*.bytes", SearchOption.AllDirectories);for(int j=0; i 2014. 12. 17.
에셋 번들 빌드 시 계속 1KB 로 생성될 때 리부팅하세요 -_-;; 2014. 12. 16.
Unity 3D - StartCorutine 꿀팁 그림 예제 // CoroutineFunc n 개가 동시에 시작 foreach(KeyValuePair tmp in verMap) { ArrayList val = new ArrayList(); val.Add(tmp.Key); val.Add(tmp.Value); StartCoroutine( CoroutineFunc(val) ); } // CoroutineFunc 이 그 전 CoroutineFunc 이 끝나면 차례로 시작 foreach(KeyValuePair tmp in verMap) { ArrayList val = new ArrayList(); val.Add(tmp.Key); val.Add(tmp.Value); yield return StartCoroutine( CoroutineFunc(val) ); } 2014. 11. 28.
Unity 3D - InvokeRepeating 함수를 일정 시간 지연 & 시간 텀을 주고 반복 실행 2014. 11. 28.
Unity 3D - 안드로이드 기기에서 www.assetBundle.Load 로 다운 안받아질 때 에셋 번들 빌드 할 때 빌드 옵션에서 BuildTarget.Android 확인하세요 개고생 말고 ㅇ_ㅇㅋㅋ 2014. 11. 28.
Unity 3D - BuildPipeline AssetDependencies 프로젝트를 진행하다 에셋 번들을 만드는데.. 일반적인 방법으로 제작을 했더니 용량이 어마어마 했다 뭐 보나마나 리소스의 중복이겠지... BuildAssetBundleOptions.CollectDependencies + BuildAssetBundleOptions.CompleteAssets 의 남발 ㅋㅋ 그래서 직접 빌드파이브라인을 건드려서 테스트를 해보기로 했다. 이 기능이 반드시 필요할 텐데 국내나 해외쪽에서도 정보가 그다지 많지 않았다는게 신기... 아니면 너무 쉬운거라 거론할 가치도 없었던 것이거나... (난 바보인가 ㅠ.ㅠ) 실험을 위해 위와 같이 그냥 용량만 큰 bmp 파일 2개로 머티리얼을 제작.. 프리팹 3개에 나눠 쓰잘 때기 없이 중복으 로 써준다 내용은 그냥 머티리얼... 그리고 이 무자비.. 2014. 11. 5.