public IEnumerator set_icon_in_hotbar_slot_1() { Hotbar hotbar = Object.FindObjectOfType <Hotbar>(); Slot slot1 = hotbar.GetComponentInChildren <Slot>(); Assert.AreNotSame(_item.Icon, slot1.IconImage.sprite); // Set position immediate to reduce the test time. _item.transform.position = _player.transform.position; // Wait till physics is processed (so collision with item would be triggered). yield return(new WaitForFixedUpdate()); Assert.AreEqual(_item.Icon, slot1.IconImage.sprite); }