본문 바로가기
728x90

분류 전체보기252

Object Color Flicker 만들기 준비물 : Flicker 대상 Material, Object 1. Object의 형상을 구현한다. 2. 해당 Object에 적용할 Material을 만든다. 3. Material의 속성을 설정하고, Object에 입힌다. 4. Filcker Code 작성 using System.Collections.Generic; using UnityEngine; public class ColorFlicker : MonoBehaviour { public Renderer Lamp; private Color color; void Start() { // lamp에 color 값 저장 color = Lamp.material.color; } void Update() { colorFlicker(); } void colorFlick.. 2020. 12. 13.
Trigger Enter, Stay, Exit 정리 Trigger : 어떤 물체가 지정된 물체와 부딪혔으나, 부딪혔다는 사실만 인지할 뿐, 어떠한 물리적 변경이 보여지지 않는 경우를 뜻함. 일종의 유령 상태. 충돌 감지의 일종 Trigger의 종류 : Enter, Stay, Exit Trigger 설정된 물체와의 접촉이 시작된 상태에서 1회만 호출. 재호출 하기 위해서는 추가 조건을 걸거나, 트리거와 접촉 분리한 후, 재접촉하면 된다. using UnityEngine; public class TriggerText : Monobehaviour { private void OnTriggerEnter (collison other) { if(other.transform.tag == "1") Debug.Log("Enter 1") } }.. 2020. 12. 13.
App 종료 & 시스템 강제 종료 using UnityEngine; public class Quit : Monobehaviour { public void OnAppExit() { Application.Quit(); // 시스템 강제 종료 #if UNITY_EDITOR System.Diagnostics.Process.GetCurrentProcess().Kill(); #endif } } 2020. 12. 13.
[Unity] RealTime을 Unity TMP text로 표시하기 ◈ 방법 1. 정석 스타일 using System; using UnityEngine; using TMPro; public class TimeCtrl : Monobehaviour { public TMP_Text date_txt; private void FixedUpdate() { date_txt.text = DateTime.Now.ToStrind("yyyy-MM-dd HH:mm:ss tt"); // 연, 월, 일, 시, 분, 초, 오전/오후 } } ◈ 방법 2. 간략화 스타일 - 람다식 사용 () => { } using System; using UnityEngine; using TMPro; public class TimeCtrl : Monobehaviour { public TMP_Text date_txt;.. 2020. 12. 13.