Answer the question
In order to leave comments, you need to log in
How to use one method in another class?
The solution to this issue has now become incomprehensible to me - since it works in one place, but not in another, here is an example, the class itself
public class DataStorage : MonoBehaviour{
public Text ScoreText;
public static DataStorage instance;
void Awake(){
instance = this;
}
....................................
public class CanvasBoard : MonoBehaviour{
private DataStorage Di;
public static CanvasBoard instance;
private void Awake(){
instance = this;
Di = DataStorage.instance;
}
...........
void Update(){
Di.ScoreText.text = "" + Score;
.........
public class IAPSeller : MonoBehaviour, IStoreListener{
private DataStorage Di;
public static IAPSeller instance;
private void Awake(){
instance = this;
Di = DataStorage.instance;
...........
private void InitializationLot(Product p){
Di.ScoreText.text = "11111";
.........
NullReferenceException: Object reference not set to an instance of an object
IAPSeller.InitializationLot (UnityEngine.Purchasing.Product p) (at Assets/Resources/Scripts/IAPSeller.cs:632)
............. ...............
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question