- Home /
This post has been wikified, any user with enough reputation can edit it.
Question by
itsigii1 · Jul 06, 2020 at 10:34 AM ·
script.collider2dclickedit
edit isTrigger by clicking on it,
hi i'm trying to make a isTrigger to true when clicking on the object and when is not holding set isTrigeer to false (i'm trying to make it for a drag and drop script so that it cannot push and throw the player) this is the script and it cant seem to work (i just started so don't judge)
public GameObject blocc;
// Use this for initialization
void Start()
{
if (Input.GetMouseButtonDown(0))
blocc.GetComponent<BoxCollider2D>().isTrigger = true;
}
Comment
Answer by Macarona_Virus · Jul 06, 2020 at 11:10 AM
try this:
blocc.GetComponent<Collider2D>().isTrigger= Input.GetMouseButtonDown(0);