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 /
  • Help Room /
avatar image
0
Question by GamingOink · Nov 09, 2018 at 02:23 AM · lerpif-statementsbooleans

complete code in an if-statement even if statement turn false

The current problem right now is I have a movement function, specifically Vector2.Lerp(), inside an if statement. What I want to happen is if the if-statement is true, the Lerp should activate and finish. But before the Lerp activates, I need to make the conditions in the if-statement false and still have the Lerp complete, how would I do that? Right now it stops because the if statement turns false.

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

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by mjboga29 · Nov 09, 2018 at 02:39 AM

In the code, after the Lerp activates, put in "WaitForSeconds(1f)" that should give time for it to activate, and after one second the code will continue and then the if statement will be false. Im not 100% sure if this will work but you can try. Sry if it didnt help

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 GamingOink · Nov 09, 2018 at 03:39 AM 0
Share

This won't make the Lerp continue if I make the condition that the Lerp is in false. Thanks for the answer though.

avatar image
0

Answer by Nivbot · Nov 09, 2018 at 03:21 AM

 If (originalBool || lerpBool)
 {
   oringinalBool == false;
 vector3.Lerp(blah blah);
 If(whatever makes lerp stop)
 {
    lerpBool == false;
 }
 }
Comment
Add comment · Show 6 · 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 mjboga29 · Nov 09, 2018 at 03:23 AM 0
Share

his way is better, trust him

avatar image Nivbot · Nov 09, 2018 at 03:28 AM 0
Share

Oops that should be = false not == false;

avatar image GamingOink · Nov 09, 2018 at 03:38 AM 0
Share

Im sorry, but what do you mean by "whatever makes Lerp stop"?

avatar image GamingOink · Nov 09, 2018 at 03:40 AM 0
Share

I also do not think this will work. i need to able to interrupt the if statement mid Lerp.

avatar image Nivbot GamingOink · Nov 09, 2018 at 05:02 AM 0
Share

What I meant by whatever makes the lerp stop is just that. Did it reach the destination or did something happen that you want to stop it. The way it is written allows you to set the original bool to false and allows you and continue the lerp if that's what you wanted to do.

avatar image Nivbot · Nov 09, 2018 at 05:08 AM 0
Share

Or, you can always just separate them If(OriginalBool == true) { OriginalBool = false; lerpBool = true; } if(lerpBool == true) { //do lerp stuff here }

Otherwise I'm not sure what you are really trying to do

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

97 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

Related Questions

If statement not getting called after Lerping a Scale 1 Answer

Problem with IF-statement 2 Answers

Issue with if-statements requiring two conditions. 1 Answer

How to return an index value from an array 1 Answer

Referencing a Boolean from another script 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