개발모음집

Unity로 VR 구현하기 본문

TheRestDevelop

Unity로 VR 구현하기

void 2018. 11. 8. 09:00

1. VR 기본 구현 : How to make a VR 360 Video app within Unity for Android


2. VideoPlyer로 영상과 함께 음악소리 나오게 

Through trial and error, here's the minimum that I've found that needs to be called to play a VideoClip from C# using Unity 2017.1 on Windows 10:

public class VideoPlayerTest : MonoBehaviour {

   public VideoPlayer player;
   public VideoClip clip;
   public AudioSource audioSource;

   // Use this for initialization
   void Start () {
       player.audioOutputMode = VideoAudioOutputMode.AudioSource;
       player.SetTargetAudioSource(0, audioSource);
       player.source = VideoSource.VideoClip;
       player.clip = clip;
       player.Play();
   }
}

Using a GameObject configured like this: Unity Editor Inspector With this MP4 file (download and drop into your Assets directory): https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4

Good luck! I spent a lot of time fiddling with enabling tracks/channels and it didn't seem to do anything before stumbling upon this simple configuration.


출처 : stackoverflow


* VR 안드로이드 기기로 빌드할 때 조심해야할 점!

VR을 안드로이드로 빌드할때는 vr기기가 필요하기 때문에 빌드를 할 때 유니티에게 어떠한 기기로 vr기기를 동작시킬건지 알려줘야함

file - Build Settings - Player Settings - XR Settings - Virual Reality Supported - '+' 눌러서 카드보드 추가