- Home /
Reigns Game - Use Random.Range at Start() and a second time via another script and set GameObject as active
Hello folks, I hope the title is interesting enough, so many people look at this question.
I'm currently working on a Project which contains 2D and 3D elements. This game works like the mobile game "Reigns" and is very simple:
In the center of the main camera is an image, The image should be a "card". It isn't 2D (so no UI or sprite), I used a 3D cube, so I could write a moving script for it myself. Above the card there is a textfield which is a question. You can move the card to the left (there is a trigger) and also to the right (another trigger). Left means that you reply to the question with "Yes" or, when you move it to the right, with "No".
It's not important in this case if you answer with "Yes" or "No", because after the card exits one of the trigger ( OnTriggerExit
) , then a new question and a new card should appear, but that does not really work.
Everything works fine for the first randomized card!
Now to my Problem:
At the beginning within the method void Start()
a number gets randomized. After that, the if-statement within the method void checkingCards()
tries to find out which card and question will appear when (for example) number 3 gets generated randomly. Until here everything works, as I said!. When I reply now with "Yes" or "No" a second/new random number should be generated and another card and question should appear.
This step doesn't work correctly and I don't know exactly how I could solve it, because I tried so many things but nothing worked.
If anyone understood what I want to achieve then I would appreciate any help which helps. If you don't got what I wanted to say just tell me and I try to explain better.