Dice
Press to roll 1 to 6, shown on a sign and by an animation. Everyone sees the same roll.
You need
- A button to roll (with a collider)
- A sign for the number (TextMeshPro)
- An Animator with an animation per face, switched by an Int parameter Face
Variables
| Name | Type | Sync |
|---|---|---|
| face | Integer | Synced |
Cards
WhenInteract⋯
What to do
Random Number⋯
Variableface
Min1
Max6
+ Add what to do
WhenOn Variable Changed — face⋯
What to do
Set Text⋯
TargetsDice Sign
Text{face}
Animator Set Integer⋯
TargetsDice
ParameterFace
ValueVariable: face
+ Add what to do
For an integer variable, Random Number includes the maximum (6).
The same face twice
Rolling the same face again doesn't change the value, so On Variable Changed doesn't run. To animate every roll, also count rolls in another synced variable and react to that one.