2022๋ ๊ธฐ์ค์ผ๋ก ๊ณผ๊ฑฐ์ ๋ฌธ์๋๋ก ๋ฐ๋ผํ๋ฉด ํฌํค์ด ์๋ ์ ์๋ค.
ํด๋น ๊ธ์ 2022๋ 1์ 4์ผ ๊ธฐ์ค์ผ๋ก ํฌํคPUN2๊ฐ ๋์๊ฐ๋ ๊ฒ์ ํ์ธํ๊ณ ์์ฑํ๋ ๊ธ์ด๋ค.
์์์ ๋ฉํฐํ๋ ์ด์ด ๊ฒ์์ ์ ์ ๋ ๋ฌด๋ฃ ํฌํค์ผ๋ก ์์ฉ๊ฐ๋ฅํ๋ค.
์๋ ํฌํค ์ฌ์ดํธ์ ๊ฐ์ ํ์๊ฐ์ ์ ํ ๋ค์์ ์ดํ๋ฆฌ์ผ์ด์ ์์ฑ์ ๋๋ฅด๊ณ
์ ๋นํ ํ๋ก์ ํธ ์ด๋ฆ์ ์จ์ฃผ๋ฉด ID๊ฐ ๋ฌ๋ค.
https://www.photonengine.com/ko-KR/Photon
๊ธ๋ก๋ฒ ํฌ๋ก์ค ํ๋ซํผ ์ค์๊ฐ ๊ฒ์ ๊ฐ๋ฐ | Photon Engine
Cookie Settings Photon uses cookies to identify you as logged-in user, to improve your experience and for marketing. Review and manage your cookie settings below to control your privacy. For more information on how we use cookies and what each cookie stand
www.photonengine.com
์ ๋ํฐ ์์ ๋งํฌ, ๋งํฌ์์ ์์ ์ ๋ค์ด๋ก๋ ํ ์ํฌํธ ์์ผ์ค๋ค.
์ํฌํธ ์ํฌ ๋ ID๋ฅผ ์์ฑํด์ค๋ค.
PUN 2 - FREE | Network | Unity Asset Store
PUN 2 - FREE | ๋คํธ์ํฌ | Unity Asset Store
Get the PUN 2 - FREE package from Exit Games and speed up your game development process. Find this & other ๋คํธ์ํฌ options on the Unity Asset Store.
assetstore.unity.com
์ต์ ๋ฒ์ ํฌํคPun
using Photon.Pun;์ ๋ฌ์์ฃผ๊ณ
public class NetworkManager : MonoBehaviourPunCallbacks
{
}
์ด๋ ๊ฒ MonoBehaviourPunCallbacks๋ฅผ ์์ํด์ฃผ๋ฉด ํฌํค ํด๋์ค์ ํจ์๋ค์ ์ค๋ฒ๋ผ์ด๋ฉํด์ ์ฌ์ฉํ ์ ์๋ค.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
public class NetworkManager : MonoBehaviourPunCallbacks
{
}
ํฌํค ํด๋์ค๋ฅผ ํตํด ์ฌ์ฉํ ์ ์๋ ํจ์๋ค์ ๋ณผ ์ ์๋ ๊ณต์๋ฌธ์์ด๋ค.
ํฌํค ํํ์ด์ง์ ์์ต์๊น์ง ์ ์์ฑ๋์ด ์์ผ๋
ํ๋์ฉ ๋ฐ๋ผํ๋ค๋ณด๋ฉด ๊ทผ์ฌํ ์๊ท๋ชจ ๋คํธ์ํฌ ๊ฒ์์ ๋ง๋ค ์ ์์ ๊ฒ์ด๋ค.
์๊ฐ | ๊ด์ ์์ง (photonengine.com)
Introduction | Photon Engine
Cookie Settings Photon uses cookies to identify you as logged-in user, to improve your experience and for marketing. Review and manage your cookie settings below to control your privacy. For more information on how we use cookies and what each cookie stand
doc.photonengine.com
Photon Unity Networking 2: MonoBehaviourPunCallbacks Class Reference
This class provides a .photonView and all callbacks/events that PUN can call. Override the events/methods you want to use. More... This class provides a .photonView and all callbacks/events that PUN can call. Override the events/methods you want to use. By
doc-api.photonengine.com
๊ด์ ์ ๋ํฐ ๋คํธ์ํน 2: ๋ชจ๋ ธํ๋ํ์ฝ๋ฐฑ ํด๋์ค ์ฐธ์กฐ (photonengine.com)
Photon Unity Networking 2: MonoBehaviourPunCallbacks Class Reference
This class provides a .photonView and all callbacks/events that PUN can call. Override the events/methods you want to use. More... This class provides a .photonView and all callbacks/events that PUN can call. Override the events/methods you want to use. By
doc-api.photonengine.com
์๋ ์ฝ๋๋ ๊ฐ๋จํ ํฌํคํด๋์ค ๋ด ํจ์๋ค์ ์ค๋ฒ๋ผ์ด๋ฉํด์
๋ง์คํฐ ์ฐ๊ฒฐ, ๋๋ค ๋ฃธ ์ ์ฅ ์๋, ๋ฐฉ์ ์ฅ์ด ์๋๋ฉด ๋ฐฉ์ด ์์ฑ๋์ง ์์์์ ๋ก๊ทธ๋ก ๋ฐ์ฐ๊ณ ๋ฐฉ ์์ฑ,
์์ฑ๋ ๋ฐฉ์ ์ ์ฅํ๋ ๊ฒ๊น์ง ๋ก๊ทธ๋ก ํ์ธํ๋ ์ฝ๋์ด๋ค.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
//์์ ๋ฐ์ ํฌํคํด๋์ค์ ํจ์๋ค์ ์ฌ์ ์ํด์ ์ด๋ค.
public class NetworkManager : MonoBehaviourPunCallbacks
{
private void Awake()
{
PhotonNetwork.AutomaticallySyncScene = true;
Debug.Log("TEST");
//ํฌํค ๋คํธ์ํฌ์ ์ ์
PhotonNetwork.GameVersion = "1.0";
PhotonNetwork.NickName = "test";
PhotonNetwork.ConnectUsingSettings();
}
//์ฐ๊ฒฐ๋์์ ๋ ์ํ๋๋ ์ด๋ฒคํธ ํจ์
public override void OnConnectedToMaster()
{
Debug.Log("OnConnectedToMaster() ๋ง์คํฐ์ ์ฐ๊ฒฐ๋์๋ค");
PhotonNetwork.JoinRandomRoom();
}
// ๋๋ค ๋ฃธ ์
์ฅ์ ์คํจํ์ ๋ ํธ์ถ ๋๋ ํจ์
public override void OnJoinRandomFailed(short returnCode, string message)
{
Debug.Log("๋ฐฉ์ด ์์");
PhotonNetwork.CreateRoom("TEST");
}
public override void OnCreatedRoom()
{
Debug.Log("OnCreatedRoom() ๋ฃธ์ ๋ง๋๋ ๋ฐ ์ฑ๊ณตํ๋ค");
}
public override void OnJoinedRoom()
{
Debug.Log("OnJoinedRoom() ๋ฃธ์ ๋ค์ด์๋ค");
}
}