How To Enable a Script on a object that will be enabled onCollision With tag. C# type

Hello Everyone Can Someone Give me some Example to Enable a certain Script on a object That will be Enabled when Collided with a tagged object.

void OnCollisionEnter(Collision col){
col.transform.GetComponent().enabled = true;
}

You might as well care for checking first if the collided object has YourScriptClassHere component at all like this:

col.transform.GetComponent<YourScriptClassHere>() != null;

if you are going to reuse YourScriptClassHere object a lot in the function and are going to have a lot of collisions than you’d rather store it in a variable instead of using GetComponent every time (seems to me like a little heavy and brute getter)