I change the color of an gameObject if the player enters this gameObject. I use:
void OnTriggerEnter(Collider player)
{
Color color = Color.red;
color.a = alpha;
rend.material.color = color;
}
and:
void OnTriggerExit(Collider player)
{
rend.material.color = myColor; //myColor = the original Color of the object
}
But I want also to check if the player is fully within the gameObject and then change the color accordingly. To get this information I should use OnCollisionEnter but then OnTriggerEnter does not work and my player can’t pass through the gameObject anymore.