해보자/포톤을 배워보자
3일차 - PUN으로 클라우드에 접속보자
artisticbit
2019. 1. 13. 19:32
3일차
공식 홈페이지에 튜토리얼이 한글로 잘 나와있다
참조 : https://doc.photonengine.com/ko-kr/pun/v2/demos-and-tutorials/pun-basics-tutorial/intro
유니티 에셋스토에서 PUN을 받는다
PUN 을 임포트하고 포톤 클라우드의 애플리케이션 ID를 입력하면 된다
씬을 하나 만든 후 빈 오브젝트에 아래 스크립트를 추가해 보자
https://doc-api.photonengine.com/ko-kr/pun/current/index.html
API 도 한글로 잘 되어있다
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 | using System.Collections; using System.Collections.Generic; using UnityEngine; using Photon.Pun; namespace Com.MyCompany.MyGame { public class Launcher : MonoBehaviour { string gameVersion = "1"; private void Awake() { PhotonNetwork.AutomaticallySyncScene = true; } void Start() { Connect(); } void Update() { } public void Connect() { if (PhotonNetwork.IsConnected) { PhotonNetwork.JoinRandomRoom(); } else { PhotonNetwork.GameVersion = gameVersion; PhotonNetwork.ConnectUsingSettings(); } } } } |
PhotomNetwork가 사용중이니
https://doc-api.photonengine.com/ko-kr/pun/current/class_photon_network.html
관련 API를 보자
Window -> Photon Unity Networking ->PUN Wizard
PUN 관련 세팅을 할 수 있다
Logging 을 full로 설정하면 전체 로그를 확인 할 수 있다