Please Help I dont know whats wrong

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;

public class MultiJoy : MonoBehaviour, IPointerDownHandler,
IPointerUpHandler, IDragHandler
{
public RectTransform pad;
public RectTransform stick;

public void OnDrag(PointerEventData eventData)
{
stick.positioin = eventData.position;

stick.plocalPosition =
Vector2.ClampMagnitude(eventData.position -
(Vector)pad.position, pad.rect.width * 0.5f);
}

public void OnPointerDown(PointerEventData eventData)
{
pad.position = eventData.position;
}

public void OnPointerUp(PointerEventData eventData)
{
stick.localPosition = Vector2.zero;
}
}

Error that it gives is:
Assets\MultiJoy1.cs(14,15): error CS1061: ‘RectTransform’ does not contain a definition for ‘positioin’ and no accessible extension method ‘positioin’ accepting a first argument of type ‘RectTransform’ could be found (are you missing a using directive or an assembly reference?)

Assets\MultiJoy1.cs(16,15): error CS1061: ‘RectTransform’ does not contain a definition for ‘plocalPosition’ and no accessible extension method ‘plocalPosition’ accepting a first argument of type ‘RectTransform’ could be found (are you missing a using directive or an assembly reference?)

Assets\MultiJoy1.cs(18,10): error CS0246: The type or namespace name ‘Vector’ could not be found (are you missing a using directive or an assembly reference?)

None of these exist.
You misspelled position, added a p before localPosition, and meant either Vector2 or Vector3.

That said, please have a read: http://plbm.com/?p=220
Please use code tags next time as well :slight_smile:

1 Like