Hi all,
I’ve been noticing some errors after upgrading our project to 2018.1b12 from b11. It looks like Unity has added some enforcing of the Component submenus, where validate functions are now necessary. The problem is that many of the external plugins we have, are written without validate functions for their menus, and if those menus were placed in the Component submenu, then this causes errors.
Here’s a simple repro:
- Create a new project.
- Create this script.
using UnityEditor;
using UnityEngine;
public static class Potato
{
[MenuItem("Component/Potato")]
public static void Potate()
{
Debug.Log("Potato");
}
}
Compile and access the component menu, and you’ll see the error in the console after clicking it.
Ok, you may say - that’s not a big deal - update that yourself and add a validation component or use the AddComponentMenu
attribute. Well, the problem is when it comes not from my own code, but from third party assets that are using say [MenuComponent("Component/ThirdPartyAsset")]
.
Some examples, from, say the Obi rope plugin we’re using:
Now in this case, I have access to the code because I have the source code and can tweak it. But other things are using DLLs that have those menu items hardcoded and I can’t change those.
Additionally, I don’t know when or why this is happening, but at random times, the error messages will just pop up randomly, even in gameplay, which sucks if you have Error-Pause turned on to diagnose all errors.
Anyway - I’m not sure if this is a regression or not - it looks pretty clear that things coming from the Component Menu need a validate function now, and without it won’t exactly work, but the error that’s coming out is a bit annoying and I can’t do anything if it comes from compiled DLLs.
It happens sometimes when I boot unity and then at random other times, even though I’m not using the Component menu or even using those features at all.