Quantcast
Channel: Photon Unity Networking (PUN) — Photon Engine
Viewing all 8947 articles
Browse latest View live

Sync. How it works? Sync child

$
0
0
Hello. How can I sync GameObject(tank) and his Turret. I need to sync Tank only 2D x,y. Turret ONLY Z Rotation! How is it possible? I never used sync in Photon, But I saw someone written for very fast rigidbody objects need another type of sync and slowly object another, Is it Right? Because I need also Sync Bullets.

PUN v1.80 | web-player

$
0
0
Hi, seems that latest version of PUN v1.80 does not support web-player anymore (updated from v1.73 | unity 5.3.7f1).
Game works fine in editor and standalone build, but in web-player is not connecting.
Unity web-player is not supported anymore, or it could be a bug?

Spawn players in unique places Please helpppp

$
0
0
Ok i give up...thats why im posting this. I just cant figure out why my variables arent updating.

Currently this is how i am spawning the player:

spawnPoints = GameObject.FindGameObjectsWithTag("pSpawnP");
bool spawned = false;
while(!spawned){
int randS = Random.Range(0, spawnPoints.Length);
if(spawnPoints[randS].transform.childCount == 0){
GameObject insPlr = PhotonNetwork.Instantiate(playerPrefabE[selectedModel].name, spawnPoints[randS].transform.position, spawnPoints[randS].transform.rotation, 0);
insPlr.transform.SetParent(spawnPoints[randS].transform);
spawned = true;
}else{
spawned = false;
}
}

In my scene i have spawn points with photon views. When i spawn my player i check if a spawn point has a child and if it doesnt i spawn it and set that spawn point as the parent to my player. However when other players join they cant see that i am a child of the spawn point. The spawn point isnt synchronizing its children.

I also tried making a script for the spawn points and setting a bool to false. When i spawn the player i check if its false and then spawn the player and set it to true. I set this variable using a PUNRPC call, but when other players join the game they cant see the updated variable. I tried using an int and setting it to 0 when not occupied and 1 when occupied but when players enter they cant see it update. I also tried putting the variable in PhotonOnserializeView and i tried different observe options and still when players enter the match they cant see the updated variable, just the default.

Am i missing something? How do i sync a variable for players that havent joined the match yet, or how can i sync a spawnpoint and the child object to new players entering the match.

thank you,
chris

High ping.

$
0
0
Hi.
I'm connecting to PUN from PK on a 10mb connection with 46ms ping on speedtest.
Doing a ConnectToBestCloudServer connects me to EU where I get about 170ms with PhotonNetwork.GetPing() and 157ms with ping command on windows.
Is this normal? Since PhotonNetwork.GetPing() gives a RTT, should I divide it by 2 to show it to the users?
Thanks.

GetRoomList() does not show any room when it called immediately after joining a lobby

$
0
0
Hello,

I want the room list to be shown when a player join a lobby, thus I use GetRoomList() in OnJoinedLobby(), like this:
public override void OnJoinedLobby()
{
foreach (RoomInfo room in PhotonNetwork.GetRoomList())
{
Debug.Log("room name:" + room.Name + " " + room.PlayerCount);
}
}
It does not show anything.

However, if I call GetRoomList() in Awake(), the console will log the rooms existing in the lobby. And it also work when I make a button and make its Onclick to GetRoomList().

But I don't want GetRoomList() to be called in every frame, nor do I want to ask the player to press a button to show room list. Anybody know why it does not work in OnJoinedLobby()?

Why is your server down??

$
0
0
Europe Server doesn't connect! I tested from my project and from your example projects

Failed to get server instance

$
0
0
Hi,

I have same problem but with self hosted server.
createGame failed, client stays on masterserver: OperationResponse 227: ReturnCode: 32762 (Failed to get server instance.). Parameters: {}.
UnityEngine.Debug:LogError(Object)
PhotonHandler:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:125)
NetworkingPeer:DebugReturn(DebugLevel, String) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:700)
NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:831)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:79)

How do i fix this?

Custom Room Properties Not Updating?

$
0
0
Hello!

I'm having an issue similar to this one: http://forum.exitgames.com/viewtopic.php?f=17&t=4947 I don't see that they got a resolution though. Basically, my issue is that I'm setting up custom room properties for match making, game state, etc. I can get the initial properties to get set just fine when creating the room, however, if I try to update the properties after the room has been created, it only updates the properties for the client(s) already in the room. Anyone who tries to join still sees the original properties until they join the room. My understanding is that using SetCustomProperties should update the properties of the room to the whole lobby and not just the room's client(s). Am I doing something wrong?

Below is the code I'm using to try and update the room's custom properties. One example of when this is used is after the room is already created and the game starts. I want to update "C3" to be 1 (In game) from 0 (In Lobby). When I do this, all the clients in the room see that "C3" updated to 1, but clients outside the room still see that "C3" is at 0, which is the default value. Same thing happens with C0 through C2.
RoomOptions newRoomOptions = new RoomOptions();
		newRoomOptions.isOpen = true;
		newRoomOptions.isVisible = true;
		newRoomOptions.maxPlayers = 4;
		
		newRoomOptions.customRoomProperties = new ExitGames.Client.Photon.Hashtable();
		newRoomOptions.customRoomProperties.Add ("C0", NetworkSettings.gameType); // Game Type; 0 = Team Tackle, 1 = Death Match, 2 = Survival, 3 = Random
		newRoomOptions.customRoomProperties.Add ("C1", (newRoomOptions.maxPlayers - playerCount)); // Number of open player slots available
		newRoomOptions.customRoomProperties.Add ("C2", NetworkSettings.HighestRating()); // Highest rating of player in game (for matchmaking purposes)
		newRoomOptions.customRoomProperties.Add ("C3", 1); // Flag for if the game is currently in lobby; 0 = In Lobby, 1 = In Game, 2 = Private
		
		newRoomOptions.customRoomPropertiesForLobby = new string[] {"C0","C1","C2","C3"}; // this makes "C0, C1, C2, C3" available in the lobby

		PhotonNetwork.room.SetCustomProperties(newRoomOptions.customRoomProperties);

