Search Unity

How to enable/disable an AR Object on gui.button touch in Android

Discussion in 'Vuforia' started by Suyash999, Jan 25, 2018.

  1. Suyash999

    Suyash999

    Joined:
    Jan 25, 2018
    Posts:
    2
    I have multiple objects which i need to enable and disable using GUI touch buttons in Android on screen.. Can anyone help with the code for it ?
    By default it should have Camera And AR enabled.
     
  2. Vuforia-Strasza

    Vuforia-Strasza

    Official Vuforia Employee Vuforia

    Joined:
    Jun 13, 2017
    Posts:
    548
    Hello @Suyash999

    Are you looking for these buttons to enable and disable Unity objects or Vuforia trackables?
     
  3. Suyash999

    Suyash999

    Joined:
    Jan 25, 2018
    Posts:
    2
    I need the buttons to enable and disable unity objects
     
  4. theolagendijk

    theolagendijk

    Joined:
    Nov 12, 2014
    Posts:
    109
    Hi @Suyash999,

    It's not entirely clear what you mean by enabling / disabling an object. I assume you want to activate / deactivate a Unity GameObject in your game scene hierarchy?

    If you want to activate/deactivate a Unity GameObject you can use it's SetActive function with parameter true/false. There's a code example for that in the GameObject.SetActive documentation page ; https://docs.unity3d.com/ScriptReference/GameObject.SetActive.html

    If you want to enable / disable a GameObject's component ( a script attached to a GameObject ) then your best course of action depends on the specific component.
     
    Vuforia-Strasza likes this.