-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Expand file tree
/
Copy pathProfilerModuleMetadataAttribute.cs
More file actions
39 lines (32 loc) · 1.28 KB
/
ProfilerModuleMetadataAttribute.cs
File metadata and controls
39 lines (32 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using System;
namespace Unity.Profiling.Editor
{
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public partial class ProfilerModuleMetadataAttribute : Attribute
{
public ProfilerModuleMetadataAttribute(string displayName)
{
DisplayName = displayName;
}
public string DisplayName { get; }
public string IconPath { get; set; } = "Profiler.Custom";
}
public partial class ProfilerModuleMetadataAttribute : Attribute
{
// Internally we localize module names using this constructor.
internal ProfilerModuleMetadataAttribute(string displayNameKey, Type localizationResourceType)
{
var resource = Activator.CreateInstance(localizationResourceType) as IResource;
if (resource == null)
throw new ArgumentException($"Resource type must implement {nameof(IResource)}.", "resourceType");
DisplayName = resource.GetLocalizedString(displayNameKey);
}
internal interface IResource
{
string GetLocalizedString(string key);
}
}
}