Content Performance Analyser is no longer loading

Copper Contributor

Since updating to the Mesh Unity Toolkit (v5.2315.6), the Content Performance Analyser window no longer opens in the Editor. The error message is:

NullReferenceException: Object reference not set to an instance of an object
Microsoft.Mesh.Toolkit.CPA.Editor.AnalyzerWindow.CreateGUI () (at ./Library/PackageCache/com.microsoft.mesh.toolkit@5.2315.6/mesh.toolkit.cpa/Editor/AnalyzerWindow.cs:96)

 This is the `c#` code it fails on:

var window = windowTemplate.Instantiate()

 ... and this looks like it is a VisualTreeAsset object from Unity UI Toolkit

private VisualTreeAsset windowTemplate;

 

7 Replies

Thanks @Lee_Probert for reporting this! I'll check this out and report back if there is a local workaround you can take. 

Good and bad news I wasn't able to reproduce this in v5.2315.6 - but I want to learn how we can fix it for you (and likely others).

 

If you select the AnalyzerWindow script in the Mesh Toolkit package, do you see a valid "Window Template" specified in the inspector? Or is it set to none?

 

Unity editorUnity editor

@CameronMicka 

Apologies for the confusion ... I am logged in with another account and cannot find a way to switch accounts on this forum.
I have another project using Mesh that is working fine. It has the same Unity version and the same SDK.
Here's a screenshot of the Inspector with the file you have shown above selected. As you can see, there is something definitely wrong with the compilation of that script.

 

Do you think it is the capitalisation of CPA in the namespace?

 

Mesh_CPA_Error.png

Thanks for the extra info! Could you try closing Unity and deleting your Unity project's "Library" folder? Or if you are using git (and have everything committed) you can perform a `git clean -xdf` - this might be a Unity bug I've encountered before.

I have an idea on how to make loading the VisualTreeAsset more robust which I may try as well for future Mesh releases.

@CameronMicka 

 

Deleting the library fixed it. Do you think it has anything to do with the capitalisation in the namespace? 

@Weald_Spatial thanks for verifying that! I think this is a Unity 2022 bug we are trying to track down.

 

The idea that it could be capitalization in the namespace is interesting, I'm honestly not sure. I wouldn't think that would cause this issue? I'm working on some changes to make this more robust, so this doesn't happen to other people too. 

I forgot to mention I added more "fail safes" to this happening again so it shouldn't occur in Mesh Toolkit 5.2402+. Please let me know if you see it again!