Hi, I’m trying to modify brackeys dialogue system using raycast in an interactableOjects Script so that I can talk with multiple characters, however, when I talk to Character A it appears Characters B text and if I go to Character B the same text shows up (which in character B’s Case wouldn’t be a problem haha). is there a way that I can tell my script to identify both different objects and play different script (I mean without having to create different layers or tags)
InteractableObjects Script:
public void PersonInteract()
{
int layer_mask = LayerMask.GetMask("Person");
RaycastHit hit;
if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range, layer_mask))
{
Debug.Log("Speak");
FindObjectOfType<DialogueTrigger>().TriggerDialogue();
}
}
DialogueTrigger Script(the one that is attached to the NPC’s:
public class DialogueTrigger : MonoBehaviour
{
public Dialogue dialogue;
public Image faceChange;
public void TriggerDialogue()
{
faceChange.sprite = dialogue.Face;
Debug.Log("Talk");
FindObjectOfType<DialogueManager>().StartDialogue(dialogue);
}
}