Skip to content

Argument

314pies edited this page Aug 24, 2024 · 15 revisions

Arguments are custom strings that can be set up for each individual clone. It can be a simple string like "client"/"server", user name, or a complex JSON representing the loadout of a character.


↑ Argument can be set from the clones manager windows.

To get the custom argument, invoke ClonesManager.GetArgument():

// This should be editor only
#if UNITY_EDITOR
using UnityEngine;
using ParrelSync;

public class CustomArgumentExample : MonoBehaviour
{
    void Start()
    {
        //Is this unity editor instance opening a clone project?
        if (ClonesManager.IsClone())
        {
            Debug.Log("This is a clone project.");
            // Get the custom argument for this clone project.  
            string customArgument = ClonesManager.GetArgument();
            // Do whatever you need with the argument string.
            Debug.Log("The custom argument of this clone project is: " + customArgument);            
        }
        else
        {
            Debug.Log("This is the original project.");
        }
    }
}
#endif
Clone this wiki locally