Roll a ball and quiz (Pause scene, load scene and resume)
Hello Guys,
First I am very new to Unity and Csharp scripting. But for this question I have searched google, forums and looked into tutorials but not finding the right way to handle it.
Well basically I am using the Roll a ball tutorial and I am making a simple quiz game on top.
When the ball hits 3 objects, I load the quiz scene and ask a question. On answering the question, the game should resume and if the answer is correct it should add it to the count value.
Problem. On hitting the 3 objects I load the scene but on answering the question , when I return the game won't resume and it stays there.
What I have done so far. My first approach LoadScene
void OnTriggerEnter(Collider other) { if (concount == 3) { if (qcallcount <= 2) { concount = 0; qcallcount = +1; Time.timeScale = 0; SetScene(); } }
     // Run the 'SetCountText()' function (see below)
     SetCountText();
 }
 
               } public void AddCount(int points) { count = +points; SetCountText(); }
private static void SetScene() { SceneManager.LoadScene("Questions"); }
In my questions gamecontroller
public void AnswerButtonClicked(bool isCorrect) { if (isCorrect) { playerScore += currentRoundData.pointsAddedForCorrectAnswer; questionIndex++; ReturnToGame(); }
 }
 public void ReturnToGame()
 {
 
               SceneManager.LoadScene ("Roll-a-ball") }
This is loading 2 instances of the Roll a ball
2nd Approach LoadScene Additive
In my ontriggerenter I load the questions with LoadScene Additive Then I set my question display panel to false in the ReturnToGame() questionDisplay.SetActive(false);
But this results in error "To many event systems , not supported " and the game does not resume and it is always paused
3rd Approach UnloadScene
I did Unload my scene (questions) but the game does not progress and the data is also lost.
PS: I set Time.timescale = 1; in fixed update so that I can resume the game, I also tried Time.timescale = 1 in update, but no success.
Please guys need your help in understanding how I can achieve this ?
I need to collect x objects, then pop a question, Now once user answers it I have to return to roll the ball and continue. I keep doing this till all objects are cleared or if all questions are completed. I need to track the right answers and add to users score.
Your answer
 
             Follow this Question
Related Questions
How to change value of another gameobject through script 2 Answers
Texture turn black and Gameobject become half or unseen-able 0 Answers
Framing multiple objects from a list along y axis only? 0 Answers
Why is the this object referenced to itself? 1 Answer
Collision only counted first time 1 Answer