ive been working on thisa for like 3 days straight
if(Input.GetAxis("Fire1") > 0)
{
Debug.Log("fire1");
if(Physics2D.Raycast(trans, InputDirection, RayDist,layerMask))
{
Debug.Log("raycast");
RaycastHit2D HIT = Physics2D.Raycast(trans, InputDirection, layerMask);
Debug.Log(HIT.collider.gameObject);
GameObject HitGameObject = HIT.collider.gameObject;
Debug.Log(HitGameObject.GetComponent("Dialogue"));
if(HIT.collider.GetComponent<Dialogue>() != null)
{
Dialogue i_Ctrl = HIT.collider.GetComponent<Dialogue>();
Array Diags = i_Ctrl.DialogueArr;
Array ChaIf = i_Ctrl.characterInfos;
Debug.Log("got arrays");
UI.StartDialogue(Diags, ChaIf);
}
}
}
i have tryed getting the script from the collider HIT.collider.GetComponent();
i have tryed getting the game object then trying to grab the script from the game object
GameObject HitGameObject = HIT.collider.gameObject;
Debug.Log(HitGameObject.GetComponent(“Dialogue”));
IT IS
on the correct object
active in the scene
file name is named the same as the class
timing is not the problem
the problem IS the ()part of the script i can get transforms and other components easily just not the script
help PLEASE TvT