Godot Version
Godot_v4.5-stable_mono_win64
Question
(my code is all in c#) in the following video, inside the melee() function the man accesses the variable "health" with "body.health". but when i try to do the same thing in my code it doesn't allow me to get to that variable or to be more specific, nothing inside the class that the script has
this is the main part.
public override void _Process(double delta)
{
base._Process(delta);
if (Input.IsActionJustPressed("attack") == true)
{
if (!WeaponAnimation.IsPlaying())
{
WeaponAnimation.Play("attack");
WeaponAnimation.Queue("return");
}
if (WeaponAnimation.CurrentAnimation == "attack")
{
foreach (var enemy in WeaponHitbox.GetOverlappingBodies())
{
MeshInstance3D parent = enemy.GetParent<MeshInstance3D>();
if (parent.IsInGroup("enemy"))
{
GD.Print(enemy.Name);
GD.Print(parent.Name);
//parent.gothit()
}
}
}
}
}
this is what the two GD.Print() print

this is the enemy code:
using Godot;
using System;
public partial class Enemy : MeshInstance3D
{
public float healthShi = 10.0f;
public void gothit(float DamageGotten)
{
healthShi = -DamageGotten;
}
public override void _Process(double delta)
{
if (healthShi <= 0)
{
QueueFree();
}
}
}
i can answer fairly quickly for the next like, 2 hours i guess

