Please Help! (How to make a Quiz Game in Unity Ep2)

Updated 4 days ago in Answers
Share on Facebook0Tweet about this on Twitter0Share on Google+0Share on Reddit0
3 on April 20, 2017

I’ve recently started the How to make a Quiz Game in Unity tutorial and everything was going fine until at 6:40 when we made 3 question he has a section to type text in and an isTrue tick box underneath. When I type the exact code in an double checked it many times my script comes out with 3 different elements instead.

What I have

What I have

What I should have

What I should have

My code is:
————————————————————————————————————————————-
GameManager.cs


using System.Collections;
using UnityEngine;
public class GameManager : MonoBehaviour {
public Question[] questions;
void Start()
{
}
}

Question.cs


 using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[System.Serializable]
public class Question : MonoBehaviour
{
public string fact;
public bool isTrue;
}

————————————————————————————————————————————-

Is anyone able to tell me how to fix this problem please?
Many Thanks

  • Liked by
  • Binary Bites
Reply
0 on April 22, 2017

Bump

  • Liked by
Reply
Cancel

Bump 2

  • Liked by
Reply
Cancel

I just tried it out. Tricky mistake to catch, but it’s a simple fix.

Remove the “: MonoBehavior” from the Question class. This piece simply means that this class “extends” “MonoBehavior” and to my understanding this implies will be used as a(n) (game)object or something of the sort. If you remove this, you will have the dropdowns that are in the video you watched.

 Sebastian Lague has a great beginner video explaining classes.

  • Liked by
Reply
Cancel