If you need any other information, please let me know and I'll be happy to provide it!

Auto select Teams ?

$
0
0
I dont have any idea how can i make auto select teams ? example A team 10 players B team 5 players I want to auto equal teams if any player join room auto select team B

Using Photon View To Sync "WheelCollider" how?

$
0
0
I'm Making a multiplayer game using photon

everything is working fine except that other players don't see the Wheel Colliders "suspension distance" updating

Ive added a photon view component to the Wheel Colliders, and observe but doesn't work



How to send a RPC for this client but on server

$
0
0
Hello, i have some trouble with my script and i hope you can help me.
I have an item/inventory system but the problem is, if 2 people pick the item in the same time with some ping, the 2 player can take the item, so i do my stuff like that thinking it's gonna resolve my problem :

[PunRPC]
void Pickup ()
{
int id = rayObject.gameObject.GetComponent ().itemID;
if (id != null && rayObject.gameObject.layer == 8)
{
if (rayObject.GetComponent ().instantiationId == 0)
{
Destroy (rayObject.gameObject);
}
else if (rayObject.GetComponent ().isMine)
{
PhotonNetwork.Destroy (rayObject.gameObject);
}
inventory.AddItem (id);
}
else
{
Debug.Log ("Item picked up in same time (but don't work)");
}
}
So the rayObject it's a raycast who return the ID and the Layer of the gameObject (Layer for know if its an item, and ID for know who item to add in inventory)
That's my RPC call

photonView.RPC ("Pickup", PhotonTargets.AllViaServer);

the problem is all the player launch the function Pickup if one launch it, how i can do for not 2 people can take an inventory if he have some ping ?
Im really stuck, thanks in advance for any help !

JoinRandomRoom fails but OnPhotonRandomJoinFailed will not be called back!!!

$
0
0
I use JoinRandomRoom and when OnPhotonRandomJoinFailed is called back, i know any room not exists then i use CreateRoom. because PUN has not any api like JoinRandomRoomOrCreate().
My problem is that in rarely times, JoinRandomRoom throws error GameDoesNotExist and OnPhotonRandomJoinFailed will not be called back.

PhotonNetwork.Instantiate

$
0
0
Hi,

If player connect after others dont see ,But if it connects to the same time yes is good

I have co-constructions in my games, and others do not see what and built, if players join room

PhotonNetwork.Instantiate??? but never work

need help


i need this work please

PhotonNetwork.Instantiate("Campfire", Vector3.zero, Quaternion.identity, 0);


Instantiating Objects in Wrong Scene

$
0
0
This is a recent and weird issue, but here's the layout of the game and where the problem lies.

Player 1
Scene 1: Players log in
Scene 2: Players choose character
Scene 3: Objects instantiate here into the game.

Player 2
Scene 1: Player logs in
Scene 2: Player chooses character, but the other players character is shown instantiated and animating in this scene?
Scene 3: In the same map where the other player is, there appears to be no one.

How can I make sure instantiated objects STAY in the map they instantiate for everyone?

Now to sync starting game?

$
0
0
Hello. In my game there is "Waiting room" before starting the game. Then host can press button Start and everyone will load new level and play(room will be closed and not visible). But I found a problem... If host press button "Start" everyone load scene BUT game events doesn't happens on clients, only on host! (Like a Spawning players etc). But If I load scene from everyone in waiting room, game will work perfect! Load for everyone it if OnJoinedRoom and PlayerConnected call function which will start the game. (Host, and all clients will Start game, not only host). How can I fix it from button? How can I do a RPC in waiting room without PUN View?

Kick player?

$
0
0
Okay. I found how to start game, but how to kick player from waiting room, without PUN View?

Abnormal CPU usage on SendOutgoingCommands with Unity Android/iOS

$
0
0
Hi! I have recently updated to Unity 5.5 and I'm experiencing the same problem, contrariwise no issues with Unity 5.3 and 5.4. I'm using SDK 4.1.1.7 and I observed the problem both with Android and iOS: abnormal cpu usage (98.8%) when calling "SendOutgoingCommands". The documentation suggests to call the method regularly (2..20 times a second), I tried to gradually decrease the rate and I observed that the problem occurs when calling the method approximately more than 4-5 times a second (and below this threshold the APIs does not work as expected for my game). I tried also to call the method from a Coroutine but it doesn't solved. I attached a screen from my profile.
Thank you for the support!


Pun 1.80 New Problem

$
0
0
I used pun 1.74 same codes same project its well but now i updated 1.80 my game doesnt work i create room and someone player join my room.other player invisible

Photon Animator View Value Change

$
0
0
Hello,

I have a problem with my component Photon Animator View.
I set all my Synchronize parametrers to Continuous for a test. But when i run my game and I check on my character localCharacter the value of each variable in the inspector. Some of them change to become Disabled and other Discrete.
But if on my loval Character I check the other player For him no variable change.

I have no script interacting with PhotonAnimator View.
I set this component as last because they is some Triggers.
And I put This component in my PhotonView Component.

This problem is only when i connect another player , if I'm playing only with my local player there is no change.

Regards

Thibault Coutaz

Synchronize IK

$
0
0
Hi everyone! I am wondering how to sync IK over the network. When I instantiate my gun, an IK script takes the gameobjects of that gun to position the hands. It works on the local client, but I don't know how to make other clients see the IK. Does someone know how to achieve this?

Thank you in advance!
Viewing all 8947 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>