Skip to main content

A Unity3d installation finder and a command line helper.

Project description

funity

PyPI PyPI - Python Version PyPI - Status PyPI - License PyPI - Format PyPI - Downloads

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 UnityEditor, UnityProject, UnityVersion


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.11

  • Fixed Unity version detection on Windows installations.

v0.0.10

  • Minor bug fixes.

v0.0.9

  • Added additional UnityProject helper methods.

v0.0.8

  • Added more UnityProject test cases.

v0.0.7

  • Added additional UnityProject helper methods.

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 Distribution

funity-0.0.11.tar.gz (10.0 kB view details)

Uploaded Source

Built Distribution

funity-0.0.11-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

Details for the file funity-0.0.11.tar.gz.

File metadata

  • Download URL: funity-0.0.11.tar.gz
  • Upload date:
  • Size: 10.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for funity-0.0.11.tar.gz
Algorithm Hash digest
SHA256 027eed8c082450a9051416a800827fc1eb83e6c86070cb3c90163dbe4e455fd1
MD5 cb40f8b5d3ffbcf898a975473f54c7bb
BLAKE2b-256 dd6c78d52bf0de2e7e77503023fe8749c31fe1232fc966f30d417682ced434f8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: funity-0.0.11-py3-none-any.whl
  • Upload date:
  • Size: 11.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.51.0 CPython/3.9.0

File hashes

Hashes for funity-0.0.11-py3-none-any.whl
Algorithm Hash digest
SHA256 bfb52766814f0a20893529d4c354386f3d084141239264a6be8410a1dab2fa42
MD5 0311d35f8507768321811d0f1a5d451f
BLAKE2b-256 ca3c3e988fa9ad7e630de3ce0033b7e3886a7fa557b02b314e1bb2e9297ac928

See more details on using hashes here.

Supported by

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