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 /
avatar image
0
Question by josedlmayer · Jan 25, 2018 at 10:26 PM · scripting problemtexturematerialsscrolling

How to change material that is being scrolled for Material.SetTextureOffset

SetTextureOffset

I'm using this to try and move the texture on my clothing for a vrchat character but it always only moves the skin. I wanted to know if there is a way that I can set the script to move another material. Right now it says "(instance)" next to the body material.

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 KittenSnipes · Jan 26, 2018 at 09:38 AM 0
Share

@josedlmayer

Like is it a raw image or is a $$anonymous$$aterial? I know how to do scrolling with raw images but if it with materials I would still be glad to help

2 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by KittenSnipes · Jan 26, 2018 at 10:09 AM

@josedlmayer

Your material would most likely need to be attached to a renderer. You can change the material like so:

     //Reference to the renderer
     Renderer thisRenderer;
 
     //Material to change the current render material to
     public Material MaterialToChangeTo;
 
     //Y offset of the material 
     public float yOffset = .25f;
 
     //X offset of the material
     public float xOffset = .25f;
 
     // Use this for initialization
     void Start()
     {
         //Get the renderer of our object
         thisRenderer = GetComponent<Renderer>();
 
         //Change the current material to the material we want
         thisRenderer.material = MaterialToChangeTo;
     }
 
     // Update is called once per frame
     void Update()
     {
         //Do that cool scroll effect on our material
         thisRenderer.material.mainTextureOffset = new Vector2(thisRenderer.material.mainTextureOffset.x + xOffset * Time.deltaTime, thisRenderer.material.mainTextureOffset.y + yOffset * Time.deltaTime);
     }
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 josedlmayer · Jan 30, 2018 at 01:29 AM 0
Share

it says UCE0001: ';' expected. Insert a semicolon at the end. I used this script or do I add this to the other one? void Start() { //Get the renderer of our object thisRenderer = GetComponent();

      //Change the current material to the material we want
      thisRenderer.material = $$anonymous$$aterialToChangeTo;
  }
 
  // Update is called once per frame
  void Update()
  {
      //Do that cool scroll effect on our material
      thisRenderer.material.mainTextureOffset = new Vector2(thisRenderer.material.mainTextureOffset.x + xOffset * Time.deltaTime, thisRenderer.material.mainTextureOffset.y + yOffset * Time.deltaTime);
  }
avatar image
0

Answer by josedlmayer · Jan 31, 2018 at 12:11 AM

@KittenSnipes I'm trying to make the material on a character move in vrchat

Comment
Add comment · 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

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

148 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 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

How do I attach a Created Material A Texture, NormalMap and OcclussionMap? 0 Answers

So, what's the problem with this code? 1 Answer

textures/Materials Disappearing Upon Play 0 Answers

How to properly ease out texture scrolling? 1 Answer

Save Texture in lua table 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