Unity 5 - Cannot extend final type

Since upgrading my project to Unity 5 I’m getting this error with JS.

BCE0103: Cannot extend final type ‘UnityEditor.Menu’.

Here’s my code for the class:

class Menu extends MonoBehaviour{

}

And then extending that:

class MenuMain extends Menu{

}

I’m not sure why this wouldn’t work. Has worked since Unity 3 through 4.

Is Menu an existing class in the UnityEditor namespace (ie. change your class names)

2 Likes

That just dawned on me now; it makes sense that the word “Menu” is probably used as a class. I’ll change it up now and report back…

Yup, that seems to be it. Now I have to deal with my class called “Audio”… I knew that one was going to come back to haunt me. :S

Just put them in your own namespace. Then you can use all the duplicated names you like.

EDIT: Just occured to me that you might not be able to do that in unityscript. Switch to C# :smile:

1 Like

It actually only took me about 20 minutes to actually hunt the classes down and change them. Everything works great now with no errors. Took me 2 hours tops to upgrade the project from 4.x to 5.x. Not bad at all!

OooOOoo. How’s 5?

I really haven’t taken it for a proper test drive. Been working on another game in 4.6. A game portal site wanted a WebGL version of an old game, so I decided to upgrade it. The WebGL version doesn’t work so well though. :frowning: