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
0
Question by AngryOldMan · Mar 10, 2011 at 04:27 PM · buttontimescalesyntaxpress

Problem with finding the right syntax for time.

I'm hoping thats the correct way to phrase this question. I trying to increase an objects size a certain amount over 3 seconds. I have a script to instantiate the prefabed object. This is what I have so far.

var expand : Vector3 = new Vector3 (2,2,2);

function Update () { StopWhen(); }

function StopWhen () { transform.localScale = expand * Time.deltaTime; yield WaitForSeconds (3); Destroy (gameObject); }

Time.deltaTime obviously doesn't work as its the length of time it took to complete the last frame. Time.time doesn't work because after playing for say 30 seconds when you instantiate the object its HUGE because Time.time is the length of time since the game started or something there abouts. What I'm looking for is a syntax for time which means "the length of time since this button was last pressed" I understand that there may not be one (as I'v been lookin for a while now) and that I may have to script the functionality of a timer which starts/resets on a button press. Any help in this matter would be greatly appreciated, I'v put off asking this question and used cheating (not literally just more coding than necessary) and fixes to acheive similar things in similar situations but none of them can achieve the same result for 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
1
Best Answer

Answer by DaveA · Mar 10, 2011 at 04:37 PM

try transform.localScale += expand * Time.deltaTime;

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 AngryOldMan · Mar 10, 2011 at 04:45 PM 0
Share

You sir are a legend, I was so busy trying to mess around with the time syntax that I never thought to try change my equations. Thank you very much.

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

Checking to see how many times a button was pressed in a certain amount of time? 2 Answers

how to find time of a button pressed 2 Answers

A Question about Dot Syntax... 1 Answer

gui.button down 2 Answers

Scaling dynamic created buttons 2 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