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

PUN 1.75 don't export to Windows Phone 8.1

$
0
0
Hello.
PUN+ 1.75 don't export to Windows Phone 8.1 or universal 8.1.
Previous PUN+ 1.74 was working fine.
I did followed the instructions on the Unity Export to Windows 8.1 and Windows 10 Universal thread.
I have Unity 5.4.0f3 x64

Is there a way to fix it?

It gives the following error:

UnityException: Failed to run serialization weaver with command "Temp\StagingArea\Data\Managed\Photon3Unity3D.dll" -pdb -verbose -unity-engine="Temp\StagingArea\Data\Managed\UnityEngine.dll" "Temp\StagingArea\TempSerializationWeaver" -additionalAssemblyPath="C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\WindowsPhoneApp\v8.1" -additionalAssemblyPath="Temp\StagingArea\Data\Managed".
Symbols will be read from Temp\StagingArea\Data\Managed\UnityEngine.pdb
Symbols will be read from Temp\StagingArea\Data\Managed\Photon3Unity3D.pdb
Weaving assembly D:\WorkD\UnityProjects\PATWO\PATWO\Temp\StagingArea\Data\Managed\Photon3Unity3D.dll
System.InvalidOperationException: Operaci n no v lida dado el estado actual del objeto.
en Mono.Cecil.ModuleDefinition.ProcessDebugHeader()
en Mono.Cecil.ModuleReader.ReadSymbols(ModuleDefinition module, ReaderParameters parameters)
en Mono.Cecil.ModuleReader.CreateModuleFrom(Image image, ReaderParameters parameters)
en Mono.Cecil.ModuleDefinition.ReadModule(String fileName, ReaderParameters parameters)
en usw.Weaver.WeaveAssembly(String assemblyPath, AssemblyDefinition unityEngineAssemblyDefinition, ReaderParameters readerParameters)
en usw.Weaver.Weave()
en usw.Program.RunProgram(ConversionOptions options)
en usw.Program.Main(String[] args)

PostProcessWinRT.RunSerializationWeaver () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:438)
PostProcessWinRT.Process () (at C:/buildslave/unity/build/PlatformDependent/WinRT/SharedSources/CSharp/PostProcessWinRT.cs:123)
UnityEditor.Metro.BuildPostprocessor.PostProcess (BuildPostProcessArgs args) (at C:/buildslave/unity/build/PlatformDependent/MetroPlayer/Extensions/Managed/ExtensionModule.cs:130)
UnityEditor.PostprocessBuildPlayer.Postprocess (BuildTarget target, System.String installPath, System.String companyName, System.String productName, Int32 width, Int32 height, System.String downloadWebplayerUrl, System.String manualDownloadWebplayerUrl, BuildOptions options, UnityEditor.RuntimeClassRegistry usedClassRegistry, UnityEditor.BuildReporting.BuildReport report) (at C:/buildslave/unity/build/Editor/Mono/BuildPipeline/PostprocessBuildPlayer.cs:176)
UnityEditor.HostView:OnGUI()



Thanks.


Ownership of objects already in scene?

$
0
0
Hi.

I'm having trouble with photonViews and ownership. In my game right now there's a menu, and when you click on the "host game" button you switch scene and create a new room. However, the scene you load already has two paddles (think ping pong or any other game where there are two paddles), and the two paddles have a Photon View already attached to each of them.

I don't want to instantiate each paddle separately because I want there to be a paddle, so what I want to do is just give the "host" or creator of the room 1 of the 2 paddles, and then the second player the other paddle. Right now my problem is that whenever you create the room you are given ownership of both paddles.

How can I only give ownership of ONE paddle to a player?

Can PunRpc be passed from parent gameobject to child

$
0
0
Hello,

I have a gameObject that has PhotonView attached, then I have other child objects connected to that parent.

Those child objects need to communicate over the network using RPC. But it seems with photon, only the parent object that has the PhotonView attached can communicate, and not any of the children.

Is there a way I can forward the RPC from the parent to the child objects, without writing individual functions in the parent to call the child functions manually?

I know in uLink networking I can specify that RPC can be called to/from any child object, but seems that cant work in photon.

Thanks

Detected issue with Unity 5.4 - Changing scene - OnLevelWasLoaded() method

