Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by MC HALO · Sep 29, 2010 at 12:42 PM · upgradebce0019menu-item

Unity 3.0 help mee

Hello, i have just downloaded unity 3.0 and imported my old project into it.it updated my project and when it opened my project i had to attach my scripts back to all my objects. now the problem is on my main menu. the problem is i have entered this following line in to my script:

menuItems[MenuItem].OnSelected(true);

this line of code is just informing my game object to select the first menu item when the game loads. now in unity 2.6 this worked fine but as soon as downloaded 3.0 this error message keeps coming up:

Assets/Standard Assets/Scripts/MenuManager.js(14,21): BCE0019: 'OnSelected' is not a member of 'UnityEditor.MenuItem'.

CAN ANYONE PLEASE HELP ME

here is the script that is making the first object selectable:

var menuItems: MenuItem[];

var MySong: AudioClip;

var MySong2: AudioClip;

var currentMenuItem: int = 0;

var KeyDelay: float = 0.25;

function Start() { AudioSource.PlayClipAtPoint(MySong2,transform.position);

var lastMenuItem: int = currentMenuItem;

menuItems[MenuItem].OnSelected(true);

while(true) { if(Input.GetAxis("Vertical") > 0.9)

{ AudioSource.PlayClipAtPoint(MySong,transform.position);

lastMenuItem = currentMenuItem;

         currentMenuItem--;
         if(currentMenuItem < 0) currentMenuItem = 0;

         if(lastMenuItem!= currentMenuItem)

         menuItems[lastMenuItem].OnSelected(false);
         menuItems[currentMenuItem].OnSelected(true);

         yield new WaitForSeconds(KeyDelay);

 }
 else if(Input.GetAxis("Vertical") < -0.9)
 {
 AudioSource.PlayClipAtPoint(MySong,transform.position);
 lastMenuItem = currentMenuItem;
 currentMenuItem++;

 if(currentMenuItem >= menuItems.length) currentMenuItem = menuItems.length - 1;

         if(lastMenuItem!= currentMenuItem)

menuItems[lastMenuItem].OnSelected(false); menuItems[currentMenuItem].OnSelected(true);

         yield new WaitForSeconds(KeyDelay);
     }
     yield;
     if (Input.GetAxis("NewGame")){

     Application.LoadLevel (1);



     }

}

}

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Herman-Tulleken · Sep 29, 2010 at 01:46 PM 0
Share

Can you please format your code so that we can read it?

avatar image skovacs1 · Sep 29, 2010 at 02:13 PM 1
Share
  • on the code formatting. $$anonymous$$enuItem is an editor class and would only affect the editor. How was this supposed to work in-game?

avatar image spinaljack · Sep 29, 2010 at 06:21 PM 0
Share

you know you don't need to post every line of code you have, just the relevant bits is fine

avatar image MC HALO · Sep 30, 2010 at 03:15 AM 0
Share

@spinaljack

yea sorry about that lol

4 Replies

· Add your reply
  • Sort: 
avatar image
2
Best Answer

Answer by Darky.du · Oct 04, 2010 at 05:14 PM

Had the same problem, i changed my scripts name and designed the array again. Started to work for me at least. Seems unity 3.0 really have something called MenuItem already. Noticed that it highlited the MenuItem in the script, was kinda odd. Hope this helps.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MC HALO · Oct 05, 2010 at 12:39 AM 0
Share

Hmmm i will try that thank you. yea i noticed that in unity 3.0 $$anonymous$$enuItem is highlighted so i should just change the name of the array and it started to work for you. what was you array called before and what did you name it as now? please let me know i think this my actually work thank you very much Darky :) smiles all the way

avatar image Bampf · Oct 05, 2010 at 01:00 PM 0
Share

Isn't this exactly what I suggested earlier?.. I guess I can spare the 15 points from not being the Accepted answer any more; maybe you understood his answer better, so fair enough. But let me point out that you don't have to accept ANY answer until you know for sure that it solves your problem. Test first, THEN give D the points if it worked.

avatar image MC HALO · Oct 05, 2010 at 10:26 PM 0
Share

Haha No Bampf your answer is the exact same and it worked lol i don't know how the tick went to this reply lol sorry dude your answer worked :). No i was just writing back because i had nothing to do lol but you are the one that fixed my issue for me and i am very thank full because you helped me a lot :)

avatar image
1
Best Answer

Answer by Bampf · Oct 01, 2010 at 01:47 PM

Apparently menuItems[] is an array of MenuItem. But the reason everyone is so confused is that your examples don't look much like Unity's editor MenuItem's. For example, those are used with static functions, and yours aren't.

I'm wondering if maybe your code had its own MenuItem class, and during the conversion it got lost or is now getting overridden by the Unity or .NET MenuItem classes.

Go back to the original Unity 2.6 project and search through all the scripts (filenames and contents) for the string "MenuItem". If there is a class named MenuItem then make sure the same file(s) are in the Unity 3 project. You might also consider renaming your MenuItem class.

(Whatever you try, make sure you keep an unedited copy of the working, unconverted 2.6 project! That's your baseline as you try to get the Unity 3 version working.)

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MC HALO · Oct 02, 2010 at 12:39 AM 0
Share

thank you very much you are a great help and all your ideas are great :)

avatar image
1

Answer by uni · Sep 29, 2010 at 01:08 PM

This may sound dumb, but, try changing the name of the .js script. Maybe Unity 3 has a menu manager of it's own. I don't know. Just a quick suggestion.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MC HALO · Sep 29, 2010 at 01:09 PM 0
Share

not dumb at all i have tried that as well and same problem thanks 4 the idea buddy

avatar image
1

Answer by Bampf · Sep 29, 2010 at 05:15 PM

The error is occurring in a standard asset. Try upgrading the Standard Assets- this should replace the old script with one that was written for Unity 3. (I'm assuming that you didn't edit any of the standard assets- if you did, then this would overwrite your changes to them.)

Instructions for upgrading Standard Assets can be found at the bottom of this manual page.

Comment
Add comment · Show 6 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image MC HALO · Sep 30, 2010 at 02:57 AM 0
Share

Thanks for the idea but it still does not work...:( this is the error message that i get when i run the game:

Assets/Standard Assets/Scripts/Utility Scripts/$$anonymous$$y Scripts/$$anonymous$$enu$$anonymous$$anager.js(12,21): BCE0019: 'OnSelected' is not a member of 'UnityEditor.$$anonymous$$enuItem'.

i dont know if that helps lol

avatar image Bampf · Sep 30, 2010 at 03:05 AM 0
Share

I see. You put your script in a folder inside Standard Assets. (As a general rule, best to keep your stuff separate from built-in and third-party scripts. You can for instance drag $$anonymous$$y Scripts folder out of Standard Assets.)

avatar image Bampf · Sep 30, 2010 at 03:07 AM 0
Share

Where did you get this $$anonymous$$enu$$anonymous$$anager.js script from? Are you even using it? It does not appear to have any bearing on in-game menus.

avatar image MC HALO · Oct 01, 2010 at 12:42 PM 0
Share

The Script is $$anonymous$$e and it does relate to the gameObjects trust me it worked fine in unity 2.6 also i had some help on the script from a mate

avatar image MC HALO · Oct 01, 2010 at 12:44 PM 0
Share

@Bampf Yea i will give that a try as well thanks :)

Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Issues with 3.3 to 3.4 javascript update 1 Answer

Problem with upgrading project to untiy 3. 1 Answer

Missing GameObject properties for upgraded project 1 Answer

Script acts differently since upgrade to Unity 3 5 Answers

Unity 3.0 Upgrade ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges