Godot Version
Godot 4.4.1 Mono
Question
I just adapted mono version as i want to use c# for some metaprogramming.
So i created one my customized Attribute:
using System;
using Metalama.Framework.Aspects;
[AttributeUsage(AttributeTargets.Property, Inherited = true, AllowMultiple = false)]
[RunTime]
public class IdentifierAttribute : Attribute
{
public string BlanketField { get; set; }
}
And try to use it in my class:
using Godot;
using Godot.Collections;
using System;
[GlobalClass]
public partial class Unit : SerializableCS
{
const string Source = "data/units.csv";
[Identifier]
public int Id { get; set; }
private string Name { get; set; }
private Vector2I Coordinate { get; set; }
}
And in another class, i tried to fetch the Attribute from property Id:
var members = toType.GetMembers(BindingFlags.DeclaredOnly | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
foreach (var item in members)
{
GD.Print(item.Name);
GD.Print(item.GetCustomAttributes());
}
But all the members, print empty Attributes. I tried to list Properties, result are same.
Also tried add some Godot custom Attribute like [Export]. Also no luck, which is understanddable as those are work in editor process only.
Output be like:
Id
System.Attribute
Name
System.Attribute
AttributeCorrection
System.Attribute
MoveRange
System.Attribute
k__BackingField
System.Attribute
k__BackingField
System.Attribute
I just want some of my own attribute to be found in Runtime, can someone help?
[Runtime] Attribute from Metalama is some attemptence but not working also. tried RuntimeOrCompileTime as well.