what i’m trying to do is to check if an object’s material is the “orange” material i created.
public Material orange;
public Material thisMaterial;
// Start is called before the first frame update
void Start()
{
thisMaterial = GetComponent<MeshRenderer>().material;
}
// Update is called once per frame
void Update()
{
Debug.Log(thisMaterial);
Debug.Log(orange);
}
private void OnMouseDown()
{
if (thisMaterial == orange) //if current sprite is the neutral one
{
Debug.Log("material is orange");
}
}
Here is the tip if you do not acsess the singleInstanceMat there is ok the sharedMaterial is keeping the material that you want. And the first debug returns TRUE. But when you acsess the normal .material the shared material is changeing i guess because of the instance.