public static weapon GetWeapon(weapon which) { GameObject obj = null; while (!obj) { List<GameObject> list = repositoryNow.weaponsList.FindAll(x => x.GetComponent<weapon>().NameId() == which.NameId()); obj = GetObjInList(list, typesObjs.weapon, which.gameObject); } weapon wp = obj.GetComponent<weapon>(); wp.UseWeapon(); return wp; }