+1 vote
tool
extends MeshInstance

export(Vector3) var repeat: Vector3 = Vector3(1,1,1) setget set_repeat
var my_mesh: Mesh = get_mesh()
var sm: SpatialMaterial = my_mesh.surface_get_material(0) 
var prev_scale

func _ready():
    update_uv1_scale()

func _process(_delta):
    if prev_scale == null:
        prev_scale = scale
    else:
        if prev_scale != scale:
            update_uv1_scale()
            prev_scale = scale

func update_uv1_scale():
    sm.uv1_scale = scale * repeat

func set_repeat(vector: Vector3):
    repeat = vector
    update_uv1_scale()

It seems to be working, just unsure... Also there a way to callback a function whenever the scale is changed or would I just have to do what I'm doing now?

Edit: Purpose of this is trying to prevent lag, and making different sizes walls is getting annoying when you keep haing to uv1 them lol

in Engine by (25 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.