How to access a variable of a collider?

I have a particle and if it comes into contact with another particle of the same kind they form a cluster (named a micel).

These clusters need to be reshaped and the time they stick together becomes longer when more particles join the micel.

For this I created a micel and micelmanager class to keep everything in order. Those classes basically store which micels there are and in the micels which particles are there.

When creating the micel I give it an ID which gets returned so the particle can store in which micel it is. The problem for me occurs when particles collide and I want to check if the other particle is in a micel and if so adding this particle to that micel.

public void OnTriggerEnter(Collider other)
		{
			// one collision
			if (stickToBinder || stickToSurfactant || stickToThickener)
				return;

			CurrentCollider = other.collider;

			// surfactant head collision
			if (CurrentCollider.tag == "head" && this.collider.tag == "head")
			{
				stickToSurfactant = true;
                            // read if other particle is in micel!!!
			}
		}

I can not get “Collider” to “SurfactantParticle” type. This would contain the variable (and method GetMicelID())

On a further note I have to say that all actions surrounding the particles are done via a FSM. But in the FSM I only got the Collider type.

Any ideas how to solve this problem?

I don’t know if I get you correctly, but if SurfactantParticle script is attached to a game object you collided with (other), then you can retrieve it using:

var surfactantParticle = other.GetComponent<SurfactantParticle>();

and then you can use

var id = surfactantParticle.GetMicelID();