unity3d - Unity: How to detect mouse click in a script without attaching the script to an object? -
in unity, using c#, how detect click anywhere in screen, without attaching script object?
to specific, looking individual clicks, not mouse downs.
e.g. code below checks mouse down, want clicks instead
// update called once per frame void update () { // 1 vector3 currentposition = transform.position; // 2 if( input.getbutton("fire1") ) { // } }
you going need monobehaviour can use update()
function advantage. attach empty gameobject, not uncommon game have 1 empty gameobject has few scripts handle things.
check getmouseup
count clicks.
Comments
Post a Comment