Search Unity

  1. Unity 2019.1 is now released.
    Dismiss Notice

OnMouse events not working

Discussion in 'Samsung Smart TV' started by matheuspb95, May 17, 2016.

  1. matheuspb95

    matheuspb95

    Joined:
    Apr 16, 2015
    Posts:
    3
    Hello everybody, I'm a game where i use the touch remote to click on circles on the screen. I'm using OnMouse events, that aren't working. My unity version is 5.3.4f1, the TV model is 46" Smart TV Full HD F8000 Série 8,
     
  2. Jaehyun

    Jaehyun

    Unity Technologies

    Joined:
    Feb 4, 2014
    Posts:
    55
    You can get mouse events after setting "SamsungTV.touchPadMode".
    This is sample code.
    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3.  
    4. public class NewBehaviourScript : MonoBehaviour {
    5.  
    6.     public Texture2D cursor;
    7.     // Use this for initialization
    8.     void Start () {
    9.        
    10.         #if UNITY_SAMSUNGTV
    11.         if (Application.platform == RuntimePlatform.SamsungTVPlayer)
    12.         {
    13.             // Set up samsung mouse mode
    14.             SamsungTV.touchPadMode = SamsungTV.TouchPadMode.Mouse;
    15.             Cursor.SetCursor(cursor, Vector2.zero, CursorMode.Auto);
    16.         }
    17.         #endif
    18.     }
    19.    
    20.     // Update is called once per frame
    21.     void Update () {
    22.         // Position of the mouse pointer
    23.         Vector3 pos = Input.mousePosition;
    24.        
    25.         if (Input.GetMouseButtonDown (0))
    26.         {
    27.             // touchpad clicked
    28.         }
    29.     }
    30. }
     
  3. matheuspb95

    matheuspb95

    Joined:
    Apr 16, 2015
    Posts:
    3
    I can get Input.GetMouseButton and other input related mouse.
    I wanna now if is possible to use OnMouseDown() in a script. it works on the editor but when i put it on the tv stop working. I need to know if this have an issue because i'm making a tutorial for tv development.
    Here is the code that i'm trying to use:
    Code (CSharp):
    1.  
    2.     void OnMouseDown()
    3.     {
    4.         StartCoroutine(Reduce(0.4f));
    5.         scenemanager.GainPoint();
    6.         reducing = true;
    7.     }
    8.  
     
    Last edited: May 19, 2016
  4. Jaehyun

    Jaehyun

    Unity Technologies

    Joined:
    Feb 4, 2014
    Posts:
    55
    I found that Unity has a problem related to this issue while building a game in Samsung TV.
    I'll patch this problem ASAP.
    (I guess the expected version that has a fix of this issue will be 5.3.5p4.)

    Thanks,