Metadata-Version: 2.1
Name: funity
Version: 0.0.11
Summary: A Unity3d installation finder and a command line helper.
Home-page: https://github.com/fopoon/funity
Author: Elmer Nocon, fopoon
Author-email: elmernocon@gmail.com
License: MIT
Download-URL: https://pypi.org/project/funity/
Description: # funity
        
        ![PyPI](https://img.shields.io/pypi/v/funity)
        ![PyPI - Python Version](https://img.shields.io/pypi/pyversions/funity)
        ![PyPI - Status](https://img.shields.io/pypi/status/funity)
        ![PyPI - License](https://img.shields.io/pypi/l/funity)
        ![PyPI - Format](https://img.shields.io/pypi/format/funity)
        ![PyPI - Downloads](https://img.shields.io/pypi/dm/funity)
        
        A Unity3d installation finder and command line helper.
        
        ## Installation
        
        ```sh
        pip install funity
        ```
        
        ## Usage
        
        ### In Terminal
        
        ```sh
        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
        
        ```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.
        
Platform: Any
Classifier: Development Status :: 1 - Planning
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows :: Windows 10
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3 :: Only
Description-Content-Type: text/markdown
