- Home /
OnClick() function not working!!!
My code is as follows:
public class Exit : MonoBehaviour {
public GameObject pl1;
public GameObject pl2;
public Transform pl1v;
public Transform pl2v;
void Start () {
}
public BeenClicked () {
pl1.transform.position = pl1v.position;
pl2.transform.position = pl2v.position;
}
}
OnClick is not working. what should I do?
Answer by allenallenallen · Dec 26, 2015 at 03:29 PM
Where's OnClick function? I don't see it. How can you say something's not working when you don't show a screenshot of the OnClick function in the editor?
Did you set it up correctly like this?
Answer by SidDixit · Dec 27, 2015 at 01:05 AM
If you are talking about button onclick then,
add the script to your button then in the button go to onclick() then click the + icon drag the button(the one in which the script is added) in it and then- NoFunction-->Button(attached script) --> select the function BeenClicked()
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Add Listeners to array of Buttons 2 Answers
Unity 5: UI button OnPointerDown not function as expected 1 Answer