본문 바로가기

Unity10

[Unity3D] UGUI Text 문자열 색 바꾸기 게임에서 자주 쓰이는 기능중에 하나입니다. 강조를 위해 색을 바꿔야할 때 기능을 기록해 둡니다. 1 2 3 4 5 6 Text temp; string str = "" + "Text" + "" temp.text = str; //"" + "글색깔 변경" + "" 생각보다 자주 쓰이는 잔재중에 하나입니다. 알아두면 아주 좋을 듯..; 2020. 4. 10.
[Unity3D] Warning : OnLevelWasLoaded deprecated 프로젝트를 날려 먹고 유니티를 다시 까는 상황이 벌어졌다. 그리고 나니 Warning 들이 미친듯이;;; 으아아아;; 이왕 다시 시작하는 마음으로 Warning 을 잡아보려고 한다. 보자 짧은 영어로 해석을 해보자면... 으음... 아. 다음 유니티에서 뭔가 없어진댄다. 근데 저건 함수 이름이니까 함수가 없어진다는 소리인듯. 한마디로 OnLevelWasLoaded 함수 대신에 다른걸 넣어야된다는 소리 이리저리 찾아보니 일반적으로 이렇게 잡아본다고들 한다. 1 2 3 4 void OnLevelWasLoaded(int value) { SetCanvas(); } http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5text-decoratio.. 2019. 11. 21.
[Unity3D] UI 제외하고 터치하기 UI 만들다보면 UI와 게임씬에 반응이 같이 될때가 있다. 아마도 입력 방식이 달라서 서로 다르게 받아들여서 그런것같기는 한데. (아마 인게임은 Raycast 나 mouseButtonDown 같은 거일테고, UI는 EventSystem에서 따로 받으니까) 그래서 UI를 터치할때는 인게임을 제외하고 싶을 때가 있다. 그때 쓰는 함수. 1 2 3 4 if (EventSystem.current.IsPointerOverGameObject() == false) { Debug.Log("This is the way"); } http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5; text-decoration:none">Colored by Color.. 2019. 6. 27.
[Unity3D] 자식 오브젝트 찾기 대략 2가지로 이야기들 하는 듯하다. 첫째로 transform.GetChild("'Index"); 1 2 3 4 5 6 7 8 9 10 11 public class NewBehaviourScript : MonoBehaviour { public Transform transformChild; private void Start() { transformChild = transform.GetChild(0); Debug.Log(transformChild.name); } } http://colorscripter.com/info#e" target="_blank" style="color:#e5e5e5; text-decoration:none">Colored by Color Scripter GetChild(0) 은 첫번째... 2019. 6. 26.