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 Avash · Feb 28, 2015 at 04:08 PM · ui4.6

How should I check is pointer over an ui image?

I tried with Pointer Enter but that didn't work very well. http://postimg.org/image/z1dw3llyl/6c2abf4b/ It worked only when moving cursor from outside. Idea is that player should keep right mouse button pressed when selecting a segment.

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 Mmmpies · Feb 28, 2015 at 04:12 PM 0
Share

The EventTrigger PointerEnter should be used with PointerExit to switch a bool in script to true when entering and false when exiting. It is the correct way to go about this so what issues did you get?

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Mmmpies · Feb 28, 2015 at 04:36 PM

So set a bool as I said.

 private bool hovering = false;
 
 void Update()
 {
     if(hovering)
         Debug.Log(gameObject.name);
 }
 
 public void OnPointyEnter()
 {
     hovering = true;
 }
 
 public void OnPointyExit()
 {
     hovering = false;
 }

Of course in the Update you'll want to handle the Input from the right button but put this script on each image and change the name of each image so it reports back when over that image.

You also need to Add the PointerExit and PointerEnter for each button.

Not tested the code though so may contain typos!

Comment
Add comment · Show 1 · 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 Hanh · Sep 09, 2017 at 09:16 AM 0
Share

Best solution

avatar image
0

Answer by tayyab43 · Feb 28, 2015 at 04:19 PM

OnHover should be used

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 Avash · Feb 28, 2015 at 04:22 PM 0
Share

There is no such thing. http://s12.postimg.org/v6kgr8zhp/N_ytt_kuva_2015_02_28_kello_18_31_25.png

avatar image tayyab43 · Feb 28, 2015 at 04:26 PM 0
Share

oh your using Unitys new UI system, try adding this code:

http://docs.unity3d.com/ScriptReference/GUIStyle-onHover.html

avatar image Mmmpies · Feb 28, 2015 at 04:42 PM 0
Share

OnGUI is old UI system @tayyab43, the new system works with Events and I can highly recommend it, very very powerful and so much better than the old GUI. Got some issues (I don't care too much for the anchor system myself) but the Event System is a work of genius.

avatar image tayyab43 · Feb 28, 2015 at 04:45 PM 0
Share

true, i am using it but its just getting used to it is a bit annoying, im so used to the old system that i prefer using it for things like trying to to get buttons on certain places no matter what the screen size is and things like that.

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

22 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

Related Questions

[Unity 4.6] Button Tracking UI System? 0 Answers

(c#) Photon networking, get players in room? 1 Answer

4.6 UI Text rect does not expand automatically 2 Answers

Unity 4.6 button movement problem 1 Answer

[4.6 - UI] Keep aspect ratio 2 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