Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 a1468155 · Feb 20, 2014 at 11:17 PM · menuinvisiblevisibleappearreal-time

How do I make one object appear when I mouse over another object?

I am currently working on a menu, and I would like for another object in the scene to appear when I mouse over my 3D text.

The object in question is currently set to invisible using this script:

GetComponent(MeshRenderer).enabled = false;

My understanding is that if I set the value above to True, it will do the trick.

However,

  • Which object should I put that part of the script on?

  • And where in that script do I identify the object that I want to make visible?

Thank you.

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
Best Answer

Answer by MikeNewall · Feb 21, 2014 at 12:20 AM

Attach this script to your text. Assign the object you want to show to the menuObject variable in the inspector.

 public GameObject menuObject;

 void Start(){
     menuObject.renderer.enabled = false;
 }

 void OnMouseOver(){
     menuObject.renderer.enabled = true;
 }

Just so you know a Gameobject has a property which gets its renderer if it has one attached so you don't need to get the component :)

Comment
Add comment · Show 4 · 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 a1468155 · Feb 22, 2014 at 10:41 PM 0
Share

Thank you for the reply! I did get an error upon attaching that script to the 3D text object:

Assets/invisibleVisible.js(3,12): BCE0043: Unexpected token: GameObject.

avatar image robertbu · Feb 22, 2014 at 10:45 PM 0
Share

@al468155 - the above script is C#. You pasted it into a Javascript file.

avatar image a1468155 · Feb 23, 2014 at 02:36 AM 0
Share

@$$anonymous$$ikeNewall and @robertbu, thank you both very much! I got it working right away! Perfect!!

avatar image getyour411 · Feb 23, 2014 at 02:38 AM 0
Share

Ins$$anonymous$$d of posting a follow up/thank you as another ANSWER (as you did here), please tick the 'Accept Answer' icon under the thumbs icons up there. I converted this one for you.

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

20 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

Related Questions

Mouse over make object Visible 2 Answers

Converting C# to JS: rendering a mesh 1 Answer

get object invisible for couple seconds and get visible again 1 Answer

how GUIText get visible? 2 Answers

Make invisible wall appear visible upon collision/detection 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