hit.collider = null, but why..?


Hi everyone i want to know why my program is’nt entering in the second if
i have put lines like this.GetComponent<SpriteRenderer>().color = Color.red; so i can “debug” from my iphone, and while i am touching the sprites they are turning red but not blue or green…

I dont want a better method instead of this, I know that i am maybe not doing this the best way, but i juste want to understand why it is not “working”…
thanks a lot by advance guys :slight_smile:

You are using Physics2D.Raycast method while your object has Sphere Collider which is 3D collider. In Unity those two don’t interact so you either have to use Physics.Raycast or change your collider to Circle Collider 2D