Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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
3
Question by Ionus101 · Jul 28, 2015 at 06:35 PM · buttonreferencemissingonclickmissing-reference

Method reference dropping from OnClick()

Problem: A method referenced by one of my buttons randomly comes up as "Missing":

alt text

Details: The referenced method is not static, although that shouldn't be an issue in 5. Here's the referenced script:

 using UnityEngine;
 using System.Collections;
 
 public class MenuManager : MonoBehaviour
 {
     // …
     //Referenced method
     public void ShowMenu(Menu menu)
     {
         if(menu.IsPopup == false)
         {
             //Closes the current menu
             if(CurrentMenu != null)
             {
                 CurrentMenu.IsOpen = false;
                 CurrentMenu.IsActive = false;
             }
             
             //Sets new menu (target of function) to CurrentMenu, and opens current menu
             CurrentMenu = menu;
             CurrentMenu.IsOpen = true;
             CurrentMenu.IsActive = true;
         }
         else
         {
             if(CurrentMenu != null)
             {
                 CurrentMenu.IsOpen = false;
                 CurrentMenu.IsActive = true;
             }
             
             CurrentMenu = menu;
             CurrentMenu.IsOpen = true;
             CurrentMenu.IsActive = true;
             
         }
     }
 }


The object that OnClick is referencing has the component script on it, and the method in the component shows up in the OnClick drop-down menu in editor:

alt text

Attempted Solutions: I'll replace the missing reference by reselecting it from the drop-down menu. Then I save and close Unity, reopen it a few times or work on other scripts, and the method shows up as Missing again. I've tried recreating the button wholesale, renaming the script, moving the script to a difference object in the Hierarchy and referencing it there-- all to no avail.

Desperately seeking help. Thanks for looking.

untitled-picture.png (13.5 kB)
untitled-picture2.png (51.9 kB)
Comment
Add comment · Show 5
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 Positive7 · Jul 28, 2015 at 06:59 PM 0
Share

Haven't seen this issue since Unity 3 (0.0d I think) By any chance it is a prefab?

avatar image meat5000 ♦ · Jul 28, 2015 at 07:12 PM 0
Share

Two you have two conflicting scripts? By title or by classname?

avatar image Ionus101 · Jul 29, 2015 at 01:32 PM 0
Share

@Positive- Not using prefabs anywhere in this scene, good suggestion though. You said you've seen this in Unity 3?

@meat5000- I'll check for conflicting scripts, but I don't think I have any of the same name/class.

avatar image Positive7 · Jul 29, 2015 at 04:09 PM 0
Share

Yes I had this issue in Unity 3 Here is the related forum talk about it but it was when using prefabs. http://www.tasharen.com/forum/index.php?topic=5937.0

avatar image Ionus101 · Jul 30, 2015 at 04:05 PM 0
Share

No conflicting scripts or class names that I can find. Still no idea what's causing this behavior.

I notice that whenever I "fix" it, and then open and re-save the script, the method shows up as $$anonymous$$issing again. I have a feeling that something in Unity or my source control (GitHub) is resaving or rewriting the script on startup and causing the error. I still don't know how to fix it.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by kblood · Jul 31, 2017 at 08:31 AM

I am currently looking into this as well. What you got so far seems interesting.

Since this is from 2015, maybe you found a solution?

Comment
Add comment · 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

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Reference For Button Which Calls OnClick 4 Answers

[Solved] Button OnClick properties are missing after loading the scene 4 Answers

Button Listener Takes Reference But I Want to Pass Value? 1 Answer

How to trigger a button click from script 3 Answers

Button OnClick() only being called once? 3 Answers


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