Search Unity

QUIZ MARKS

Discussion in 'Scripting' started by unity_PmQTfv-2EMmSJA, Jan 19, 2019.

  1. unity_PmQTfv-2EMmSJA

    unity_PmQTfv-2EMmSJA

    Joined:
    Jul 26, 2018
    Posts:
    11
    HELP MEEE ASAP!!! I want marks to add 5 if function PlayGame is use? Below is my coding .


    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using UnityEngine.UI;
    public class NextSceneQuiz : MonoBehaviour {

    public int mark;
    public GameObject myPopUpObject;
    public GameObject myPopUpObject1;
    public GameObject CloseQuestion;
    public Text Marks;

    // Use this for initialization
    void Start()
    {



    }

    // Update is called once per frame
    void Update()
    {
    if (myPopUpObject.activeInHierarchy == true)
    {
    mark = mark + 5;
    }



    }

    public void PlayGame()
    {

    myPopUpObject.SetActive(true);
    CloseQuestion.SetActive(false);

    }

    public void PlayGame1()
    {
    myPopUpObject1.SetActive(true);
    CloseQuestion.SetActive(false);

    }
    }
     
  2. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    825
    Thats what we are here for...

    mark += 5; (or mark = mark + 5; They are the same)

    You have already used this line of code, just copy and paste it into your PlayGame function.

    You do not have to ask for help in all caps in your post, we know. Just focus on asking your question in an as clear way as possible.
     
  3. unity_PmQTfv-2EMmSJA

    unity_PmQTfv-2EMmSJA

    Joined:
    Jul 26, 2018
    Posts:
    11




    I have 5 questions.But it count once only.
     
  4. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    825
    I assume this is related to your PlayGame1 function. Which is basically just a duplicate of PlayGame. Just duplicate the mark = mark + 5; line into each PlayGame function. Right? It is really hard to tell when you give almost no information.
     
  5. unity_PmQTfv-2EMmSJA

    unity_PmQTfv-2EMmSJA

    Joined:
    Jul 26, 2018
    Posts:
    11

    no its different.PlayGame is for correct.PlayGame1 is for incorrect.
     
  6. TaleOf4Gamers

    TaleOf4Gamers

    Joined:
    Nov 15, 2013
    Posts:
    825
    I seriously recommend renaming those then. It is impossible to know what they do without being in your brain. Unfortunately, I just cannot help here, with the poor naming and limited information you make it really hard to help. Perhaps someone else can decipher it though and find the issue.