- Home /
Question by
JerBear264 · Sep 10, 2017 at 08:14 PM ·
scriptableobjectcomponentsclick objects
what's an Easy Way to Detect Clicking within a Script?
I know the question has been asked several times, but, in a 2D plane, what's an easy way to detect clicking?
I have a 2D platformer game where you click on NPCs to interact with them. Step by step, what do I have to do, in the scripting and using components, to have something happen when I click.
Yes I know that was very vague but this is a more or less complicated question.
Comment
Answer by HammerCar · Sep 10, 2017 at 08:20 PM
Just add "2d" to your google search.
Use the OnMouseDown method. https://docs.unity3d.com/ScriptReference/MonoBehaviour.OnMouseDown.html
Your answer
Follow this Question
Related Questions
Using ScriptableObjects to build ECS archetypes 0 Answers
ScriptableObject use error , not use ? 0 Answers
Cannot create assets with c# 1 Answer
Save EditorWindow to disk 1 Answer