전체 글(164)
-
0503 쉐이더 기본
픽셀의 색을 정해주는 함수 Draw Call 드로우 콜이 높아질 수록 성능이 저하된다. 텍스쳐 1장당 1개의 드로우 콜이 생겨나므로, 아틀라스를 이용해 작업하면 드로우콜이 낮아진다. 랜더링 파이프라인 3D가상 공간의 물체를 화면의 픽셀의 색으로 출력하는 과정 1. 오브젝트 데이터를 받아온다. 2. 버텍스 쉐이더를 계산한다. (점들의 좌표 위치 계산) 3. 래스터라이즈 (만들어낸 면을 쪼개어 색을 칠할 수 있도록 편집) 4. 픽셀 쉐이더/프래그먼트 쉐이더 (텍스쳐를 칠한다.) 한 개의 픽셀은 3개의 서브픽셀로 이루어져 있다. 컬러들을 숫자로 인식한다. 한 픽셀의 색을 결정하는 코드를 픽셀 쉐이더라고 부른다. Adobe RGB(255,255,255) > float3(1.0,1.0,1.0) 으로 색상 연산이 ..
2021.05.03 -
0430 조이스틱으로 움직이고, 때리는 모션
using UnityEngine; using UnityEngine.UI; public class JoyStickTest : MonoBehaviour { public VariableJoystick variableJoystick; public Transform heroTrans; public float moveSpeed=1f; public CharacterController player; private Vector3 dir; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { StartCoroutine(RunImpl()); StartCoroutine(A..
2021.04.30 -
0429 조이스틱으로 캐릭터 움직이기
조이스틱은 유니티 에셋에서 가져왔음 'JoyStick Pack' using UnityEngine; public class JoyStickTest : MonoBehaviour { //VariableJoystick은 에셋에 포함된 스크립트임 public VariableJoystick variableJoystick; public Transform hero; public float moveSpeed=1f; // Start is called before the first frame update void Start() { } // Update is called once per frame void Update() { Debug.LogFormat("{0}", variableJoystick.Direction); var ..
2021.04.29 -
0429 데이터 연동으로 해당 프리팹 불러오기
using System.Collections.Generic; using UnityEngine; using Newtonsoft.Json; using System.Linq; public class Test : MonoBehaviour { public GameObject GaugeGo; public Hero hero; public UIButton btn; public GameObject labelPrefab; public UIPanel panel; private Dictionary dicCharDatas; private Dictionary dicPrefabs = new Dictionary(); // Start is called before the first frame update void Start() { t..
2021.04.29 -
0428 월드 좌표를 로컬 좌표로 변환하기(+ DOTween)
ui상의 보스 체력을 나타내는 게이지를 월드 좌표 안에 있는 캐릭터의 머리 위에 띄우려고 한다. using UnityEngine; public class Hero : MonoBehaviour { public Transform hudGaugeTrans; public Transform hudDamageTrans; public GameObject gaugeGo; // Start is called before the first frame update void Start() { Debug.LogFormat("{0}", UICamera.mainCamera); } // Update is called once per frame void Update() { Vector3 overlay = NGUIMath.WorldToL..
2021.04.28 -
0427 NGUI Scroll View+(데이터 연동)
using UnityEngine; public class NGUITestScrollView : MonoBehaviour { public GameObject prefab; public UIGrid grid; // Start is called before the first frame update void Start() { for (int i = 0; i < 10; i++) { var go = Instantiate(this.prefab, this.grid.transform); } grid.Reposition(); } 데이터 연동 using UnityEngine; public class UIListItem : MonoBehaviour { public UIButton btnPurchase; public GameO..
2021.04.27