Buenas a todos, mi problema en el que me quede estancado es sobre un sistema dedialogos que usa " public AssetText text " para colocar mi texto text.txt
Por ejemplo tenemos 2 NPC o 3(gameObject), a cada uno le asignamos un text.txt con su dialogo en su interior y una collision 2d trigger, en el que el player cuando se acerca y luego apretamos espacio se muestra el dialogo, hasta ahi todo perfecto, pero el problema es que al activar uno me sale el dialogo de otro npc y me acero a otro npc y me sale el mismo dialogo, los 3 npc me sale el mismo dialogo siendo que le asigne diferentes textos
este es el que atacho a los npc
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ActivateTextAtLine : MonoBehaviour {
public TextAsset theText;
public int startLine;
public int endLine;
public textBoxManager theTextBox;
public bool destroyWhenActivate;
public bool requireButtomPress;
public static bool waitForPress;
public string nombreNpc;
// Use this for initialization
void Start () {
theTextBox = FindObjectOfType<textBoxManager> ();
}
// Update is called once per frame
void Update () {
if (waitForPress && Input.GetKeyDown(KeyCode.Space)) {
waitForPress = false;
theTextBox.ReloadScripts (theText);
theTextBox.currentLine = startLine;
theTextBox.endAtLine = endLine;
//theTextBox.EnableTextBox ();
if (destroyWhenActivate) {
Destroy (gameObject);
}
}
}
void OnTriggerEnter2D(Collider2D other)
{
if (other.gameObject.name == "Player") {
if (requireButtomPress) {
waitForPress = true;
return;
}
theTextBox.ReloadScripts (theText);
theTextBox.currentLine = startLine;
theTextBox.endAtLine = endLine;
theTextBox.EnableTextBox ();
if (destroyWhenActivate) {
Destroy (gameObject);
}
}
}
void OnTriggerExit2D(Collider2D other)
{
if (other.name == "Player")