Managing Unity3D

nbrookes
New Contributor

My company has several application programmers and about a dozen content producer that use Unity3D for designing iOS application and content for those applications. This means that they need to have the Unity IDE installed and maintained on their systems.

My users don't have admin access, and Unity puts out patches weekly that have to be deployed. More annoying is their update requires you download a download agent every week and select which modules you want, and it does a fresh install every time.

Has anyone found a way to manage this through scripts or self service? I have been unable to figure anything out besides downloading and installing it every week onto a VM and using Composer to make a new package. This is very time consuming though.

28 REPLIES 28

Look
Valued Contributor III

One thing that can make it a little bit easier.
If you run the download application on a machine all the way through to the end but don't quit it there will be folder in Downloads that contains all the PKG files it pulled down and an INI file describing them.
The moment you quit the Installer they are all deleted, but you can copy them out before this.
You can use these to create an install process without using Composer etc... The INI file appears to list the packages in the order they are to be installed and even has the PKG name as well.
I just pushed all the PKGs down in a DMG and then had a script read the names out of the INI and install them in order.
I'll find it for you when I am back in the office.

Look
Valued Contributor III

Reads the package names from the URL line of the install.ini described above and installs them in the order in which they appear.

I just placed all the downloaded files into /Library/Scripts/UnityPackages but of course you could use any location that takes your fancy.

#!/bin/bash

for Unity_PKG in $(awk -F"/" '/url=/ {print $NF}' < /Library/Scripts/UnityPackages/install.ini); do
installer -pkg "/Library/Scripts/UnityPackages/$Unity_PKG" -target /
done

rm -rf /Library/Scripts/UnityPackages

prodservices
New Contributor III

Thanks much for this tip & script.

Has anyone seen how to automate the last mile of installation (aka user account login and serialization) for macOS? I know people have been asking for this feature so it's something they'll likely release at some point, but the most I found was batch file activations and that was for Windows clients...If anyone has figured this out I would love to hear their solution.

luke_jaeger
Contributor

