In my game I am trying to send Gameobject position, it's color and some game object true/false. When I am sending all data using photon networking RPC using AllBuffered(or using ALL, Others, OthersBuffered) it sending half data or some time it can't send everything.
↧
PunRPC not working
↧
Disconnect all players when initial masterclient disconnects / crashes
Hello everyone!
I am currently trying to discconect all players from a room when the initial masterclient (creator of the room) leaves the room/ has crashed or disconnect due other reasons. I tried using a rpc to disconnect players when the masterclient leaves but that sadly does not work for some reason. I have also looked into the onmasterclientswitch for this issue but can not get that working either sadly.
If anyone could help me out with this issue would be really appreciated.
Kind regards,
Pablo Discobar
I am currently trying to discconect all players from a room when the initial masterclient (creator of the room) leaves the room/ has crashed or disconnect due other reasons. I tried using a rpc to disconnect players when the masterclient leaves but that sadly does not work for some reason. I have also looked into the onmasterclientswitch for this issue but can not get that working either sadly.
If anyone could help me out with this issue would be really appreciated.
Kind regards,
Pablo Discobar
↧
↧
OnPlayerPropertiesUpdate not automatically called on the client that is calling SetCustomProperties
Hi, I have the same problem as in this post https://forum.photonengine.com/discussion/12872/onplayerpropertiesupdate-not-called. I am using the latest SDK and PhotonLoadBalancing server. I need to call OnPlayerPropertiesUpdate on all players, in this case it is not called on the Local player(that is calling SetCustomProperties()) and create a problem. RoomOptions.BroadcastPropsChangeToAll = true does not help solve this problem.
↧
How to Create Friend list?
hi,
I am trying to create photon friend list. in my game photon friend is online/offline not showing. I am used photon2.
I am trying to create photon friend list. in my game photon friend is online/offline not showing. I am used photon2.
↧
Rummikub Game - How do I drop stones to slots? Other players don't see dropped stone.
Hi,
I'm making multiplayer rummikub game but I stucked on event sending. I did the player stations. When the players join to room, names showing properly at stations. But i can't handle the stone drop.
I'm dropping a stone but the other players don't see the dropped stone.
I'm thinking I need the send event the all players but I can't do that and unfortunately there is not example for this. Do you know what I need to do?
I'm making multiplayer rummikub game but I stucked on event sending. I did the player stations. When the players join to room, names showing properly at stations. But i can't handle the stone drop.
I'm dropping a stone but the other players don't see the dropped stone.
I'm thinking I need the send event the all players but I can't do that and unfortunately there is not example for this. Do you know what I need to do?
↧
↧
Any chance to get a working oculus avatar example ?
Hi,
Tried to have a working version of PUN2 and oculus avatar sdk, but not working at all.
I'v fallowed tutorial and many video to understand PUN2. But facing same problem of other user trying PUN2 and Oculus quest...
I use Unity 2109.2.15f1 with last oculus SDK (regulary updated)
in OnLocalAvatarPacketRecorded() from PhotonAvatarView
Oculus.Platform.Core.IsInitialized() is always false
ovrAvatar.Initialized is always false too
DEBUG:
PhotonNetwork.InRoom = true and PhotonNetwork.CurrentRoom.PlayerCount = 2 in trace
I can see my hand and base localavatar, same from remoteuser except I can't see moving (hand, body)
Any chance to get a working basic version of this ? I only want use PUN2 on VR with Oculus Quest...
this tutorial not working for sure: demos-and-tutorials/oculusavatarsdk
Thanks for help
Tried to have a working version of PUN2 and oculus avatar sdk, but not working at all.
I'v fallowed tutorial and many video to understand PUN2. But facing same problem of other user trying PUN2 and Oculus quest...
I use Unity 2109.2.15f1 with last oculus SDK (regulary updated)
in OnLocalAvatarPacketRecorded() from PhotonAvatarView
Oculus.Platform.Core.IsInitialized() is always false
ovrAvatar.Initialized is always false too
DEBUG:
PhotonNetwork.InRoom = true and PhotonNetwork.CurrentRoom.PlayerCount = 2 in trace
I can see my hand and base localavatar, same from remoteuser except I can't see moving (hand, body)
Any chance to get a working basic version of this ? I only want use PUN2 on VR with Oculus Quest...
this tutorial not working for sure: demos-and-tutorials/oculusavatarsdk
public void OnLocalAvatarPacketRecorded(object sender, OvrAvatar.PacketEventArgs args) { //if (!PhotonNetwork.InRoom || (PhotonNetwork.CurrentRoom.PlayerCount < 2)) // return; Debug.Log("-----------OnLocalAvatarPacketRecorded-------Oculus.Platform.Core.IsInitialized() = "+Oculus.Platform.Core.IsInitialized()); Debug.Log("-----------OnLocalAvatarPacketRecorded-------ovrAvatar.Initialized = "+ovrAvatar.Initialized); Debug.Log("-----------OnLocalAvatarPacketRecorded-------PhotonNetwork.InRoom = "+PhotonNetwork.InRoom); Debug.Log("-----------OnLocalAvatarPacketRecorded-------PhotonNetwork.CurrentRoom.PlayerCount = "+PhotonNetwork.CurrentRoom.PlayerCount); //if (!notReadyForSerialization) { Debug.Log("-----------OnLocalAvatarPacketRecorded = notReadyForSerialization--------------"); return; } using (MemoryStream outputStream = new MemoryStream()) { BinaryWriter writer = new BinaryWriter(outputStream); var size = Oculus.Avatar.CAPI.ovrAvatarPacket_GetSize(args.Packet.ovrNativePacket); byte[] data = new byte[size]; Oculus.Avatar.CAPI.ovrAvatarPacket_Write(args.Packet.ovrNativePacket, size, data); writer.Write(localSequence++); writer.Write(size); writer.Write(data); packetData.Add(outputStream.ToArray()); } }
Thanks for help
↧
Is there any tutorial teaching step by step how make a mmo(rpg) using PUN?
Is there any tutorial teaching step by step how make a mmo(rpg) using PUN?
↧
Player position not sync on for different playe
My level contains a platform and the players have the ability to jump and to move around. Everything works fine until a player jumps under the platform and starts jumping against the ceiling. On the screen of the player it looks just fine but on the screen of the others it looks like he is falling. I am very new to photon and have no idea how to fix this.
This is my code:
This is my code:
using System.Collections; using System.Collections.Generic; using UnityEngine; public class playerMovement : Photon.MonoBehaviour { public PhotonView photonView; public Rigidbody2D rb; private Vector3 selfPos; public float moveSpeed; public float jumpForce; public bool devTesting = false; private void FixedUpdate() { if (!devTesting) { if (photonView.isMine) checkInput(); else smoothNetMovement(); } else { checkInput(); } } private void checkInput() { if(Input.GetAxisRaw("Horizontal") > .5f || Input.GetAxisRaw("Horizontal") < -.5f) { rb.velocity = new Vector2(Input.GetAxisRaw("Horizontal") * moveSpeed, rb.velocity.y); } else if (Input.GetAxisRaw("Horizontal") < .5f || Input.GetAxisRaw("Horizontal") > -.5f) { rb.velocity = new Vector2(0f, rb.velocity.y); } if(Input.GetAxisRaw("Jump") > .5f) { rb.velocity = new Vector2(rb.velocity.x, Input.GetAxisRaw("Jump") * jumpForce); } } private void smoothNetMovement() { transform.position = Vector3.Lerp(transform.position, selfPos, Time.deltaTime * 8); } private void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.isWriting) { stream.SendNext(transform.position); } else { selfPos = (Vector3)stream.ReceiveNext(); } } }
↧
Trying to make a game where players try to push each other out of the ring (gif)
Right now I'm using Unity physics and getting some problems especially at high speed and what. I'm wondering what would be the best Photon tools to build this game? https://imgur.com/t8LdyrF
↧
↧
How to load multiple scenes with PUN 2
Hi there,
Since I can't find anything about this on forum or Google, this is probably a noob question. But I can't figure out how to load multiple scenes with PUN 2 enable.
So actually the equivalent of:
SceneManager.LoadSceneAsync(levelToLoad, LoadSceneMode.Single);
SceneManager.LoadSceneAsync(baseLevel, LoadSceneMode.Additive);
Anyone who can point me in the right direction?
Thanks!!
Since I can't find anything about this on forum or Google, this is probably a noob question. But I can't figure out how to load multiple scenes with PUN 2 enable.
So actually the equivalent of:
SceneManager.LoadSceneAsync(levelToLoad, LoadSceneMode.Single);
SceneManager.LoadSceneAsync(baseLevel, LoadSceneMode.Additive);
Anyone who can point me in the right direction?
Thanks!!
↧
Destroying scene objects - no InstantiationId error
Hello,
I have a scene with several PhotonViews in it, say items.
When a player picks up an item, I want to destroy it - but use a networked-destroy, so that other players joining after the item was picked up will not see it.
Here's my function for destroying the objects:
However, this only works for objects instantiated with PhotonNetwork.Instantiate. Items that are in the scene are not removed, and I'm getting an error:
Failed to 'network-remove' GameObject because it is missing a valid InstantiationId on view: View XX on XXXXXXX (scene). Not Destroying GameObject or PhotonViews!.
Testing the view's InstnatiationId gives me 0, which kind of makes sense I suppose - but if that's the case, how am I supposed to remove these scene items?
Thanks,
Ev
I have a scene with several PhotonViews in it, say items.
When a player picks up an item, I want to destroy it - but use a networked-destroy, so that other players joining after the item was picked up will not see it.
Here's my function for destroying the objects:
public static void DestroySceneObject( PhotonView photonView ) { if( PhotonNetwork.IsConnected ) { if( !photonView.IsMine ) { photonView.RequestOwnership(); } PhotonNetwork.Destroy( photonView ); } else { GameObject.Destroy( photonView.gameObject ); } }
However, this only works for objects instantiated with PhotonNetwork.Instantiate. Items that are in the scene are not removed, and I'm getting an error:
Failed to 'network-remove' GameObject because it is missing a valid InstantiationId on view: View XX on XXXXXXX (scene). Not Destroying GameObject or PhotonViews!.
Testing the view's InstnatiationId gives me 0, which kind of makes sense I suppose - but if that's the case, how am I supposed to remove these scene items?
Thanks,
Ev
↧
OnLeftRoom and CreateOrJoin
Hi guys
Is it safe to call CreateOrJoinRoom() right in the OnLeftRoom callback?
I get an error here and I think that this is too soon.
Is it safe to call CreateOrJoinRoom() right in the OnLeftRoom callback?
I get an error here and I think that this is too soon.
↧
Photon 2 Oculus Avatar Demo Issue
I need help in getting the https://doc.photonengine.com/en-us/pun/v2/demos-and-tutorials/oculusavatarsdk to run.
I am new to VR , frustrated getting the demo to run.
I followed the steps in the Demo,
1. Created PhotonAvatarView
2. Created the NetworkManager.
3. Moved the LocalAvatar and RemoteAvatar Prefabs to Assets/Resource Folder.
4. Add the PhotonView and PhotonAvatarView to the Avatars
5. Add PhotonAvatarView to the Observed Component of the PhotonAvatar.
6. Created an Empty GameObject in an empty scene, Renamed the GameObject to NetworkManager and added the NetworkManager Script to the Component.
I also added the AppId to Oculus Settings, Add UserID to the Local and Remote Avatars.
I put Debug.Log in all the functions in NetworkManager Script and change the Server Setting Log to full.
I do not think the NetworkManager script is being called or non of the methods in the script are called.
I will appreciate any help.
I am new to VR , frustrated getting the demo to run.
I followed the steps in the Demo,
1. Created PhotonAvatarView
2. Created the NetworkManager.
3. Moved the LocalAvatar and RemoteAvatar Prefabs to Assets/Resource Folder.
4. Add the PhotonView and PhotonAvatarView to the Avatars
5. Add PhotonAvatarView to the Observed Component of the PhotonAvatar.
6. Created an Empty GameObject in an empty scene, Renamed the GameObject to NetworkManager and added the NetworkManager Script to the Component.
I also added the AppId to Oculus Settings, Add UserID to the Local and Remote Avatars.
I put Debug.Log in all the functions in NetworkManager Script and change the Server Setting Log to full.
I do not think the NetworkManager script is being called or non of the methods in the script are called.
I will appreciate any help.
↧
↧
Any help?
I'm having problems with a script named bot, the error is Bot.cs(233,17): error CS7036: There is no argument given that corresponds to the required formal parameter 'weapon' of 'PlayerDamage.TotalDamage(float, string, string)'.
Note that player damage script has nothing to do with bot that needs weapon message, Bots when kill player doesnt say bot killed player but only player died.
The stuff bot has to do with player damage script is only damaging the player.
Script bot error line.
Player damage line.
How can i fix it?
Note that player damage script has nothing to do with bot that needs weapon message, Bots when kill player doesnt say bot killed player but only player died.
The stuff bot has to do with player damage script is only damaging the player.
Script bot error line.
playerDamage.TotalDamage(damage + maxDamage);
Player damage line.
public void TotalDamage(float damage, string weapon, string message){ if(disableDamage) return; fadeValue = 2; photonView.RPC("DoDamage", PhotonTargets.All, damage, weapon, message, PhotonNetwork.player); }
How can i fix it?
↧
intellisense for photon working partially??
I used to use pun 1 and I just downloaded PUN 2 on my unity.
Then i found intellisense is working for photon chat only. and unity default APIs.
when i type in 'pho' on scripting, I only see 'Photon' on the autocomplete but nothing else.
is there any way to make intellisense for PhotonNetwork work properly?
Then i found intellisense is working for photon chat only. and unity default APIs.
when i type in 'pho' on scripting, I only see 'Photon' on the autocomplete but nothing else.
is there any way to make intellisense for PhotonNetwork work properly?
↧
error
Operation LeaveRoom (254) not allowed on current server (MasterServer). how many times i tried to solve the same error gets repeated.
↧
Custom Properties, Unity, Object refence not set to an instance of an object
when I control player on masterClient İ get no erros but n the other player that line I marked gives nullreferenceexception
bool startTimer = false; double timerIncrementValue; double startTime; [SerializeField] double timer = 20; ExitGames.Client.Photon.Hashtable CustomeValue; void Start() { if (PhotonNetwork.IsMasterClient) { CustomeValue = new ExitGames.Client.Photon.Hashtable(); startTime = PhotonNetwork.time; startTimer = true; CustomeValue.Add("StartTime", startTime); PhotonNetwork.CurrentRoom.SetCustomProperties(CustomeValue); } else { startTime = double.Parse(PhotonNetwork.CurrentRoom.CustomProperties["StartTime"].ToString()); //ERROR LINE****** startTimer = true; } } void Update() { if (!startTimer) return; timerIncrementValue = PhotonNetwork.time - startTime; if (timerIncrementValue >= timer) { //Timer Completed //Do What Ever You What to Do Here } }
↧
↧
Cached events
Hello
I'm working with PUN2 and I'm currently implementing cached events.
I managed to make cached events works but there is still questions I can't answer.
Let's say I'm joining a room and I will receive the data from the cached event, is there a way to know when the cached data is finished to being recovered. Is there a distinction possible between the current data that I'm receiving and the data which is stored in the room knowing that both have the same event code ?
What I would like to do is : make someone joins a room, wait until he loads all the stored data on the cache of the room
( perform actions with data ), instantiate him ( he's free now ! ^^ ).
I don't know if I'm verty understandable at this point but my second question is about the size of the cache room and the global cache room, could we know what are their maximum size capacity ?
My last question would be about room cache & global room cache, is this Paint enough accurate to describe their both differences ? https://imgur.com/a/RexdYgZ
I'm working with PUN2 and I'm currently implementing cached events.
I managed to make cached events works but there is still questions I can't answer.
Let's say I'm joining a room and I will receive the data from the cached event, is there a way to know when the cached data is finished to being recovered. Is there a distinction possible between the current data that I'm receiving and the data which is stored in the room knowing that both have the same event code ?
What I would like to do is : make someone joins a room, wait until he loads all the stored data on the cache of the room
( perform actions with data ), instantiate him ( he's free now ! ^^ ).
I don't know if I'm verty understandable at this point but my second question is about the size of the cache room and the global cache room, could we know what are their maximum size capacity ?
My last question would be about room cache & global room cache, is this Paint enough accurate to describe their both differences ? https://imgur.com/a/RexdYgZ
↧
Unable to disconnect using the PhotonNetwork.Disconnect() function
As the title states, I'm never able to disconnect from the master server using the basic PhotonNetwork.Disconnect() function. The game thinks that my game is always connected to the servers even after calling PhotonNetwork.Disconnect() (PhotonNetwork.IsConnected is always true for some reason). Anybody have any idea what the problem could be? Here is the code that's running to connect and disconnect when the main menu loads each time:
private void Start()
{
if (PhotonNetwork.IsConnected == true)
{
Debug.Log("Starting Disconnect. . .");
StartCoroutine(Disconnect());
}
else
{
PhotonNetwork.ConnectUsingSettings();
Debug.Log("Connecting. . . ");
}
}
IEnumerator Disconnect()
{
PhotonNetwork.Disconnect();
while (PhotonNetwork.IsConnected)
{
yield return null;
Debug.Log("Disconnecting. . .");
}
Debug.Log("DISCONNECTED!");
}
( It will never hit the Debug.Log("DISCONNECTED!") line of code )
I want it to disconnect when returning to the main menu after a game over so that I can manually reconnect it. I get an error when trying to join a room after completing a match ("Client is on GameServer (must be Master Server for matchmaking) and ready. Wait for callback: OnJoinedLobby or OnConnectedToMaster") and as I work around I'm trying to completely disconnect and then reconnect to the master server so I can join a lobby and then join a room again without issues. Any help is greatly appreciated!
private void Start()
{
if (PhotonNetwork.IsConnected == true)
{
Debug.Log("Starting Disconnect. . .");
StartCoroutine(Disconnect());
}
else
{
PhotonNetwork.ConnectUsingSettings();
Debug.Log("Connecting. . . ");
}
}
IEnumerator Disconnect()
{
PhotonNetwork.Disconnect();
while (PhotonNetwork.IsConnected)
{
yield return null;
Debug.Log("Disconnecting. . .");
}
Debug.Log("DISCONNECTED!");
}
( It will never hit the Debug.Log("DISCONNECTED!") line of code )
I want it to disconnect when returning to the main menu after a game over so that I can manually reconnect it. I get an error when trying to join a room after completing a match ("Client is on GameServer (must be Master Server for matchmaking) and ready. Wait for callback: OnJoinedLobby or OnConnectedToMaster") and as I work around I'm trying to completely disconnect and then reconnect to the master server so I can join a lobby and then join a room again without issues. Any help is greatly appreciated!
↧
RPC as a Generic Method
Can RPCs be generic methods?
My specific use case is that I want to have a method that adds a component to a gameobject. The component would be passed to the method by the template parameter. However, I'm not sure how this interacts with RPCs, or if RPCs even support it.
A stripped down example of my code looks like this:
Any ideas on how I can do this? Thanks!
My specific use case is that I want to have a method that adds a component to a gameobject. The component would be passed to the method by the template parameter. However, I'm not sure how this interacts with RPCs, or if RPCs even support it.
A stripped down example of my code looks like this:
public void AddAffliction<T>() where T : Affliction { photonView.RPC("addAfflictionRPC", RpcTarget.All, ???); } [PunRPC] void addAfflictionRPC<T>() where T : Affliction { ... // Add the affliction Affliction prop = gameObject.AddComponent<T>(); ... }
Any ideas on how I can do this? Thanks!
↧