$
0
0
In Unity 5.4, OnLevelWasLoaded() method has been deprecated. Photon Engine knows this and has commented the method OnLevelWasLoaded() located at PhotonHandler.cs. However this causes that the method NewSceneLoaded() in NetworkingPeer.cs is never called and the network mesage-queue is not enabled again as it's stated in the documentation of LoadLevel():

While loading levels, it makes sense to not dispatch messages received by other players. This method takes care of that by setting PhotonNetwork.isMessageQueueRunning = false and enabling the queue when the level was loaded.

I suppose this will be solved in the future but as now, the solution is emulate the OnLevelWasLoaded method:
		void OnLevelWasLoadedFixed(Scene scene, LoadSceneMode loadSceneMode){
PhotonNetwork.networkingPeer.NewSceneLoaded();
PhotonNetwork.networkingPeer.SetLevelInPropsIfSynced(SceneManagerHelper.ActiveSceneName);
}
And call it using:

SceneManager.sceneLoaded += OnLevelWasLoadedFixed;

Hope it helps!

Unity display player list in room with unity's new UI

$
0
0
Hello photon engeeners, photon developers and game developers who uses photon:)

I'm making a awaiting lobby inside room. Inside room lobby designed that to see connected players to existing room max 10 minimum 2 players. also Inside room lobby has count down number. when count down number will equal to "0" all players will spawn in Game Scene. Inside lobby is not global lobby which gives us photon. Inside lobby has designed with unity's new UI "AwaitingPanel" and it is possible when the room has created. there are 10 UI.text which will be PhotonNetwork.player.name when players join to existing room. So, Player1 creates room if there is no room and his name will be UI.text1 = Player1.
here I'm having problem, When Player2 and other Player3, 4,etc joins to the room which has been created by Player1. I can't figure out how can I make a list of connected players like UI.text2 = Player2, UI.text3 = Player3 etc.

I have tried with different methods but all my effort has no success. I'll post my codes here that u can understand.
I also got sample codes from here: http://forum.unity3d.com/threads/problem-with-playerlist-using-new-ui-pun.329627/#post-2136290
last 2 comments by alarm656 are mine.

my codes:
public class LoobyHook : Photon.MonoBehaviour {


[SerializeField] GameObject MainPanel;
[SerializeField] GameObject WaitingPanel;
[SerializeField] InputField PlayerName;
[SerializeField] GameObject playerInfo;
[SerializeField] Transform Hover;

public GameObject P1;
public GameObject P2;
public GameObject P3;


public static Transform[] pl;
public Vector3[] lp;

public static int playerID;
public int pCount;

public string roomName = "testRoom";

private static PhotonView ScenePhotonView;

void Awake ()
{
if (PhotonNetwork.connectionState == ConnectionState.Connected)
{

}

if (PhotonNetwork.connectionState == ConnectionState.Disconnected)
{
MultiplayerConnector.Instance.Connect ();
}
}

public void StartMatch ()
{
if (PhotonNetwork.connected == true)
{

PhotonNetwork.JoinRandomRoom ();

MainPanel.SetActive (false);
WaitingPanel.SetActive (true);
}
}


public void OnPhotonRandomJoinFailed ()
{
PhotonNetwork.CreateRoom (null);
CreateRoom();

}

public void CreateRoom ()
{
RoomOptions roomOptions = new RoomOptions() {IsVisible = true, maxPlayers = 10};
PhotonNetwork.JoinOrCreateRoom (roomName + System.Guid.NewGuid().ToString("N"), roomOptions, TypedLobby.Default);
Debug.Log ("room created" + roomName);

}

private bool m_blocalPlayerJoined = false;

private int joinedPlayer = 0;

void OnJoinedRoom ()
{
if (!m_blocalPlayerJoined)
{
UpdatePlayerList ();
m_blocalPlayerJoined = true;
joinedPlayer = joinedPlayer + 1;
}

playerID = PhotonNetwork.player.ID;

Debug.Log ("playerID: " + playerID);

}

private void UpdatePlayerList ()
{
foreach (PhotonPlayer player in PhotonNetwork.playerList)
{

GameObject temp = (GameObject)Instantiate (playerInfo, lp [0], Quaternion.identity);
temp.transform.SetParent (Hover.transform, false);
temp.GetComponentInChildren<Text> ().text = "" + player.name;


}
}



void Update ()
{
PhotonNetwork.player.name = PlayerName.text;


}



/*void OnGUI()
{
GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());

foreach (RoomInfo game in PhotonNetwork.GetRoomList()) {
if (GUILayout.Button (game.name + " " + game.playerCount + "/" + game.maxPlayers)) {
PhotonNetwork.JoinRoom (game.name);
MainPanel.SetActive (false);
WaitingPanel.SetActive (true);
//SpawnPlayerName ();

}

}

foreach (PhotonPlayer pl in PhotonNetwork.playerList)
{
GUILayout.Box (pl.name);

}
}*/

}
looks like if I use old GUI everything works fine but I would prefer to use new UI system.

some of my methods that I used was:
if(PhotonNetwork.playerList.Lenth == 1)
{
GameObject temp = (GameObject)Instantiate (playerInfo, lp [0], Quaternion.identity);
temp.transform.SetParent (Hover.transform, false);
temp.GetComponentInChildren<Text> ().text = "" + player.name;
}

if(PhotonNetwork.playerList.Lenth == 2)
{
GameObject temp = (GameObject)Instantiate (playerInfo, lp [1], Quaternion.identity);
temp.transform.SetParent (Hover.transform, false);
temp.GetComponentInChildren<Text> ().text = "" + player.name;
}
All players when they joins gets single position.

I hope everybody has understood what I wanted to explain.
Thank you very much for taking time to read my post.
I hope you'll give me an solution, thanks

Problem with keeping the position of a game object synced between clients.

$
0
0
So, only one of the clients (the one who connects first) can actually move the game object so that it moves on everyone's screens. If I move the gameobject from the secondary client, it moves on that clients screen but not on the hosts whereas if I move it on the host's screen, it moves for both clients. As if the game object movement is only networked when the client that was first to connect moves it.

Here is a gif example of what I mean, the first client to connect on the left and the second on the right. Here you can see what I described above.

Here is the inspector for the game object being moved.

Here is a paste bin of the script used to move the game object around.

and here is a paste of the NetworkManager script that puts the users into the same room.

I hope this is all of the information that is needed. I know for a fact I am doing something wrong, I just can't figure it out. my goal is to get it where whoever moves the unit, every client, no matter their join order, sees that unit. It doesn't have to be fast or account for low latency as the timespan of the game can't last ages and it isn't fast paced whatsoever.

Thanks.

PhotonNetwork.PrefabPool for instantiating local objects?

$
0
0
Hi,

Is there any good reason that PrefabPool only used for instantiation of remote objects and not for local objects? This is inconsistent for API like PhotonNetwork.Instantiate(), in that it always instantiate objects locally while remote objects are pooled and reused as it should. I could change PUN source code to do so, but I'd like to avoid maintenance of local changes.

Thanks in advance.

Synchronize object one last time before pause?

$
0
0
Hello,

I'm finding that updating a synchronized property on a PhotonView during OnApplicationPaused is not getting sent over the wire to other clients - I suspect this is because object updates happen during Update() and there are no more calls to Update() once the application is paused. Is there a clean way to tell Photon to synchronize all objects one more time during OnApplicationPaused? Or should I use RPCs for this purpose instead? Thanks!

Object Synchronization just after joining a room

$
0
0
Hi:
When a new player joins a room, There seems to be a little time difference before object synchronization like game characters from server to this player. So it's difficult to visit these objects during the time difference. Another problem is we don't know how long the time difference is, and there's still no such event as "Wait Until All Object Synchronization" to catch the point.
Is there any way to work it out, thanks.

IPv6 for Unity iOS Exports

$
0
0
Apple now requires iOS apps to support pure IPv6 connections.
We tested PUN v1.75 and it supports IPv6, including the "Best Region" setting.

If you use the Photon Cloud, you only have to make sure your PUN version is up to date.
If you run a Photon Server, you might have to update.

Test All Builds

Unity's support for IPv6 begins with 5.3.4p4. They posted about adding IPv6 support.

Several versions of Unity do not successfully support IPv6, so you should test each build.

If you get a client-side error like this, your client needs an update;
Connect() to 'x.x.x.x' failed: System.Net.Sockets.SocketException: Network is unreachable in a IPv6 network.

Test Procedure

Read "Test for IPv6 DNS64/NAT64 Compatibility Regularly" to learn how to test IPv6 support easily.

We do this for PUN before release.
Make sure there is not some other plugin failing!

Handling Rejections

We know that some apps got rejected, despite using PUN v1.75.

If your app gets rejected, please get in touch with the Apple review team. Point out that you're using PUN and that we and you both tested the netcode versus their own test procedures.

