How to get rid of Scripting Define Symbols in PUN V2

Options
Hi,

I am on Unity 2019.2.12f1 using PUN 2.15 and still see the PhotonV2 entries in the Scripting Define Symbols line:
PHOTON_UNITY_NETWORKING; PUN_2_0_OR_NEWER; PUN_2_OR_NEWER;

This input line is not very practical if it is overcrowded. I like to use it for my own build branches.

I would like to ask if I can remove them if I change your C # scripts accordingly. I mean, if I remove the old code there. Do you use these values somewhere else where I can not change the code by myself?

All the best,
Klaus

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @Klaus Eiperle,

    Thank you for choosing Photon!

    I think it's fine to delete those and replace them with a line(s) at the top of the files that use them:

    #define REPLACE_WITH_USED_PUN_SCRIPTING_DEFINE_SYMBOL_USED_IN_SAME_FILE
  • Klaus Eiperle
    edited November 2019
    Options
    Hi JohnTube,

    thank you very much for your quick reply. Now I have searched in all your C# scripts for:
    PHOTON_UNITY_NETWORKING; PUN_2_0_OR_NEWER; PUN_2_OR_NEWER;
    and see, they are used only in Photon/PhotonUnityNetworking/Code/Editor/PhotonEditorUtils.cs.

    First, it adds all three keys, and then later it removes all three keys. ???
    Where is the sense behind that ?
    Can I remove these code ?

    All the best,
    Klaus
  • JohnTube
    JohnTube ✭✭✭✭✭
    edited November 2019
    Options
    Hi @Klaus Eiperle,

    The code in "EditorPhotonEditorUtils" should add those scripting defines when PUN2 is imported and remove them when PUN2 is removed.
    I think "PHOTON_UNITY_NETWORKING" could be used in assets other Photon Unity assets like Photon Chat when imported separately.
  • Hi JohnTube,

    I only use PUN2 for online meetings. I do not use PhotonChat or PhotonVoice. I have disabled these lines and now have a cleaned "Scripting Define Symbols". I'm sure other users will see the same benefit. Now it looks like this:

    static PhotonEditorUtils()
    {
    // HasVoice = Type.GetType("Photon.Voice.VoiceClient, Assembly-CSharp") != null || Type.GetType("Photon.Voice.VoiceClient, Assembly-CSharp-firstpass") != null || Type.GetType("Photon.Voice.VoiceClient, PhotonVoice.API") != null;
    // HasChat = Type.GetType("Photon.Chat.ChatClient, Assembly-CSharp") != null || Type.GetType("Photon.Chat.ChatClient, Assembly-CSharp-firstpass") != null || Type.GetType("Photon.Chat.ChatClient, PhotonChat") != null;
    HasPun = Type.GetType("Photon.Pun.PhotonNetwork, Assembly-CSharp") != null || Type.GetType("Photon.Pun.PhotonNetwork, Assembly-CSharp-firstpass") != null || Type.GetType("Photon.Pun.PhotonNetwork, PhotonUnityNetworking") != null;
    PhotonEditorUtils.HasCheckedProducts = true;

    /*##KE## if (HasPun)
    {
    // MOUNTING SYMBOLS
    #if !PHOTON_UNITY_NETWORKING
    AddScriptingDefineSymbolToAllBuildTargetGroups("PHOTON_UNITY_NETWORKING");
    #endif

    #if !PUN_2_0_OR_NEWER
    AddScriptingDefineSymbolToAllBuildTargetGroups("PUN_2_0_OR_NEWER");
    #endif

    #if !PUN_2_OR_NEWER
    AddScriptingDefineSymbolToAllBuildTargetGroups("PUN_2_OR_NEWER");
    #endif
    }*/
    }
  • jeanfabre
    Options
    Hi,

    I am not sure I fully understand this thread and what's the problem with this.

    The scripting define symbols on big projects can be very lengthy, it's not meant to be handled manually so much really.

    The purpose of these define scripting symbol is multiple, and for pun, it helps third party assets that supports PUN to properly work on all projects without throwing errors should pun not be installed yet or at all, by simply using these define symbols in their class. So in your project, feel free to edit this as you wish, but we need that for others to play nice with developer's projects.


    Bye,

    Jean