목록Unity (54)
한 걸음 두 걸음
–https://developers.google.com/vr/unity/download Downloads and samples | Google VR | Google Developers Terms & Conditions By downloading the Google VR SDK, you agree that the Google APIs Terms of Service govern your use thereof. I have read and agree with the above terms and conditions, proceed to the downloads To develop for Google VR, you need a supported developers.google.com 에서 받아온 Google SD..
타이머 + 타이머가 어떤 객체를 일정 거리를 두고 따라다니도록 만들었습니다.(mobile용) using System.Collections; using System.Collections.Generic; using UnityEngine; public class Timer : MonoBehaviour { public UnityEngine.UI.Text _guiTime; public UnityEngine.UI.Scrollbar obj_scrollbar_; public Camera cam; //시간을 입력받는 변수 private float _timeCnt; //pacman과 text 사이의 거리 Vector3 dist = new Vector3(0, 0, 0); //스크롤바 플래그 private bool isgam..
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; public class VRbutton : MonoBehaviour { /* 게임이 로딩중임을 알리는 스크롤바와 텍스트를 관리하는 스크립트입니다. */ public Text label; public UnityEngine.UI.Scrollbar obj_scrollbar_; public void Start() { label.text = "At start func"; } private void Update() { } //시점이 스크롤바에 닿으면 작동하는 함수입니다 public void PointEnter() { label.text ..
팩맨과 유령에서 유령이 팩맨(target)한테 이동하도록 하는 코드입니다. using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class navi : MonoBehaviour { /* 목표물(pacman)으로 이동하는 네비게이션 스크립트입니다.*/ public Transform target; Vector3 destination; NavMeshAgent agent; void Start() { agent = GetComponent(); destination = agent.destination; } void Update() { if (Vector3.Distance(des..
MoveTowards.cs : 적용시킨 객체를 카메라 방향으로 나아갑니다.(위/ 아래로는 움직이지 않습니다.) using System.Collections; using System.Collections.Generic; using UnityEngine; public class MoveTowards : MonoBehaviour { /* 시점 방향으로 이동하는 스크립트입니다. */ public Camera cam; //메인카메라 private float speed = 0.5f; // 이동속도 void Start() { } void Update() { MoveLookAt(); } void MoveLookAt() { //메인카메라가 바라보는 방향입니다. Vector3 dir = cam.transform.local..
먼저 빌드 세팅에서 해당 Scene을 추가시켜주고난 후, 안드로아드 플랫폼으로 스위칭 시켜줍니다. 저는 mobile(android)에서 볼 것이니까요. 그 다음에 창 하단에 있는 Player Setting으로 들어가 (Gradle system : 모바일 환경에서 빌드 / Internal system :apk 파일 생성인데 저는 바로 bulid and run할 예정이기에 gradle로 사용합니다. ) 가로모드로 설정해줍니다. Company와 ProjectName을 일치되도록 맞춰주시고 – https://developers.google.com/vr/unity/download Downloads and samples | Google VR | Google Developers Terms & Conditions By..
유니티에서 control 9 키를 눌러 asset Store에 들어가신 후, Vuforia Digital Eyewear Sample를 검색해줍니다. 다운로드를 다 하시면 경고창 무시하고 설치해줍니다. 이후 플레이버튼을 누르면 이런 메세지가 나올 수 있는데ㅡ 위 에러 메세지는 Sample과 Vuforia의 버전이 일치하지 않아 발생하는 문제이므로, Vuforia의 버전을 업데이트해주면 해결됩니다. 버전 업데이트는 VuforiaConfiguration에서 Download Vuforia로 다운받아주시면 됩니다, 다운로드가 완료되면 압축 풀어주시고 설치를 진행시켜주세요ㅎㅎ 파일 경로를 지정해주어야하는데, 저같은 경우는 unity가 설치됐던 경로로 지정해주었습니다. 이 때, 해당 유니티가 켜져있으면 충돌하므로, ..
재생하자마자 지정된 음악을 재생시키도록 만들겠습니다. 코드는 아래처럼 굉장히 간단합니다. using System.Collections; using System.Collections.Generic; using UnityEngine; public class bgm : MonoBehaviour { public AudioClip sndExp; // Start is called before the first frame update void Start() { AudioSource.PlayClipAtPoint(sndExp, transform.position); } // Update is called once per frame void Update() { } } public AudioClip sndExp;어떤 음원을 ..