Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Ochreous · Oct 22, 2015 at 12:54 AM · c#interfacepointermemberimplement

C# Class Does Not Implement Interface Member

I'm having some issues with my OnPointerClickString Class. When I tried to implement IPointerClickHandler and ISubmitHandler I got two errors saying OnPointerClickString does not implement them. Any ideas why? am I missing a library I need to implement? Did I implement them incorrectly?

 using UnityEngine;
 using UnityEngine.Events;
 using UnityEngine.EventSystems;
 using UnityEngine.Serialization;
 using System.Collections;
 
 public class OnPointerClickString : MonoBehaviour, IPointerClickHandler, ISubmitHandler {
     void OnPointerClick(PointerEventData eventData){
     Debug.Log("Has Clicked");
     }
 }
 
Comment
Add comment · Show 5
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image The-Little-Guy · Oct 22, 2015 at 01:25 AM 1
Share

You need to add all the methods from IPointerClickHandler and ISubmitHandler and put them into OnPointerClickString

avatar image Ochreous The-Little-Guy · Oct 22, 2015 at 02:50 AM 0
Share

Ok thanks for the info, you also have to declare the methods public too as I found out.

avatar image The-Little-Guy Ochreous · Oct 22, 2015 at 03:06 AM 0
Share

You only need to make them public if they are public in the Interface. If they are protected in the interface they need to be protected and same with private.

Show more comments
avatar image nadiahsofian · Feb 23, 2016 at 06:03 PM 0
Share

How I'm going to add all the methods from IPointerClickHandler and ISubmitHandler and put them into OnPointerClickString

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by jgodfrey · Feb 24, 2016 at 01:34 AM

An interface only contains signatures - so no actual implementation code. If you are creating a class that implements an interface (in your case, your class implements 2 interfaces), you must implement every member in the specified interface(s) within your class.

I don't know what IDE you're using, but Visual Studio has the ability to automatically generate stubs for specified interfaces. That said, you still have to provide the implementation code.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by Dimitrigaming · Jan 11, 2019 at 06:33 AM

you basically have to write each method down before the error will go away so you still need to add

 void OnPointerClick(PointerEventData click){
      Debug.Log("Has Clicked");
 }
 void OnSubmit(BaseEventData submit){
      Debug.Log("Has Submit");
 }

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

33 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

EventTrigger runtime added callbacks to OnPointerClick/OnPointerUp/OnPointerDown don't work. 1 Answer

Pointer or Copied Value? 1 Answer

How do I get gameobjects to fire a method based on an interface? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges