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 maggot · Mar 10, 2012 at 02:24 PM · c#guiraycastinputcapturing

Separating mouse button clicks from GUI and game input

In an imaginary game written in cSharp, I have a typical 3rd person controller and ground setup so I can walk about and punch with mouse or fire1 button. I also have a GUI menu on during gameplay to do things like cast spells - for example fireball. Now, casting fireball from the GUI and starting the punch event are separate actions, but how do I get it so when I click 'fireball' on the GUI it does not also start the punch event ?

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 Kleptomaniac · Mar 10, 2012 at 02:33 PM

I think that Rect.Contains(), as is described in this post by Christian H Pedersen, is your only option. Unfortunately, as he mentions, it really is a convoluted fix to what should be an easily solved problem within Unity. Until the engine itself provides better and more user-friendly control over problems like this, I think this may be the only fix.

Hopefully that helped ...

Klep

P.S - I'm a bit disconcerted as to what you mean by 'imaginary game' ... are you implying that we really are a part of the Matrix!? Mind blown (and childhood dreams realised)! ;)

Comment
Add comment · Show 5 · 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 Kleptomaniac · Mar 10, 2012 at 02:46 PM 0
Share

Just remember to take the red pill ... :D

Haha, glad I could help! Happy travels Alice!

avatar image maggot · Mar 10, 2012 at 02:51 PM 0
Share

neo[phyte] wants to have his $$anonymous$$d blown by morpheus. morpheus wants neo to blow his ...not just his $$anonymous$$d

The imaginary game scenario was a little easier to explain than the actual game scenario - thanks for your answer, I looked up that (link/)stinky rabbit hole, what I wanted was a working example. I've searched youtube also for tutorials to no avail.. The standard solution seems to be have the menu on a separate screen , for instance a game options menu screen, but that is not what I wanted

avatar image maggot · Mar 10, 2012 at 02:52 PM 0
Share

I wouldn't take any pills, that is my matrix solution ! :)

avatar image Kleptomaniac · Mar 10, 2012 at 03:09 PM 0
Share

O$$anonymous$$, try this on for size. Also uses Rect.Contains, but provides a working example. You may be able to mould it into what you want.

As I said, I believe Rect.Contains() is your only solution. Also, I found a lot of these other answers simply by Googling, so try to broaden your search before co$$anonymous$$g on UA. It isn't that I'm not happy to help you, but all I'm saying is that Neo had to get a tracking device in the form of an electronic bug sucked out of his belly button before he's able to 'find the truth', if you know what I mean. :D

Hope this helps, $$anonymous$$lep

avatar image maggot · Mar 10, 2012 at 05:45 PM 0
Share

Nope, none of them work with the latest Unity, I can't get Rect.Contains() to report that the mouse pointer is inside the Rectangle. I'll probably put GUI onto a separate screen, or assign new input (for example new fire buttons) and use those inputs to navigate the menu.

Temporary alternatives to waiting until the new GUI is released for Unity :D

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

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

GUI texture touch input problem 1 Answer

Updating GUI text with GetButtonDown? 1 Answer

Car AI help 0 Answers

gui list problem 2 Answers

How would I implement a GUI texture that acts as a slider? 0 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