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

Unable to call Photon.PunBehaviour

$
0
0
So I'm trying to make the FPSController that comes in the Standard Assets package work with PUN... However, I'm having a slight issue with this. It simply won't recognize anything Photon. It throws this error when I try to call it:
Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/FirstPersonController.cs(11,53): error CS0234: The type or namespace name `PunBehaviour' does not exist in the namespace `Photon'. Are you missing an assembly reference?


I wondered if it had anything to do with the namespace they gave the script. I removed it and that didn't change anything at all.

Here's a picture of the script, along with the project setup on the left just in case something's wrong there:





backend database

$
0
0
I am using Photon Cloud to develop a RPG game with huge open world. How is the backend database going to work? Does Photon Cloud have database built in? if not, what database will you recommend me to use? what if i use Facebook auth? will database situation be different? what if i use PlayFab?

Get data from master client.

$
0
0
Hello, What way I can get data from host? I need get spawn position.

I see it like this:
Request to Master Client and get callback from he with Vector2.
But better way without RPC. Can I do it with RaiseEvents?

Photon with Kinect V2 to send point cloud to remote user

$
0
0
I am creating an program where multiple participants will be interacting with each other using Kinect V2 point cloud. I am able to extract the point cloud from Kinect V2 and display it in the Unity. But now I am stuck at how to get started on send those Kinect Point Cloud to the remote user using Photon Networking. Do anyone have tutorials or directions for it?

Thanks

OnPhotonPlayerDisconnected not called after Disconnect() ?

$
0
0
Hi guys,

I just spent a lot of time trying to figure out why my OnPhotonPlayerDisconnected was not called after the PhotonNetwork.LeaveRoom() on one client, and after 6 depressions and 12 reconsiderations of my career, I discovered that this callback is not called when the disconnected client executes a PhotonNetwork.Disconnect() after the PhotonNetwork.LeaveRoom().
Is this behavior intended ?

Unity - Synchronization problem

$
0
0
Hi. I develop online soccer shooting game with with using Photon Network. Two players, will be goalkeepers respectively and will shoot each other.
For example:
Player A: Shooter
Player B: Goalkeeper

Players will change after player A shot the ball. So it will be like this:
Player A: Goalkeeper
Player B: Shooter

The goalkeeper and the shooter objects are already on stage and attached PhotonView component(I do not instantiate later these objects). At first; Player who created the room is shooter and other player is goalkepper. The problem starts here.
Local players can move their own objects(goalkeeper and shooter object) but there is a problem on global.The first player(Shooter) is can do it moving the Shooter object on local but other player sees the shooter object still(stationary). But second player(goalkeeper) when move the goalkeeper, The first player can see it. So, the first player's movements are not synchronized. There is no problem in the second player.
When I look at the photonview component of the Shooter object from the editor, I saw "Owner" value is "scene" in the local and global(Same object ama in the other player game). I think this is the problem. Because when I look at the photonview component of the goalkeeper object, I saw the owner is other player photon player name..

Sometimes this is the exact opposite(no problem in the first player but the second player has problem).

Could you help me? Thanks
Note: I am using Unity3D Game engine
(Sorry for my bad english)

PhotonNetwork Instantiate for selected players

$
0
0
I would like PhotonNetwork to instantiate prefabs for only selected players in the game. Is it possible to make the photonnetwork instantiate call pass through the network to only specific players connected in the room?

OnJoinedLobby() isn't called after first login for the session

$
0
0
"Called on entering a lobby on the Master Server."

"OnJoinedLobby() or OnConnectedToMaster() are called when PUN is ready"

The callback works after failing to join a room or every other time it's supposed to. Everything else seems to work if I wait a few seconds to enter lobby. However, the point is -- OnJoinedLobby is never called on init!

Am I missing something? :pensive: autojoinlobby is true

Room Creation: Not all properties are forwarded to web server

$
0
0
Hello Photonians!

Expanding our back-end system, we were looking at registering / logging the changes of room properties in a DB. We can successfully get the event on our back-end system that a room is created. However, inspecting the data of the incoming event, I notice that not all properties that define the room are present. More specifically, only the properties that are marked for listing inside the lobby are forwarded in the event. So any other property defined at room creation time, is not available for our server first hand.

I have included two images showcasing the issue:
- During room creation:
image
- After doing an update to the room:
image

I can come up with 2 workarounds, but neither is ideal.
- Immediately after the room is created, do a "fake" update of all room properties again, in essence triggering a property update event on the back-end so that we can get all properties at the beginning.
- List all room creation properties as lobby properties...

Is there a flag I'm still missing at room creation, or is this intended behaviour?

As a side-note, I also noticed that updating the max-players number for a room does not trigger any update on the back-end as well.

Thank you in advance!

Kind regards

Event called twice! WHY?

$
0
0
Hello, I have a Problem with Events. They are calling twice!
(This code in Room script)
In Awake I do event callback :
PhotonNetwork.OnEventCall += OnEvent;

In Start I send event to Master Client
RaiseEventOptions rs = new RaiseEventOptions();
rs.Receivers = ReceiverGroup.MasterClient;
PhotonNetwork.RaiseEvent(0, 0, true, rs);
In OnEvent I got this by 0 eventCode
if (!PhotonNetwork.isMasterClient)
     return;
