Setting up the Asset Server
Reference Manual > Asset Server Guide > Setting up the Asset Server

Setting up the Asset Server

Server-side Installation

The Asset Server is designed to be a simple one-time installation on a server machine. Interacting with the Asset Server is done through Unity. Unity can be installed on the server machine, but it does not need to be. It must be administrated from a Client machine, where Projects and Users can be added. Each additional client must be configured to synchronize with a Project, using a specific User credential.

You can install the Asset Server on any Mac OS X machine or on Linux. Download Unity Asset Server

The installer will install all necessary files, setup a database and launch the Asset Server. At the end of the process you will be asked for an Admin password. This password is required to administer the Asset Server from within Unity. You must connect to the Asset Server as the administrator before you can create any projects or users.

Administrating the Asset Server

The Asset Server allows any number of Users to connect to a Project. The Administrator must first connect to the Server with Unity as a client and create new Projects and Users.

To access the Administrator controls, launch Unity and select Window->Asset Server, then click the Server Administration button.


The Administration tab

In the Server Address field, enter either the ip address or host name of the computer running the Asset Server that you want to administer. If the Asset Server is installed on your local machine, you can use "localhost" as the Server Address. Next, provide the administrator name and password. The administrator name is always "admin", and the password is what was entered when installing the Asset Server. Finally, hit the Connect button. You're now connected to the Asset Server, and can perform the initial setup.

Creating a new Project and adding Users

Each Server can contain several Projects, and each User can have permission to one or more Projects. Projects are generally orthogonal, and unique in asset collections. It is best to think "one Project equals one game".

New Projects can be created by clicking on the Create button in the Server Administration tab.


Click Create, then enter a name for the new project

New users can be created by first selecting an existing project and then clicking on the New User button.


Creating a new user

After a user has been created in one Project, the user can be added to another project by enabling the checkbox on the left of the user name in the users list.

Asset Server Client Setup

Once you have been provided a Project and User account, you can synchronize your local Project with any server Project. You will have to establish a connection with the server initially, and you can only be connected to one project at any given time. Every time you want to change server or project, you will need to follow this process.

Establishing a Client Connection

Every client must connect to the machine running the Asset Server. To access the Connection Settings dialog, click the Connection button from the Overview tab.


The Connection tab

Here, enter a new server address in the Server field, or choose a previously entered server from the dropdown. Provide your user credentials, and click the Show Projects button. Select the Project from the list that appears on the right, and click Connect. Alternatively, if you know the project name you can enter it directly in the Project Name field and click Connect.

Firewall settings

The Unity Asset Server uses TCP port 10733. You might need to enable connections to this port in your firewall and/or router.

Advanced

The Asset Server is built using a modified version of PostgreSQL. Accessing the SQL database directly requires a bit of technical knowledge about SQL and Unix/Linux command lines. User discretion is advised.

Accessing the Asset Server Database

To view the tables in a Project database, first you need to figure out the name of the actual database. Run this command line command on the machine hosting the Asset Server:

Mac OS X
/Library/UnityAssetServer/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases__view'

Linux
/opt/unity_asset_server/bin/psql -U admin -h localhost -d postgres -c 'select * from all_databases__view'

Windows
"%ProgramFiles%\Unity\AssetServer\bin\psql.exe" -U admin -h localhost -d postgres -c "select * from all_databases__view"

This and other commands will prompt you for a password. Every time this happens, enter the admin password for the database, which was set during the installation. The result will be a table that follows this basic layout:

    databasename    |    projectname     |       description        | version 
--------------------+--------------------+--------------------------+---------
 sandbox            | Sandbox            | Created with Unity 2.0.0 | 1.0
 game               | Game               | Created with Unity 2.0.0 | 1.0
 my_game_project    | My Game Project    | Created with Unity 2.0.0 | 1.0
(3 rows)

Now you need to identify the "databasename" of the Project you want to back up. When creating a database, the default "databasename" is same as the "projectname" as shown inside Unity, but in lowercase and spaces replaced with underscores.

Backing up

To create a backup of an Asset Server database, run the following command, replacing DATABASENAME with the name of the desired database, pulled from your "databasename" list produced earlier.

Mac OS X
/Library/UnityAssetServer/bin/pg_dump -U admin -h localhost DATABASENAME -bo -F c > DATABASENAME.pgdump

Linux
/opt/unity_asset_server/bin/pg_dump -U admin -h localhost DATABASENAME -bo -F c > DATABASENAME.pgdump

Windows
"%ProgramFiles%\Unity\AssetServer\bin\pg_dump.exe" -U admin -h localhost -bo -F t -f DATABASENAME.pgdump DATABASENAME

Restoring a Backup

To restore a backup of an Asset Server database, run the following command, replacing DATABASENAME with the name of the desired database, pulled from your "databasename" list produced earlier.

Mac OS X
/Library/UnityAssetServer/bin/pg_restore -U admin -h localhost -c -F c -d DATABASENAME < DATABASENAME.pgdump

Linux
/opt/unity_asset_server/bin/pg_restore -U admin -h localhost -c -F c -d DATABASENAME < DATABASENAME.pgdump

Windows
"%ProgramFiles%\Unity\AssetServer\bin\pg_restore.exe" -U admin -h localhost -c -F t -d DATABASENAME DATABASENAME.pgdump

If you are restoring to a new database that doesn't exist yet, you should create a new Project first inside the Asset Server Administration dialog, then restore to this empty database. This is a much preferred way than using the -C option.

Deleting a Database

Note: You cannot undo this command, so it is recommended that you have a backup first.

To delete an Asset Server database including all data, run the following command, replacing DATABASENAME with the name of the desired database, pulled from your "databasename" list produced earlier.

Mac OS X
/Library/UnityAssetServer/bin/dropdb -U admin -h localhost -d DATABASENAME

Linux
/opt/unity_asset_server/bin/dropdb -U admin -h localhost -d DATABASENAME

Windows
"%ProgramFiles%\Unity\AssetServer\bin\dropdb.exe" -U admin -h localhost DATABASENAME

Deleting User Accounts

Note: Be careful not to remove any system accounts (such as admin or unitysrv) or you might render your Asset Server installation unusable.

You can enable or disable user access for individual projects in the built-in administration tool, but to completely remove a user from the server, run the following command, replacing USERNAME with the user name of the user you want to remove.

Mac OS X
/Library/UnityAssetServer/bin/dropuser -U admin -h localhost -d USERNAME

Linux
/opt/unity_asset_server/bin/dropuser -U admin -h localhost -d USERNAME

Windows
"%ProgramFiles%\Unity\AssetServer\bin\dropuser.exe" -U admin -h localhost USERNAME

Additional SQL Functions

These and all other commands use tools from the PostgreSQL distribution. You can read more about these tools here: http://www.postgresql.org/docs/8.2/interactive/reference-client.html