Answer the question
In order to leave comments, you need to log in
NullReferenceException object reference not set to an instance of an object DetectClicks.OnMouseDown () (at Assets/Scripts/DetectClick.cs:19)?
//using
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
//public
public class DetectClicks : MonoBehaviour {
public GameObject buttons;
public Text playTxt, gameName;
//private bool
private bool clicked;
// void
void OnMouseDown () {
if (!clicked) {
clicked = true;
playTxt.gameObject.SetActive (false);
gameName.text = " 0"; // изменяется название игры на очки игры
<blockquote> buttons.GetComponent <ScrollObjects> ().speed = 5f; // уезжание вниз кнопкам
buttons.GetComponent <ScrollObjects> ().checkPos = 5f; //</blockquote>
}
}
}
Answer the question
In order to leave comments, you need to log in
Translate? The reference does not point to an instance of an object. It is necessary to check objects before manipulating them.
First, edit the markup of the question)
//будет нормально отображать
buttons.GetComponent<SOME_SCRIPT>().checkPos = 5f;
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question