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 JamesJLinden · Dec 12, 2014 at 12:57 AM · uibuttonngui

Unity Button Without an Image?

I want to create a button whose clickable area is only specified by a BoxCollider with Unity's new UI (similar to how you would do it from within NGUI). I can't get a Unity Button to work without the presence of an Image component (which ultimately represents the clickable area of the button).

alt text

Comment
Add comment · Show 2
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 Vurawid · Dec 12, 2014 at 01:58 AM 0
Share

Do you need to use the UI button? If just need to detect a click on the object, you could create a script and attach it. Here are a couple related answers...

Clicking on objects

Use raycast to click on object

avatar image JamesJLinden · Dec 12, 2014 at 02:02 AM 0
Share

I do need the UIButton unfortunately.

2 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by VesuvianPrime · Dec 12, 2014 at 04:06 AM

As a workaround, can you use a transparent image?

Comment
Add comment · Show 6 · 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 JamesJLinden · Dec 12, 2014 at 06:22 PM 0
Share

Yes, this works. Feels pretty hacky though. Not sure about side-effects. Guessing there's no way to know if there's any runtime overhead for having a spriteless Image right?

avatar image VesuvianPrime · Dec 12, 2014 at 06:27 PM 0
Share

I concur it's hacky, but it's not worth dwelling on if it keeps you moving with the rest of the game.

avatar image Jinja · Jul 28, 2015 at 09:23 PM 0
Share

Anyone figure out how to do this without a blank image? I notice that the blank image is using a drawcall which I need to remove.

avatar image JamesJLinden · Jul 28, 2015 at 11:55 PM 0
Share

@Jinja Seconding Jinja's question, would love to get rid of the extra draw call created by the pure alpha image.

avatar image Jinja · Jul 29, 2015 at 12:09 AM 0
Share

I managed to dodge a drawcall by using an image from the current atlas. Also, ins$$anonymous$$d of using NONE as the Source Image to draw a solid colour block, add a small white texture to the relevant atlas and use that ins$$anonymous$$d. NONE seems to add a extra draw call too. These are still hack solutions that shouldn't be required, but at least the extra draw calls can be dodged, even if the fill rate is still being wasted.

Show more comments
avatar image
0

Answer by Neil-Kemojo-Martin · Oct 26, 2017 at 09:24 PM

This thread has an answer. Create a component that inherits Graphic, and use that instead of Image...

http://answers.unity3d.com/questions/1091618/ui-panel-without-image-component-as-raycast-target.html

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

29 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Button.OnClic.AddListener(delegate{method(object);}), wrong object sent 1 Answer

Button.onClick.AddListener(() => Attack()); isn't running function math correctly 1 Answer

While mouse is pressed and moved to a button, button should be pressed as well 0 Answers

Changing Color of Material with Bool and Unity UI 1 Answer

UI Buttons Not Working Except In Development 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