There is a "silent serialization" script that works great when you run it thru ARD, but for the life of me I cannot get it to work in Casper. I even modified it so that it runs as the currently logged-in user (the user running the script has to own a GUI session, so you can't run it as root). If anyone else has solved this problem, I'd really appreciate hearing about it. I do not want to use the "at login" trigger because they're never reliable.

The basic syntax looks like this:

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial R3-XXXX-XXXX-XXXX-XXXX-XXXX -username 'somebody@example.com' -password 'MyPassw0rd'

ICTMuttenz
Contributor

Have found anybody a solution?

jmahlman
Valued Contributor

I'm hoping to find a solution to this since I'm going to be installing this in some of our labs.

If I manage to get it working, I'll post something.

jmahlman
Valued Contributor

Unfortunately, I had to go the manual route (Grab packages, use script, login, ARD and run the batchmode command).

I did do a test to run the batchcommand at login and it did work, but I also don't like login policies that much.

ICTMuttenz
Contributor

can you send me the batchcommand which you uses for login policies?

I tryed, but by us doesn't work that.

jmahlman
Valued Contributor

It was the same as above but I made it run when the dock loaded to give it a little buffer:

#!/bin/sh

until [[ $(pgrep Dock) ]]; do
    wait
done

/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial R3-XXXX-XXXX-XXXX-XXXX-XXXX -username 'somebody@example.com' -password 'MyPassw0rd'

ICTMuttenz
Contributor
Executing Policy ActivatingUnity
Running script ActivateUnity...
Script exit code: 139
Script result: 2017-09-26 08:34:59.777 Unity[898:5768] NSDocumentController Info.plist warning: The values of CFBundleTypeRole entries must be 'Editor', 'Viewer', 'None', or 'Shell'.<br/>...270213 bytes written to /var/root/Library/Unity/Certificates/CACerts.pem<br/>/Library/Application Support/JAMF/tmp/ActivateUnity: line 7: 898 Segmentation fault: 11 /Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial -serial R3-XXXX-XXXX-XXXX-XXXX-XXXX -username 'somebody@example.com' -password 'MyPassw0rd'<br/>
Error running script: return code was 139.

we get this error. How can we solve this?

ICTMuttenz
Contributor

Hello

I found a solutions. If some instred, let me know. But it is not automatic.

Greetings

jmahlman
Valued Contributor

<REMOVED>

alanp5
New Contributor II

Not sure if this will help.
I done some testing with Unity2018.1.2f1 (with an educational license) As described by the user "Look" above, if you attempt an install it (I generally specify an external USB drive as the destination) and while it is downloading the pkg files to the downloads folder, copy them out to an alternative location, then kill the installation. Once you have have obtained all packages, i then use a program called packages, add them to the destination of /private/tmp/, then run a post script to install the packages.
for example:

#!/bin/sh
installer -pkg /private/tmp/Unity.pkg -target /
installer -pkg /private/tmp/StandardAssets.pkg -target /
installer -pkg /private/tmp/1.pkg -target /
installer -pkg /private/tmp/2.pkg -target /
installer -pkg /private/tmp/UnitySetup-Windows-Mono-Support-for-Editor-2018.1.2f1.pkg -target /
installer -pkg /private/tmp/Documentation.pkg -target /
rm -rf /private/tmp/Unity.pkg
rm -rf /private/tmp/StandardAssets.pkg
rm -rf /private/tmp/1.pkg
rm -rf /private/tmp/2.pkg
rm -rf /private/tmp/UnitySetup-Windows-Mono-Support-for-Editor-2018.1.2f1.pkg
rm -rf /private/tmp/Documentation.pkg

I then create a seperate package which just has the one post-install script which contains the following:

#!/bin/sh
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial E3-XXXX-XXXX-XXXX-XXXX-XXXX -username 'your-username@mail.com' -password 'password' || :

Bring both packages into JAMF, with the first package set at a priority of 10, and the licensing part with a priority of 11, throw it into a policy and point it at a group of computers that dont have unity installed.

if you run the command above using ARD, it generally returns a null error, hence i have thrown in the "|| :" at the end so that it returns true anyway. If you run this from JAMF (even without a user logged in at the time), it will create the Unity_lic.ulf file in /Library/Application Support/Unity.

One thing i noticed, If you have the machine bound to AD and a standard network user were to log on and launch Unity, they then become the owner of the Unity_lic.ulf file above, so in theory, they can delete this license file without being prompted for admin credentials. If they do, then the next user that logs in wont be able to launch Unity until it is activated again, so you may want to copy the .ulf file somewhere else when it is created and then script it so it is copied back to its original location upon logout. Havent tested that bit yet!!

RussellCollis
New Contributor II

Just a follow up on this as it may be helpful to some...
I had an error with this on machines I was imaging and despite the install working without issue, they would not license.

It appears the 2018 version when opened created an empty license file in /Library/Application Support/Unity - I just had to add a line in the batch file to license to remove this file - and it all worked.

metalfoot77
Contributor II

I have been testing the latest update to Unity (2019.1.10) that apparently needs the Unity Hub to function. I was able to script the removal of all the old settings and files and package and install the new Unity Hub correctly. Where I am having issues is with licensing. As @RussellCollis mentioned above, it doesn't appear that Unity Hub uses the same licensing structure as the older version did before.

Has anyone been able to get Unity 2019.1.10 (in Unity Hub) running with a personal license? I'm aiming for students to be able to skip logging in and just create projects like they used be able to in previous versions.

RussellCollis
New Contributor II

Hi @kricotta do you have copy of the removal script for the old unity settings? Also im working on a new package for 2019.2.0f1 which is appearing to work....

I run the normal install of unity via

#!/bin/bash

for Unity_PKG in $(awk -F"/" '/url=/ {print $NF}' < /private/tmp/UnityPackages/install.ini); do
installer -pkg "/private/tmp/UnityPackages/$Unity_PKG" -target /
done

Then include the unity app within the package just putting it into applications as normal - then using a second pkg to license the app - this was done with educational, but did seem to work in testing..

#!/bin/bash

/Applications/Unity/Unity.app/Contents/MacOS/Unity -batchmode -quit -serial 123-456-789-0 -username 'user@name.uk' -password 'password' || :1

How have you got on?

stephaniemm77
Contributor

ah!! I have been going back and forth with support trying to figure out the licensing! I installed all the apps using Unity Hub...In the past I would use Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial xx-xxxx-xxxx-xxxx-xxxx-xxxx -username 'software@quinnipiac.edu' -password 'password!'

That def doesn't seem to work anymore when I run that command in terminal I just get not such file or directory...support just keeps hitting me with the canned responses referring to the documentation out there already. I will let you know if they give me anything more. We are using an EDU license but still running into the same issues!

stephaniemm77
Contributor

So here was my response from Unity

Hello Stephanie

Thank you for reaching us, hope you are having a good day.

I apologize.

This process only works for Unity version 2018 and all previous versions, after deleting the Unity hub you´ll be able to make a command line activation

This is the folder you´ll need to delete

C:Users<user>AppDataRoamingUnityHublogs folder

For 2019 versions, command line activation is not available, you´ll need to do a manual activation on each computer.

You can see the steps on this link

https://docs.unity3d.com/Manual/ManualActivationGuide.html

mgshepherd
Contributor

What...did I just read that for the 2019 version we'll have manually activate each machine? Oh geez...

tomhastings
Contributor II

mgshepherd, I just completed a remote installation that was successful in my test environment. I'm working on documentation and will share once I have it all worked out.

allanp81
Valued Contributor

They appear to have pulled a blinder with this software now because of the stupid Unity Hub that wasn't on there before.

Even if you manage to activate it (whic I have a working automated method for) it then creates the licence file as that user with other users only having read access to it. If you then set 777 on this file and login with a different user it deletes the file and then creates a new one again with ownership set to that user and everyone else read only. The knock on effect of this is that every other user will get a box come up asking for administrator permissions to change Unity Hub when they open Unity.

The file is /Library/Application Support/Unity/Unity_lic.ulf

BOBW
Contributor II

depending on your licensing we run this:
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -nographics -serial -username ‘’ -password ‘*’ || :

this seems to fail using jamf remote but works fine using Apple Remote Desktop
this will license all users for Unity for the device...... its been a while since we have done it but I am sure this what we did ;)

allanp81
Valued Contributor

@BOBW The licensing side works fine, the issue seems to be the ownership of the lic file. Unity 2018 was fine but 2019 needs the Unity hub part and that seems to cause complications.

allanp81
Valued Contributor

Looking into this a bit further and I can't figure out the issue. The lic file gets its ownership changed successfully but each user still gets the "Unity Hub wants to make changes" popup asking for an admin password. I can't figure out what it's trying to change as I've given both the Unity and Unity Hub apps full permissions for all users.

allanp81
Valued Contributor

I think I've got this all working by using the Outset tool to run a script on each login (privileged) that does a chmod 777 on the "/Library/Application Support/Unity/Unity_lic.ulf" file. This then allows teh next user to launch it without getting a prompt for admin password.

I also added the -nographics onto the activation command which seems to them make it work properly when using Jamf Remote etc.

chris_at_the_pr
New Contributor

@allanp81

Ran across this problem. My current environment is running 10.14.6 deploying Unity 2019.2.17f1. Found the following issues After activating Unity on our Macs:

  • First Test User who logs in and runs Unity can run Unity fine without issues. But the permissions and ownership of the /Library/Application Support/Unity/Unity_lic.ulf changes and the current logged in user who ran Unity now owns Unity.
  • Second Test User logs in and cannot run Unity. "Unity Hub wants to make changes" prompt comes up asking for the admin password. This is the software asking to read the Unity License. If you create a project for Unity then the license permission ownership changes to the new currently logged in user.

