using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class LivesManager : MonoBehaviour
{
public GameObject player;
public GameObject enemy;
public int P1Life;
public int P2Life;
public GameObject Player1Wins;
public GameObject Player2Wins;
public GameObject Player1Text;
public GameObject Player2Text;
//This Code doesn't seemed to be acknowledged by Visual Studio
public static int ScoreValue = 0;
Text score;
// Start is called before the first frame update
void Start()
{
score = GetComponent<Text>();
}
// Update is called once per frame
void Update()
{
if(P1Life <= 0)
{
player.SetActive(false);
Player2Wins.SetActive(true);
}
if (P2Life <= 0)
{
enemy.SetActive(false);
Player1Wins.SetActive(true);
}
}
public void HurtP1()
{
P1Life -= 1;
Player2Text.ScoreValue += 10;
}
public void HurtP2()
{
P2Life -= 1;
Player1Text.ScoreValue += 10;
}
}
Hi There I am working on a Multiplayer Score System and with my script it’s complaining about Error CS1061 complaining that I don’t have the right Method?
Here is the message I got from it
Assets\Scripts\LivesManager.cs(50,21): error CS1061: ‘GameObject’ does not contain a definition for ‘ScoreValue’ and no accessible extension method ‘ScoreValue’ accepting a first argument of type ‘GameObject’ could be found (are you missing a using directive or an assembly reference?)
What am I doing wrong here?