Stuck at this Google Dino game error notif

Hi! I’m following the Dino Game tutorial by Zigurous. I’m currently at the GameManager script and I’ve been having this problem/error notif in Unity of having a " Type ‘NewBehaviourScript’ already defines a member called ‘Update’ with the same parameter types". I’m guessing from the Player script. Can someone help me on this one?

I’m not sure now but I’m following the code as what’s written in the video. Is there like a way to compare the code? (Disclaimer: I’m a complete beginner in Unity.)

Here’s the code for the GameManager:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GameManager : MonoBehaviour
{
    public static GameManager Instance {get; private set;}

    public float initialGameSpeed = 5f;
    public float gameSpeedIncrease = 0.1f;
    public float gameSpeed { get; private set; }

  
    private void Awake()
    {
        if (Instance == null){
            Instance = this;
        } else {
            DestroyImmediate(gameObject);
        }
    }

        private void OnDestroy()
        {
            if (Instance == this) {
                Instance = null;
            }
        }

        private void Start()
        {
            NewGame();
        }

        private void NewGame()
        {
            gameSpeed = initialGameSpeed;
        }

        private void Update()
        {
            gameSpeed += gameSpeedIncrease * Time.deltaTime;
        }
}

And here’s for the Player script:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class NewBehaviourScript : MonoBehaviour
{
    private CharacterController character;
    private Vector3 direction;

    public float gravity = 9.81f * 2f;
    public float jumpForce = 8f;

    private void Awake()
    {
        character = GetComponent<CharacterController>();
    }

    private void OnEnable()
    {
        direction = Vector3.zero;
    }

    private void Update()
    {
        direction += Vector3.down * gravity * Time.deltaTime;

        if (character.isGrounded)
        {
            direction = Vector3.down;

            if (Input.GetButton("Jump"))
            {
                direction = Vector3.up * jumpForce;
            }
        }

        character.Move(direction * Time.deltaTime);
    }
  
}

This post is solved. I don’t know now how to delete this. Man this has really poor UI.

This is not poor UI, this is intentional. This is not a personal help desk. This is a forum and stuff posted here is supposed to help the community. So when you solved your own problem, it would be nice to post a solution and not just leach knowledge and keep yours for yourself.

1 Like