[c#] Texture-based Trigger?

Hello! I want to make a trigger with condition “when object1 with texture1 enters the trigger area, trigger is disabled.” and “when object1 with texture other than texture1, trigger is enabled”

I’m sorry for my bad english… rage comic below will explain my question better…

anyone can help me?

alt text

So you could do something like this, which allows you to have a different function for each texture:

   void OnTriggerEnter(Collider other)
       var mainTexture = other.GetComponentInChildren<Renderer>().mainTexture;
       if(mainTexture != null)
             SendMessage("Hit" + mainTexture.name, other, SendMessageOptions.DontRequireReceiver);

Then on the trigger object in any script:

    void HitTexture1(Collider otherObject)
        //Do whatever

Or you could just do a switch or an if…