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 Malace · Nov 15, 2015 at 08:10 AM · c#unity 52duidrag-and-drop

C# UI list item drag onto 2d sprite in world space?

Hey all,

Is it possible to detect if a user drags a UI List item onto a 2d sprite in world space?

Working in C#

I currently have an icon at a base that shows up if there are any units at the base. At the moment you can drag the icon to another base in the 2d world space using simple 2d collisions. That moves the icon, and all units, and locks it down till x number of turns pass. Double clicking it(the unit icon) opens up a menu with a list of the unit objects at the base. UI Objects full of UI labels and an image created for each of the units at the base.

I would like for the user to be able to drag the unit from the UI list. To a different base object in world space. That way they can easily control where the units are on the map. However Dragging my UI doesn't seem to pick up when the UI element is over the base sprite with collisions.

Can this be done with simple collisions? Am I missing something in the scene setup? Or do I need to go to an event based system? Ray cast even?

I'm a bit hung up on the events arguments. The examples I've found. Haven't dealt with much detecting if a UI element is let go over a game object.

If you have any suggestions/references/examples of how you would go about this. That would be greatly appreciated. At the moment I'm working on other in game content. That will likely implement the same feature. So I'm using the tag "Base" for the 2d world locations. And "Unit_UI" for the UI element being dragged. So if object Unit_UI is dragged over any Base tagged game object and let go over it. It executes some code.

Again any and all help is appreciated.

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 Malace · Nov 19, 2015 at 07:04 PM 0
Share

Anyone have any advice or pointers on this? Still stuck on it.

0 Replies

· Add your reply
  • Sort: 

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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

prefabs inside content area not fitting entire width of content area? 0 Answers

How to create a turn based battle system? 3 Answers

My rigidbody2d is passing through the side of a collider2d but it's working on the top 0 Answers

2d image does not scale/stretch correctly 2 Answers

Any way to use multiple font styles within a single UI Text component? 1 Answer


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