Assets/Script/SpinController.cs(6,61): error CS0535: 'SpinController' does not implement…
- Assistant
Hello! How can I assist you today? If you have any questions or need information, feel free to ask.
- User
Assets/Script/SpinController.cs(6,61): error CS0535: 'SpinController' does not implement interface member 'IEndDragHandler.OnEndDrag(PointerEventData)'
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems;
public class SpinController : MonoBehaviour, IDragHandler, IEndDragHandler { private RectTransform rectTransform; private void Awake() { rectTransform = GetComponent(); }
codepublic void OnDrag(PointerEventData eventData) { rectTransform.Rotate(0, 0, eventData.delta.x + eventData.delta.y); } public void IEndDragHandler(PointerEventData eventData) { // Ici, vous pouvez implémenter une logique pour “fixer” la roue sur la couleur à sélectionner }}
- Assistant
The error message indicates that your
SpinControllerclass declares that it implements theIEndDragHandlerinterface but does not properly implement the interface's required methodOnEndDrag(PointerEventData). The methodIEndDragHandler(PointerEventData eventData)you have defined is incorrectly named; it should be namedOnEndDrag(PointerEventData eventData)to correctly implement the interface.Here is how you can correct the code:
csharp - User
je veux que mon spin puisse faire une rotation dans les 2 sens en fonction du sens de rotation effectué par l'utilisateur
- Assistant
- User
Assets/Script/SpinController.cs(26,28): error CS0103: The name 'currentDragPosition' does not exist in the current context
- Assistant