Skip to main content

A Unity3d installation finder and a command line helper.

Project description

funity

A Unity3d installation finder and command line helper.

Installation

pip install funity

Usage

In Terminal

python -m funity

# Outputs a JSON-formatted file containing all Unity3d editors found in the current working directory.

# editor.cache
# [
#   "/Applications/Unity/Hub/Editor/2019.2.6f1"
# ]

In Python

from os import getcwd
from pathlib import Path

from funity import *


cache_dir = Path(getcwd()) / 'editor.cache'

# Find all Unity editor installations and cache the results into 'cache_dir'.
editors = UnityEditor.find_in(cache=str(cache_dir))

version = UnityVersion(2019, 2)

# Filter results to only Unity 2019.2.xfx versions.
editors_2019_2 = [e for e in editors if e.version.is_equal_to(version, fuzzy=True)]

# Throw an exception if no compatible Unity version is found.
if not editors_2019_2:
    raise Exception(f'No Unity {version} found.')

# Get the first Unity 2019.2.xfx editor.
editor = editors_2019_2[0]

# Create a UnityProject instance.
project = UnityProject('/Users/you/Projects/HelloWorld')

# Run 'executeMethod' on the Unity project using the Unity editor CLI.
return_code = editor.run(
    '-projectPath', str(project),
    '-buildTarget', 'Win64',
    '-executeMethod', 'BuildPlayerCommand.Execute',
    cli=True,  # Shorthand for '-batchmode', '-nographics', '-quit', '-silent-crashes'.
    log_func=lambda l: print(l, end='')  # Prints all logs from Unity.
)

Changelog

v0.0.6

  • Minor bug fixes.

v0.0.5

  • Added support for getting the Unity version for Windows systems.

v0.0.4

  • Added UnityVersion class.
  • Updated the README file.

v0.0.3

  • Some bug fixes when fetching the Unity version for Darwin systems.

v0.0.2

  • Added support for getting the Unity version for Darwin systems.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

funity-0.0.6-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file funity-0.0.6-py3-none-any.whl.

File metadata

  • Download URL: funity-0.0.6-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.1 requests-toolbelt/0.9.1 tqdm/4.39.0 CPython/3.7.4

File hashes

Hashes for funity-0.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 6f078701a518c176d5c7903f8dcff7d432f85e4f9382d1f21c7e91cb6bbd35a6
MD5 8ee97ae8a094d4849af266271aae68a4
BLAKE2b-256 09f195d9f8da603d8a60f6fc9b949e08ee3f01c40eba88c677f5b0bf25461f19

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page