Search Unity

Other Question for ParrelSync

Discussion in 'Multiplayer Tools' started by sava-game, Mar 27, 2023.

  1. sava-game

    sava-game

    Joined:
    Feb 14, 2023
    Posts:
    21
    I am working with ParrelSync in Unity2022.2.12f1.
    It worked well in Unity2022.2.2f1 or older but it is not working in Unity2022.2.12f1.
    I don't mean I can not clone a project with this plugin.
    I can reference this plugin in my custom script like this:

    using ParrelSync;
    void Start()
    {
    if(ClonesManager.IsClone())
    {
    Debug.Log("I am clone of Manager");
    }
    }

    This code block is working well in Editor.
    But I am getting red errors when I build android apk.
    (error CS0246: The type or namespace name 'ParrelSync' could not be found (are you missing a using directive or an assembly reference?)

    I attached screenshot.
    upload_2023-3-28_4-50-11.png
     
  2. cerestorm

    cerestorm

    Joined:
    Apr 16, 2020
    Posts:
    666
    You'll want to exclude ParrelSync references from the build and you can do this using preprocessor directives and scripting symbols. You can use the UNITY_EDITOR symbol to only include the ParrelSync code when built in the editor, like this:
    Code (CSharp):
    1. #if UNITY_EDITOR
    2. using ParrelSync;
    3. #endif
    4.  
    5. .
    6. .
    7. .
    8.  
    9. #if UNITY_EDITOR
    10. if (ClonesManager.IsClone())
    11. {
    12.     Debug.Log("I am clone of Manager");
    13. }
    14. #endif
     
    bantus likes this.