반응형
- 코드 작성
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine.UI;
public class NetworkManager : MonoBehaviourPunCallbacks
{
public Text notionText;
public PhotonView PV;
private void Awake()
{
PV = GetComponent<PhotonView>();
}
public override void OnPlayerEnteredRoom(Player newPlayer)
{
PV.RPC("NotionRPC", RpcTarget.All, newPlayer.NickName + "님이 참가하셨습니다.");
}
public override void OnPlayerLeftRoom(Player otherPlayer)
{
PV.RPC("NotionRPC", RpcTarget.All, otherPlayer.NickName + "님이 퇴장하셨습니다.");
}
[PunRPC]
void NotionRPC(string msg)
{
Debug.Log(msg);
notionText.text = msg;
}
}
- 포톤 공식 Api 참고
https://doc.photonengine.com/ko-kr/pun/v1/gameplay/rpcsandraiseevent
반응형
'개발 > Photon' 카테고리의 다른 글
유니티 C# 포톤 씬 로드하기 Photon Scene Load (0) | 2022.12.22 |
---|---|
유니티 C# 포톤 타이머 간단 구현 Photon Timer (0) | 2022.12.22 |
유니티 C# 포톤 소유권 제어하기 Photon Ownership (0) | 2022.12.22 |
유니티 C# 포톤 커스텀 프로퍼티 간단 사용법 Photon Custom Property (0) | 2022.12.22 |
유니티 C# 포톤 변수 동기화 Photon RPC (0) | 2022.12.22 |
유니티 C# 포톤 방 설정하기 Photon RoomOptions (0) | 2022.12.22 |
유니티 C# 포톤 서버 접속하기 간단 구현 Photon Server (0) | 2022.12.22 |
유니티 C# 포톤 설치 Photon 실시간 멀티 구현 (0) | 2022.12.22 |
댓글