Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 TechSupportIncoming1 · Jul 28, 2015 at 12:07 PM · sprite

Rendering overlapped sprites w/ Alpha channel applied to background ones.

I would like to slide an arrow (by changing its RectTransform anchoredPosition) over a background line. The problem is that this arrow has an alpha channel that I want to be applied to the background line as well i.e. I want the background line region that is behind the arrow not to be rendered/to have 0 Alpha.

Hierarchy goes like this:

 Canvas
 |-lineRawImage
 |
 |-arrowRawImage

Also, here are two explanatory images to better understand the problem:

Expected behavior: alt text

Actual behavior: alt text

Apologize for my eye-bleeding Paint skills :P

I had couple ideas as candidate solutions but they are not suitable/practical:

1- Merging the arrow and the background line into one image and scorlling it left and right using a scrollrect and a mask.

2- Having pre-designed templates of for example 10 different states of where the arrow could be, and switching those sprites (templates).

overlappedsprite02.png (103.2 kB)
overlappedsprite01.png (50.1 kB)
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 TechSupportIncoming1 · Jul 29, 2015 at 10:23 AM

I solved the issue by extrapolating on my first idea lastly mentioned in the question; using a ScrollRect(with mask component, in fact there's no need for ScrollRect) and a line with more width solved the case. Now I just have to sync the RectTransform anchoredPosition of the arrow (that can slide left and right) with its counterpart in the hovered element in the 2nd red RectScroll area below the arrow. The goal of doing this is to merely make the arrow point to the right element in the scrollRect below it. Which is really daunting and requires lots of mathematical formulas :/ I got the hover event to fire up correctly but syncing the positions of two rect scrolls and performing correct scaling/clamping is really giving me a headache...

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

21 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

Related Questions

Sprite Swapping help 1 Answer

How can I get the height of a sprite? 1 Answer

2D character face another character 2 Answers

How to change the textureRect of a Sprite with a dynamic way? 0 Answers

how to decrease vertices number of a sprite 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