Card Shuffling Function

Just would like to add, you can also use the new inventory extension.

At the beginning just add 52 items to an inventory with the name 1,2,3,4…52. Each item would represent a card in the deck and you can even call the inventory as"deck"

After, when you are about to take a card from the deck, just create a random number and check if the item with tha number as name is available in the “deck” or not.
If it available, create a card with tha animation displayed and remove item from the “deck”.
In case it is not available then generate a new random number until find one that is available using the while loop.

Each player could have it own inventory and just move the items/cards between the inventories by simply remove/add items and check which item/card is present in which inventory.
Also, from experience, instead of creating and deleting card objects, it easier to make a card game if objects are permanently present in the scene to display cards but displaying an empty animation or hidden when don’t needed and it become visible and display an animation only when needed. Basically think of it as empty slots waiting for information to display a card.

2 Likes