Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 TurboHermit · Mar 14, 2013 at 10:17 PM · textureoffsetcell

Animated Texture doesn't begin at first frame

Hi, I've been having this problem several times over several projects. I use the Extended Animated Texture script from here

Problem is: I instantiate prefabs with this script, but the animation won't always start at the first frame. Anyone has any idea how to prevent this?

Comment
Add comment · Show 1
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 TurboHermit · Mar 14, 2013 at 11:40 PM 0
Share

I've found additional information here

I've applied a piece of code that deter$$anonymous$$es the starting time of the instantiated object, which works. But somehow the animation plays really weird, with an fps that seems like 0.5. Also it still doesn't start at the first frame. Can someone shed some light on this issue?

1 Reply

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

Answer by Seth-Bergman · Mar 14, 2013 at 11:49 PM

going off of your first link, the problem lies with this line:

     var index : int = Time.time * fps;

Time.time goes off of the time the game started, what you want is to start with zero.. to do this ,we can zero out the individual time on creation.. just change/add the lines:

     var framesPerSecond = 1.0;
     var myStart : float;  //add this line

   function Start(){
     myStart = Time.time;   //add this
   }

 
   function Update(){

            var index : int = (Time.time-myStart) * framesPerSecond; //change this
   }
   

this way, we account for the amount of time that has passed between the game start and the creation of the object :)

Comment
Add comment · Show 2 · 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 TurboHermit · Mar 14, 2013 at 11:55 PM 0
Share

It's funny, I had the exact same thing except for the ()'s. Apparently, that solved the problem! Thanks man, you're a lifesaver.

avatar image Seth-Bergman · Mar 14, 2013 at 11:57 PM 0
Share

order of operations, multiplication comes first...

glad to help!

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

11 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

Related Questions

Read Y offset value of a Texture 1 Answer

Assigning UV Map to model at runtime 0 Answers

How Can I Make Materials Keep The Same Global Offset On Different Objects? 1 Answer

Offset textures individually into specific world directions 2 Answers

Remove annoying texture offset on custom mesh 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