ic = new InfoCenter();
Et dans mon constructeur, je veux récupérer l'objet BTN_1 comme ceci :
Code : Tout sélectionner
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class InfoCenter
{
[SerializeField]
GameObject BTN_1;
public InfoCenter()
{
BTN_1.SetActive(true);
}
NullReferenceException: Object reference not set to an instance of an object
Pourtant j'ai placé mon objet dans l'inspector...
Merci d'avance pour votre réponse
Kebek