Before you start, verify you meet the prerequisites.
Install the Python SDK package
To install Python SDK, follow these steps:
- Run the following command:
pip install --index-url https://unity3ddist.jfrog.io/artifactory/api/pypi/am-pypi-prod-local/simple unity-cloud
- If it's not the first time you're installing the Python SDK, add the
--force-reinstall
argument in the command as follows:pip install --index-url https://unity3ddist.jfrog.io/artifactory/api/pypi/am-pypi-prod-local/simple unity-cloud --force-reinstall
.
Use the Python SDK
To use the SDK, first call initialize()
. Here is an example of the typical initialize process:
def initialize(): unity_cloud.initialize() unity_cloud.identity.user_login.use() # Check whether the user is signed in auth_state = unity_cloud.identity.user_login.get_authentication_state() if auth_state != unity_cloud.identity.user_login.Authentication_State.LOGGED_IN: unity_cloud.identity.user_login.login()
However, if you need to run an initialization again, you must uninitialize before that. Here is an example of the typical uninitialize process:
def uninitialize(): unity_cloud.uninitialize()
Read more about the Identity module and managing authentication.