Slide 20
Slide 20 text
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
public class PageAssetAttribute : Attribute
{
public string PrefabName { get; }
public PageAssetAttribute(string prefabName)
{
this.PrefabName = prefabName;
}
}
[PageAsset("BarPage.prefab")]
public class BarPage : BasePage
{
public class Transition : BasePageTransition{}
}
// PageAssetAttributeを取り出す
var pageNameAttr = Attribute.GetCustomAttribute(typeof(TPage),
typeof(PageAssetAttribute)) as PageAssetAttribute;
var pageInstance = await DoPrefabLoad(pageNameAttr.PrefabName);
2021/03/24 Gotanda.unity #17 20