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 majidarif · Sep 11, 2015 at 04:40 PM · unity 5unity5

Carousel or Swipe Menu

I want to do a specific kind of effect, a demo can be found HERE. It has a set of image(menu) that can be carouseled by swiping. It has bullet points to denote the currently selected menu. It also show the currently centered menu to be larger than the others.

I'm not sure what this effect is called, but I wish to know how to do it in Unity 5.

Currently I have something like this:

 // menu items
 public GameObject Quest;
 public GameObject Vortex;
 public GameObject RaidBattle;
 public GameObject Randall;
 public GameObject Arena;

 // menu item bullets
 public GameObject bulletQuest;
 public GameObject bulletVortex;
 public GameObject bulletRaidBattle;
 public GameObject bulletRandall;
 public GameObject bulletArena;

 // other public
 public GameObject centerPoint;

 // private
 private GameObject firstItem;
 private GameObject lastItem;
 private GameObject chosenItem;

 private bool isHolding = false;

 // quest is always the center menu on load
 void Start () {
     chosenItem = Quest;
 }

 void Update () {
     Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
     Vector2 touchPos = new Vector2(mousePos.x, mousePos.y);

     // left click (should be touch)
     if (Input.GetMouseButtonDown (0) && !isHolding) {
         // check if collided with a sprite
         if (chosenItem.GetComponent<BoxCollider2D>() == Physics2D.OverlapPoint(touchPos)) {
             isHolding = true;
         }
     }

     // release left click
     if (Input.GetMouseButtonUp (0) && isHolding) isHolding = false;

     // holding on
     if (isHolding) {
         transform.localPosition = new Vector3(mousePos.x, transform.localPosition.y, 1f);
     }

     // check collision between center and a menu
     Debug.Log (centerPoint.GetComponent<BoxCollider2D>()) ;
 }

But I'm already starting to get confused on what to do next. I guess I need to steply grow and shrink the localScale of the gameObjects but:

  • How do I know if which one is currently in the center?

  • How do I make it snap to the center?

  • How do I consider the force of the swipe to make it revolve per menu item?

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

Answer by Coder1983 · Jan 21, 2017 at 05:18 PM

You can try this asset. https://www.assetstore.unity3d.com/#!/content/79251

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

[Unity3d 5.1] Multiplayer - Multiple match - dedicated server 1 Answer

Audio doesn't play when "Play on awake" is unticked 0 Answers

Why is it taking Unity so long to process video's? 0 Answers

Trees that I painted on terrain are really dark and also missing parts in it's hirearchy... 0 Answers

What this error means? 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