Hello World!
I’m having an error:
The name `tqgameController2’ does not
exist in the current context
Not sure what i’m doing wrong in my code to get this error. Any suggestions?
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using System.Collections;
using TriviaQuizGame;
using TriviaQuizGame.Types;
public class OnClick_Button_Canvas : MonoBehaviour
{
public Button buttonPrefab; //default button
void start()
{
GameObject go = GameObject.Find("GameController");
TQGGameController tqgameController = (TQGGameController)go.GetComponent(typeof(TQGGameController));
TQGGameController tqgameController2 = new TQGGameController();
buttonPrefab.onClick.AddListener(delegate { MyMethod(0); });
}
void MyMethod(int index)
{
Debug.Log("Button Clicked");
tqgameController2.ChooseAnswer(index);
}
}