Search Unity

Simple script for multiple unity installs

Discussion in 'Linux' started by RetroZelda, Aug 16, 2017.

  1. RetroZelda

    RetroZelda

    Joined:
    Jan 8, 2013
    Posts:
    6
    I hope this kind of post is allowed here. Essentially, I developed a simple script to help with multiple unity installs that I figured might help some people out. I am running Ubuntu 16.10, but i imagine itll work with other distros.

    To install, do the following:
    - Place the script inside /bin (or wherever you keep your custom scripts)
    - name the script unity-editor (or whatever you want to call it)
    - Or just: sudo nano /bin/unity-editor then paste it in and save
    - run command: sudo chmod +x /bin/unity-editor
    - Install unity versions via the installation scripts to /opt
    - Ensure the unity install folder is named similar to Unity-*Version*. Example: Unity-5.6.1.

    Now, you can execute the script by running: unity-editor *version*. So, if you have Unity-5.6.1, you will run: unity-editor 5.6.1. If you run without a version set, it will list out all version you have available on your machine.


    My environment is:
    Code (CSharp):
    1. retrozelda:Desktop$ cd /opt
    2. retrozelda:opt$ ls
    3. click.ubuntu.com  perforce  Unity-2017.1.0  Unity-5.5.2  Unity-5.6.1  zoom
    4. retrozelda:opt$ unity-editor
    5. Available Versions:
    6. 2017.1.0
    7. 5.5.2
    8. 5.6.1
    9. retrozelda:opt$ unity-editor 5.6.1
    10. Launching Unity Unity version 5.6.1 at path /opt/Unity-5.6.1/Editor/Unity
    11. retrozelda:opt$
    12.  

    and here is the script

    Code (CSharp):
    1. #!/bin/bash
    2.  
    3. UNITY_VERSION=$1
    4. if [ -z "${UNITY_VERSION}" ]
    5. then
    6.     echo "Available Versions:"
    7.     ls /opt |grep Unity | grep -o '[^Unity-]*'
    8.     exit
    9. fi
    10.  
    11. UNITY_EXECUTION="/opt/Unity-${UNITY_VERSION}/Editor/Unity"
    12. if [ -x "${UNITY_EXECUTION}" ]
    13. then
    14.  
    15.     echo "Launching Unity Unity version ${UNITY_VERSION} at path ${UNITY_EXECUTION}"
    16.     exec "${UNITY_EXECUTION}" &
    17.     exit
    18. fi
    19.  
    20. echo "Cannot find Unity version ${UNITY_VERSION} at path ${UNITY_EXECUTION} or version isnt executable"
    21.  
    I hope you enjoy
     
  2. jerome-lacoste

    jerome-lacoste

    Joined:
    Jan 7, 2012
    Posts:
    206
  3. ironthronethrone

    ironthronethrone

    Joined:
    May 31, 2018
    Posts:
    1

    Hi , i have a question about how to install multi unity linux editor . My os is ubuntu 16.0.4, and install unity by .deb package, the installed unity is located in /opt/Unity (do not contains version),so when i want to install another unity eidtor version,the previous version is overrided. So how do you install different unity version on ubuntu?