UNITY_ACCESS;
UNITY_UDL;
namespace {
classPlayer : publicClass {
public:inlinestatic Field<unity::api::csharp::String*> name;
inlinestatic Field<int> hp;
inlinestatic Method<void, Player*, int> set_hp;
inlinestatic Method<void, int> set_hp_static;
inlinestatic Property<int, Player> hp_access;
};
autouse() -> void {
constauto class_result = "Test.dll:Player"_class;
constauto& class_ = *class_result->lock();
constauto& name_filed = "Test.dll:Player:name"_field;
constauto& hp_field = *class_[UTYPE(unity::UnityField), "hp"]->lock();
constexprauto method = UTYPE(unity::UnityMethod);
auto& hp_set_field = *class_[method, "set_hp"]->lock();
auto& hp_static_field = *class_[method, "set_hp_static"]->lock();
auto& hp_field_set = *class_[method, "hp_access_set"]->lock();
auto& hp_field_get = *class_[method, "hp_access_get"]->lock();
Player::hp[hp_field.offset()];
Player::set_hp[hp_set_field.call()];
Player::set_hp_static[hp_static_field.call()];
Player::hp_access[hp_field_get.call(), hp_field_set.call()];
Player player;
player[Player::hp] = 114514;
player[Player::set_hp](114514);
Player::set_hp_static(114514);
player[Player::hp_access] = 114514;
[[maybe_unused]]int hp = player[Player::hp_access];
}
} // namespaceLatest commit
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|