must declare a body because it is not marked abstract, extern, or partial

Linus K 21 Reputation points
2022-07-20T16:58:14.627+00:00
using System.Collections;  
using System.Collections.Generic;  
using UnityEngine;  
using UnityEngine.UI;  
  
public class Coin : MonoBehaviour  
{  
	//Start is called before the first frame update  
	void Start()  
	{  
  
	}  
    //Update is called once per frame  
	void Update()  
	{  
		     
		 {  
			  
			 if (hit.gameObject.tag == "Coin")  
			 {  
				 int coinscollected = PlayerPrefs.GetInt("CoinsCollected");  
				 PlayerPrefs.SetInt("CoinsCollected", coinscollecd + 1);  
				 PlayerPrefs.Save();  
				 testText.text = "Coins: " + coinscollect;  
				 coinAudioSource.Play();  
				 Destroy(hit.gameObject);  
				     
					  
					  
			 }  
		 }  
	}  
private void OnControllerColliderHit(ControllerColliderHit hit);  
}  
Developer technologies | C#
{count} votes

Accepted answer
  1. Jack J Jun 25,296 Reputation points
    2022-07-21T08:42:50.92+00:00

    @Linus K , Welcome to Microsoft Q&A, as reza suggested, you could define a body for the problem to solve the problem.

     private void OnControllerColliderHit(ControllerColliderHit hit)  
            {  
      
            }  
    

    Best Regards,
    Jack


    If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.