반응형
반응형
플레이팹 로그인이 되었다는 가정하에 진행 유니티 플레이팹 게스트 로그인 Playfab Sign In with Guest Login 간단 사용법 코드 작성 using PlayFab; using PlayFab.ClientModels; using PlayFab.Json; using PlayFab.ProfilesModels; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using UnityEngine; using EntityKey = PlayFab.ProfilesMod parksh3641.tistory.com 데이터 불러오기 using PlayFab; using PlayFab.ClientMo..
코드 작성 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { public AudioSource audioSource; public AudioClip audioClip; private void Start() { audioSource.Play(); //재생 audioSource.Stop(); //정지 audioSource.Pause(); //일시정지 audioSource.UnPause(); //일시정지 해제 audioSource.playOnAwake = true; //씬 시작시 바로 재..
코드 작성using System;using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class Example : MonoBehaviour{ public float shakeAmount = 3.0f; public float shakeTime = 1.0f; private void Start() { StartCoroutine(Shake(shakeAmount, shakeTime)); } IEnumerator Shake(float ShakeAmount, float ShakeTime) { float timer = 0; ..
코드 작성 using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { DateTime today; DateTime now; private void Start() //날짜 디버그 출력 { today = System.DateTime.Today; now = System.DateTime.Now; Debug.Log(today.ToString("yyyy-MM-dd")); Debug.Log(now.ToString("yyyy-MM-dd-hh-mm-ss")); } void AddDateTime() //날짜 ..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { private void Start() { StartCoroutine(ExampleCoroutine()); StartCoroutine(Example2Coroutine()); StopAllCoroutine(); //모든 코루틴 정지 } IEnumerator ExampleCoroutine() { Debug.Log("코루틴 실행중"); yield return new WaitForSeconds(1f); StartCoroutine(ExampleCoroutin..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class SkillManager : MonoBehaviour { [Range(0, 20)] public float skillTime = 10.0f; [Range(0, 20)] public float skillCoolTime = 10.0f; public Image skillFillAmount; public Text skillCoolTimeText; bool isUseSkill = true; private void Awake() { skillInformationText.text = "Skill OFF"; ..
코드 작성 (적용하고 싶은 오브젝트에 적용) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { public Transform target; public float moveSpeed = 1.0f; private void Update() { Vector2 relativePos = target.transform.position - transform.position; float angle = Mathf.Atan2(relativePos.y, relativePos.x) * Mathf.Rad2Deg; transform...
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { bool isPause = false; void Awake() { Time.timeScale = 1; } public void Pause() { if (!isPause) //정지됨 { isPause = true; Time.timeScale = 0; } else //해제 { isPause = false; Time.timeScale = 1; } } }
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; public class TouchManager : MonoBehaviour { private Vector2 startPos; public float minSwipeDistY = 50f; public float minSwipeDistX = 50f; private bool firstSwipe = false; public string direction = ""; //Up, Down, Left, Right로 입력이 들어옵니다. void Update() { if (Time.timeScale == 0) { InputButtonUp(); return; } } publ..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class Example : MonoBehaviour { public int width = 1080; //가로 public int height = 1920; //세로 private void Start() { Screen.SetResolution(width, height, true); } }
유니티 C# 시스템 언어 가져오기 System Language 간단 사용법코드 작성using System.Collections;using System.Collections.Generic;using UnityEngine;public class Example : MonoBehaviour{ void Start() { if (Application.systemLanguage == SystemLanguage.English) { Debug.Log("영어"); } else if (Application.systemLanguage == SystemLanguage.Korean) { Debug.Log("한국어");..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Example : MonoBehaviour { void Start() { #if UNITY_EDITOR Debug.Log("유니티 에디터에서 실행"); #elif UNITY_ANDROID Debug.Log("안드로이드에서 실행"); #elif UNITY_IOS Debug.Log("아이폰에서 실행"); #elif UNITY_WEBGL Debug.Log("웹에서 실행"); #endif } } 다른 방법 using System.Collections; using System.Collections.Generic; using UnityEngi..