본문 바로가기
반응형

전체 글382

유니티 C# 랜덤 난수 생성 Random.Range 간단 사용법 코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Example : MonoBehaviour { public int minNumber = 0; public int maxNumber = 10; void Start() { int random = Random.Range(0, 10); Debug.Log(random); int random2 = Random.Range(minNumber, maxNumber); Debug.Log(random2); } } 유니티 Api 참조 https://docs.unity3d.com/kr/530/ScriptReference/Random.Range.html Ra.. 2022. 6. 21.
유니티 C# 파이어베이스 애널리틱스 Firebase Analytics 간단 사용법 파이어베이스 SDK 다운로드 Unity 프로젝트에 Firebase 추가 | Unity용 Firebase 의견 보내기 Unity 프로젝트에 Firebase 추가 Firebase Unity SDK를 활용하여 Unity 게임을 업그레이드 해보세요. Firebase를 Unity 프로젝트에 연결하는 것이 얼마나 간편한지 보여드리기 위해 Google은 MechaHamst firebase.google.com 압축 푼 뒤 dotnet4 / FirebaseAnalytics.unitypackage 설치 코드 작성 using Firebase; using Firebase.Analytics; using System.Collections; using System.Collections.Generic; using UnityEngin.. 2022. 6. 21.
유니티 C# 특수문자 제한 간단 사용법 input text 코드 작성 using System.Collections; using System.Collections.Generic; using System.IO; using System.Text.RegularExpressions; using UnityEngine; public class NickNameManager : MonoBehaviour { public InputField inputField; public void CheckNickName() { string Check = Regex.Replace(inputField.text, @"[^a-zA-Z0-9가-힣]", "", RegexOptions.Singleline); Check = Regex.Replace(inputField.text, @"[^\w\.@-]", "".. 2022. 6. 21.
유니티 C# 캐릭터 키보드 이동 간단 구현 방향키로 이동 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class PlayerMove : MonoBehaviour { public float moveSpeed = 5.0f; private void FixedUpdate() //키보드로 이동 { float h = Input.GetAxis("Horizontal"); float v = Input.GetAxis("Vertical"); transform.position += new Vector3(h, 0, v) * moveSpeed * Time.deltaTime; } } 키보드로 이동 using System.Col.. 2022. 6. 20.
유니티 C# 키보드 입력 Keyboard input 간단 사용법 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Example : MonoBehaviour { void Update() { if(Input.GetKey(KeyCode.A)) { Debug.Log("Press A"); } if (Input.GetKey(KeyCode.UpArrow)) { Debug.Log("Press UpArrow"); } if (Input.GetKey(KeyCode.Space)) { Debug.Log("Press Space"); } } } 2022. 6. 20.
유니티 C# 파이어베이스 푸시알림 Firebase Cloud Messaging FCM 간단 사용법 파이어베이스 SDK 다운로드 Unity 프로젝트에 Firebase 추가 | Unity용 Firebase 의견 보내기 Unity 프로젝트에 Firebase 추가 Firebase Unity SDK를 활용하여 Unity 게임을 업그레이드 해보세요. Firebase를 Unity 프로젝트에 연결하는 것이 얼마나 간편한지 보여드리기 위해 Google은 MechaHamst firebase.google.com 압축 푼 뒤 dotnet4 / FirebaseMessaging.unitypackage 설치 코드 작성 using Firebase; using Firebase.Messaging; using System.Collections; using System.Collections.Generic; using UnityEngin.. 2022. 6. 20.
유니티 C# 윈도우 창 애니메이션 Window Animation 간단 사용법 코드 작성 (Dotween 사용) using UnityEngine; using System.Collections; using DG.Tweening; public class WindowAnimation : MonoBehaviour { float duration = 0.15f; Vector3 scaleTo = new Vector3(1f, 1f, 1f); void OnEnable() { transform.localScale = new Vector3(0, 0, 0); transform.DOScale(scaleTo, duration); } void OnDisable() { transform.localScale = new Vector3(0, 0, 0); } } 코드 작성 using UnityEngine; using.. 2022. 6. 20.
유니티 C# CSV 파일 저장, 불러오기 Read, Write 간단 사용법 파일 저장 경로 불러오는 코드 작성 using System.IO; using UnityEngine; public static class SystemPath { public static string GetPath(string fileName) { string path = GetPath(); return Path.Combine(GetPath(), fileName); } public static string GetPath() { string path = null; switch (Application.platform) { case RuntimePlatform.Android: path = Application.persistentDataPath; path = path.Substring(0, path.LastInde.. 2022. 6. 20.
유니티 C# 인앱결제 시스템 IAP Manager 간단 사용법 코드 작성 (구버전용) using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Purchasing; public class IAPManager : MonoBehaviour, IStoreListener { private static IStoreController mStoreController; private static IExtensionProvider mStroeExtensionProvider; public static string Product_1 = "shop.cristalpack100"; void Start() { if (mStoreController == null) { Initia.. 2022. 6. 19.
유니티 C# 인터넷 연결 상태 확인 Network Connect 간단 사용법 코드 작성 using UnityEngine; public class NetworkConnect : MonoBehaviour { bool isConnect = false; public bool CheckConnectInternet() { if (Application.internetReachability == NetworkReachability.NotReachable) { // 인터넷 연결이 안되었을때 isConnect = false; } else if (Application.internetReachability == NetworkReachability.ReachableViaCarrierDataNetwork) { // 데이터로 인터넷 연결이 되었을때 isConnect = true; } else { // 와이.. 2022. 6. 19.
유니티 C# 기즈모 Gizmo 간단 사용법 using System.Collections; using System.Collections.Generic; using UnityEngine; public class Gizmo : MonoBehaviour { public Color color = Color.blue; public float radius = 1.0f; void OnDrawGizmos() { Gizmos.color = color; Gizmos.DrawSphere(transform.position, radius); } } 2022. 6. 19.
유니티 C# 버튼 클릭 애니메이션 Button Click Animation 간단 사용법 코드 작성 using UnityEngine; using System.Collections; using UnityEngine.UI; using UnityEngine.EventSystems; public class ButtonClickAnimation : MonoBehaviour, IPointerDownHandler, IPointerUpHandler { public void OnPointerDown(PointerEventData eventData) //버튼 눌렀을 떄 { transform.localScale = Vector3.one * 0.95f; } public void OnPointerUp(PointerEventData eventData) //버튼을 땟을 때 { transform.localScale = .. 2022. 6. 19.
반응형