Simple script for multiple unity installs

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:

retrozelda:smile:esktop$ cd /opt
retrozelda:opt$ ls
click.ubuntu.com  perforce  Unity-2017.1.0  Unity-5.5.2  Unity-5.6.1  zoom
retrozelda:opt$ unity-editor
Available Versions:
2017.1.0
5.5.2
5.6.1
retrozelda:opt$ unity-editor 5.6.1
Launching Unity Unity version 5.6.1 at path /opt/Unity-5.6.1/Editor/Unity
retrozelda:opt$

and here is the script

#!/bin/bash

UNITY_VERSION=$1
if [ -z "${UNITY_VERSION}" ]
then
    echo "Available Versions:"
    ls /opt |grep Unity | grep -o '[^Unity-]*'
    exit
fi

UNITY_EXECUTION="/opt/Unity-${UNITY_VERSION}/Editor/Unity"
if [ -x "${UNITY_EXECUTION}" ]
then

    echo "Launching Unity Unity version ${UNITY_VERSION} at path ${UNITY_EXECUTION}"
    exec "${UNITY_EXECUTION}" &
    exit
fi

echo "Cannot find Unity version ${UNITY_VERSION} at path ${UNITY_EXECUTION} or version isnt executable"

I hope you enjoy

@RetroZelda_1 , I hope this kind of answer is allowed here :wink:

We developed u3d to download/install/run unity from the command line, and it supports Linux. Maybe you will find it interesting :slight_smile:

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?