- Home /
Answer by FireGreeks · Jun 12, 2017 at 07:49 AM
I know that this is a really an acient post but here is my answer that I found just exploring around :
Go to the object with the texture you want to unstretch
Click on the material or texture
Go in Main Maps and put the Tiling to the dimensions of your object
Thanks! I always thought that you have to use the Detail $$anonymous$$ask for that, but now I now better. :)
This is awesome! I never knew it was so easy! Thank you so much
Answer by Graham-Dunnett · Dec 11, 2012 at 12:17 AM
See http://docs.unity3d.com/Documentation/Components/class-Material.html. Just set the Tiling x and y to whatever you need.
It's still stretching. In my example I have a cube with changed scale, for example: (80, 5, 5) and texture stretched across that 80 meters long wall.
I didn't need to add that script. Setting the 'Wrap $$anonymous$$ode' of the texture to 'Repeat' ins$$anonymous$$d of 'Clamp' make this work for me.
See also the answer to the following question: http://answers.unity3d.com/questions/775619/texture-stretches-when-tiled-in-editor.html
I think, the API functionality is this now: https://docs.unity3d.com/ScriptReference/$$anonymous$$aterial.SetTextureScale.html
Answer by KopperNatt · Mar 06, 2017 at 04:13 PM
@Jalima142 Make a material whitch you can add a texture to it. Here's how to do it:
Select the Material in the "project" tab.
Get into the inspector and go to "Secondary Maps".
import your texture asset (if you haven't allready) and drag it in to "Detail Albedo".
Now the texture still should be stretched but to change that:
Do the instruction above this one first or it may not work!
Go to "Secondary Maps" again and there you'll see the setting "Tiling" There you can change the "X" and "Y" change it for the best look. :D
I know I'm late but if someone else want to know now when you cannot enter the link by @Graham-Dunnett
Hope it worked for you :D Glad to help
Answer by august_unity496 · Aug 26, 2019 at 09:31 PM
I figured how to make it tile without having to change it for each object. although it doesn't attach to a material, you can just attach it to a game object, and it will tile using the tile x, and y in the editor (you will have to change the texture from a script)
public class GifTexture : MonoBehaviour
{
[SerializeField] private float tileX = 1;
[SerializeField] private float tileY = 1;
Mesh mesh;
private Material mat;
void Start()
{
mat = GetComponent<Renderer>().material;
mesh = GetComponent<MeshFilter>().mesh;
}
void Update()
{
mat.mainTextureScale = new Vector2((mesh.bounds.size.x *
transform.localScale.x)/100*tileX, (mesh.bounds.size.y * transform.localScale.y)/100*tileY);
}
}
Answer by alexq4p3 · Jun 07, 2021 at 11:31 PM
Set the mesh x, y at the same proportion of the image. if the texture is 720 x 1080... set the scale to something like 72 x 108.
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
I need help with textures. 2 Answers
How To Add Textures To GameObjects? 2 Answers
Texture stretches when tiled in editor 1 Answer
Having trouble tiling a shader over a plane instead of stretching 0 Answers