this error happened when i added a public onto a void but when i change it back it stayed.
here is the error:
void OnTriggerEnter(Collider collider)
Assets\Player.cs(13,10): error CS0111: Type ‘Player’ already defines a member called ‘Start’ with the same parameter types
i don’t have any other script called “Player” but it’s telling me that there is another so i’m very confused.
it’s also happening to one of my other scripts.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Player : MonoBehaviour
{
public int maxHealth = 10;
public int currentHealth;
public HealthBar healthBar;
// Start is called before the first frame update
void Start()
{
currentHealth = maxHealth;
healthBar.SetMaxHealth(maxHealth);
}
// Update is called once per frame
/* void Update()
{
if ()
{
TakeDamage(1);
}
}*/
public void TakeDamage(int Damage)
{
currentHealth -= Damage;
healthBar.SetHealth(currentHealth);
}
}
Second Code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Pathfinding;
public class EnemyGFX : MonoBehaviour
{
public AIPath aiPath;
// Update is called once per frame
void Update()
{
if(aiPath.desiredVelocity.x >= 0.01)
{
transform.localScale = new Vector3(-1f, 1f, 1f);
} else if (aiPath.desiredVelocity.x <= -0.01f)
{
transform.localScale = new Vector3(1f, 1f, 1f);
}
}
void OnCollisionEnter2D(Collision2D collision)
{
if(collision.gameObject.tag == "Player")
{
TakeDamage(1);
}
}
}