목록Development (21)
Tegi Log : 블록체인, 축구, 소레어, Sorare 컨텐츠망상공간

💡 PlayerPrefs를 이용해서 데이터를 저장하고 불러와보자. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; //PlayerPrefs. // [쓰기(세팅)] //SetString(); 키를 지정해서 string 타입의 값을 저장 //SetInt(); 키를 지정해서 int 타입의 값을 저장 //SetFloat(); 키를 지정해서 float 타입의 값을 저장 // [검사] //HasKey(); 해당 키가 존재하는지 검사 bool타입으로 반환해줌. // [읽기(로딩)] //GetString(); 지정한 키의 String 타입 값을 읽어옴. //GetInt(); 지정한 키의 ..
💡 상태를 관리할때 자주 쓰이는 열거형 변수 enum에 대해서 알아봅시다. public class EnumSwitch : MonoBehaviour {//열거형 변수 CatState 상태정의 public enum CatState{ IDLE, MEAW, RUN }; // catState 변수선언 public CatState catState; void Update() { // switch()인자로 catState 변수전달 switch (catState) { // case 띄고 CatState.상태:(변수명이 아니라 타입명을 쳐야됨){ 실행문 } case CatState.IDLE:{ Debug.Log("IDLE!"); } break; //break; 조건에 만족하는 실행문이 끝나면 break에서 멈춘다. cas..
💡 싱글톤 패턴은 클래스객체를 하나로 제한해서 쓰고 싶을때 쓰는 디자인패턴입니다. 게임매니저 같은 전체적인 데이터를 관리할때 쓰곤 합니다. public class GameManager : MonoBehaviour { //게임매니저 변수 선언. public static GameManager instance; private void Awake() { //GameManager 변수 instance가 없다면 this(게임매니저클래스)를 instance에 대입. if(instance == null){ instance = this; //게임매니저 클래스가 아니라면 게임오브젝트를 제거한다. }else if(instance != this){ Destroy(gameObject); } //씬이 전환되도 게임오브젝트가 유지..
만든 컴포넌트를 안에 3개를 다른 name으로 호출시킨 모습. return() 소괄호 안에 주석을 달려면 {}중괄호로 묶어서 자바스크립트라는걸 알려줘야됨.
onChange 프로퍼티에 익명함수(변수)를 전달하는 것. event로 받아온 것을 event.target.value 밸류로 접근하는 것. jsx는 html과 다른점이 몇가지 있다. 변수를 할당할때 ${}이 아닌 {}으로 인식하고 class이름은 className for는 htmlFor 이런식으로 다른 프로퍼티들이 존재함.

💡 JSON은 네트워크 데이터 전송방식의 표준 포맷으로 보편적으로 쓰이고 있습니다. 실제 자바스크립트에서 쓰일때는 파싱을 해야되는데 간단히 살펴봅시다! const character = JSON.parse('{"name":"lena","age": 14}'); console.log(typeof(character)); console.log(character.name); console.log(character.age); //문자열에 적혀있는 객체가 오브젝트타입으로 변환됨. const character2 = JSON.stringify({name:'tom', age:12}); console.log(typeof(character2)); console.log(character2.name); console.log(cha..