//Something code
First time events work right,
but I leave room and disconnect Photon(using this code).
PhotonNetwork.Disconnect();
and then again connect to Server(without restart game) and create room and THIS EVENT CALLING TWICE!! (//Something code run twice!). How to fix?

Photon stuck state after connection failure

$
0
0
My method for testing connection issues handling is unplug and plug back the usb wifi.
I just want to handle failures.

Sometimes this works fine, photon shows some errors, but I can connect back.
Other times, and its very often, it gets stuck as:
connection state detailed: connectedToNameServer
connection state: connected
connecting: true
connected: false
connectedAndReady: false

Is that a valid state? Its not tryng to connect anymore, as it never progresses from there.
Im not sure what I should do to handle this. Im not even sure how to detect this.
I will need a timer and assume Im stuch and force disconnect to try to connect..?

Can I send struct in event? Or other way?

$
0
0
I wanna send structure using Event, but I don't know how to add new type in CustomTypes. And are there other ways without structure send Vector2 and Integer in one event?(For economy traffic) or you think better send it in two different events?

animator trigger not synchronizing

$
0
0
So I have an attack trigger and it is not synchronizing properly with the animator view,
i made sure the "set trigger" script is before the animator view and i should work but it doesn't...
i tried to search the forum for solution but couldn't find one.

thanks is advance for the help

NEED HELP WITH WEAPON SWITCH SYNC

$
0
0
hi, i am still new to photon networking, and i am having trouble with weapon switch. i want the weapon switch to update to the other clients.

here's my code for weapon switch. i dont know where to start XD

public int selectWeapon = 0;

void Start()
{

SelectWeapon();

}



void Update()
{
SelectWeapon();
if (Input.GetAxis("Mouse ScrollWheel") > 0f)
{
if (selectWeapon >= transform.childCount - 1)

selectWeapon = 0;

else

selectWeapon++;
}

if (Input.GetAxis("Mouse ScrollWheel") < 0f)
{
if (selectWeapon <= 0)

selectWeapon = transform.childCount - 1;

else

selectWeapon--;
}

if (Input.GetKeyDown(KeyCode.Alpha1))
{
selectWeapon = 0;

}

if (Input.GetKeyDown(KeyCode.Alpha2))
{
selectWeapon = 1;

}
if (Input.GetKeyDown(KeyCode.Alpha3))
{
selectWeapon = 2;

}


}



public void SelectWeapon()
{
int i = 0;
foreach (Transform weapon in transform)
{
if (i == selectWeapon)
weapon.gameObject.SetActive(true);
else

weapon.gameObject.SetActive(false);

i++;
}

}

NEED HELP WITH MY SCRIPT CAMERA SHAKE

$
0
0
i use unity's FPS controller.i manage to make camera shake on the other players.

the idea is. i shoot, my camera shakes. and when enemy is hit, his camera shakes as well. like feeling the impact.

so i manage to do this. i use allbuffered. but the problem is, everyone who are not hit are affected as well. i was confused. i manage to do this with damage health script without any problem. (only the target is affected).
but with the camera shake. it affects everyone. did i miss something or is it something with photonnetwork target?

i use raycast. and store all my hit components. and able to read parent or child.

i will show you the script. it may be dirty. was really want to manage how to fix this issue. i have the clean version one before i try to do camera shake on enemies cam.



my goal for this is, i only want the enemie's cam to shake(who is hit by my raycast) would be the only one affect. not everyone else or yourself.



https://forum.unity3d.com/threads/need-help-with-camera-shake-photon-unity.477194/

Is there a way to figure out the Best cloud server?

$
0
0
Is there some kind of way or a function that returns a CloudRegionCode with the best server? I need it to compare with PhotonNetwork.CloudRegion. I've looked through the documentation and I can't seem to find something useful.

NullReferenceException on MasterClient transfer

$
0
0
Having some trouble figuring out what's happening here, perhaps someone can shed some light.

A GameObject is instantiated using InstantiateSceneObject(),
Player 2 joins,
Player 1, MasterClient, disconnects and ownership is transferred to Player 2,
this.photonView now returns null and I'm getting a NullReferenceException

While debugging I've found:
* The photonView component definitely exists on the GameObject in the Unity Editor on Player 2's machine
* The inspector shows Player 2 is the owner of that photonView
* Everything works great BEFORE the masterclient transfers ownership

RPCs are sent and received on the GameObject in question and I believe the client and all of the views are in the same group.

Any ideas?


How to get data(value) from room?

$
0
0
Hello. I created room with custom properties. How can I get by Key value of custom properties later during the game?
I know about PhotonNetwork.room.CustomProperties but I don't understand how I should it use...

XML File on game

$
0
0
Hi guys,
I try to manage the ip of the file "PhotonServersSettings" with an external file

Serialize Class on Photon

$
0
0
Hi I've a problem, for my "Combat System" I have an abstract class Character and 2 class Hero and NPC that inherit Character. Inside Character I have the methods Damage and TakeDamage that calculate the damage and apply the damage, but for calculate this value I need the tarhet class to apply te defensive value.
This methods are called by a script Photon.Monobehaviour.
So I need serialize the abstract class, but I don't know how to do, I looked for on serveral forums and I'm still in difficulty
Viewing all 8947 articles
Browse latest View live


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