• 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 diarafbi · Sep 08, 2014 at 01:31 PM · androidbuttonobject

Change 3D Object by pressing Gui Button

i,m work with unity 3d and vuforia to make an augmented reality, my question is, how to make 3d model change when gui button pressed exemple i have a two 3D model as a child called object1 and object2 on ImageTarget(parent). now i wanna make two Gui button "button1" and "button2" . and if i hit the "button1" 3d model "objet1" show up and if i hit the "button2" 3d model "objet2" show up, i use a C# script any one here can help me?

Comment
Add comment · Show 1
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 Josh Naylor ♦♦ · Sep 08, 2014 at 01:31 PM 0
Share

what have you tried so far, have you got any code we can help you with?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by aman_jha · Sep 08, 2014 at 04:35 PM

Make two functions and make two references for the two objects, like so:

 public class AwesomeClass () {
         public GameObject Object1;
         public GameObject Object2;
         
         void ButtonOneClicked () {
             Object1.SetActive(true);
             Object2.SetActive(false);
         }
         
         void ButtonTwoClicked () {
             Object1.SetActive(false);
             Object2.SetActive(true);
         }
     }
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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

BCE0019: 'position' is not a member of 'Object' 4 Answers

A few android questions. 0 Answers

how can i make a script that when you tilt the android something happens and make a button on android? 1 Answer

Enable/Disable GameObject Button script 1 Answer

[Android] Why does my enemy die no matter where I am in the 3D environment? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges