반응형
반응형
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; public enum MoneyType { Gold = 0, Crystal } public class ExampleEnum : MonoBehaviour { public MoneyType moneyType = MoneyType.Gold; void GetEnumCount() { int count = System.Enum.GetValues(typeof(MoneyType)).Length; } }
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class MousePosition : MonoBehaviour { private void Start() { } void Update() { if (Input.GetMouseButtonDown(0)) { Vector3 mousePos = Camera.main.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, -Camera.main.transform.position.z)); Debug.Log(mousePos.ToStri..
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using UniRx; public class CoroutionUniRX : MonoBehaviour { private void Start() { Observable.FromCoroutine(ExampleCoroution, false) .Subscribe(_ => Debug.Log("Exit")); } IEnumerator ExampleCoroution() { yield return new WaitForSeconds(1); Debug.Log("Coroution Exit"); } } 참고할만한 글 유니티 C# UniRX 타이머 간단 구현 Timer 코드 작..
코드 작성 using System.Collections; using System.Collections.Generic; using UniRx; using UnityEngine; using UnityEngine.UI; public class TimerUniRX : MonoBehaviour { public Text timerText; private int timerIndex = 0; private void Start() { Observable.Timer(System.TimeSpan.FromSeconds(1)) .Repeat() .Subscribe(_ => UpdateTimer()); } void UpdateTimer() { timerIndex++; timerText.text = timerIndex.ToStri..
코드 작성 using System.Collections; using System.Collections.Generic; using UniRx; using UnityEngine; using UnityEngine.UI; public class ExampleUniRX : MonoBehaviour { private void Start() { var parallel = Observable.WhenAll( ObservableWWW.Get("http://google.com/"), ObservableWWW.Get("http://bing.com/"), ObservableWWW.Get("http://unity3d.com")); parallel.Subscribe(xs => { Debug.Log(xs[0].Substring(0..
코드 작성 using System.Collections; using System.Collections.Generic; using UniRx; using UnityEngine; using UnityEngine.UI; public class ButtonClickUniRX : MonoBehaviour { public Button button; public Text text; private void Start() { button.onClick .AsObservable() .Subscribe(_ => { text.text = "Clicked"; }); } } 참고할만한 글
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using UniRx; using UniRx.Triggers; using System; public class DoubleClickUniRX : MonoBehaviour { public Text text; void Start() { var clickStream = this.UpdateAsObservable() .Where(_ => Input.GetMouseButtonDown(0)); clickStream.Buffer(clickStream.Throttle(TimeSpan.FromMilliseconds(200))) .W..
유니티 UniRX (Reactive Extensions for Unity) 다운로드 UniRx - Reactive Extensions for Unity | 기능 통합 | Unity Asset Store Use the UniRx - Reactive Extensions for Unity from neuecc on your next project. Find this integration tool & more on the Unity Asset Store. assetstore.unity.com
UIroot.cs 코드 변경 public void UpdateScale(bool updateAnchors = true) { if (mTrans != null) { float calcActiveHeight = activeHeight; if (calcActiveHeight > 0f) { float size = 2f / calcActiveHeight; Vector3 ls = mTrans.localScale; if (!(Mathf.Abs(ls.x - size)
코드 작성 using System.Collections; using System.Collections.Generic; using UnityEngine; public class CameraResolution : MonoBehaviour { private void Start() { SetResolution(); } public void SetResolution() { int setWidth = 1080; int setHeight = 1920; int deviceWidth = Screen.width; int deviceHeight = Screen.height; Screen.SetResolution(setWidth, (int)(((float)deviceHeight / deviceWidth) * setWidth)..
코드 작성using System.Collections;using System.Collections.Generic;using UnityEngine;using UnityEngine.UI;public class Example : MonoBehaviour{ private void Start() { float number = SystemInfo.batteryLevel; // 베터리 충전량 가져오기 (0 ~ 1); Debug.Log(SystemInfo.batteryLevel); switch(SystemInfo.batteryStatus) //베터리 상태 가져오기 { case BatteryStatus.Unknown: ..
파이어베이스 SDK 다운로드 Unity 프로젝트에 Firebase 추가 | Unity용 Firebase 의견 보내기 Unity 프로젝트에 Firebase 추가 Firebase Unity SDK를 활용하여 Unity 게임을 업그레이드 해보세요. Firebase를 Unity 프로젝트에 연결하는 것이 얼마나 간편한지 보여드리기 위해 Google은 MechaHamst firebase.google.com 압축 푼 뒤 dotnet4 / FirebaseStorage.unitypackage 설치 코드 작성 using Firebase; using Firebase.Extensions; using Firebase.Storage; using System.Collections; using System.Collections.Ge..