In my project i have many platforms and they all share same script.
What i’m trying to achieve is that when player collides with the platform the script that is attached to the platform will deactivate. But only that one script on that specific platform the player is standing on. All the other scripts, on other platforms he is not standing on, should be activated until player collides with them.
Thank you guys for any answers or ideas on how to solve this problem.
So far i have:
public GameObject[] cubes;
public Script theScript;
Start ()
{
cubes = GameObject.FindGameObjectsWithTag("cubes");
theScript = ?
}
void OnCollisionEnter2D(Collision2D other)
{
if(other.gameObject.tag == "cubes")
{
theScript.enabled = false
}
}