public void Serve() { SimObjPhysics target; if (osr.attachPoint.transform.GetComponentInChildren <SimObjPhysics>() && onOff.isTurnedOnOrOff()) { target = osr.attachPoint.transform.GetComponentInChildren <SimObjPhysics>(); Fill f = target.GetComponent <Fill>(); //if not already toasted, toast it! if (!f.IsFilled()) { f.FillObject("coffee"); } } }