Two colliders enter a trigger in C#

Hi everyone, I create 3 main Game Objects with child objects.

ObjectA–> add a Game Object (name"cat"), then add a empty Game Object with Box Collider (name"boxA"), mark with “isTrigger”, and assigned script (OnTriggerEnter.cs).

ObjectB → add a empty Game Object with Box Collider (name"boxB") and a rigidbody.

ObjectC → add a empty Game Object with Box Collider (name"boxC")and a rigidbody.

In OnTriggerEnter.cs, I sucessfully write a script (see Code Try1) that when boxA collide with boxB, a CAT shown.

However, when I change to code to become the code like Code Try2, a CAT do not shown. Why?
I am trying to show a CAT when both boxB and boxC collide with boxA at the same time.
I am stuck at here two days ago… Please help. Thanks in advanced.

Code Try1:

public void OnTriggerEnter(Collider other){

if(other.gameObject.collider.name == "boxB")

{

	mCat.SetActive(true);

}}

Code Try2:

public void OnTriggerEnter(Collider other){

if(other.gameObject.collider.name == "boxB" && other.gameObject.collider.name == "boxC")

{

	mCat.SetActive(true);

}}

Your logic is flawed.

OnTriggerEnter() is called once for each collider that enters the trigger in a given frame.
In your second script, the line:

if(other.gameObject.collider.name == "boxB" && other.gameObject.collider.name == "boxC")

can never be true, because there is no single collider that can possibly have both the name “boxB” and “boxC”.

In any case, do you really want to only show a cat if both boxB and boxC enter the trigger in exactly the same frame? This seems incredibly unlikely.

Do you not instead want to display the cat whenever both boxB and boxC are inside the trigger at the same time? To do this, try reading my blog article at Keeping Track of Targets in a Trigger | Alastair Aitchison