Godot Version
4.6
Question
Hi!
I’m trying to call a method in a PackedScene with an attached GDscript, passing it an Array of custom Resources, but in the GDscript I receive it as an Array of EncodedAsObjectID instead. (see screenshot)
When trying to use instance_from_id(ugprade) I get the following error:
Error at (11, 37): Invalid argument for “instance_from_id()” function: argument 1 should be “int” but is “res://core/abilities/AbilityUpgrade.cs”.
This is my C# code:
[Export] private PackedScene _upgradeScreenScene;
// ...
private void OnLevelUp(int newLevel)
{
Node upgradeScreenInstance = _upgradeScreenScene.Instantiate();
upgradeScreenInstance.Call("set_ability_upgrades", new Array<AbilityUpgrade> { chosenUpgrade });
My custom resource:
[GlobalClass]
public partial class AbilityUpgrade : Resource
{
[Export] public string Id { get; set; }
[Export] public string Name { get; set; }
[Export(PropertyHint.MultilineText)] public string Description { get; set; }
}
It works with simple types like int or string. Tried for about an hour now to get it to work in any way or find something on the internet with no success. How do I get this to work?
