Создал кнопку

После чего создал для нее скрипт:
(кнопка находится на Scroll VIew)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class UpButtonHelper : MonoBehaviour
{
public Text DamageText;
public Text PriceText;
public int Damage = 10;
public int Price = 100;
private GameHelper _gameHelper;
// Use this for initialization
void Start()
{
DamageText.text = Damage.ToString();
PriceText.text = Price.ToString();
_gameHelper = GameObject.FindObjectOfType<GameHelper>();
}
// Update is called once per frame
void Update ()
{
}
public void UpClick()
{
if (_gameHelper.PlayerGold >= Price)
{
_gameHelper.PlayerGold -= Price;
_gameHelper.PlayerDamage += Damage;
Destroy(gameObject);
}
}
}
Но при нажатии ничего не происходит ( настройки кнопки снизу )

Как это можно исправить?