I have a simple code that changes the material of an object to a material from an array.
public Material[] allMats; //an array of materials
public Transform cubePrefab; //a model with at least 1 child transform
void Start(){
Transform t = Instantiate(cubePrefab, transform.position, Quaternion.identity, transform);
t.name = "TEST";
t = t.GetChild(0);
t.GetComponent().sharedMaterial = allMats[0];
}
However, this code will give two different results depending on whether I use the default Unity Cube, or my own OBJ model from blender. The OBJ is just a quad.
My OBJ will always get assigned an (instance) of the material, and the Unity cube will always get a non instance. I want my custom quad to get a non instance material.
What causes this? What model properties interfere with Unity materials? Is it OBJ format specific?
↧