I have an area with 2 signals connected to the GUI node.
When signal body_entered() tries to call the function bumpObjective() i get an error.
Weirdly enough when i call the function addObjective() with the ready() signal i dont get an error.
Both functions are in the same script.
I think i have everything setup correctly so i'm not sure what is happening here.

Code of GUI node
`
using Godot;
using System;
using System.Collections.Generic;

public class objective
{
public string name = "";
public int points = 0;
public int maxPoints = 0;
public bool complete = false;
public bool displayPoints = true;
}

public partial class GUIHandler : Control
{

[ExportCategory("Mission UI")]
[Export]
public Control mainUI { get; set; }

[Export]
public Label healthLabel { get; set; }

[Export]
public RichTextLabel objectiveLabel { get; set; }

[ExportCategory("Gameover UI")]
[Export]
public Control gameoverUI { get; set; }

[ExportCategory("Victory UI")]
[Export]
public Control victoryUI { get; set; }

List<objective> objectives = new List<objective>();


void updateObjectives()
{
	string resultText = "";
	foreach (objective obj in objectives)
	{
		string color = "";
		if(obj.complete)
		{
			color = "[color=#00ffff] ";
		}

		string count = "";

		if (obj.displayPoints)
		{
			count = " ( " + obj.points + " / " + obj.maxPoints + " )";
		}

		resultText += color + "Objective: " + obj.name + count + "\n";

	}

	objectiveLabel.Text = resultText;

}

public void bumpObjective(string name)
{
	objective obj = objectives.Find(x => x.name == name);
	if (obj != null)
	{

		int index = objectives.IndexOf(obj);

        obj.points++;

		if (obj.points > obj.maxPoints)
		{
			obj.complete = true;
		}

        objectives[index] = obj;

    }

	updateObjectives();
}

public void addObjective(string name, int requirement, bool display)
{
	objective obj = new objective();

	obj.name = name;
	obj.maxPoints = requirement;
	obj.displayPoints = display;

	objectives.Add(obj);

	updateObjectives();
}

public void changeHealth(float health)
{

	healthLabel.Text = Mathf.Round(health).ToString();

}

public void victory()
{

	mainUI.Visible = false;
	victoryUI.Visible = true;

	VehicleScript VS = GetNode<Node3D>("../Vehicle") as VehicleScript;
	
	VS.ignoreInput = true;

	CameraScript CS = GetNode<Node3D>("../MainCamera") as CameraScript;

}

public void gameover()
{

	mainUI.Visible = false;
	gameoverUI.Visible = true;

}


// Called when the node enters the scene tree for the first time.
public override void _Ready()
{

}

// Called every frame. 'delta' is the elapsed time since the previous frame.
public override void _Process(double delta)
{

}

}

`
Ready signal

Body_entered signal

  • Toxe replied to this.

    Toxe emit_signalp: Error calling from signal 'body_entered' to callable: 'Control(GUIHandler.cs)::bumpObjective': Method not found.

    Found the issue.
    body_entered outputs node3d when firing so instead of the args just being a string its now node3d and string.
    bumpObjective() only accepts string.
    Not sure if it's possible to disable the default signal output though.