Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 Karnsteiner · Feb 07, 2016 at 07:59 PM · user interfacemaskscrollviewdrag-and-dropmasking

Is it possible to drag UI item from ScrollRect to elsewhere without mask blocking item?

Hi there. I have a class implementing IDropHandler used on rect transforms as a plane to drag items onto and another that implements the IDragHandler (and begin/end variants) to allow for dragging elements to and from the class dropping IDropHandler. This works perfectly on straight panels and items can be moved from one panel to another with no problems.

However, when using a ScrollRect with the IDropHandler class any items dragged from it are blocked from view by its Mask component until the item has been moved to another panel. Once it is on another panel, it can then be moved onto the ScrollRect IDropHandler instance with no mask problems; it only occurs when the IDragHandler class is still parented to the ScrollRect's content gameobject and thus still within the mask.

I've experimented with resetting the IDragHandler class's parent to null and various parents, but for all intents and purposes this has not solved the problem or added additional issues. Is there a way to enable dragging items from a ScrollRect's bounds without the Mask blocking it from view?

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 dtumolo · Oct 02, 2017 at 10:26 PM 0
Share

How did you get the objects in the scrollrect to get drag events? When I try something similar the scrollrect gets the drag events, and no dragging of objects happens.

avatar image ThomasBT · Apr 19, 2018 at 09:43 AM 0
Share

Don't suppose you can add the code, or at least where it came from, I am having a similar problem, I can't figure out how to make the drag drop go over the mask and the code we use may be different.

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by JoshuaMcKenzie · Feb 08, 2016 at 01:51 AM

you're close, you need to keep the draggable UI a child of a canvas for it to render properly, not set to null. so simply move it above the scrollrect and the mask in your canvas hierarchy.

since its not mentioned this should be noted just to be sure. for RectTransforms don't set transform.parent, but use transform.SetParent() instead. also be aware that setting parents can also mess up their scaling too. After calling SetParent() you usually want to call transform.localScale = Vector3.One;

Comment
Add comment · Show 2 · 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 Karnsteiner · Feb 08, 2016 at 03:14 PM 0
Share

I'll give this another shot and get back to you; I had not been using SetParent when attempting to remove it out of the mask. Thanks for the tip!

avatar image Snipe3000 · Jan 26, 2017 at 04:01 AM 0
Share

This worked great for me. Thanks.

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

7 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Scrolling content with ScrollRect does not stop scrolling.. 0 Answers

How to mask on a shader , limit a shader to an area in a ScrollView? 0 Answers

Masking camera from rectangular to arbitrary shape 0 Answers

GameObject/Sprite Masking - How to? 1 Answer

Paper Mario Path Effect 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