Forum Discussion
mofvr
6 years agoHonored Guest
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
- cloud_canvasExpert ProtegeMy 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.
- paulodgnHonored Guest@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?
- MassiveStateProtegeHey 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:
But now it seems like my event data for RemoteAvatar not being sent, here's my CallBack.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);
}
}
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.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");
}
}
}
@paulodgn I feel we can put our heads together and figure it out, maybe @cloud_canvas can help us ;) - paulodgnHonored Guest@"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 - paulodgnHonored Guest@"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. - MassiveStateProtege@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.Yea I'm following that tutorial. Thanks a bunch!
Did you follow that guide? https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/oculusavatarsdk
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 - paulodgnHonored Guest@"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: - MassiveStateProtegeYea I have those set. hmm
- pyrussHonored GuestWould 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) - pyrussHonored GuestJustin were do you apply your "EventCallback" scripts? What about OVR camera? how do you call it?
Quick Links
- Horizon Developer Support
- Quest User Forums
- Troubleshooting Forum for problems with a game or app
- Quest Support for problems with your device
Other Meta Support
Related Content
- 3 months ago
- 6 months ago
- 8 months ago