Hello guys, i am creating a gameobject with above image, white circle with a small red circle, i just want to set the collision setting for red circle ONLY, i add the circle collider 2D for red size only.
But when i try to play on debug mode, object collider with the white circle will still trigger the collision.
How can i collide to red circle only without changing the gameobject?
if(collision.collider.gameObject.tag == "yourTagHere")
Something like that, add a tag to the red collider so that when the player or whatever collides with it, the script doesn’t do anything until the current collisions tag is the same as the red tag. Doing it off size would be tough.
I dont know if this is exactly what you want but when you selected your object with the colider that you want to change, there should be in the inspector an option with a few squares with a line connecting them. Click on that and you should be able to see a green box showing around the object. You will then be able to see little dots within the middle of each face of the collider. You can change the scale of the collider by using those dots. Again i dont know if this is what you want but there ya go
Ok it works now!
Tried to set both item as is a trigger and using the following coding.
private void OnTriggerEnter2D(Collider2D other)
if(other.gameObject.layer == LayerMask.NameToLayer("enemy"))
Reference: 第05回 当たり判定とアニメーションイベントとレイヤー · unity3d-jp-tutorials/2d-shooting-game Wiki · GitHub