Incredibly frustrating. So I created a script that will:

  1. Create a login Hook that will reset the permissions to 777 on the license file.
  2. Create a Start up Script that will also reset the permissions to 777.

* Please note that my environment we have SIPS disabled. For SIP enabled computers You can probably create the login Hook using a Policy that can do the equivalent of running "defaults write com.apple.loginwindow LoginHook /Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh"

I have not tested this on a SIP enabled machine. But I thought it would be worth mentioning here.

#!/bin/bash

# Christian Orellana
# January 2020
# Academic Computing
# Install Plist and Bash script for Unity License Fix

### FUNCTIONS

RemoveLoginandStartHook() {

    launchctl unload -w /Library/LaunchDaemons/com.pratt.it.chris.UnityLicense.plist

}

removePlist() {

    rm /Library/LaunchDaemons/com.pratt.it.chris.UnityLicense.plist

}

removeBash() {

    rm /Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh

}

createBashScript() {

    mkdir /Library/Scripts/Pratt
    touch /Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh

    cat << 'EOF' >> /Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh
#!/bin/bash

# Christian Orellana
# January 2020

# Unity License Fix

## RUN CODE

chown -R root:wheel /Library/Application Support/Unity; chmod -R 777 /Library/Application Support/Unity

exit 0
EOF

    chown root:wheel /Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh
    chmod 644 /Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh
    chmod +x /Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh

}

createPlist() {

    touch /Library/LaunchDaemons/com.pratt.it.chris.UnityLicense.plist

    cat << 'EOF' >> /Library/LaunchDaemons/com.pratt.it.chris.UnityLicense.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
        <key>Label</key>
        <string>com.pratt.it.chris.UnityLicense</string>
        <key>Program</key>
        <string>/Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh</string>
        <key>RunAtLoad</key>
        <true/>
    </dict>
</plist>
EOF

    chown root:wheel /Library/LaunchDaemons/com.pratt.it.chris.UnityLicense.plist
    chmod 644 /Library/LaunchDaemons/com.pratt.it.chris.UnityLicense.plist

}

InstallLoginHookandStartUpHook() {

    # Start Up / boot up hook
    launchctl load -w /Library/LaunchDaemons/com.pratt.it.chris.UnityLicense.plist

    # Log in Hook
    defaults write com.apple.loginwindow LoginHook /Library/Scripts/Pratt/pratt_it_chris_unityLicensefix.sh

}

## RUN 

RemoveLoginandStartHook
removePlist
removeBash
createBashScript
createPlist
InstallLoginHookandStartUpHook

exit 0

Hope anyone finds it useful.

pitcherj
New Contributor III

Hello,

Just wanted to add my $0.02.

I found as everyone else did that Unity Technologies added "Unity Hub" to the mix while I was preparing deployment of Unity 2019.4.4f1.

With that said, deployment methodology from previous versions worked for me.

1) Download all packages for your desired release of Unity from here:
https://unity3d.com/get-unity/download/archive
2) Copy the Visual Studio .app from the DMG (if needed) to /Applications, package with Composer.
3) Upload all packages to Jamf, setting priority on each package so that they install in the proper order.
4) Create a policy that installs all the packages.
5) Create a second policy that (either as a script or as an execute command item) runs the following:
/Applications/Unity/Unity.app/Contents/MacOS/Unity -quit -batchmode -serial Your-Super-Duper-Unity-Serial-Number -username 'YourSuperDuper@unity.account' -password 'YourSuperDuperUnityPassword' || :

This secondary policy needs to run once per machine, so I assigned it as a self-service item and instructed the students/technicians in the labs where the software is used that if they need to run Unity, someone needs to first run this icon, that way we only end up activating the product on machines it will actually be used on.

One thing to keep in mind is that for whatever reason (and this was true with the 2018 version too) the very first person to run this activation icon ends up with a broken unity install, so typically the instructors notify us or the technicians in the area of their intention to teach the product, and a technician that won't be using the software does this ahead of time.

Carl_R
New Contributor II

So in a edu lab setting would it make sense to get the students to just sign in via the Unity Hub?