unity3d - how to make the new input handlers (IPointerDownHandler, and so on) work on non-UI GameObject? -
i wrote script this:
public class luatap : monobehaviour, ipointerdownhandler, ipointerexithandler, ipointeruphandler { #region ipointerdownhandler implementation public void onpointerdown (pointereventdata eventdata) { debug.log ("down "); } #endregion #region ipointerexithandler implementation public void onpointerexit (pointereventdata eventdata) { debug.log ("exit"); } #endregion #region ipointeruphandler implementation public void onpointerup (pointereventdata eventdata) { debug.log ("up"); } #endregion }
when script added non-ui gameobject, not work. prefer new input handlers , far know works on new ui.
how make work on non-ui gameobjects?
you game object has have collider. then, ensure have event system , relevant raycaster present in scene. ui system, graphic raycaster used, think might need physics raycaster instead.
Comments
Post a Comment