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 hijinxbassist · Apr 22, 2012 at 08:37 PM · texturetexture2dscale

Animating a Texture2D using cells

Hi,

Im trying to use the http://www.unifycommunity.com/wiki/?title=Animating_Tiled_texture_-_Extended>animating tile texture code from the Unify Community. I really like the idea, but im trying to figure out how to use this same principal on a texture2D copy instead of an objects material.

Is this possible? Or maybe too much work for the end result? If you know of a better way to do a tile animation on a texture, im all ears!

Thanks in advance!

Comment
Add comment · Show 5
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 syclamoth · Apr 23, 2012 at 01:17 AM 0
Share

I'm not sure I understand the question. Why would you want to do that? Almost all uses for texture2d objects work through materials- are you using this for GUI stuff?

avatar image hijinxbassist · Apr 23, 2012 at 05:44 AM 0
Share

@syclamoth yeah using it for gui stuff. $$anonymous$$ight be way to expensive to call, i might just make an array of textures and cycle through those ins$$anonymous$$d.

avatar image save · Apr 23, 2012 at 05:53 AM 1
Share

Using an array of textures sounds heavier than just offsetting one texture. Could you perhaps use a sprite attached to the camera and render it on top? It's easiest if you can use a material.

avatar image hijinxbassist · Apr 23, 2012 at 07:02 AM 0
Share

@save I will give it a try and see how it works.

avatar image hijinxbassist · Apr 24, 2012 at 08:56 PM 0
Share

@save i gave it a try, but didnt have any success. The graphics draw texture turned out to be exactly what i needed. Thanks for the suggestion tho. Cheers

1 Reply

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

Answer by flamy · Apr 23, 2012 at 07:18 AM

You can use the same method for GUI in a much simpler way using Graphics.DrawTexture()

You can use the same method from that unify link for calculating uvs and jus pass the UV values to the above function.

Having an array of textures would be heavy never ever prefer it. Even if you want to do it with multiple textures, you gotta use Resources.Load(), with an array of string for the path of the textures. Any way you gotta call this function often to keep the memory in check.

Hope it helps :)

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 hijinxbassist · Apr 23, 2012 at 07:30 PM 0
Share

@vijayakumar Im not sure exactly where the UV coords come into play in the Graphics.DrawTexture() function. Can you give me an example of usage? It would be greatly appreciated. So far this sounds like the path i want to take.

avatar image hijinxbassist · Apr 23, 2012 at 07:33 PM 1
Share

Oh...source rect. Awesome, lemme give it a test and post my success.

avatar image hijinxbassist · Apr 24, 2012 at 08:50 PM 0
Share

@vijayakumar Works like a charm! Didnt have time to test yesterday, but it only took a few $$anonymous$$utes today to convert. Only needed an additional variable and 2 lines.

Thanks for the great answer.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Resizing GUI textures 0 Answers

animating terrain texture question 1 Answer

Scaling / Resizing an Image (Texture2D) 6 Answers

How to not see white background on texture 1 Answer

how to post rawimage.texture to wwwPOST method to my server as a PNG 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