So I dared myself and I pulled it off!

Feeling so overpowered right now ^^

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class ScoreBoard : MonoBehaviour
{
    int scoreCurrent;
    int scoreValue_Enemy = 500;
    [SerializeField] Text myText;

    private void Start()
    {
        scoreCurrent = 0;
        WriteScore();
    }
    void ScoreHit()
    {
        scoreCurrent += scoreValue_Enemy;
        WriteScore(); 
    }

    private void WriteScore()
    {
        myText.text = scoreCurrent.ToString();
    }
}

edit: Also, added a reference to my ScoreBoard Gameobject instance (not prefab), and called its ScoreHit method on Enemy death:

        ref_scoreBoard.Invoke("ScoreHit",0);
3 Likes

:+1:

This is coming along very nicely Manu, well done :slight_smile:

1 Like

Thank you Rob

1 Like

Nice tie fighter!

Privacy & Terms