Unity AssetServer – FATAL: could not reattach to shared memory

If you run into an issue where the Unity AssetServer fails to start, try a simple restart of the server in the first instance.  There are a heap of posts indicating it is postgres related but I have not gotten to the root of the error.  So far a simple restart of the server seems to clear the shared memory lock but I will be making regular backups as well as at least one person has not been so lucky.

LOG:  database system was interrupted; last known up at 2014-11-12 04:06:49 GMT
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  record with zero length at 1/F3E78290
LOG:  redo is not required
LOG:  database system is ready to accept connections
FATAL:  could not reattach to shared memory (key=256, addr=018D0000): 487
LOG:  background writer process (PID 2132) exited with exit code 1
LOG:  terminating any other active server processes
FATAL:  could not reattach to shared memory (key=256, addr=018D0000): 487
LOG:  autovacuum launcher started
LOG:  all server processes terminated; reinitializing
FATAL:  pre-existing shared memory block is still in use
HINT:  Check if there are any old server processes still running, and terminate them.

Asset Server on Azure

There are many advantages and disadvantages of using hosted team collaboration services like Visual Studio Online, Git and Subversion compared with the Unity Asset Server.  In some situations, standing up a self-hosted source control repository is a good choice.

Unity Asset Server is only available with a Team License holder.

The following are the steps required to create a Unity Asset Server on the Azure.  Assuming an Azure subscription is already in place, the first step is to provision a new virtual machine.  As we do not require any additional features, a quick create will suffice:


The setup is very simple.  A DNS name that has not been currently registered is required and some information about what type of VM.  For my purposes I went with the most inexpensive option with the idea that I could scale up as required (an advantage of using Azure to host the VM).  The user name and password specified here is primarily for remote desktop access to the VM.


Once the server has been fully created, connect to the server from the virtual machine dashboard:


Once a connection has been made then install Unity Asset Server.  Before this can be done though the .Net Framework version needs to be updated to include 3.5.  The first step is to start the Server Manager dashboard (at the bottom of the screen):


The next step is to enable a new feature:


The wizard will take you through several steps.  Most notably are selecting the type of feature-based installation:


The particular server needs to be selected:


Finally the framework needs to be selected:


Once this is complete, then the Asset Server can be installed.  The easiest way is to download the package via the Unity Collaboration page.  The setup is uneventful except for an Asset Server Admin password is required.  This password will be used to create projects and users on the Asset Server from the Unity IDE.


The Asset Server should then start and should display that it is running successfully:


Now for connectivity to the server remotely.  Back in the Azure Management Portal, the accessible endpoints are listed on the endpoints section of the VM:


Click ADD to launch the endpoint wizard.  As this is for a single VM, select the Add a stand-alone endpoint option:


On the next page the details of the endpoint are specified:


Great.  We are done!  The simplest way to verify the server is listening and available is to use a simple test test.  I used paging as it is free and simple:


From here, there are many posts about how to setup the Asset Server including:

Asset Server

Setting up Asset Server with Unity3D over local-network

Debugging Unity with Visual Studio

Congrats to SyntaxTree on being acquired by Microsoft.  I look forward to seeing more innovation in from SyntaxTree and Microsoft in regards to Unity.

You can download the latest tools from the Visual Studio Gallery and install them as normal.

After starting Unity you will see a new Asset available as Visual Studio 2013 Tools:


This will bring in two new dlls into the Unity IDE:


If you want to debug your solution in Visual Studio, check the build settings to allow Visual Studio to connect:



Winner KiwiGameStarter 2014

Great news!  Phantasmal has won the KiwiGameStarter 2014 competition run by the New Zealand Game Developers Association Incorporated (NZGDA).

KiwiGameStarter 2014 is a business start-up competition for New Zealand-based game development teams. Its purpose is to support the commercial success of one high-potential team or project

So what does it mean.  Kudos, a sense of achievement and

  • $10,000 cash
  • One one-year license for Autodesk Maya LT
  • One commercial suite license for Unity 3D
  • public relations and marketing strategy advice from Pursuit Public Relations to the value of $2,000
  • assistance by Hudson Gavin Martin (specialist Technology and IP lawyers) with the drafting of a licence agreement for the winning Entry to license the Winner’s Game to end users (worth $2,000 plus GST) and additional legal advice from Hudson Gavin Martin in relation to the Game up to the value of $2,000 plus GST
  • introductions from the NZGDA to experienced game development professionals in New Zealand (Mentors) who have expertise in a domain or genre relevant to the Winner’s Entry

