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

PhotonNetwork.Instantiate prefab missing properties

$
0
0
Not sure how best to describe this problem, but will try. Basically, my Photon Player prefab is getting instantiated with missing properties and components. If I use Unity Object.Instantiate, I get an instance of my prefab that matches, with all properties and child components as expected. perhaps some kind of weird caching issue? this works Instantiate(MyPrefab) This does not PhotonNetwork.Instantiate(myPrefab.name) I'm running the latest version of PUN 2 and Unity 2019.1.4

Instantiating hitpoint debris/blood/fx with photon ?

$
0
0
Hi, This is my original code to instantiate an effect wherever my raycast hits and it works, but only on my players screen as it isn't sent over the network with photon. I've looked into PhotonNetwork.Instantiate but I can't get it to work as it has to happen on the "hitpoint" in real time: Code (CSharp): Ray ray = new Ray(RootToShoot.transform.position, RootToShoot.transform.forward); Transform hitTransform; Vector3 hitPoint; hitTransform = FindClosestHitObject(ray, out hitPoint); if (hitTransform != null) { if (hitTransform.gameObject.tag == "rock") { GameObject impactGO = Instantiate(impactEffectrock, hitPoint, transform.rotation); Destroy(impactGO, 1f); } The raycast, however, is visible over the network as I used [PunRPC] on this shooting function. I wonder how to instantiate the hitpoint effects over the network based on the code above. Can anyone help me with this? It would be very much appreciated.

Back to the basic

$
0
0
Hi I'm experimenting with PUN for a multiplayer application, but i have a lot of strange behaviour, like moving the object of other and not mine also if I use IsMine, proble with instatiation that freeze the UI. So I decided thet is time to review the basic. First of all PUN and Realtime are the same regaring object instantiation, can I use the application ID of both without problems? Because is not clear to me the difference between PUN and Realtime. Sorry to bother with such stupid question, but as I said, back to the basics. Thanks Paolo

PUN dont try resend packages again after short lag.

$
0
0
In my game, before PhotonNetwork.Connect(); i execute this. PhotonNetwork.networkingPeer.DisconnectTimeout = 25000; PhotonNetwork.networkingPeer.QuickResendAttempts = 3; PhotonNetwork.networkingPeer.SentCountAllowance = 10; But, if my phone lost signal for one seconds, after 25 sec i ALWAYS see it. 06-03 12:49:30.195: E/Unity(743): Cannot send to: 178.162.196.159. Network is unreachable And i get DisconnectByClientTimeout. Why? In PUN documentation i see what photon try resend all lost package automatically, and will continue the game. Why one second disconnect always guaranteed get DisconnectByClientTimeout after 25 second?

Properties of players

$
0
0
I have a rather simple task which I seem to solve in a very complex way...basically I want to have an integer associated to everyone and this integer can not be taken by other players. Let's say: Player1 has number 0 Player 2 has number 1 Player 3 has number 2 Now if Player 4 joins, he should know which number everyone has and also do not take numbers 0,1 and 2. He should also make his number known to other players. No one can have the same number so someone should know which numbers are already taken. How would you solve this problem?

How do I transfer ownership of a gameObject?

$
0
0
I'm trying to better understand ownership over ID's but I'm not entirely sure how to transfer ownership to another client. The problem: I have a building system where blocks are placed, but I want ALL players to be able to destroy one another's blocks. My code doesn't do that- obviously. How can I transfer the ownership of the block over to the person trying to destroy it? Thanks.

"OnPlayerNumberingChanged" event never fired ...

$
0
0
Hi, I am trynig just to fire the OnPlayerNumberingChanged event using the very basic tutorial but the event is never fired ... Any ideas ?
using UnityEngine;
using Photon.Pun;
using Photon.Realtime;
using Photon.Pun.UtilityScripts;

public class TestConnect : MonoBehaviourPunCallbacks
{

    string gameVersion = "1";

    public override void OnEnable()
    {
        base.OnEnable();
        PlayerNumbering.OnPlayerNumberingChanged += OnPlayerNumberingChanged;
    }

    void Awake()
    {
        PhotonNetwork.AutomaticallySyncScene = true;
    }

    void Start()
    {
        Connect();
    }

    public override void OnConnectedToMaster()
    {
        Debug.Log("PUN Basics Tutorial/Launcher: OnConnectedToMaster() was called by PUN");
        PhotonNetwork.JoinRandomRoom();
    }

    public override void OnDisconnected(DisconnectCause cause)
    {
        Debug.LogWarningFormat("PUN Basics Tutorial/Launcher: OnDisconnected() was called by PUN with reason {0}", cause);
    }

