Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 BLISS · Jan 30, 2012 at 08:52 AM · mouse-over

how do i program the mouse over event

i'm new to java programming and i wanna program a mouse over event. to be more specific

i want different cars to appear at mouse over event (to choose a car from five different cars)

and when you click the button i want it a go to a specific scene. so how do i program mouse over event and application.loalevel()in the same button

please help

thank u!

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 fafase · Jan 30, 2012 at 10:00 AM 1
Share

First off, if you refer to a java manual for unity you will have trouble. It is javascript that is used. You will have to go through a whole GUI tutorial to fix you problem. You need to create the car object and a collision with the mouse to load the application. This is not done in 10 lines unfortunately.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by IgnoranceIsBliss · Jan 30, 2012 at 12:06 PM

Just as some hints to let you know where to look...

For 2D buttons, check out the 'GUI' classes in Unity. These will let you make text, buttons and other 2D objects that can be clicked and hovered over. You can use custom skin and backgrounds on your 'GUIStyle' class to try and draw different cars, if you like.

A little more tricky but more useful is doing it in 3D.

In this case, you put all of the cars in your scene and then - in a seperate layer - put an empty GameObject with a BoxCollider over each car.

Then you would make a Unity Behaviour that uses the Physics.Raycast and Camera.ScreenToWorldPos to fire a 'ray' (like a fake beam of light) into your scene from the mouse cursor to see what it might be hovering over. If it strikes one of those colliders, the mouse is over the car.

It's tricky - Unity is a 3D engine, not a 2D one. If you want a simple mouse-over on a 2D environment, I'd consider doing your game in HTML5 or Flash.

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

OnMouseOver is not working properly? 1 Answer

Screen.width & Screen.height Becoming button 0 Answers

Why is GUI texture not showing on mouse over in build? 1 Answer

How to change 3d text font on mouse enter? 1 Answer

OnMouseOver how does it work? 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