Explicitly point to their own test-description page. If our tests fail and theirs doesn't, we have to figure out what we have to test! At the moment, it's unclear.

Cloud and Server

The Photon Cloud itself will not be directly available via IPv6 in the short term. Apple's requirement is that clients can cope with IPv6 addresses, if there is a "IP translation", as described in their article.

For anyone using Photon Server (OnPremise), this means, you can likely continue to run it as IPv4 service.
If you want to setup a true IPv6 server, we have some docs for that.



Get Photon Unity Networking in the Asset Store.

How long of a string can a roomproperty be?

$
0
0
i need to a roomproperty to contain a huge string with positions of different game objects, this room property is not visible in the lobby, only for the room.
Any limits? At what point will it affect the games performance?

The connection to the master server does not work.

$
0
0
Please help me.
The connection to the master server does not work.
"PhotonNetwork.ConnectUsingSettings(“v1.0“);" in the place of, "PhotonNetwork.connected: False " comes out error that.
In fact, even when you use the "MasterServer.ClearHostList()", I get an error that "Failed to connect to master server at 67.225.180.24:23466".
Was examined various, information is in trouble not found.
Will not you help.

securing the connection

$
0
0
Hi all,

So I'm using PUN and setting up connections and rooms using the standard code:

PhotonNetwork.ConnectUsingSettings("1.0");

PhotonNetwork.JoinRandomRoom

etc

My question is, if someone obtains our Photon AppID, can they use it in their own app and consume our allocated CCU? Is there something simple I can do to prevent this from happening? How do I ensure that the traffic is actually coming from our app?

Thanks in advance

GameObject Instantiated before Scene Completes Loading when Joining Room

$
0
0
I am just getting started using PUN and OnSite server with Unity. Overall it's going well. I'm able to create a lobby and use it for clients to join a room. I've set it up so that a UMA character instantiates as soon as you enter the room. The UMA's are networked so any proxies also spawn. The problem I've encountered is that the second player to enter a room receives an error that the UMA libraries aren't available. The issue is that the first UMA character to spawn is the networked (proxy) character. When this happens it appears that the scene hasn't fully loaded (the new room is in a new scene) and the GameObject with the UMA libraries (context, overlay, slot...) haven't loaded. The second UMA character to load, the local player, loads just fine. On the first client, that created the room, both UMA's are showing because the scene has already been loaded.

My first thought was to use a coroutine to delay the spawn of the UMA until the needed library GameObjects could be found. The coroutines get initiated on two separate GameObjects but only the second one completes. The first one seems to get overwritten by the first. Didn't think that was supposed to happen, especially on separate scripts on two different game objects, but it did. I've tried the OnJoinedRoom callback but that was called even before the spawn.

I have a couple of question perhaps someone can help me with. I've used UMA with a couple of different networking systems but, frankly, I'm at a loss here.

1. It isn't clear how the spawn of the proxy character is happening in code. Can someone point me to where I should look for this?

2. Does anyone know of another callback that might be better than OnJoinedRoom? I looked at the Pun Callback list but didn't see anything.

Any help would be greatly appreciated!

RPC queue

$
0
0
There are 8 users.

1. users Rpc.call("test",allusers); time 00:00:00:01
2. users Rpc.call("test",allusers); time 00:00:00:02
6. users Rpc.call("test",allusers); time 00:00:00:03
3. users Rpc.call("test",allusers); time 00:00:00:04
5. users Rpc.call("test",allusers); time 00:00:00:05

I wonder Is this kind of problem arises



8. users result "rpc" queue (transmitted to the user)
1-) is it OK absolutely
1.2.6.3.5 ?

Or
2-) Mybe RPC s Can be lost
1.2.5 ?

Or
3- ) Is it well may be mixed
6.1.3.5.2


Which would

I hope you can explain
Thanks


Tizen suport

$
0
0
Hello,
Any plan to add suport for Tizen platform?
Thanks

ReconnectAndRejoin: AuthValues == null is not correct?

$
0
0
I am attempting to use PhotonNetwork.ReconnectAndRejoin() to get back in a room after a mobile user gets disconnected by the OS when the app goes to the background.

It doesn't seem to work and throws an error: "ReconnectAndRejoin() with AuthValues == null is not correct!"

I don't understand why AuthValues are required for reconnect but not the normal connect?

