Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Question please help line 17, 35, 39 it says identifier excpected

Discussion in 'Scripting' started by DashingMortis, Jun 2, 2020.

  1. DashingMortis

    DashingMortis

    Joined:
    Jun 1, 2020
    Posts:
    13
    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using UnityEngine.UI;
    5. using UnityEngine.EventSystems;
    6.  
    7. public class JoyStick : MonoBehaviour, IPointerDownHandler, IPointerUpHandler, IDragHandler {
    8.  
    9.     private Image treshold;
    10.     private Image touch;
    11.  
    12.     [HideInInspector]
    13.     public Vector3 InputDir;
    14.     [HideInInspector]
    15.     public bool shoot;
    16.  
    17.     public void OnDrag(UnityEngine,EventSystems PointerEventData ,data) {
    18.         Vector2 position = Vector2.zero;
    19.  
    20.         if (RectTransformUtility.ScreenPointToLocalPointInRectangle (treshold.rectTransform,
    21.                 eventData.position,
    22.                 eventData.pressEventCamera,
    23.                 out position)) {
    24.             position.x = (position.x / treshold.rectTransform.sizeDelta.x);
    25.             position.y = (position.y / treshold.rectTransform.sizeDelta.y);
    26.        
    27.             float x = (treshold.rectTransform.pivot.x == 1f) ? position.x * 2 + 1 : position.x * 2 - 1;
    28.             float y = (treshold.rectTransform.pivot.y == 1f) ? position.y * 2 + 1 : position.y * 2 - 1;    
    29.        
    30.             InputDir = new Vector3(x, y, 0);
    31.             InputDir = (InputDir.magnitude > 1) ? InputDir.normalized : InputDir;
    32.         }
    33.     }
    34.  
    35.     public void OnPointerDown (UnityEngine.EventSystems PointerEventData ,data) {
    36.         throw new System.NotImplementedException();
    37.     }
    38.  
    39.     public void OnPointerUp(UnityEngine.EventSystems PointerEventData ,data) {
    40.         throw new System.NotImplementedException();
    41.     }
    42.     // When The Scene Starts
    43.     void Start(){
    44.         treshold = GetComponent<Image> ();
    45.         touch = transform.GetChild (0).GetComponent<Image> ();
    46.         InputDir = Vector3.zero;
    47.     }
    48. }
     
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    Code (CSharp):
    1. UnityEngine.EventSystems PointerEventData ,data
    should be
    Code (CSharp):
    1. UnityEngine.EventSystems.PointerEventData data
    in all those places. You must have copied and pasted or copied something wrong.
     
  3. DashingMortis

    DashingMortis

    Joined:
    Jun 1, 2020
    Posts:
    13
    Code (CSharp):
    1. public void OnDrag(UnityEngine.EventSystems PointerEventData ,data)
    it says i need to put a identifier i tried removing the comma but then it just made another error saying "," expected
     
  4. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    "UnityEngine.EventSystems.PointerEventData" is the type.
    "data" is the identifier. An identifier is just a name for a variable.

    Make sure that's exactly what you have everywhere. Currently in some places you're using a comma(,) instead of a period(.) or you're missing a period. Look closely.