2D dice game!

Hey guys!

I’m working on a 2D dice game. Most of the code was finished and working on Android Studio, but as I’m willing to make it an online real time multiplayer I ended up buying a unity course as I believe unity is more appropriate for this purpose.

I’m still kinda lost though. I don’t need the game to roll 3D dice, I just want to recreate my 2D dice game in unity.

Am I correct to assume that the best way to do it is by creating 6 game objects (6 dice) and then change the image sprite source each time I roll the dice according to the random numbers I generate? That’s what I was doing on Android Studio with Java. I just have no idea how to do this on unity. Any advice, suggestion or piece of code are welcome!

Thanks in advance!

var img1;Texture2D;
var img2;Texture2D;
var img3;Texture2D;
var img4;Texture2D;
var img5;Texture2D;
var img6;Texture2D;

var imgs:Texture2D[];
    imgs=new Texture2D[7];
var dice1:GameObject;
var dice2:GameObject;

var i:int;
function Update () {

make 2 planes or cubes Objects in your inspector and name them “dice1” and “dice2” in your scene.
draw six PNG pictures and drag and drop them onto the texture spaces shown in the inspector from this code.
press play … press spacebar:)
i hope this example helps!

Hey, that’s great! It does work! I just don’t see any results in the game window when I play it. I thought it would get the image resource and add it to my game objects.

Btw, I would like to actually understand your code, do you know any good place for information on that?

Thanks again!

You could solve the problem of not seeing. I have the same problem.