using System.Collections; using System.Collections.Generic; using UnityEngine; public class MoveTexture : MonoBehaviour { public float scrollSpeed=0.1f; Renderer rend; // Start is called before the first frame update void Start() { rend = GetComponent(); } // Update is called once per frame void Update() { float moveThis = Time.time * scrollSpeed; rend.material.SetTextureOffset("_MainTex", new Vector2 (0, moveThis)); } }
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class MoveTexture : MonoBehaviour
{
public float scrollSpeed=0.1f;
Renderer rend;
// Start is called before the first frame update
void Start()
{
rend = GetComponent();
}
// Update is called once per frame
void Update()
{
float moveThis = Time.time * scrollSpeed;
rend.material.SetTextureOffset("_MainTex", new Vector2
(0, moveThis));
}
}
Thanks this helped me out
I don't understand the moveTexture for me is not working, is it because my project is in URP?
Nice video. Is there a way to just move the emissive texture, not the whole texture?
Not sure there would be unless it’s a different material. They’d you could move the material.
This might help with calling an emissive material: answers.unity.com/questions/1019974/how-to-access-emission-color-of-a-material-in-scri.html
This is exactly what I needed!!!
Glad I could help 😊👍
I tried this in Unity 2020.1, but it doesn't flow smoothly. It just goes back and forth like it wants to go, but it doesn't go
This is a result of writing "Time.deltaTime" instead of "Time.time" 😅
@@connorpayne2671 I was going to say: nothing in 2020 should alter the way that script works... 👍👍
@@octobeard4946 yep. I am glad that I figured out the issue. Maybe other people will try this, make the same mistake, and see the comment 😅
@@connorpayne2671 Let’s hope so, if they do. 👍👍
I don't understand, for me it says "rend" doest exist in this context
for me it said that unity had a fatal crash. depressing
Material 'LavaTex (Instance)' with Shader 'Standard' doesn't have a texture property '_MainText'
I think it may just be a typo - if you write "_MainTex", it should work :)
Thank you sir !!!!
😍