Click here to Skip to main content
15,890,123 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.SceneManagement;

public class Ahivments : MonoBehaviour
{
    int total_Coin_Vanya;

    [SerializeField] Button firstAch;
    [SerializeField] bool isFirst;


    // Start is called before the first frame update
    void Start()
    {
    total_Coin_Vanya = PlayerPrefs.GetInt("total_Coin_Vanya");
    if(total_Coin_Vanya2 >= 10 && !isFirst)
    {
     firstAch.interactable = true;
    }
    else
    {
     firstAch.interactable = false;
    }
    }

    public GetFirst()
    {
    int Coin_Vanya = PlayerPrefs.GetInt("Coin_Vanya");
    Coin_Vanya =+ 10;
    PlayerPrefs.SetInt("Coin_Vanya", Coin_Vanya);
    isFirst = trye;
    PlayerPrefs.SetInt("isFirst", isFirst ? 1 : 0);
    }

    public void ToMeinMenu()
    {
    SceneManager.LoadScene(0);
    }
}


What I have tried:

I tried to read the code, but I'm a beginner and I don't understand how to solve the problem.
Posted
Updated 18-Dec-22 6:01am
v2

Your method
C#
public GetFirst()

must have a return type such as void, int, etc..
C#
public void GetFirst()
 
Share this answer
 
Comments
Михаил Шпак 18-Dec-22 11:05am    
thanks
C#
public GetFirst() // but what does it return?

All methods other than constructors and destructors need to have a return statement, either explicit or implicit. So if this method does not return any value(s) then declare it as void, which means that it does not return anything:
C#
public void GetFirst() // does not return anything

Although it is usual for methods with "Get" as the first part to actually return something.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900