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.
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);
}
@KittenSnipes
I’m trying to make the material on a character move in vrchat