Keeping constant texture size for unity maps w/ blender

I’m trying to make a level/levels, and the walls are my biggest challenge, because I have to re-scale textures in blender every time I make a new wall of a different size.

Is there a way to have a texture scale automatically when I change the size? For example, I properly scaled the texture on the middle wall (see image), but the smaller (left) and larger (right) walls have skewed textures. I want these to mimic the scale of the middle wall. Is there a cycles node for this?

I wan’t to use baking fro

m cycles for my texture atlas, so unity functions aren’t applicable.

Thanks!

This isn’t really a Unity question at all…but since I love Blender I’ll answer anyway.

Use a texture coordinate node. You can read a good explanation of the outputs here. You can select another object to use it’s in the highlighted section if you are using the object output. You can play with object output and generated output. You can also use a vector mapping node to scale the coordinates after the texture coord input.

Let me know if this helps :wink:

I haven’t tested this with blender, but I had the need to set up a ruler object (with lines on it that looked like a ruler) and needed to make instances of the ruler different lengths throughout my scenes, while keeping the ruler lines consistent. You’d have to change the scale factor to your size of course, and probably add in a y factor as well but maybe this script could help??

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlaneTiling : MonoBehaviour {

public Renderer rend;

// Use this for initialization
void Start () {
	Vector3 scale = transform.localScale;
	rend.material.mainTextureScale = new Vector2 ((scale.x/.00254f), 1f);
	//Debug.Log (scale.x);
}

}