Hello, i am starting with unity and i am make a really simple game, i am trying to make an adventure game in 2d the only interactuable item in my scenes are buttons.
My idea is that each time I click one of this button depending witch one the player will get a point or lose a point so at the end i can change what ending the player get.
I have the following code:
-I have this to create the variable that will tell me the “score” of the player:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class global : MonoBehaviour
{
public static int loadFinal = 0;
}
-I have this added in the on click, in the button, technically this will increse in one the “score”:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class add : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
global.loadFinal = global.loadFinal + 1;
//global.loadFinal = global.loadFinal - 1;
}
// Update is called once per frame
void Update()
{
}
}
I am a bit lose with all this, what i am missing?