all I want is a simple script that lets me change the texture of whatever object I add the script to. I don’t know why but every answer I try gives me errors. any help is appreciated.
maybe, you can try this:
public Texture tex;
void Start() {
GetComponent<Renderer>().material.mainTexture = tex;
}
Good day.
I supose you are still new in Unity. You must know, that GameObjects, have a mesh, this mesh is rendered with a material. and this material can have multiple textures.
So first, take your time to see if you need to change the amterial or the texture of the material. As you can save materials as prefabs, normally is better to change material of the object, and not change the texture of the material (because all objects with that material will revice the same change)
Good Luck!
Bye!