Answer the question
In order to leave comments, you need to log in
Error CS0101: The namespace '' already contains a definition for 'Destroyable'?
Guys, please help. It would seem that I have only 27 lines of code, but it’s not clear where the 3 errors come from ... It seems that I wrote everything correctly.
1 Error CS0101: The namespace '' already contains a definition for 'Destroyable'
2 Error CS0111: Type 'Destroyable' already defines a member called 'Start' with the same parameter types
3 Error CS0111: Type 'Destroyable' already defines a member called 'Update' with the same parameter types
My code
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Destroyable : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
private void OnCollisionEnter2D(Collision2D collision)
{
if (collision.gameObject.tag == "Player")
{
collision.gameObject.GetComponent<Rigidbody2D>().AddForce(transform.up * 8f, ForceMode2D.Impulse);
gameObject.GetComponentInParent<Enemy>().startDeath();
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question