Question by
the1zymryd · May 02, 2021 at 11:19 PM ·
drop
Depending on the dropped number, the object moves to the point from the ID and adds the next dropped number
public class Test : MonoBehaviour { public Sprite[] diceSide; public int dropNumber; public Image diceImage; public GameObject insideDice;
public Image chipImage;
public void DropDice() { StartCoroutine(DropNumber()); }
IEnumerator DropNumber() { dropNumber = Random.Range(1, 7); for(int i = 0; i < 50; i++) { diceImage.sprite = diceSide[Random.Range(0, diceSide.Length)]; yield return new WaitForSeconds(0.1f); } diceImage.sprite = diceSide[dropNumber - 1]; }
Linking to id in a separate script, what is the best way to implement this?
Comment
Your answer
![](https://koobas.hobune.stream/wayback/20220613033203im_/https://answers.unity.com/themes/thub/images/avi.jpg)