void OnTriggerEnter(Collider collider) { Liftable liftable = collider.GetComponent <Liftable>(); if (liftable != null && !liftable.IsAttached()) { liftable.Attach(guide); } }
List <Liftable> colliding = new List <Liftable>(); // the list of things we're currently colliding with // Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0) && colliding.Count > 0) { carrying = colliding[0]; carrying.Attach(guide); } else if (Input.GetMouseButtonUp(0) && carrying != null) { PutDown(); } }