I attempted to set some AuthValues or just use a blank AuthValues but I get errors when creating a room about not having an AppId (I'm using on-premise hosted version) or the Auth type not being supported.

I've also tried using the normal Connect function after disconnected by iOS but it doesn't work and I don't receive either of the OnFailedToConnectToPhoton, OnConnectedToLobby, OnConnectedToMaster callbacks...

Using Photon Unity Networking 1.73

Regions Ping Always 0

$
0
0
I'm connecting to the NameServer to get a list of all severs and list it to the player with each current ping, but the ping value that i get is always 0.

public override void Show(bool p_show)
{
foreach (Region __region in PhotonNetwork.networkingPeer.AvailableRegions)
{
RegionBar __regionBar = Instantiate(regionBarPrefab);

__regionBar.regionLabel.text = __region.Code.ToString();
__regionBar.pingLabel.text = "Ping: " + __region.Ping; //Always 0
__regionBar.region = __region;

__regionBar.transform.SetParent(regionBarGrid.transform);

_regionBars.Add(__regionBar);
}

base.Show(p_show);

_displaying = true;
}

void Update()
{
if (!_displaying)
return;

foreach (RegionBar __regionBar in _regionBars)
{
__regionBar.pingLabel.text = "Ping: " + __regionBar.region.Ping; //Always 0
}
}
What am i doing wrong, do i have to manually send a ping command ? If so, how do i do this ?

Writing to the stream for Non-Host

$
0
0
Basically I have a vehicle that is controlled by the person who well, gets in the driver seat. The host will get into the driver seat and its that local clients job to track the physics (Rigidbody is only enabled for that client) and so it is their responsibility to properly update the vehicle along all screens. The problem of course now being that when the non-host gets in the seat, they can't send the vehicles info to the stream, they can only receive it. (This I BELIEVE (not sure) is due to the fact that the vehicle starts in the scene). So I am wondering if there is any way to make so the non-host player can write to the stream rather than just the host.

This is the script I am currently using to track the vehicle:

using System.Collections;

using UnityEngine;
using System.Collections;

public class TrackMyObject : Photon.MonoBehaviour {

Vector3 realPosition = Vector3.zero;
Quaternion realRotation = Quaternion.identity;

public float updateRatePos = 0.1f;
public float updateRateRot = 0.1f;

public bool syncPos;
public bool syncRot;

// Use this for initialization
void Start () {
realPosition = gameObject.transform.position;
}

// Update is called once per frame
void Update () {

if (photonView.isMine) {
// If this is my player - im sending info no need to receive
} else {
// If its not mine and im receiving the info
if (syncPos == true) {
transform.position = Vector3.Lerp (transform.position, realPosition, updateRatePos);
}
if (syncRot == true) {
transform.rotation = Quaternion.Lerp (transform.rotation, realRotation, updateRateRot);
}
}
}

public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {

// If we are the one sending the data
// In the case send the other players our info / position
if (stream.isWriting) {
if (syncPos == true) {
stream.SendNext (transform.position);
}
if (syncRot == true) {
stream.SendNext (transform.rotation);
}
} else { // If we are the one receiving not sending data
// In this case receive the other players info / position
if (syncPos == true) {
realPosition = (Vector3)stream.ReceiveNext ();
}
if (syncRot == true) {
realRotation = (Quaternion)stream.ReceiveNext ();
}
}
}

}


I would like to question if this is even the best way to be tracking objects in the first place or if there's something better I could be doing. (Lerping the info so it looks smooth). Any and all feedback would be greatly appreciated.

(I put the update speed for the lerp to a variable because certain things don't need to be updated often, but for most things I have it set to 0.05f)

Low Latency Packet Loss

$
0
0
I'm currently trying to port an existing network system to use Photon networking. The system is written on top of a custom built reliable UDP system. Essentially it boils down to two primary methods:

SendReliableOrdered(byte targetPeer, ArraySegment packet)
SendUnreliableUnordered(byte targetPeer, ArraySegment packet)

I've tried to implement this same contract on top of Photon using "PhotonNetwork.RaiseEvent". Here's the relevant code extract: https://gist.github.com/martindevans/a770f090d1e4b1e50e5d918ce83a38a7

This seems to basically work except I'm getting a *lot* of packet loss as I ramp the send rate up. At roughly 50 packets/second I'm getting approximately 5-10% packet loss sending from localhost to localhost (presumably bouncing off the photon cloud servers though).

Any suggestions?
Viewing all 8947 articles
Browse latest View live


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