Avoid NullArgumentException when running in a Unity3D application

Fixes issue #320.