Hi, I make a script in Unity 2018 where Instantiate a Button from a prefab and put a tet in him.
The code is:
using UnityEngine;
using UnityEngine.UI;
using Unity.Collections;
using System.Collections;
using System.Collections.Generic;
public class Dialogo : MonoBehaviour {
public Parlamento parlamento;
private int i = 0;
private int j=0;
public Text panelDeDialogo;
public Text button;
public GameObject boton;
public GameObject padre;
void Start()
{
//boton = GetComponent ();
for(int j=0; j < parlamento.respuestas.Length; j++ ){
GameObject tmp = Instantiate(boton, panelDeDialogo.transform) as GameObject;
tmp.transform.parent=padre.transform;
tmp.GetComponent.text = parlamento.respuestas [j];
}
}
But when I type the .text the compiler give me an error CS0119 and I dont know how resolve it.
Sorry for my English and thank you for your responces.
,
↧