Simple Example to begin with Photon PUN multiplayer game development

This simple script is to connect the game to Photon server and instantiate a player prefab on your Resources folder. Make sure your player prefab has PhotonView component in it.

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Pun;

public class SimpleLauncher : MonoBehaviourPunCallbacks
	public PhotonView playerPrefab;
    // Start is called before the first frame update
    void Start()

	public override void OnConnectedToMaster(){
		Debug.Log("Connected to Master");
	public override void OnJoinedRoom(){
		Debug.Log("Joined a room.");
		PhotonNetwork.Instantiate(,, Quaternion.identity);

Check out this video on how to use it:

Ready to develop more? Watch out the next steps of what we can do with Photon PUN 2 in this video tutorial playlist:

Leave a Reply

Your email address will not be published. Required fields are marked *