Physics.IgnoreCollision by Tag question

hello & thanks for looking at my question. should be a simple one. I’m trying to make an tagged gameobject not collide with another tagged gameobject but Physics.IgnoreCollision is telling me they are both the same object. can’t wrap my head around the concept yet. script is attached to LeftStopper gameobject. i know how i would do it via javascript based just can’ get the same idea to work in C#. or am i doing it completely wrong? tried it so many different ways with no luck.

void OnCollisionEnter(Collision collision)	{
		if(collision.gameObject.tag == "RightMarble" && collider.gameObject.tag == "LeftStopper")
		{
			Debug.Log("Collided RightMarble with _LeftStopper");
                       // would like a Physics.IgnoreCollision(a,b) here
		} 
}

You are using OnCollisionEnter in the wrong way. OnCollisionEnter is referencing collision with the colliders attached to the object which the script is attached to (your LeftStopper gameObject). Therefore, you only need to check for a collision with RightMarble. So like this:

if(collision.gameObject.tag == "RightMarble" ) {

I believe that should work. Hope it helps! Klep

yes a layer-baised solution was exactly the thing i needed. how nifty is that feature! just when i almost gave up, i solve it without code! thanks @Bunny83 (& @fafase above) for the tips.

ps. sorry, im new to this question form, so how do mark question as solved?