i have many errors in my code that i will list bellow with the code please help me:
Assets\scripts\RagdollDeath.cs(5,14): error CS0101: The namespace ‘’ already contains a definition for ‘RagdollDeath’
Assets\scripts\RagdollDeath.cs(13,14): error CS0111: Type ‘RagdollDeath’ already defines a member called ‘Start’ with the same parameter types
Assets\scripts\RagdollDeath.cs(33,14): error CS0111: Type ‘RagdollDeath’ already defines a member called ‘ToggleRagdoll’ with the same parameter types
Assets\RagdollDeath.cs(8,6): error CS0246: The type or namespace name ‘SerializedFieldAttribute’ could not be found (are you missing a using directive or an assembly reference?)
Assets\RagdollDeath.cs(8,6): error CS0246: The type or namespace name ‘SerializedField’ could not be found (are you missing a using directive or an assembly reference?)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class RagdollDeath : MonoBehaviour
{
[Header("References")]
[SerializeField] private Animator animator = null;
private Rigidbody[] ragdollBodies;
private Collider[] ragdollColloders;
private void Start()
{
ragdollBodies = GetComponentsInChildren<Rigidbody>();
ragdollColliders = GetComponentsInChildren<Collider>();
ToggleRagdoll(False);
Invoke(nameof(Die), 5f);
}
private void Die()
{
ToggleRagdoll(true);
foreach(Rigidbody rb in ragdollBodies)
{
rb.AddExplosionForce(107f, new Vector3(-1f, 0.5f, -1f), 5f, 0f, ForceMode.Impulse);
}
}
private void ToggleRagdoll(bool state)
{
animator.enabled = !state;
foreach(Rigidbody rb in ragdollBodies)
{
rb.isKinematic = !state;
}
foreach (Collider collider in ragdollColliders)
{
collider.enabled = state;
}
}
}
[code]