The pressure is on.  If you haven’t done so, please head over and look at Steam Greenlight: http://steamcommunity.com/sharedfiles/filedetails/?id=291861158&result=1

Unity and UnityVS

When you are used to the power of Visual Studio, debugging Unity can be awkward and frustrating.  The common approach is to set debug messages in code, cross your fingers and hope when the game runs you set the message in the correct place for it to be useful.  This approach was fine in the ’80s when I had more patience, but now it is just painful.

I heard of SyntaxTree’s UnityVS from some more experienced Unity developers but they were put off by the price: ~$100 for an individual license.  They were not the only ones.

Hmmm…  the price did not sound to bad if UnityVS does what it says in the list of features.  The features I am interested in are Seamless Integration, Debugging, and the Unity Console within Visual Studio.

I had some time and with the free 14 day free trial, I decided to give UnityVS a test run.

Installation of UnityVS 2012

The UnityVS 14 day trial is given out per email address, and given a password supplied by email, the download (~7mb) and installation process was straightforward .

Sample Project

At the same time, I decided to take a look at the Unity 4.3 2D support by downloading the sample project from the Asset Store.


After downloading the package, I created a new project and selected the following packages:


First off, I opened the Level scene and gave the game a run.  Cool, my little character runs around the screen as expected.

I then found an interesting looking script attached to the hero and double clicked.  Visual Studio, my default script editor, launched and I am presented with a dialog to enter my UnityVS license that I received attached to my registration email:


As expected, Visual Studio correctly shows the scripts in the project; granted the display is more clear.  I like the Seamless Integration feature but still not worth $100.


Unity debug message

Let’s say we wanted to identify when the number of available bombs goes from 1 to 0.  A simple way would be to add the highlighted debug message in the LayBombs.cs script:


Now when the game is run and the player runs out of bombs, the following is printed to the Unity console window:


Now with UnityVS

Let’s check out UnityVS now.  The first thing is to check the integration while the game is running in Unity.  I simply start the debugger in Visual Studio (F5).  UnityVS gives me a prompt at the bottom to let me know it is all ready:


And after some game play, yes the console is log messages are shown in the Error List window with the benefit of extra information.  Nice feature!


Now, let’s get rid of the code to write the debug message and set a breakpoint when the number of bombs is decremented.


Now when the breakpoint is triggered when a bomb is laid, and as expected, a view of the variables in scope are available:


It is important to note that gameplay stops while the breakpoint is active.

Why Visual Studio?

For those that might not be familiar with Visual Studio, there are many cool features.  Just to illustrate one, I decided to change the breakpoint to only fire when the number of bombs becomes 0.  To do this simply set a condition to the breakpoint by selecting the condition option on the breakpoint:


and entering in the following evaluation:


Now the breakpoint will only trigger when the bombs run out.  The great thing here is your code does not become clouded with pointless debug messages.

Definitely worth the price.


Unity and crazy bullets

I worked on a game with Eyemobi recently called Split Screen Arena.  One of the issues I encountered, as a Unity newbie, was a funny issue with the main characters’ bullets.  The issue was the bullets were interacting with other bullets and other items.  The effect was rather funny as bullets would collide and veer off in different directions.  Funny but still buggie.

The reason was that the bullets were interacting with the physics world.  What I wanted to achieve is just have the bullets project in a straight line from the character and identify when they collided with another game object.

This is how I solved this issue.  First of all the objects were marked as kinematic.  This made the objects so they would not be manipulated by the physics object.  Great, my bullets would now shoot away and not veer off… but I was detecting the collision in OnCollisionEnter() which now was not firing.

The solution was simple, on the monster prefabs I had to set their collider object as Is Trigger.  This then caused the OnTriggerEvent() to start firing.  With a simple parameter change my existing logic worked!

Nice and simple…

Construct2 AzureGames Plug-in version 1.2

The AzureGames plug-in for Construct2 has been added to support additional functionality:

  • GetGameDefinition
  • Facebook Authentication
  • Windows Live Authentication
  • Google Authentication
  • Get High Score
  • Submit High Score
  • GetLeaderboard
  • UpdateUsername

At the moment, when a user authenticates for the first time, a default username is generated by combining a adjective and noun (e.g. LazyRabbit).  The defaulted username is guaranteed to be unique within AzureGames.  If the user wants to change the username, then they can by using the UpdateUsername() API.