    public override void OnJoinRandomFailed(short returnCode, string message)
    {
        Debug.Log("PUN Basics Tutorial/Launcher:OnJoinRandomFailed() was called by PUN. No random room available, so we create one.\nCalling: PhotonNetwork.CreateRoom");

        PhotonNetwork.CreateRoom(null, new RoomOptions());
    }

    public override void OnJoinedRoom()
    {
        Debug.Log("PUN Basics Tutorial/Launcher: OnJoinedRoom() called by PUN. Now this client is in a room.");
    }

    public override void OnDisable()
    {
        base.OnDisable();
        PlayerNumbering.OnPlayerNumberingChanged -= OnPlayerNumberingChanged;
    }

    private void OnPlayerNumberingChanged()
    {
        Debug.Log("ON Player Numbering changed");
    }

    public void Connect()
    {
        {
            PhotonNetwork.JoinRandomRoom();
        }
        else
        {
            PhotonNetwork.GameVersion = gameVersion;
            PhotonNetwork.ConnectUsingSettings();
        }
    }
}
Console Output:
  1. PUN Basics Tutorial/Launcher: OnConnectedToMaster() was called by PUN
  2. PUN Basics Tutorial/Launcher:OnJoinRandomFailed() was called by PUN. No random room available, so we create one.
  3. PUN Basics Tutorial/Launcher: OnJoinedRoom() called by PUN. Now this client is in a room.
And that's it :( Thanks in advance for your help

Cross Server Rooms

$
0
0
I had set my PUN server settings to fixed region 'usw', thinking that it'd help allow a social game I'm building the chance to group friends together. The idea is that when a user creates a new game, it'll generate and pick a 'roomID' that they can send to their friends to jump in and join. My experience has been that if you land on a different server, we will instead see "ERROR: Game does not exist". For a game without many players, or where you want to ensure "friends" can play with one another. What's the recommended approach?

Photon Error cant Access UnityEngine.UI etc.

$
0
0
Hi. I'm new to Photon Unity Networking. i cant use photon because of this error. PUNERROR its like 75 error. any solutions? im using Unity 2019.3.0a3 personal and im using PUN 3 Free

Place players at different positions (how other players perceive position of player)

$
0
0
Hi, I am running into serious trouble while developing my application. Here is my problem: Rough overview: - I have players that spawn in the world, they instantiate and are using Leap Motion and VR - I need the local player always be at 0,0,0 of the world coordinates. - Other players should be placed differently depending on their internal number(locally they stay at 0,0,0 but for other players they are placed differently!). So the idea I have is, I have the player avatar object, which has no photon transform view attached. On the local client I use that to move this avatar object wherever I need. The child objects have photon transform view attached. What I observe is that the objects get warped back to their initial position. So let's say the player is at 0,0,0 and the photon transform syncs a child for 1,0,0...after I move the player to 5,0,0(It stays that value and does not change since it doesn't have a photon transform view) the child is now synced for -4,0,0 (it counters the manual transformation I did by calculating 1 - 5!) What can I do here?

Get an array of connected players?

$
0
0
Hi Im making a hide and seek game and I need a mode where one player gets randomly choosen to be the seeker after x amount of time . I was wondering if the player ID is stored in some array and how to access.

Player leaving and joining room back again even after room closed

$
0
0
Hi, I have created a random room and after 2 players joining I close the room. What I want to do now is that when either player leaves the game and want to join back after some time they should be able to join back. Only those players should be able to join who were registered in the room before it got close. Is there any way I can achieve this thing? Any help would be appreciated.

How to improve the network perfs of my game ?

