|
|
|
|
|
|
} |
|
|
|
else |
|
|
|
{ |
|
|
|
m_AssetRoleToolbarMenu.text = GetDisplayName(type); |
|
|
|
m_AssetRoleToolbarMenu.text = GetAssetRoleDisplayName(type); |
|
|
|
var newAssetRole = (AssetRoleBase)Activator.CreateInstance(type); |
|
|
|
m_AssetRoleProperty.managedReferenceValue = newAssetRole; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
static string GetAssetRoleDisplayName(Type type) |
|
|
|
{ |
|
|
|
return ((AssetRoleBase)Activator.CreateInstance(type)).label; |
|
|
|
return $"{((AssetRoleBase)Activator.CreateInstance(type)).label} ({type.Name})"; |
|
|
|
} |
|
|
|
} |
|
|
|
} |