Tanoda
CheckMappers.cs
Go to the documentation of this file.
2using TriLibCore.Utils;
3using UnityEditor;
4using UnityEngine;
5
6namespace TriLibCore.Editor
7{
8 public static class CheckMappers
9 {
10 [InitializeOnEnterPlayMode]
11 [InitializeOnLoadMethod]
12 public static void Initialize()
13 {
14 var hasAnyMapper = false;
15 foreach (var materialMapperName in MaterialMapper.RegisteredMappers)
16 {
17 if (TriLibSettings.GetBool(materialMapperName))
18 {
19 hasAnyMapper = true;
20 break;
21 }
22 }
23 if (!hasAnyMapper)
24 {
25 string materialMapper;
26 if (GraphicsSettingsUtils.IsUsingHDRPPipeline)
27 {
28 materialMapper = "HDRPMaterialMapper";
29 }
30 else if (GraphicsSettingsUtils.IsUsingUniversalPipeline)
31 {
32 materialMapper = "UniversalRPMaterialMapper";
33 }
34 else
35 {
36 materialMapper = "StandardMaterialMapper";
37 }
38 Debug.Log($"TriLib is configured to use the '{materialMapper}' Material Mapper. If you want to use different Material Mappers, you can change this setting on the Project Settings/TriLib area.");
39 TriLibSettings.SetBool(materialMapper, true);
40 }
41 }
42
43 [MenuItem("TriLib/Select Material Mappers based on Rendering Pipeline")]
44 public static void AutoSelect()
45 {
46 foreach (var materialMapperName in MaterialMapper.RegisteredMappers)
47 {
48 TriLibSettings.SetBool(materialMapperName, false);
49 }
50 string materialMapper;
51 if (GraphicsSettingsUtils.IsUsingHDRPPipeline)
52 {
53 materialMapper = "HDRPMaterialMapper";
54 }
55 else if (GraphicsSettingsUtils.IsUsingUniversalPipeline)
56 {
57 materialMapper = "UniversalRPMaterialMapper";
58 }
59 else
60 {
61 materialMapper = "StandardMaterialMapper";
62 }
63 Debug.Log($"TriLib is configured to use the '{materialMapper}' Material Mapper. If you want to use different Material Mappers, you can change this setting on the Project Settings/TriLib area.");
64 TriLibSettings.SetBool(materialMapper, true);
65 }
66 }
67}
UnityEngine.Debug Debug
Definition: TanodaServer.cs:19