public void attachToStringItem(GameObject stringItem) { if (stringRigid == null) { stringRigid = stringItem.GetComponent <Rigidbody2D> (); if (stringItem.GetComponent <Umbrella> () != null) { rigid.velocity = new Vector2(rigid.velocity.x, stringRigid.velocity.y); stringRigid.velocity = rigid.velocity; } else if (stringItem.GetComponent <Balloon> () != null) { stringRigid.velocity = rigid.velocity; getPlayerController().resetJumpCount(); canJump = true; PerformRaycast(); if (downRays.Where(h => h.raycastHit.transform.tag == "Walkable").ToList().Count > 0) { canDropFromBalloon = false; } else { canDropFromBalloon = true; } } foreach (Collider2D c in stringItem.GetComponents <Collider2D> ()) { if (!c.isTrigger) { foreach (Collider2D p in this.GetComponents <Collider2D>()) { Physics2D.IgnoreCollision(c, p); } } } float xpos = stringItem.transform.position.x; // - Mathf.Sign (transform.localScale.x) * .15f; this.transform.position = new Vector3(xpos, transform.position.y, transform.position.z); StringItem stringitem = stringItem.gameObject.GetComponent <StringItem> (); stringitem.setAttachedRigidbody(rigid); stringitem.setStringGrabOffset(transform.position); rigid.gravityScale = 0; getPlayerController().onStringItem = true; anim.SetBool("stringItem", true); } }