Skip to main content
New Participant
June 3, 2019

Does Oculus Quest support Photon Unity Networking?

I am researching about possibilities to make multi user experiences for the Quest and have been wondering if Photon would help?

26 replies

Inspiring
June 20, 2019
My company's Oculus Go app has extensive integration with PUN 2 and Oculus Avatars. I am also totally new to networking. I'd recommend simply following Photon's basic tutorials and then applying the concepts (PhotonView, RPC, RaiseEvent etc.) to your own project.
Samsung Galaxy S8 (Snapdragon 835), Gear VR (2017), Oculus Go (64GB), Unity 2018.3.14f1
Up and Coming
August 19, 2019
@cloud_canvas First thanks for all the research and to share the fix with photon and Avatars. I did what it says in the Photon tutorial for the avatars but im having a problem. The avatar never gets Initialized for some reason and i dont get any errors. Any idea in what can be the cause of this?
Up and Coming
August 22, 2019
Hey I'm currently in the process of working with pun2 and avatars as well.

I realized the OnJoinedRoom() function wasn't being called when instantiating the avatars so I changed it to a LoadAvatar() function and called it just after I created the player. 

This is my NetworkManager.cs script:


private void Start()
{
CreatePlayer();
LoadAvatar();
}

//here's my create player script

public byte InstantiateVrAvatarEventCode = 123;

public void LoadAvatar()
{
GameObject localAvatar = Instantiate(Resources.Load("PUN_LocalAvatar")) as GameObject;
PhotonView photonView = localAvatar.GetComponent<PhotonView>();

//Make avatar child of PUNPlayer
localAvatar.transform.parent = player.transform;

//Center avatar on PUNPlayer
localAvatar.transform.localPosition = Vector3.zero;
localAvatar.transform.localRotation = Quaternion.identity;


if (PhotonNetwork.AllocateViewID(photonView))
{
RaiseEventOptions raiseEventOptions = new RaiseEventOptions
{
CachingOption = EventCaching.AddToRoomCache,
Receivers = ReceiverGroup.Others
};

SendOptions sendOptions = new SendOptions
{
Reliability = true
};

PhotonNetwork.RaiseEvent(InstantiateVrAvatarEventCode, photonView.ViewID, raiseEventOptions, sendOptions);
Debug.Log("Raised Event Set: " + photonView.ViewID + " | " + raiseEventOptions + " | " + sendOptions);
}
else
{
Debug.LogError("Failed to allocate a ViewId.");

Destroy(localAvatar);
}
}
But now it seems like my event data for RemoteAvatar not being sent, here's my CallBack.cs script:
public class EventCallbacks : MonoBehaviourPunCallbacks, IOnEventCallback
{

public byte InstantiateVrAvatarEventCode = 123;

public override void OnEnable()
{
PhotonNetwork.AddCallbackTarget(this);
}

public override void OnDisable()
{
PhotonNetwork.RemoveCallbackTarget(this);
}

public void OnEvent(EventData photonEvent)
{
if (photonEvent.Code == InstantiateVrAvatarEventCode)
{
GameObject remoteAvatar = Instantiate(Resources.Load("PUN_RemoteAvatar")) as GameObject;
PhotonView photonView = remoteAvatar.GetComponent<PhotonView>();
photonView.ViewID = (int)photonEvent.CustomData;

Debug.Log("Remote Avatar Instantiated");
}
}
}
Maybe I have it on the wrong GameObject or I'm putting everything in the wrong places (I have no clue). It would be helpful if the photon documentation specified "Create a script for ______ and attach it to ______". I did implement @cloud_canvas's OVRAvatar.cs hack but I'm not even getting the callback error. 

@paulodgn I feel we can put our heads together and figure it out, maybe @cloud_canvas can help us  ;)
Up and Coming
August 22, 2019
@"justin.oheir" i fixed my issue. The problem was cloud OVRAvatar fix. The avatar was never initialiazed, so i removed that part of the code and it works good now. For the rest of it i followed the tutorial from Photon and everything works.
Did you follow that guide? https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/oculusavatarsdk
Up and Coming
August 22, 2019
@"justin.oheir" Regarding the gameobjects you should have something like this for the LocalAvatar:



Make sure that the object in the Observed Component is the Photon Avatar View (marked in red). Hope it helps, im no expert, just starting with Photon also.
Up and Coming
August 22, 2019
@justin.oheir i fixed my issue. The problem was cloud OVRAvatar fix. The avatar was never initialiazed, so i removed that part of the code and it works good now. For the rest of it i followed the tutorial from Photon and everything works.
Did you follow that guide? https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/oculusavatarsdk
Yea I'm following that tutorial. Thanks a bunch! 

So I have achieved a grey avatar with no hands that doesn't move with the headset, I just removed TransformView from the PhotonView based on your set-up. I have a feeling that will fix my movement problem, come on hands! (also do you have the same scripts on the RemoteAvatar?@paulodgn

Up and Coming
August 22, 2019
@"justin.oheir" Yes the remote avatar has the same setup

For the hands to work i believe you have to set an app ID on the Avatar settings:


Up and Coming
August 22, 2019
Yea I have those set. hmm
New Participant
August 23, 2019
Would any kind soul, share  very simplistic / basic scripts on what currently work with oculus quest 7.0 + Pun2? modeler & animator with very basic scripting knowledge and 2 days of networking survey.
I am following the photon tutorials , got it to work with regular networking but as soon as i try to add the avatar portion, all hell breaks lose and nothing works, it doesnt even let me add "IOneventCallback" to the network manager script (that uses in regular tutorial) 
New Participant
August 23, 2019
Justin were do you apply your "EventCallback" scripts? What about OVR camera? how do you call it?