• 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 /
  • Help Room /
avatar image
0
Question by NorthStar79 · Mar 28, 2017 at 12:24 PM · ui

UI Slider Wont Work when i add event trigger to handle

UI slider Wont Work properly when i add event trigger to handle .

is there any way to fix this ?

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 hexagonius · Mar 28, 2017 at 05:30 PM 0
Share

you mean just adding the EventTrigger component results in the slider not working anymore? I doubt that. Please be more precise on what you did and try to get the slider working and slowing working towards the problem first.

avatar image NorthStar79 hexagonius · Mar 29, 2017 at 06:10 AM 0
Share

Okay let me explain more :) for reproduce this problem , add UI slider to scene , find handle in hierarchy (hierarchy>canvas>Slider>Handle Slide Area > Handle) Add Event Trigger.

after this steps, you can not move slider by draging handle, but you can adjust slider value by clicking it.

so what should i do for solve this problem.

1 Reply

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by SohailBukhari · Mar 29, 2017 at 06:51 AM

Attaching Event Trigger Means You are using your custom events to move slider knob.So if you want to move custom knob as your on way then handle its events in the script and assign in the event.

Comment
Add comment · Show 3 · 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 NorthStar79 · Mar 29, 2017 at 07:52 AM 0
Share

you are pointed a good point . i understand now why this problem occurs but still havent figure it out how to make it works. but thanks :)

i am trying to use slider as catapult , like when you drag the handle and release it it fires an arrow . so i added onPointerDown and onPointerUp events to handle , bu this time i cannot slide hanlde trough slider because as you said its drag event isn't handling by slider anymore. i got this, but still dont know what to do for fix this.

avatar image SohailBukhari NorthStar79 · Mar 29, 2017 at 08:11 AM 1
Share

Using onPointerDown means event will fire when you keep finger on your object and onPointerUp means event will not fire continuously.

Ins$$anonymous$$d of using onPointerDown and onPointerUp events use the onValueChanged event of slider class.

 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI; // Required when Using UI elements.
 
 public class SliderChangeValue: $$anonymous$$onoBehaviour 
 {
     public Slider mainSlider;
     
     public void Start()
     {
         //Adds a listener to the main slider and invokes a method when the value changes.
         mainSlider.onValueChanged.AddListener (delegate {ValueChangeCheck ();});
     }
     
     // Invoked when the value of the slider changes.
     public void ValueChangeCheck()
     {
         Debug.Log (mainSlider.value);
     }
 }
avatar image NorthStar79 SohailBukhari · Mar 29, 2017 at 08:16 AM 0
Share

onValueChange wont get my job done , because i need to know when player released "knob"

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

135 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 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 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 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 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

How can I raycast gameobjects with specific layer ? 1 Answer

Detecting if is currently entering text on any component. 0 Answers

UI bug, some boxes appear when I click on an item 0 Answers

How do you access the text value of the Dropdown UI? 6 Answers

GUI on a secondary display 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