Monday, September 29, 2014

GetManagerFromContext: pointer to object of manager 'RenderSettings' crash in Unity3d

I recently encountered an issue using Unity3d where I was unable to create a build of a client's project because of a crash that occurred in the Unity Editor during build publishing.  Unfortunately I don't have an image of the crash message dialog, but essentially it said:

"Fatal error! GetManagerFromContext: pointer to object manager 'RenderSettings' is NULL"

which wasn't the most helpful message in the world.  I spent some time trying to track down any obvious issue in the code with no luck, so start looking on the Unity forum and found This forum post which described a very similar issue I was seeing.

Luckily it seems this was a known issue, apparently caused by assigning ProceduralMaterials to Material properties inside scripts.  There have been a couple of fixes for this particular problem recently, the Unity 4.5.4 release notes and Unity 4.5.4p2 release notes both mention fixes related to this issue.

Updating to the vanilla Unity 4.5.4 release from 4.5.3 fixed my particular crash.

TL;DR
If you're seeing a crash similar to what I posted above, and you use procedural materials in the project, try to update to Unity 4.5.4 or one of the patch releases and see if that fixes the issue