Now Im trying to take Market data from MasterClient on its mysql database.
my problem is the process of obtaining data has a function that only the 'master client' can execute. (because only master client can excute database by local ip..i tried to use masterclient as database server)
So I changed the data to 'object[]' format and handed it over using the 'OnPhotonSerializeView' function.
but it continue to fail by "NullRefrenceException"
I don't know how to deal with it..
thanks.
↧
is it possible to get datas from Mysql Database on MasterClient?
↧
Is stream.SendNext() send 'real data'? or working other way
when masterclient send int a =5; by using
steam.sendata(5); it goes well.
but when i send a data that made by method that only masterClient can use(because only masterclinet can get data from mysql using querry). it send 'null' value at all. in this case, data type is object[] filled by object[] (i wanted to use object[,] but i couldn't)
so i want to know that how steam.SendNext() and stream.ReceiveNext() work.
Thanks
↧
↧
PhotonPlayer.SetCustomProperties, are only changes send?
When calling SetCustomProperties.SetCustomProperties and changing only one out of multiple values, are only the changes send to the other clients, or is always the complete hashtable send?
And waht about Room.SetCustomProperties, would it be the same, like for Player.SetCustomProperties?
Thank you. :)
↧
Animator view and triggers
Hi,
I have unity 2018.3 with the latest pun 1.92. I'm unable to get triggers working with the animator view.
I've read everything I can, so to confirm:
-Animator view is the last script in the prefab stack, and the last in the photon view option list - I've deleted and recreated it several times to ensure its definitely last in the stack and photon view.
-I use continuous.
-(One thing I noticed was the culling script adds itself automatically to the photon view list, even if its there already.. I tested by removing the culling script completely but the animations still do not work with the culling script active or deleted so its not this that is stopping animations - thought I'd mention that though..)
I never see the trigger change from false to true in the inspector view, and running with two players, the second player never sees the animations.
Is there a demo on this so i can check everything matches or some other trick to getting this working?
Is there a way to get it working via the OnPhotonSerializeView script ? i.e. the stream.sendnext and receive.next ? - I tried but could not work it out.
and no I really don't want to go through 100+ animation states and change them all to bools, almost all assets and creators are using triggers these days - the coding headache would be insane - surely you photon guys have a solution.
I see you struggling for a few years now with this issue and I do appreciate the single frame thing, but is there nothing that can be done ? :)
Kind Regards
Carme
↧
How should I save custom properties into local player (subject) and get it from object player?
Hello!
Sorry for my English! :)
How can I save parameters (Hashtable or object[]) into subject (PhotonView) and get them in a room?
Tried:
ExitGames.Client.Photon.Hashtable hashtable = new ExitGames.Client.Photon.Hashtable();
hashtable.Add("playerUid", Uid);
PhotonNetwork.SetPlayerCustomProperties(hashtable);
See only in local PhotonView in CustomProperties. In player object in room - CustomProperties is empty!
Tried:
_activeCharacter = PhotonNetwork.Instantiate(
Path.Combine("PhotonPrefabs", modelName),
position,
Quaternion.identity
);
_activeCharacter.GetPhotonView().ViewID = Uid;
Set only for subject (local player). In player object in room - other number!
Tried:
_activeCharacter = PhotonNetwork.Instantiate(
Path.Combine("PhotonPrefabs", modelName),
position,
Quaternion.identity
);
_activeCharacter.GetPhotonView().Owner.TagObject = _activeCharacter;
PhotonNetwork.LocalPlayer.TagObject = _activeCharacter;
No in player object in a room!
How to distinguish object players (there is no information inside them)?
Where can get all connected game object prefab list (not Photon.Player class, but real GameObjects)?
Thanks! :)
↧
↧
How do not destroy objects when the owner exit
Hello everyone, I am working on a multiplayer game. And I ran into a small problem, my game is a sandbox, something similar to minecraft, and I create objects using
PhotonNetwork.Instantiate
, and as I later noticed, I do it wrong, because when a player comes out, all the objects created by him destroyed, maybe i must use the PhotonNetwork.InstantiateSceneObject
? But it creates objects only if player is a MasterClient, but I need all players to create objects without exception, maybe i need make some kind of request should be made to the MasterClient? If so, how ???? But in short, my question is: How not to destroy objects when their owner leaves ?
Thank you in advance !!! :)
P.S : Sorry for my English :/
↧
A lot of "Scene name (not loaded)" idle labels in the Hierarchy panel after the PUN update

