Search Unity

  1. Unity 2018.3 is now released.
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Want more efficiency in your development work? Sign up to receive weekly tech and creative know-how from Unity experts.
    Dismiss Notice
  4. Build games and experiences that can load instantly and without install. Explore the Project Tiny Preview today!
    Dismiss Notice
  5. Want to provide direct feedback to the Unity team? Join the Unity Advisory Panel.
    Dismiss Notice
  6. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice

Photon Unity Networking

Discussion in 'Connected Games' started by tobiass, Aug 23, 2011.

  1. Kurtav

    Kurtav

    Joined:
    May 24, 2015
    Posts:
    79
    One customer in UpWork wrote me the following sentence -
    "The reason I am using Gamesparks is that there is no cost to use it up to 100k monthly users. For PUN there is only 20 CCU which I will easily go over just in beta testing."
    0_o
    I do not understand why such different prices? What is the key difference? Explain, please
     
  2. JohnTube

    JohnTube

    Joined:
    Sep 29, 2014
    Posts:
    38
    Hi @Kurtav,

    We have answered your question on our forum here.
     
    Kurtav likes this.
  3. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    956
    Yikes! That's quite a difference. PUN does seem to be excellent value by comparison.
     
  4. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    I haven't even heard of game spark until now. Thanks for that explanation though regardless. Incase I would of been tricked later on if I came across that company. The cost of photon is pretty dang cheap that's why I use it. My last game made $96,000 with 500 players. Only 50 of them were paying players that year. If your game can't cover pun cost then your business model for your game needs to be relooked at.

    Also I really love Photon API.
    Ever looked at UNET code? its like way more complicated.
     
  5. renman3000

    renman3000

    Joined:
    Nov 7, 2011
    Posts:
    6,419
  6. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    956
    Each one of the 50 paying customers shelled out $1920 dollars to play the game, that's some pretty impressive ROI by any standards.
     
    JohnTube likes this.
  7. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    Hey Munchy. Yup. Most are to afraid to charge for your games.

    Anyways why is PhotonTransformView still uneditable during play mode? This is so frustrating!
    I'm needing to assign things dynamically :(
    I was told this was gonna get changed a year ago.

    I literately can not think of any reason why someone would want to add PhotonView, PhotonTransformView, PhotonAnimatorView manually on every network object in their game.
    I"m gonna have thousands of objects eventually.
     
  8. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,068
    @Shadowing: I fear that we lost track of the feature to be able to edit PhotonTransformView during runtime. Sorry.

    You should consider the PhotonTransformView just as one possible solution to your problem though. It's a IPunObservable class and if you make your own (copy and rename), you can modify it any way you like. In our experience, it makes sense to have your own way to sync and smooth movement in quite a lot of cases.

    @renman3000: Yes, that solution is valid and has no sideeffects. It will be in the next updates.
     
  9. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    Doesn't this always get called.
    Right now I have a new version of PhotonTransformView named MyPhotonTransformView
    and this is never being called on that script.
    PhotonView component is observing it as well.

    Code (csharp):
    1.  
    2.     public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
    3.  
    4.              Debug.Log("Test")
    5.  
    6.     }
    7.  
    I have RPC calls all working correctly. As in finding other players by photon ID and making a player aim or jump etc..

    I don't know why i can't get stream working with loading scripts during run time.
     
    Last edited: Aug 9, 2018
  10. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    956
    Have you considered using RaiseEvent instead. Doesn't rely on PhotonViews or any of the other ready rolled networking stuff, so scripts can be easily added/removed/enabled/disabled at runtime as needed and you have complete control over how, when and to which clients you send data.
     
  11. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    Never heard of it Munchy

    So now im using this script.
    Shouldn't my Debug.Log("test")
    be spamming the heck out of my console during run time?

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. public class PhotonNetworkMover : Photon.MonoBehaviour {
    5.     Vector3 position;
    6.     Quaternion rotation;
    7.     float smoothing = 1f;
    8.     // Use this for initialization
    9.     void Start () {
    10.         if (photonView.isMine) {      
    11.         }else{
    12.             StartCoroutine("UpdateData");
    13.         }
    14.    
    15.     }
    16.     IEnumerator UpdateData()
    17.     {
    18.         while (true)
    19.         {
    20.             transform.position = Vector3.Lerp(transform.position, position, Time.deltaTime * smoothing);
    21.             transform.rotation = Quaternion.Lerp(transform.rotation, rotation, Time.deltaTime * smoothing);
    22.             yield return null;
    23.         }
    24.     }
    25.     void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info){
    26.         Debug.Log("test");
    27.         if(stream.isWriting){
    28.             stream.SendNext(transform.position);
    29.             stream.SendNext(transform.rotation);
    30.         }else{
    31.             position = (Vector3)stream.ReceiveNext();
    32.             rotation = (Quaternion)stream.ReceiveNext();
    33.         }
    34.     }
    35.    
    36. }
    37.  
     
  12. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    Well it turns out if I add photon view and photonTransformView to my prefab before run time everything works fine.
    Thats with me not using Photon.Instantiate and just using regular Instantiate on all clients.

    So I at least ruled out it not having to do with me assigning my own ID's etc..
    Also placing debug inside streaming spams my console log now.


    So the problem I have now is being able to add photon view and PhotonTransform during run time.
    If I do this some reason OnPhotonSerializeView() never gets called. Either on PhotonTransformView or the NetworkMover script I made.


    Here is one way I've tried doing it.

    Code (csharp):
    1.  
    2. GameObject CharacterPrefab = Resources.Load("Playable Characters/Characters/" + MyFunctions.FirstLetterToUpper(GameSettings.UserData["general"]["race"].Value)) as GameObject;
    3.  
    4. PhotonView m_PhotonView = CharacterPrefab.AddComponent<PhotonView>();
    5. MyPhotonTransformView m_PhotonTransformView = CharacterPrefab.AddComponent<MyPhotonTransformView>();
    6. m_PhotonTransformView.m_PositionModel.SynchronizeEnabled = true;
    7. m_PhotonTransformView.m_RotationModel.SynchronizeEnabled = true;
    8. CharacterPrefab.GetComponent<PhotonView>().ObservedComponents.Add(m_PhotonTransformView);
    9.  
    10. player = Instantiate(CharacterPrefab, new Vector3(3000, 3000, 3000), new Quaternion());
    11.  
    I do add some logic im not showing here to prevent duplicate components being added to the prefab.
    So this code works. Adds the components and assigns just fine. No issues there except OnPhotonSerializeView() never gets called. Even if I use my NetworkMover script as shown in my above post.

    Also tried adding the components after Instantiate.

    Maybe cause I can't changed observed components during run time?
    I'll do a test to test that theory out.


    Edit: ya I just confirm. the issue is assigning observed components to PhotonView during runtime. How do I get around that issue? Is there anything in the api that I need to run to update observed components?
     
    Last edited: Aug 9, 2018
  13. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    956
  14. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    Oh thanks Munchy I wasn't aware of that. That just another way of doing a RPC though. I don't have any issues with using RPC with dynamicly adding the PhotonView component.
    Its not a altnerate way to stream data.

    Maybe I should stop even using streaming and just use RPC with lerping for movement.

    @tobiass when using photon chat does each channel work like photon pun rooms? Where it uses a seperate cloud instance? Or does all channels use the same instance and it's just routing the channels?

    I built a low level API to use with photon chat that should allow hundreds of players to stay in sync. Seems to work very well and uses extremely little data.

    I was going to use photon pun for when players are grouped. To sync the players inside the group and enemies but also still sync players out side the group with photon chat.

    But if photon chat channels are instances like rooms. Then I'm thinking I should just use photon chat for everything and lerp rotations
     
  15. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,068
    @Shadowing: Technically, it should be possible to manually instantiate a networked game object and to assign a observed component to it.

    Re-reading your earlier post, I think I found what was happening in that case:
    In the code, you create a GO, which is then used as prefab to instantiate. You are adding components to the prefab and you're using concrete instances to wire them up with one another. Then you instantiate and I think this is where things fail: You setup a concrete instance which is duplicated in the instancing. The problem here: The references you set on the instances are not adjusted to the instances used in the duplicate (new instance).

    Prefab components can be setup to observe one another and Unity will resolve this into a concrete instance, when you call Instantiate. This is probably not the case here, as you're not pointing prefabs to one another and your wiring gets lost.

    Instantiate first, then setup the new instance's wiring and observed list with the concrete components.

    If that's not it, please make a minimal repro case, upload to dropbox or similar and mail the link to: developer@photonengine.com and we have a look.


    @Munchy2007 thanks for all the input! :)

    In the end, RPCs as well as OnSerializePhotonView() will both create events. While RPCs are called reactively, there is a predefined frequency for OnSerializePhotonView() updates. As PUN does, you can build both solutions with the underlying events.
    Using RaiseEvent can make sense when you want to control what's in the events or when you don't use networked objects anyways. I hope this page explains this up somewhat.
     
  16. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    Does two channels in Photon Chat share the same Load?

    Ya it doesn't matter if i try to add the components to the prefab or add it after I Instantiate it.
    Its the same result in OnSerializePhotonView never being called.
    I don't have any issues with RPC's

    Oh well I just decided to only use OnSerializePhotonView for playable characters only and not for AI. I'll get better performance that way anyways. Won't have to worry about hitting the data limit that way.
     
  17. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    203
    To clarify something,

    The OnSerializeView will only send data when the data is changed?

    for example,
    if we're sending bool (Input.getKey)
    it will only be sent when this bool changes locally to false or true?? so I don't have to make an if statement inside the onserializeview to manually check when the bool is changed?
     
  18. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,068
    @Shadowing: If you are interested in a solution, please send us a way to reproduce this. Can be via text, too.
    Mail to: developer@photonengine.com please. Thanks.

    @Smart-hawk1: OnSerializePhotonView will only send something if it did add data to the stream. It does not check if values are changed, unless you select the sync mode "reliable delta compressed", which is not optimal in most cases.

    Your code has to figure out which values it needs to send.
     
  19. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    @tobiass I read somewhere that you mentioned something about pun can handle around 400 RPC requests at a time. At least until you tell us we are over loading it.
    Is that true. If thats true I really don't need to use photon chat for movement between 300 players. If I'm only using RPC.

    I was going to use 300 for players and 100 for AI when only in a group.

    You think Photon Server will ever have a Linux solution? I'm really wanting that badly.
     
  20. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    203
  21. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    158
    I'm completely new to photon and wondered if I can add it to my existing project (about 35% complete) without a whole lot of trouble or would I be better served starting over with a brand new photon project. Your thoughts please.
     
  22. Munchy2007

    Munchy2007

    Joined:
    Jun 16, 2013
    Posts:
    956
    Personally speaking, I've always found it easier to write a multiplayer game from the ground up, rather than convert what started out as a single player game. The size of the task will scale probably exponentially with the complexity of the game.

    So my thoughts are, for a simple game, yes it probably isn't too much of a problem, otherwise, I'd approach it with multiplayer in mind from the word go.

    Edit: also being 'completely new' to Photon isn't going to make the conversion process any easier.
     
    Shadowing likes this.
  23. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    158
    Thanks for your insight. From what I've read on the topic I had all but come to that conclusion and since I still have a long ways to go it would be best as you suggest. Cheers!
     
  24. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    203
    what I did is made test Photon Project with everything I would needed in main project, then I converted the main project to MP.
     
  25. Pandalawl

    Pandalawl

    Joined:
    Jan 27, 2017
    Posts:
    8
    Im working on a small Sample Project and try to cover most of the basic things in Pun.

    If you need an Example or a code snippet look through the Project, maybe you find what you are looking for :)

    Also im tryin to add small updates over time.

    Feel free to ask for Help or fork and contribute something to the Project.

    https://github.com/SradnickDev/Photon-Example
     
  26. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,068
    Sorry guys. Missed a few posts these days.

    @Shadowing: If you are overloading PUN, depends on a lot of factors. We don't give hard limits usually, due to that. I can pretty much guarantee that you can't get a reasonable update frequency for 300 players in a room though. And 300 players sending updates, will mean each update needs to be received by 299 players. This quickly multiplies and will eat bandwidth. There is 3GB traffic/month included per CCU in a Photon Cloud plan and if you get over that, this will be charged. There's no discussion about that part, like for messges/sec in a room. Be careful.

    Request for Linux support is registered. Can't say more, sorry.

    @Smart-hawk1: You're right about Unreliable on Change. Forgot to mention this. It will send the bool once unreliable, then once reliable and then pause until it changes. Why another time reliable: Because we can't guarantee that the unreliable one arrived everywhere.
    Sorry for making you worry. :)

    @digiross: I second what @Munchy2007 wrote. It's usually better to start with multiplayer in mind. I'd say especially so, if you don't know how to do multiplayer at all. Else wou might make some design decisions which are not bad or anything but which don't work well for multiplayer.

    @Pandalawl: Thanks for sharing.
     
  27. BrianND

    BrianND

    Joined:
    May 14, 2015
    Posts:
    68
    Hi our game has a multi-scene setup.
    https://docs.unity3d.com/Manual/MultiSceneEditing.html

    I've noticed photon assigns scene viewIDs based on what scenes are active. The issue is that we reuse scenes

    For example

    version 1 of a scene
    map A
    normal gameplay stuff A <<
    sound stuff A


    version 2 of the scene
    map A
    game mode a stuff A <<
    sound stuff A



    The Photon editor tool will assign the scene view ID of items based on only what it can currently find. The problem is that the IDs keep switching if we load normal gameplay stuff A vs game mode a stuff A. This basically causes scene view ID conflicts if we build from two different machines. Is there a cleaner more persistent way to assign view IDs?
     
  28. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    Code (csharp):
    1. OnGetMessages(string channelName, string[] senders, object[] messages)
    I got a question about OnGetMessages.

    I noticed the Messages is an array of objects.
    If I send one message i need to do messages[0] to read it.

    Is there ever more than one chat message in that array?
    meaning I need to be cycling through Messages?

    I'm thinking if two uses send a chat at the same time then Messages will contain more than one chat message?

    Code (csharp):
    1. OnPrivateMessage(string sender, object message, string channelName)
    On private message doesn't have an array of objects.
     
  29. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    203
    Hi, I'm looking for advice, So When a Client Joins a Room, Client asks the Master For Current State.. for example current Health which is stored on master:

    Code (CSharp):
    1.     private void Start()
    2.     {
    3.         if (!photonView.isMine)
    4.         {
    5.             photonView.RPC("RPC_GetCurrentHealth", PhotonTargets.MasterClient);
    6.         }
    7.     }
    Master then sends back RPC of this object's current health.

    Code (CSharp):
    1.     [PunRPC]
    2.     private void RPC_GetCurrentHealth()
    3.     {
    4.         if (!PhotonNetwork.isMasterClient)
    5.             return;
    6.  
    7.         photonView.RPC("RPC_UpdateHealthForEveryone", PhotonTargets.Others, currentHealh);
    8.     }
    Code (CSharp):
    1.     [PunRPC]
    2.     private void RPC_UpdateHealthForEveryone(int health)
    3.     {
    4.         currentHealh = health;
    5.  
    6.         if (currentHealh <= 0)
    7.             OnDeath();
    8.         else
    9.             isAlive = true;
    10.  
    11.         UpdateHealthBar();
    12.     }
    Is this right way to do it ? My question is on GetCurrentHealth Method, is there a way to have the master send back the current state to only the calling player? instead of having it sent to everyone everytime someone joins?
     
  30. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,068
    @BrianND: The viewID should be saved with the scene, if a PhotonView is on a game object in the scene.
    There is a (little known and fairly rarely used) PunSceneSettingsFile. In this, you can define for each scene which minimum viewID should be assigned. With a little tuning, assigning distinct ranges is possible.

    @Shadowing: Yes, if multiple users send messages at about the same time, the server will make use of the messages-array. This is more likely in more crowded channels.
    For the private messages, we assume that it's unlikely that multiple messages arrive at the same time for a single 1:1 channel. So no arrays.

    @Smart-hawk1: RPCs are for infrequently happening actions. Syncing health is simpler when done as Custom Property or when you send the health along with positions and other frequent updates.
    https://doc.photonengine.com/en-us/pun/current/gameplay/synchronization-and-state
     
  31. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    615
    @tobiass
    This is an interesting topic I've always updated my characters stats using RPC's (one per each) but when they change only this could be frequent for stats like HP.

    So are you saying is better to use Player Properties for this? for example I have 10 stats each of them has 3 values (consumable value, total value, bonus value).
     
  32. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    @tobiass is there a call back that gets sent to all players when a player disconnects from the Photon chat?
    Like even if they just close the game or the game crashes etc..
     
  33. BlueBolt_

    BlueBolt_

    Joined:
    Feb 11, 2018
    Posts:
    20
    Hi,

    I'm starting to learn about master authority, just have 1 small question

    When a Player Joins, the master creates new prefab for that player, my question is.. do I transfer Ownership of the newly created player prefab photonview to the player who just joined or keep the ownership to the master? I don't know the difference it would make here later on.. but i'm planing to handle most of the things by master client and just get inputs from clients... what can you advice me?


    thanks
     
  34. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    203
    I've an annoying problem with Destroying Photon GameObjects

    When a Player leaves I want his objects destroyed

    I've tried

    Code (CSharp):
    1.     public void OnClick_QuitButton()
    2.     {
    3.         PhotonNetwork.DestroyPlayerObjects(PhotonNetwork.player);
    4.         PhotonNetwork.LeaveRoom();
    5.         PhotonNetwork.LoadLevel("Menu");
    6.     }
    And this
    Code (CSharp):
    1.     private void OnPhotonPlayerDisconnected(PhotonPlayer PlayerLeft)
    2.     {
    3.         if (!PhotonNetwork.isMasterClient)
    4.             return;
    5.         PhotonNetwork.DestroyPlayerObjects(PlayerLeft);
    6.     }
    and this
    Code (CSharp):
    1.     private void OnPhotonPlayerDisconnected(PhotonPlayer PlayerLeft)
    2.     {
    3.         if (!PhotonNetwork.isMasterClient)
    4.             return;
    5.  
    6.         foreach (PhotonView pv in playersPhotonViewList)
    7.         {
    8.             if (pv.owner == PlayerLeft)
    9.             {
    10.                 PhotonNetwork.Destroy(pv);
    11.                 PhotonNetwork.Destroy(pv.gameObject);
    12.             }
    13.         }
    14.      
    15.     }
    and all I get is the pv owner goes back to MasterClient, is it something to do with me transferring owner ship at the start ?

    Code (CSharp):
    1.     private void CreatePlayer(PhotonPlayer Owner)
    2.     {
    3.         if (!PhotonNetwork.isMasterClient)
    4.             return;
    5.  
    6.         GameObject _newPlayer;
    7.         _newPlayer = PhotonNetwork.Instantiate("Player", Vector3.zero, Quaternion.identity, 0);
    8.  
    9.         PhotonView NewPlayerJoinedView = _newPlayer.GetComponent<PhotonView>();
    10.         NewPlayerJoinedView.TransferOwnership(Owner);
    11. }
     
  35. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,068
    @Smart-hawk1: By default, PUN will destroy all GameObjects which are PhotonNetwork.Instantiate(d) by a player, when the player leaves. The value of PhotonNetwork.autoCleanUpPlayerObjects, is used when you create a new room. This is a per-room setting and should be on. It does not destroy objects manually instantiated (when you assign viewIDs and PhotonViews) and when a player is inactive (due to PlayerTTL), I think the objects also remain (until the PlayerTTL passed). Scene objects, are obviously also not destroyed.

    @BlueBolt_ : As you want the Master Client to be authoritative, this client not hand over ownership. It's moving the GOs on behalf of the "owner".
    When the Master Client leaves, this probably means the game is over for everyone, unless others can take over the duty of the Master Client seamlessly. This is not easy to achieve.
    Maybe this setup is a better match for Photon Bolt. If I'm right, this supports the setup more directly.

    @Shadowing: Chat has no user listing by design and there is also no notification when someone leaves. At the moment, there is no built-in solution for this.
     
  36. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    203
    Autocleanup is on, If a object is instantiated by the master, then ownership transfered to client, then client leaves.. this object does not get destroyed automatically or manually, the ownership of the view just goes back to the master, and all calls of PhotonNetwork.Destroy won't work when this happens for some reason, it would only work if the client themself instantiated the object in the start (not master then transferred) , I dont know what is wrong that im doing
     
  37. imgumby

    imgumby

    Joined:
    Nov 26, 2015
    Posts:
    104
  38. hjupter

    hjupter

    Joined:
    Dec 23, 2011
    Posts:
    615
  39. ThySpektre

    ThySpektre

    Joined:
    Mar 15, 2016
    Posts:
    38
    I have written a short (at this point) multiplayer game.

    I have a scene which is the login/matchmaking/join room (LMJR) scene with transitioning to later scenes synchronized by Photon.

    Works great for Build/Run trial, but what I miss is when working in the later scenes, I cannot simply make a small change and run it in the editor. I must go back to the LMJR scene and run from there, or do a full Build/Run and run the executable.

    The later scenes do some Photon.Instantiating in their object's Start() functions. These obviously fail if I try and run the scene directly as there has been no connecting to Unity yet nor joining a room.

    Is there anyway to connect to Photon and join a room prior to any of the objects Start functions firing? I've tried to place all code in an Awake function, but have had no luck (must wait for callbacks, etc.)

    The best kludge I have found is to run the scene and let it throw tons of errors (mostly because objects could not be instantiated and are trying to be called in the various Update() functions) in the editor until the connection occurs and then reload the scene.

    Is there a better way to accomplish this? I'd hate to tear up all the code and add a bunch of if(PhotonNetwork.connected){} blocks everywhere. Would require moving all the Start code to Update with one time run flags as well.

    Thanks in advance.


    (EDIT: I was able to achieve the functionality I was looking for by making the offending scripts dependent on network access disabled by default and enabling them after connection and room entry was completed. Thanks)
     
    Last edited: Aug 25, 2018
  40. Appminis

    Appminis

    Joined:
    Apr 12, 2014
    Posts:
    119
    What's the difference between PUN 1 and PUN 2?
     
    sathya likes this.
  41. Eiseno

    Eiseno

    Joined:
    Nov 1, 2015
    Posts:
    71
    Is there any documentation about PUN 2 ?
     
  42. levi777l

    levi777l

    Joined:
    Mar 13, 2014
    Posts:
    14
    Sad.... Bought pun 1 for full price and have not even used it yet =P
     
    Smart-hawk1 likes this.
  43. imgumby

    imgumby

    Joined:
    Nov 26, 2015
    Posts:
    104
    Me too but I'll wait until someone official answers my question a couple posts back before saying anything about that for now.Sometimes things go awry on the asset store submittal process and the upgrade path was overlooked.I find it hard to believe otherwise as I don't believe it's an entirely new product so should fall under the general unity asset stores sellers agreement to provide updates for free or at least a nominal cost like Vis2k had to do with their AI template .It was supposed to be free initially to owners of the shooter template because they'd apparently promised to incorporate it in the shooters template but chose to do a stand alone instead.They ultimately had to charge a $1 nominal fee to circumvent the stores boilerplate.
    it's the weekend and the forum will be closed on the 27th apparently so maybe by the 28th someone will have replied.
     
  44. Alardaen

    Alardaen

    Joined:
    Aug 29, 2010
    Posts:
    84
    Is there going to be a discount price for existing PUN Plus customers?
     
  45. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    203
    Code (CSharp):
    1.     private void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    2.     {
    3.         if (stream.isWriting == true)
    4.         {
    5.             if (PhotonNetwork.isMasterClient)
    6.             {
    7.                 stream.SendNext(currentHealth);
    8.             }
    9.         }
    10.         else
    11.         {
    12.             currentHealth = (int)stream.ReceiveNext();
    13.         }
    14.     }
    How can i have a stream value sent via Master Only? The above code returns an error. what i'm currently thinking it would is i keep MasterClient as PhotonView Owner, then Pass in the PhotonPlayer name to the control script and on player check if names match then give ability to control... but i dont know
     
    Last edited: Aug 26, 2018
  46. imgumby

    imgumby

    Joined:
    Nov 26, 2015
    Posts:
    104
    Hoping it's a free upgrade as usual but we'll see come the 28th or so when someone official answers .They have to make substantial additions and not just fixes and enhancements to justify charging existing customers for a new product when a current one already exists if I've remembered the sellers contract correctly.. ;)
     
  47. Shadowing

    Shadowing

    Joined:
    Jan 29, 2015
    Posts:
    967
    Is it possible to change the name of a Photon Chat channel with out actually resubscribing to it?
     
  48. Smart-hawk1

    Smart-hawk1

    Joined:
    May 23, 2017
    Posts:
    203
    also want to know this
     
  49. digiross

    digiross

    Joined:
    Jun 29, 2012
    Posts:
    158
    +1
     
  50. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    2,068
    Couldn't post about this yesterday, as there was some forum maintenance...

    PUN 2
    As of last Friday, there are new PUN 2 packages in the Asset Store. Both contain the same content, so everyone can just get and use the Free package. The Plus package includes a 100 CCU subscription, which is good for a bigger test group or an early soft launch (100 CCU cover approximately 40k monthly active users).

    What's new?!
    PUN 2 has a new structure and comes in just one "root" folder. We cleaned up the naming of many classes, fields and interfaces and there is a new callback system. We created new demos and are in the process of re-writing the documentation (note the v2 in the link). Currently the API reference is only in the package (see the PDF or CHM files). Updating existing projects will be quite some work. Here are the migration notes we took.

    Existing subscriptions
    (e.g. of a previously purchased PUN Plus) can be used with PUN 2. There is no upgrade fee or such! If you got an existing 100 CCU subscription, you can use that. Existing AppIDs can be used in PUN 2 (and vice versa).

    Why a second package then?!
    PUN 2 wraps up a lot of internal refactoring and includes multiple breaking changes for existing PUN projects. As we don't want to break existing projects, PUN 2 got separate packages.

    Should I update? Bigger or almost complete projects should probably stick with PUN "Classic". We will keep that package around and update it but we probably won't add more features. Projects starting recently or soon, should use PUN 2.

    Something is broken, right?! We tested PUN 2 in early access and with our demos but of course, there can be bugs. When reporting issues in PUN 2, please make sure to tell us you're using PUN 2 already. Reply here or mail to: developer@photonengine.com.
     
    hopeful, digiross and Munchy2007 like this.