$
0
0
Hi, I have developed a Proof of Concept of a multiplayer online game. It is a 2 players game which mix VS fighting and shoot'em up games. Each player controls a space ship and the goal is to destroy the other player. You can download a video of this project here : https://we.tl/t-UDcYCooMOW It works, however I don't have good network perfs enough (there are too much lags). The game must be competitive and very fast and paced. The current version is acceptable for casual gamers but not for pro-gamers. I use Photon PUN with RPC and PhotonView, and I don't know how to improve the network perfs of the game (this is my first online multiplayer game). Below is how I handle the network functionalities: - Matchmaking is done with "CreateOrJoinRandomRoom". The first client created the room is the MasterClient. - On each Spaceship, there is a PhotonView component with 3 ObservedComponents: - a PhotonTransformView with only "Rotation" checked - a PhotonRigidBodyView with "Enable teleport for large distances" and "synchronize velocity" checked. - my custom SpaceShipPhotonView which has 2 purposes : at the init step, it sends some informations about its datas in order the other player know it and apply it on its side. Then, in "OnPhotonSerializeView" it sends the angle of the spaceship around its forward axis if stream.IsWriting, else it applies this angle to the spaceShip model. Note that this angle is applied to a model which is a child of the GameObject on which there is the PhotonView, that is why I can't use PhotonTransformView rotation for this. - Concerning the projectiles (shoots), I don't use PhotonView because their movements are predictables. I send a RPC message when a player starts shooting and a RPC when he stops shooting, then on the other side, I instantiate the projectile and compute the distance he has reached during the time travel of the network message. The projectiles are synchronized on both clients. When a projectile hurts an object (asteroid or player or other projectile), a RPC message is send (no matter if it is on master client or other client side) with informations about the target it hit. - The asteroids are spawned only by the MasterClient with PhotonNetwork.Instantiate. They have a PhotonView component with 2 observed components : PhotonRigidbodyView (with enable teleport and synchro velocity) and PhotonTransformView (with only rotation checked). Only the MasterClient use PhotonNetwork.Destroy on this when an asteroid explodes. But they can be about 20 or more asteroids at the same time. - Only the MasterClient compute health loss and send to the other client the health value when it has been modified, using RPC message. So here are my questions: - Are there too many network messages ? - For the asteroids, should I create only one component with a PhotonView and a custom observedComponent, keeping a list of all instanciated asteroids and sending rigidbody/transform infos for all of them in "OnPhotonSerializeView" method, instead of having a PhotonView on each asteroid ? - Should I use Bolt instead of PUN ? For the proof of concept, we didn't need an authoritative server, but for the final game, it will be better if we can use an authoritative server because the game is competitive, but we don't have a lot of time to spend for the development of this game. Is it possible using PUN and what is the best compromise between low cost, fast and easy development, and good results and minimum cheating/hacking from players ? Thanks in advance for your reading.

¿ master can change properties other player ?

$
0
0
I'm thinking that when the player dies he sends a rpc to the mestro player to modify his deaths and add victories to the murderer

Issue getting room list (called from javascript sdk)

$
0
0
I have my unity game running, and I have a player connected to a room called "Test". I have a simple function on my javascript client that asks for the room list.
public getRoomList() {
    return this.lbcc.availableRooms();
  }
It is returning nothing though. The AppId on the javascript side is 'AppVersion: '0.1.3_2.12',' The AppId on the PUN side is [SerializeField] private string VersionName = "0.1.3"; Do I have something setup wrong?

Networking, where do i begin? Virtual Reality

$
0
0
Hi, I'm new to networking and I would like to make a multiplayer VR scene for Oculus Go and Quest. But I cant find any documentation, where do i begin? best, V

Completely remove Pun voice 2 (without deleting important pun files)

$
0
0
Hi, for some reason I imported the pun voice 2 in my project but now I think it dosen't suit my needs. How can I remove it completely from my project so that I don't have to ask for user's mic permission since I am not using it ?

Matchmaking for two players entering at the same time

$
0
0
Hello, I'm following this workflow for random matchmaking, but we are testing on two devices, when the two players try to do matchmaking at exactly the same time none of the both players find a room and they each one create a room and they keep waiting there. Is there any way to detect that this situation happend and merge the two rooms? What I was trying to do is every x seconds disconnect from the created room, and try to join a random room again, but if this is called at the same time on both devices the problem still ocurrs since both are trying to find a empty room at the same time again, so what I'm doing now is doing this in random intervals so both devices dsynchronize and they can finally join the same room. It's working in this way but I feel its a dirty solution, have someone else have a better suggestion or another way of doing this?

Is it possible to make a Friday the 13th Game style matchmaking system?

$
0
0
In friday the 13th the game, theres a max amount of 8 players that can be in a lobby but the game can start with just 2 players. Instead of joining a match thats currently in progress you can only start or join an existing lobby, once all the players in the lobby hit ready and theres 2 or more players in it an actual match starts. Nobody can join in it, after it starts people can only disconnect from it. Once the match is won by either side or the killer / all the survivors disconnect, the match gets closed and youre put back into the main menu / post match screen which shows all the points you made in the game.

HELP Photon view items get deleted when the host leaves the room. HELP

$
0
0
Hey i have been having an issue with photon view items getting deleted when the host leaves the server, i have the items set to "take over" and they still get deleted. Ive been trying to fix this for the past 5 hours so any help would be appreciated! heres a few screenshots that might add some context https://gyazo.com/12c8bbbbb659fb52838f6671ff8987d0 https://gyazo.com/71dc6cd01b29c4c80af68bdce80aea14 also, i have updated to the latest version of photon and it is still occurring.
Viewing all 8947 articles
Browse latest View live


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