Search Unity

The type or namespace name 'Touch' could not be found

Discussion in 'Scripting' started by Zentify, Aug 16, 2019.

  1. Zentify

    Zentify

    Joined:
    Jul 27, 2019
    Posts:
    13
    I was trying to build as WebGL and it said this was wrong

    C:\Program Files\Unity\Hub\Editor\2019.2.0f1\Editor\Data\Resources\PackageManager\BuiltInPackages\com.unity.ugui\Runtime\EventSystem\InputModules\BaseInput.cs(104,24): error CS0246: The type or namespace name 'Touch' could not be found (are you missing a using directive or an assembly reference?)

    Code (csharp):
    1.  
    2. namespace UnityEngine.EventSystems
    3. {
    4.     /// <summary>
    5.     /// Interface to the Input system used by the BaseInputModule. With this it is possible to bypass the Input system with your own but still use the same InputModule. For example this can be used to feed fake input into the UI or interface with a different input system.
    6.     /// </summary>
    7.     public class BaseInput : UIBehaviour
    8.     {
    9.         /// <summary>
    10.         /// Interface to Input.compositionString. Can be overridden to provide custom input instead of using the Input class.
    11.         /// </summary>
    12.         public virtual string compositionString
    13.         {
    14.             get { return Input.compositionString; }
    15.         }
    16.         /// <summary>
    17.         /// Interface to Input.imeCompositionMode. Can be overridden to provide custom input instead of using the Input class.
    18.         /// </summary>
    19.         public virtual IMECompositionMode imeCompositionMode
    20.         {
    21.             get { return Input.imeCompositionMode; }
    22.             set { Input.imeCompositionMode = value; }
    23.         }
    24.         /// <summary>
    25.         /// Interface to Input.compositionCursorPos. Can be overridden to provide custom input instead of using the Input class.
    26.         /// </summary>
    27.         public virtual Vector2 compositionCursorPos
    28.         {
    29.             get { return Input.compositionCursorPos; }
    30.             set { Input.compositionCursorPos = value; }
    31.         }
    32.         /// <summary>
    33.         /// Interface to Input.mousePresent. Can be overridden to provide custom input instead of using the Input class.
    34.         /// </summary>
    35.         public virtual bool mousePresent
    36.         {
    37.             get { return Input.mousePresent; }
    38.         }
    39.         /// <summary>
    40.         /// Interface to Input.GetMouseButtonDown. Can be overridden to provide custom input instead of using the Input class.
    41.         /// </summary>
    42.         /// <param name="button"></param>
    43.         /// <returns></returns>
    44.         public virtual bool GetMouseButtonDown(int button)
    45.         {
    46.             return Input.GetMouseButtonDown(button);
    47.         }
    48.         /// <summary>
    49.         /// Interface to Input.GetMouseButtonUp. Can be overridden to provide custom input instead of using the Input class.
    50.         /// </summary>
    51.         public virtual bool GetMouseButtonUp(int button)
    52.         {
    53.             return Input.GetMouseButtonUp(button);
    54.         }
    55.         /// <summary>
    56.         /// Interface to Input.GetMouseButton. Can be overridden to provide custom input instead of using the Input class.
    57.         /// </summary>
    58.         public virtual bool GetMouseButton(int button)
    59.         {
    60.             return Input.GetMouseButton(button);
    61.         }
    62.         /// <summary>
    63.         /// Interface to Input.mousePosition. Can be overridden to provide custom input instead of using the Input class.
    64.         /// </summary>
    65.         public virtual Vector2 mousePosition
    66.         {
    67.             get { return Input.mousePosition; }
    68.         }
    69.         /// <summary>
    70.         /// Interface to Input.mouseScrollDelta. Can be overridden to provide custom input instead of using the Input class.
    71.         /// </summary>
    72.         public virtual Vector2 mouseScrollDelta
    73.         {
    74.             get { return Input.mouseScrollDelta; }
    75.         }
    76.         /// <summary>
    77.         /// Interface to Input.touchSupported. Can be overridden to provide custom input instead of using the Input class.
    78.         /// </summary>
    79.         public virtual bool touchSupported
    80.         {
    81.             get { return Input.touchSupported; }
    82.         }
    83.         /// <summary>
    84.         /// Interface to Input.touchCount. Can be overridden to provide custom input instead of using the Input class.
    85.         /// </summary>
    86.         public virtual int touchCount
    87.         {
    88.             get { return Input.touchCount; }
    89.         }
    90.         /// <summary>
    91.         /// Interface to Input.GetTouch. Can be overridden to provide custom input instead of using the Input class.
    92.         /// </summary>
    93.         /// <param name="index">Touch index to get</param>
    94.         public virtual Touch GetTouch(int index)
    95.         {
    96.             return Input.GetTouch(index);
    97.         }
    98.         /// <summary>
    99.         /// Interface to Input.GetAxisRaw. Can be overridden to provide custom input instead of using the Input class.
    100.         /// </summary>
    101.         /// <param name="axisName">Axis name to check</param>
    102.         public virtual float GetAxisRaw(string axisName)
    103.         {
    104.             return Input.GetAxisRaw(axisName);
    105.         }
    106.         /// <summary>
    107.         /// Interface to Input.GetButtonDown. Can be overridden to provide custom input instead of using the Input class.
    108.         /// </summary>
    109.         /// <param name="buttonName">Button name to get</param>
    110.         public virtual bool GetButtonDown(string buttonName)
    111.         {
    112.             return Input.GetButtonDown(buttonName);
    113.         }
    114.     }
    115. }
    116.  
     
  2. Boy2000

    Boy2000

    Joined:
    Aug 21, 2019
    Posts:
    8
    I've got the same error! did you solve it?
     
  3. Zentify

    Zentify

    Joined:
    Jul 27, 2019
    Posts:
    13
  4. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,775
    Try using UnityEngine.Touch instead of just Touch. Does that help?
     
  5. lertanisslobr

    lertanisslobr

    Joined:
    Oct 2, 2019
    Posts:
    2