How to Make Flowing Lava (Moving Textures) in Unity

Поделиться
HTML-код
  • Опубликовано: 24 дек 2024

Комментарии • 19

  • @najwamohammed3961
    @najwamohammed3961 2 года назад +30

    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));
    }
    }

    • @Glue676
      @Glue676 Год назад +1

      Thanks this helped me out

  • @linac2435
    @linac2435 Год назад

    I don't understand the moveTexture for me is not working, is it because my project is in URP?

  • @DarkCyder9
    @DarkCyder9 Год назад +1

    Nice video. Is there a way to just move the emissive texture, not the whole texture?

    • @octobeard4946
      @octobeard4946  Год назад +1

      Not sure there would be unless it’s a different material. They’d you could move the material.

    • @octobeard4946
      @octobeard4946  Год назад +1

      This might help with calling an emissive material: answers.unity.com/questions/1019974/how-to-access-emission-color-of-a-material-in-scri.html

  • @meeseman7996
    @meeseman7996 3 года назад +2

    This is exactly what I needed!!!

  • @connorpayne2671
    @connorpayne2671 4 года назад +2

    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

    • @connorpayne2671
      @connorpayne2671 4 года назад +1

      This is a result of writing "Time.deltaTime" instead of "Time.time" 😅

    • @octobeard4946
      @octobeard4946  4 года назад +1

      @@connorpayne2671 I was going to say: nothing in 2020 should alter the way that script works... 👍👍

    • @connorpayne2671
      @connorpayne2671 4 года назад +1

      @@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 😅

    • @octobeard4946
      @octobeard4946  4 года назад +1

      @@connorpayne2671 Let’s hope so, if they do. 👍👍

  • @rafario448
    @rafario448 3 года назад

    I don't understand, for me it says "rend" doest exist in this context

  • @dgh25
    @dgh25 3 года назад

    Material 'LavaTex (Instance)' with Shader 'Standard' doesn't have a texture property '_MainText'

    • @desmukkepiger1
      @desmukkepiger1 2 года назад

      I think it may just be a typo - if you write "_MainTex", it should work :)

  • @floofie_3
    @floofie_3 2 года назад

    Thank you sir !!!!

  • @CreativeHRM
    @CreativeHRM 4 года назад +1

    😍