Assets/contactDamage.cs(31,23): error CS0023: The ‘.’ operator cannot be applied to operand of type

I am having a problem with this script

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

public class contactDamage : MonoBehaviour {

    playerHealth ph;
    public int attackDamage = 5;
    public GameObject player;
    public float attackTimer;
    float timer;
   

    void Awake()
    {
        player = GameObject.FindGameObjectWithTag("Player");
        ph = player.GetComponent<playerHealth>();
       
    }


    void Update()
    {
        timer += Time.deltaTime;


    }

    public void OnCollisionStay2D(Collision2D other)
    {
        if(other.transform.tag == "Player" && timer >= attackTimer)
        {
            //ph.TakeDamage(attackDamage);
            Attack();
        }
    }

    void Time()
    {

    }

    void Attack ()
    {
        ph.TakeDamage(attackDamage);
        timer = 0f;
    }
}

I keep on getting the error: Assets/contactDamage.cs(31,23): error CS0023: The ‘.’ operator cannot be applied to operand of type ‘method group’

I’m not getting any compiler errors in this code. Maybe the problem is in in the playerHealth class? Want to include the code for that here too?

Possibly try renaming this?

void Time()
{

}

Yeah the problem is that on line 25, the compiler is getting confused because you have a method called Time, but you’re trying to use the Time class. So rename your Time() method to something else.

Also your line numbers in your pasted code don’t seem to match up with the compile error line number.

-Sam