R
R
Roman Tuzov2019-12-05 17:14:22
Game development
Roman Tuzov, 2019-12-05 17:14:22

What do these errors mean (Unity3d, C#)?

Assets\Free Asset - 2D Handcrafted Art\Scripts\BulletControl.cs(7,76): error CS0535: 'BulletControl' does not implement interface member 'IBeginDragHandler.OnBeginDrag(PointerEventData)'

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

public class BulletControl : MonoBehaviour, IEndDragHandler, IDragHandler, IBeginDragHandler
{

    public void OnDrag(PointerEventData eventData)
    {
        transform.position.y = eventData.pointerCurrentRaycast.screenPosition;
    }
    
    Vector3 moveVec;

    public float speed = 5;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void FixedUpdate()
    {
        transform.Translate(Vector3.left * Time.deltaTime * speed);
    }
}
_LKjXwYX_nE.jpg

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolay Alekseev, 2019-12-09
@VariusRain

But after all, everything that it means is written in the text of the error ...
Your class does not implement the methods that should be, since you have specified certain interfaces.
If you are using Visual Studio, then just click on the problematic interface (IBeginDrug... and IEndDrug...) and press alt+enter, VS will prompt you to implement the interface explicitly or not.
If not VS, then ... go to VS.
And honestly, it's enough just to read the documentation on the interfaces you specified, what they do and why.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question