↧
Third Person Camera Sync (how do I do this?)
I try to make a third person game online,
I got stuck on the camera because the camera script I am using is the vThirdpersonCamera
this script linkss the rotation of the player and its controll with in the third person script as well.
I need these two to spawn together but with i spawn 2 players the they use only one camera, the one that is not thiers individually...its like person one has person 2 camera, and so on, the camera doesn't move.
↧
Syn Third Person Camera vtHIRDpERSON camera
I try to make a third person game online,
I got stuck on the camera because the camera script I am using is the vThirdpersonCamera
this script linkss the rotation of the player and its controll with in the third person script as well.
I need these two to spawn together but with i spawn 2 players the they use only one camera, the one that is not thiers individually...its like person one has person 2 camera, and so on, the camera doesn't move.
↧
↧
Lobbies
I have a matchmaking solution based on "Example Use Case: Teams Matchmaking" in https://doc.photonengine.com/en-us/pun/current/lobby-and-matchmaking/matchmaking-and-lobby. Basically, players in a "social" room stand on a "teleport pad" and when the pad countdown hits zero, if there are two or more players on the pad, they get sent to a new room where they can play a mini-game together (one leading player does JoinOrCreateRoom, the other players call FindFriends with the leader's UserID until the room is created). This is OK for mini-games since players are doing other "social" things in the current room until some of them decide to play a game together.
I now need a solution that will support bigger games like 5v5 battleground rooms. This means I need things like:
- Match players across ALL social rooms who are waiting to play a 5v5 match, to reduce wait times. The teleport pad to join the game could be in different Unity scenes or in different instances of a scene in multiple Photon Rooms, etc.
- Provide a good way for players to wait for a new game to start. I may change the teleport pad to something that allows the player to join/leave a queue while waiting, so they can do something else while they wait.
Is this done by using a Lobby? Would players have to actually GO to some "lobby scene" to wait where they literally just wait until the game is ready? I'd rather have a solution like World Of Warcraft to join a battleground (you just continue doing things until you get the "Join Battleground" popup - rather than some Xbox Live Halo Deathmatch screen where you watch player names get added until there are enough to play.
Thanks for any advice!
↧
unity photon send and receive data from both players
So I have this problem where when the owner of the server press "G" the bool "move right = true" for both players, but when the guest press "G" only for him "move_right = true"
THIS IS THE SCRIPT:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Photon.Realtime;
public class tower_human : MonoBehaviour {
public bool human;
public bool Player1;
public bool move_right = false;
PhotonView photonView;
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
{
if (stream.isWriting)
{
stream.SendNext (move_right);
Debug.Log ("SEND");
}
else if (stream.isReading)
{
move_right = (bool)stream.ReceiveNext ();
Debug.Log ("RECIVE");
}
}
void Start()
{
photonView = GetComponent ();
}
private void SetFiring(bool state)
{
if (state == move_right)
return;
move_right = state;
}
void Update ()
{
if (Player1) {
if (photonView.isMine && Input.GetKeyDown (KeyCode.G)) {
move_right = true;
}
if (photonView.isMine && Input.GetKeyDown (KeyCode.H))
{
move_right = false;
}
}
if (!Player1)
{
if (photonView.isMine == false && Input.GetKeyDown (KeyCode.G))
{
move_right = true;
}
if (photonView.isMine == false && Input.GetKeyDown (KeyCode.H))
{
move_right = false;
}
}
if (move_right) {
transform.Translate (1 * Time.deltaTime, 0, 0);
}
}
}
↧
Sending spaw points with RPC
Hey,
In my game I have several spawn points and they are categorized by their locations by storing them some GameObject[] arrays. I want to call spawn functions on master client so they are just spawn once and random factor will be same for all. But the problem I am storing spawn points (they are gameobjects in the map) on arrays and I have 2 array for each location and I know I can't send gameobjects with RPC. Normally spawn funciton has GameObject[] parameter so I can spawn object on spawn points.
I don't want to add photonview on each spawn points ( there are lot of spawn points) and finding them by their photonid and sending that id as a paramater. This is very unefficient. Any ideas what to do?
↧
How to detect collision ?
Hi,
I am new to photon, And I've spent the last two weeks trying to make a very simple 2d shooter (like diep.io), Now I'm in the shooting phase :smile: , I've made the shooting mechanics using RPCs but I don't know how to detect collision, scince there's a bit of lag that make the OnTriggerEnter2D useless, How can I detect the triggers ? Should I only detect them on the master? and if that's the only solution is there someway to choose the master manually (to make sure the master has a good internet speed and ping etc...)
Thanks in advance,
↧
↧
RPC problem with PhotonViews
When I send an RPC, simply, the only object that receives it is the SAME PHOTONVIEW that SENT IT but in every instance. Here's the code, just for debugging.
void Update(){
...
if (Input.GetKeyDown(KeyCode.F) && timerPush >= cdPush)
{
timerPush = 0;
Debug.Log("PULSANDO F");
Push();
}
}
void Push()
{
this.photonView.RPC("PushBack", RpcTarget.Others);
}
[PunRPC]
void PushBack(PhotonMessageInfo info)
{
Debug.LogWarning("RPC RECEIVED BY " + this.photonView.ViewID + " THAT CORRESPONDS TO " +
this.photonView.Owner.NickName + " that was sent by " + info.photonView.Owner.NickName + " with ID "+
info.photonView.ViewID);
if (this.photonView.IsMine && info.photonView.ViewID != this.photonView.ViewID)
{
gameObject.transform.position = new Vector3(0, 0, -1.2f);
}
}
I also get this error that I dont know what it means.
NullReferenceException: Object reference not set to an instance of an object
Photon.Pun.PhotonNetwork.ExecuteRpc (ExitGames.Client.Photon.Hashtable rpcData, Photon.Realtime.Player sender) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:506)
Photon.Pun.PhotonNetwork.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonUnityNetworking/Code/PhotonNetworkPart.cs:1997)
Photon.Realtime.LoadBalancingClient.OnEvent (ExitGames.Client.Photon.EventData photonEvent) (at Assets/Photon/PhotonRealtime/Code/LoadBalancingClient.cs:2782)
ExitGames.Client.Photon.PeerBase.DeserializeMessageAndCallback (ExitGames.Client.Photon.StreamBuffer stream) (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PeerBase.cs:640)
ExitGames.Client.Photon.EnetPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/EnetPeer.cs:544)
ExitGames.Client.Photon.PhotonPeer.DispatchIncomingCommands () (at C:/Dev/photon-sdk-dotnet/PhotonDotnet/PhotonPeer.cs:1535)
Photon.Pun.PhotonHandler.FixedUpdate () (at Assets/Photon/PhotonUnityNetworking/Code/PhotonHandler.cs:116)
I guess it "cant see" the others photonView... I just don't know. I'm stuck at this point for 2 whole days doing debug but I can't find anything.
↧
RPC Weird result
Hey everyone,
In my game I have drawers, doors and some bags to open and I handle it with RPC. But there is some problem door and bags are okay but when it comes the drawer the result is weird. It half opens or doesn't open, it closes immediatly and this happens with jittering. Here is my code when RPC work on bags and doesn't work on drawers.
This is for bag and it works.
void Update()
{
if (open && !isOpen)
{
pView.RPC("OpenLootBag", RpcTarget.All);
}
}
[PunRPC]
void OpenLootBag()
{
mesh.SetBlendShapeWeight(0, Mathf.Lerp(mesh.GetBlendShapeWeight(0), 0, Time.deltaTime * openSpeed));
if (mesh.GetBlendShapeWeight(0) < .1f)
isOpen = true;
}
This is for drawer and result is weird.
private void Update()
{
if (useDrawer)
pView.RPC("OpenDrawer", RpcTarget.All);
}
[PunRPC]
void OpenDrawer()
{
if (isOpen)
{
transform.localPosition = Vector3.SmoothDamp(transform.localPosition, closePos, ref velocity, drawerSpeed); //Close the drawer.
if (Vector3.Distance(transform.localPosition, closePos) < .0001f)
{
useDrawer = false; //If drawer has closed, set useDrawer to false.
isOpen = false;
}
}
else
{
transform.localPosition = Vector3.SmoothDamp(transform.localPosition, openPos, ref velocity, drawerSpeed); //Open the drawer.
if (Vector3.Distance(transform.localPosition, openPos) < .0001f)
{
useDrawer = false; //If drawer has closed, set useDrawer to false.
isOpen = true;
}
}
}
Where is the problem?
↧
Create IP Address in Photon.LoadBalancing.dll.config automatically?
Hi,
is it possible to receive the IP of the Server running a selfhosted pun service automatically? Currently we have to enter the public IP Address in the
Photon.LoadBalancing.dll.config
, like PublicIPAddress
and/or MasterIPAddress
manually before starting the Service.
But when installing PUN on an other Server, we must change the IP in the config file, as the Server changes. Is there a way to place something like %IPADDRESS%
or the like as placeholder there?
↧
Cannot send op: 254! Not connected.
This error happent on the first time i join the room ,, it something like i kicked out from the room ,,,
Cannot send op: 254! Not connected. PeerState: Disconnected
UnityEngine.Debug:LogError(Object)
↧
↧
How to test game on one pc
Hi there,
how can i test my networked game on one pc? When I build a version and run a second instance in the editor i can't connect to the same room? Both instances create a new room.
Any advice?
Greets
↧
How to configure PUN load balance correctly?
Our clusters contain two masters and two game servers, they deployed on 4 servers.
The configurations are as follows:
Master server configuration:
<LoadBalancing
MaxMessageSize="512000"
MaxQueuedDataPerPeer="512000"
PerPeerMaxReliableDataInTransit="51200"
PerPeerTransmitRateLimitKBSec="256"
PerPeerTransmitRatePeriodMilliseconds="200"
MinimumTimeout="5000"
MaximumTimeout="30000"
DisplayName="LoadBalancing (MyCloud)">
.....
<TCPListener
IPAddress="0.0.0.0"
Port="4530"
OverrideApplication="Master"
PolicyFile="Policy\assets\socket-policy.xml"
InactivityTimeout="10000"
>
</TCPListener>
<TCPListener
IPAddress="game_server_ip_1"
Port="4531"
OverrideApplication="Game"
PolicyFile="Policy\assets\socket-policy.xml"
InactivityTimeout="10000">
</TCPListener>
<TCPListener
IPAddress="game_server_ip_2"
Port="4531"
OverrideApplication="Game"
PolicyFile="Policy\assets\socket-policy.xml"
InactivityTimeout="10000">
</TCPListener>
...
</LoadBalancing>
Game server configurations:
<LoadBalancing
MaxMessageSize="512000"
MaxQueuedDataPerPeer="512000"
PerPeerMaxReliableDataInTransit="51200"
PerPeerTransmitRateLimitKBSec="256"
PerPeerTransmitRatePeriodMilliseconds="200"
MinimumTimeout="5000"
MaximumTimeout="30000"
DisplayName="LoadBalancing (MyCloud)">
.....
<TCPListener
IPAddress="0.0.0.0"
Port="4531"
OverrideApplication="Game"
PolicyFile="Policy\assets\socket-policy.xml"
InactivityTimeout="10000">
</TCPListener>
</LoadBalancing>
The master server cannot start successfully.Game server is OK.What's wrong?
↧
can i block specific player
my game use JoinRandomGame func
then user want to block specific player who swear word him
but i don't know how to block to connect specific player who they block
can i know how to block specific player in joinrandomgame with photonnetwork.playername
↧