전체 글149 Unity 마우스커서 변경 Unity 마우스커서 변경using UnityEngine;public class Player : MonoBehaviour{ [SerializeField] Texture2D cursorHover; [SerializeField] Texture2D cursorNormal; void Start() { Cursor.SetCursor(cursorNormal, Vector2.zero, CursorMode.ForceSoftware); } private void OnMouseOver() { Cursor.SetCursor(cursorHover, new Vector2(cursorHover.width/4,0), CursorMode.ForceSoftware); .. 2022. 10. 24. Unity ColorUtility Unity ColorUtility1. TryParseHtmlString Unity - Scripting API: ColorUtility.TryParseHtmlStringStrings that begin with '#' will be parsed as hexadecimal in the following way: #RGB (becomes RRGGBB) #RRGGBB #RGBA (becomes RRGGBBAA) #RRGGBBAA When not specified alpha will default to FF. Strings that do not begin with '#' will be parsed as literal colordocs.unity3d.comusing System.Collections;using S.. 2022. 10. 11. Unity Array List Dictionary Unity Array List Dictonary1. Arrayusing System.Collections;using System.Collections.Generic;using UnityEngine;using System;public class Test : MonoBehaviour{ // 배열 선언 방법 // 데이터형식[] 배열이름 = new 데이터형식[크기] public Item[] items = new Item[] { new Item(3, "carot"), new Item(2, "banana"), new Item(1, "apple"), new Item(4, "apple") }; void Start() { .. 2022. 10. 10. Action 으로 다른 스크립트 함수 가져오는 방법 Action 으로 다른 스크립트 함수 가져오는 방법예제 : Test 클래스에서 Target 클래스 내 함수를 가져오기Test 클래스using System.Collections;using System.Collections.Generic;using UnityEngine;public class Test : MonoBehaviour{ void Start() { Target.target(); }}Target 클래스using System.Collections;using System.Collections.Generic;using UnityEngine;using System;public class Target : MonoBehaviour{ public static Action targ.. 2022. 10. 10. Unity에서 Json을 사용하는 방법 Unity에서 Json을 사용하는 방법1. Json string을 만드는 방법1.1. class를 만든다.1.2. JsonUtility.ToJson(클래스의 인스턴스) 2. Json string을 class로 변환하는 방법2.1. JsonUtility.FromJson(json 변수명) using System.Collections;using System.Collections.Generic;using UnityEngine;public class SmartTag{ public string tagId; public string tagName; public string locationType; public int posX; public int posY; public int posZ.. 2022. 10. 9. 코루틴 코루틴 코루틴은 시간의 경과에 따른 절차적 단계를 수행하는 로직을 구현하는 데 사용되는 함수이다.코루틴은 HTTP 전송, 에셋 로드, 파일 I/O 완료 등을 기다리는 것과 같이 긴 비동기 작업을 처리해야 하는 경우 코루틴을 사용하는 것이 가장 좋다. 1. 실행시간의 처음과 끝이 존재할 때예제 : 키패드 1을 눌렀을 때 5초간 실행using System.Collections;using System.Collections.Generic;using UnityEngine;public class Test : MonoBehaviour{ [SerializeField] float value05; void Update() { if(Input.GetKeyDown(KeyCode.Keypad1)) .. 2022. 10. 9. 이전 1 ··· 17 18 19 20 21 22 23 ··· 25 다음