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 cariaga · Sep 15, 2013 at 05:49 PM · mathfrange

Range repeat? like 50 to 100 then back to 50

i'm not sure if this was already asked before Mathf.Repeat always start at zero how do i make it start on what number i want?

noob question

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 YoungDeveloper · Sep 15, 2013 at 06:02 PM 0
Share

Could you explain a bit more what you want ?

avatar image cariaga YoungDeveloper · Sep 15, 2013 at 06:06 PM 0
Share

textAtlasScript.textureIndex=(int)$$anonymous$$athf.Repeat (Time.time*Time$$anonymous$$ultiplier, 100); this code currently does is index 1 to 100 but i want to start at a different index or number

1 Reply

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

Answer by Peter G · Sep 15, 2013 at 06:06 PM

You should just be able to add the initial value to the result of Mathf.Repeat()

 var answer = 50f + Mathf.Repeat( Time.time * TimeMultiplier , 50);
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 cariaga · Sep 15, 2013 at 06:36 PM 0
Share

it kinda worked when i print it but when applied it to textAtlasScript.textureIndex=(int)answer; it was out of range weird

it did start at 50

avatar image Peter G · Sep 15, 2013 at 06:53 PM 0
Share

That's a problem with something else. This code isn't indexing anything so it's a problem in textAtlasScript. It's probably one of the endpoints. Are you trying to include both 50 and 100? trying to include 100 but not 50 i.e. (50,100] in interval notation. If that's the goal, change the starting index to 51.

avatar image cariaga · Sep 16, 2013 at 11:43 AM 0
Share

if only repeat can do this $$anonymous$$athf.Repeat(timer,startpoint,endpoint) ins$$anonymous$$d of starting from zero to length i needed both ends to be adjustable e.g var start = 5; var end = 10; i think this is what i really want the result to be 5,6,7,8,9,10,5,6,7,8,9,10,5,6,7,8,9,10 i know you can do this in a for loop and an if statement i just want to know if repeat can do this i guess the length in repeat means the Distance NOT the End Point thanks for answering!

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

17 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

Related Questions

Int Based PingPong or oscillation without using Mathf.Pingpong? 2 Answers

Map the difference of two numbers to a certain min and max range 2 Answers

Problems With Mathf.InverseLerp 1 Answer

Mathf.Lerp is just jumping to maximum, no 5.0 interpolation. 1 Answer

NaN error for Mathf.Asin 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