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 Milkshanks · Feb 10, 2017 at 07:34 PM · animationtexturesoffsetscrollinguvs

Scrolling AND frame animating texture at the same time?

Hey guys. I'm doing this game where I'll have this scrolling background. I'm currently scrolling the background using a big sprite in the back and animating it using Unity's animator to change the sprite renderer's image. So far so good.

I'd like to use a textured quad tho since later on my background will have to scroll in all four directions and scrolling the textures would result in a more manageable code. The problem here is that I also need to animate my background. Now I know about texture offsetting for scrolling it but then I'd lose the ability offset the texture to animate it frame by frame and vice-versa. I tried changing the material's texture using the animator like I do with sprites but it seems that's not a parameter that Unity's animator can change, so the only option would be changing the quad's Material itself, but I don't think that creating one material per frame would be really optimal. Any ideas?

I know I could animate it via a script but I'm trying to avoid that for the time being, as I think that kind of thing would start to clutter up my scripts. I've also heard that this is not a good approach, optimization wise. Could I possibly use UV animation combined with texture offsetting for this? I'd animate the UVs for scrolling and offset the texture to change animation frames. Is that too resource hungry? I'm targetting mobile btw.

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
0

Answer by theANMATOR2b · Feb 10, 2017 at 08:03 PM

This is a little confusing. Can you explain better the difference between the UV animation compared to texture offsetting? These seem to me to be the same thing.

I understand how you explained you want the background to basically scroll in all four directions, but can you explain better what you need to do to 'animate' the background. Is this like birds flying in the background, or clouds flying by in the background?

I'm not a coder - so all my answers will be something doable in the editor.

Don't forget - you can always separate elements. So you can have a static background image - scrollable however you want it to scroll, and have other elements in front of that background 'animated' on there own. And you could track (?) a pixel on the background to 'attach' the animated element to the background, so it scrolls along with the background.

Another option - is render to texture workflow. I have not used this workflow however it is referred to quite often in the forum.

Comment
Add comment · Show 4 · 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 Milkshanks · Feb 10, 2017 at 08:51 PM 0
Share

Hi! thank you for taking your time to help me out. I got under the impression that these are different things specially by watching this video where the guy talks about it: https://www.youtube.com/watch?v=$$anonymous$$WYINvm64ZI

It seems to me that in one case you'd change the part of the texture that you are applying to your mesh, where in the other scenario you'd change the area that you apply the texture to. Does that make sense?

As to what I need to animate, currently I'm using this background in my prototype (don't $$anonymous$$d the low FPS for the gif tho): https://giphy.com/gifs/l0Exr1GJ8dXFlsfSw

So basically I'd need to scroll the whole background togheter with all animated elements. So in that sense my game is kind of a runner that can go in all four directions with some kind of abstract bg.

avatar image theANMATOR2b Milkshanks · Feb 10, 2017 at 10:04 PM 0
Share

$$anonymous$$y browser just refreshed and wiped out everything I had written! Grrr.

That tutorial is showing 10 different mesh objects, 6 of which have an animated texture on them, overlaying the background striped image. That tutorial is from 2012 and he is addressing a solution to draw calls and de-scencronizing the animated sprite instances.

It seems like you might be over complicating this a little bit. Why not directly link the animation of the UVs with the movement of your character?

The background should only automatically scroll like that gif - if that is the only way the the scene will ever scroll.

If you tie the scrolling into the direction the character is moving (animating) then it will automatically update and you can still animate it - similar to how the tutorial showed with the one animated sprite on those 6 different meshes.

avatar image Milkshanks theANMATOR2b · Feb 10, 2017 at 11:34 PM 0
Share

Oh, but linking character speed with the scrolling was already in my plans. The issue tho is that for this to work you got to set the texture mode as repeatable, right? Otherwise it just clips the corners when scrolling. But if I do that I can't offset the uvs because the whole texture gets applied on the mesh.

And yes, I'm pretty sure that I might be overlooking something really obvious here.

Show more comments

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

Colour Customisation sorted by UV co-ord? 1 Answer

C# Animate Secondary "Detail" Maps Offset value 1 Answer

Problem with excessive shake when animating 2D content 0 Answers

I'm trying to get a material on a gameobject to offset slightly over time and can't figure it out. 0 Answers

cinemachine and character mocap animation offsets 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