Код
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class sl : MonoBehaviour {
public Slider newVl;
public GameObject test1;
// Use this for initialization
public void Start () {
newVl.onValueChanged.AddListener(delegate { testq();});
}
// Update is called once per frame
void Update () {}
public void testq()
{
Debug.Log("№=" + newVl.value);
}
}
хотел посмотреть как работает onValueChanged но Unity выдает ошибку:
Код
NullReferenceException: Object reference not set to an instance of an object
sl.Start () (at Assets/sl.cs:15)