Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by AarshSinghVishen · Dec 20, 2017 at 01:04 PM · unity 5uibuttonsvuforiavirtual

Deleting virtual buttons in vuforia unity ar.

Hi, I have a virtual button in my scene that I would like to destroy and I have the following script for it:

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using Vuforia;

public class Vbutton: MonoBehaviour, IVirtualButtonEventHandler

{

GameObject gb ;

 void Start()

 {

     GetComponent<VirtualButtonBehaviour>().RegisterEventHandler(this);

    

 }



 void IVirtualButtonEventHandler.OnButtonPressed(VirtualButtonBehaviour Virtualbutton)

 {

     if (this.transform.parent.gameObject)

     {

         Debug.Log("button Pressed");

         CancelInvoke("IVirtualButtonEventHandler");

         CancelInvoke(" IVirtualButtonEventHandler");

         Destroy(this.transform.parent.gameObject);

     }

 }

 void IVirtualButtonEventHandler.OnButtonReleased(VirtualButtonBehaviour Virtualbutton)

 {

    



 }

}

But i get the following HUMONGOUS error that I just do not get. Any suggestions?

Exception in callback: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> UnityEngine.MissingReferenceException: The object of type 'VirtualButtonBehaviour' has been destroyed but you are still trying to access it.

Your script should either check if it is null or you should not destroy the object.

at (wrapper managed-to-native) UnityEngine.Behaviour:get_enabled ()

at Vuforia.StateManager.UpdateVirtualButtons (Int32 numVirtualButtons, IntPtr virtualButtonPtr) [0x00000] in :0

at Vuforia.VuforiaManager.UpdateTrackers (FrameState frameState) [0x00000] in :0

at Vuforia.VuforiaManager.Update (ScreenOrientation counterRotation, System.Boolean& reapplyOldState) [0x00000] in :0

at Vuforia.VuforiaARController.UpdateStatePrivate (Boolean forceUpdate, Boolean reapplyOldState) [0x00000] in :0

at Vuforia.VuforiaARController.UpdateState (Boolean forceUpdate, Boolean reapplyOldState) [0x00000] in :0

at Vuforia.DigitalEyewearARController.Update () [0x00000] in :0

at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (object,object[],System.Exception&)

at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000d0] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:222

--- End of inner exception stack trace ---

at System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x000eb] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:232

at System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MethodBase.cs:115

at System.Delegate.DynamicInvokeImpl (System.Object[] args) [0x000b9] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:443

at System.MulticastDelegate.DynamicInvokeImpl (System.Object[] args) [0x00018] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/MulticastDelegate.cs:71

at System.Delegate.DynamicInvoke (System.Object[] args) [0x00000] in /Users/builduser/buildslave/mono/build/mcs/class/corlib/System/Delegate.cs:415

at Vuforia.DelegateHelper.InvokeDelegate (System.Delegate action, System.Object[] args) [0x00000] in :0

UnityEngine.Debug:LogError(Object)

Vuforia.DelegateHelper:InvokeDelegate(Delegate, Object[])

Vuforia.DelegateHelper:InvokeWithExceptionHandling(Action)

Vuforia.VuforiaBehaviour:Update()

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Lesliehdez · Feb 16, 2018 at 05:05 PM

Hi could you fix it? I am trying with the same, you press the button and the object do some transformation?

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

239 People are following this question.

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

Related Questions

Deleting virtual buttons 0 Answers

How to change the position of a button? 1 Answer

The type or namespace name Virtualbuttonabstactbehavour could not be found - Vuforia Virtual button help! 0 Answers

Giving a UI button a Color at Start 0 Answers

mask on UI scrollable list disappears in ARcamera(Vuforia) 0 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