- Home /
RPG Text 2D on Object Interaction Javascript
This has been driving me insane! I've been watching videos on youtube, and some of the unity tutorials, but I cant find out how to code this.
This is the code I have so far.
// var dialogue = "Hello World";
// function OnCollisionEnter2D (coll: Collision2D){
// if((coll.gameObject.tag == "Player") && (Input.GetKey(KeyCode.Space))) {
// }
// function Update(){
// if (Input.GetKeyDown(KeyCode.Space)); {}
// function OnGUI() // { GUI.Button(Rect(150,375,300,30), dialogue);
}
How can I fix this code to make it interact with something? I want to be able to have my player walk up to an object and examine it and receive text back..
Your answer
![](https://koobas.hobune.stream/wayback/20220612054436im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
UI Text showing weird string value? 1 Answer
Pause Menu Issue (Black Screen) 0 Answers
Text wont change to correct value 1 Answer
TextField text component not updating 2 Answers