Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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
1
Question by Novodantis 1 · Oct 30, 2010 at 09:56 PM · guiitweencallback

iTween multiple GUI elements with one callback

I'm using iTween.ValueTo to manipulate the buttons and other GUI objects I want to move. However, at the moment I have a seperate callback function for each one because it only takes one argument (the new value). For example:

iTween.ValueTo(gameObject, {"from":startBtn, "to":Rect(50,300,100,100), "time":.5, "onUpdate":"UpdateStartButton"});

function UpdateStartButton(pos:Rect) { startBtn = pos; }

This may be a bad way of doing it, please correct me if so. The problem with this method is I have many objects I want to move, and each one seems to need it's own function to callback and change the value.

I assume that using the hashtable it is possible to make the callback function take an additional argument (say, a Rect to update to) thereby making it possible to use one generic callback for all my ValueTo lines. However, I have no been able to find the correct syntax to do this.

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
2

Answer by pixelplacement · Nov 03, 2010 at 12:31 AM

Hey Alex,

Unfortunately that's the way it goes right now for ValueTo(). I'll admit it's a tad rough and cumbersome. I have a TON of things going on right now but I'll spare a few brain clicks here and there on looking into solving this better. I'm also hoping to get working on iTween 3.0 in a few months.

I wonder if you can somehow leverage the OnStart callback somehow with some trickery... ?

Good luck!

Comment
Add comment · Show 1 · 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 g8minhquan · Oct 17, 2014 at 04:00 AM 0
Share

You're just a great guy, pixelplacement. Thanks for all the effort you put into iTween

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

No one has followed this question yet.

Related Questions

Stuck with sliding GUI panels 0 Answers

move a gui element 1 Answer

using iTween.ValueTo for the rotation of a GameObject with RotateAround 1 Answer

iTween ValueTo FieldOfView isn't easing 1 Answer

iTween ValueTo onUpdateParams passing 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