| | 1 | | // Copyright (c) 2020-2024 dotBunny Inc. |
| | 2 | | // dotBunny licenses this file to you under the BSL-1.0 license. |
| | 3 | | // See the LICENSE file in the project root for more information. |
| | 4 | |
|
| | 5 | | #if !UNITY_DOTSRUNTIME |
| | 6 | |
|
| | 7 | | using System; |
| | 8 | | using UnityEngine; |
| | 9 | |
|
| | 10 | | namespace GDX.Developer.Reports.Resource.Objects |
| | 11 | | { |
| | 12 | | /// <exception cref="UnsupportedRuntimeException">Not supported on DOTS Runtime.</exception> |
| | 13 | | public static class ObjectInfoFactory |
| | 14 | | { |
| | 15 | | public static ObjectInfo GetObjectInfo(Type targetType) |
| 0 | 16 | | { |
| 0 | 17 | | if (targetType == typeof(Texture2D) || |
| | 18 | | targetType == typeof(Texture3D) || |
| | 19 | | targetType == typeof(Texture2DArray) || |
| | 20 | | targetType == typeof(RenderTexture) || |
| | 21 | | targetType == typeof(Cubemap) || |
| | 22 | | targetType == typeof(CubemapArray)) |
| 0 | 23 | | { |
| 0 | 24 | | return new TextureObjectInfo(); |
| | 25 | | } |
| | 26 | |
|
| 0 | 27 | | if (targetType == typeof(Mesh)) |
| 0 | 28 | | { |
| 0 | 29 | | return new MeshObjectInfo(); |
| | 30 | | } |
| | 31 | |
|
| 0 | 32 | | if (targetType == typeof(Shader)) |
| 0 | 33 | | { |
| 0 | 34 | | return new ShaderObjectInfo(); |
| | 35 | | } |
| | 36 | |
|
| 0 | 37 | | if (targetType == typeof(AssetBundle)) |
| 0 | 38 | | { |
| 0 | 39 | | return new AssetBundleObjectInfo(); |
| | 40 | | } |
| | 41 | |
|
| 0 | 42 | | return new ObjectInfo(); |
| 0 | 43 | | } |
| | 44 | |
|
| | 45 | | public static Type GetObjectInfoType(Type targetType) |
| 1 | 46 | | { |
| 1 | 47 | | if (targetType == typeof(Texture2D) || |
| | 48 | | targetType == typeof(Texture3D) || |
| | 49 | | targetType == typeof(Texture2DArray) || |
| | 50 | | targetType == typeof(RenderTexture) || |
| | 51 | | targetType == typeof(Cubemap) || |
| | 52 | | targetType == typeof(CubemapArray)) |
| 1 | 53 | | { |
| 1 | 54 | | return typeof(TextureObjectInfo); |
| | 55 | | } |
| | 56 | |
|
| 0 | 57 | | if (targetType == typeof(Mesh)) |
| 0 | 58 | | { |
| 0 | 59 | | return typeof(MeshObjectInfo); |
| | 60 | | } |
| | 61 | |
|
| 0 | 62 | | if (targetType == typeof(Shader)) |
| 0 | 63 | | { |
| 0 | 64 | | return typeof(ShaderObjectInfo); |
| | 65 | | } |
| | 66 | |
|
| 0 | 67 | | if (targetType == typeof(AssetBundle)) |
| 0 | 68 | | { |
| 0 | 69 | | return typeof(AssetBundleObjectInfo); |
| | 70 | | } |
| | 71 | |
|
| 0 | 72 | | return typeof(ObjectInfo); |
| 1 | 73 | | } |
| | 74 | | } |
| | 75 | | } |
| | 76 | | #endif // !UNITY_DOTSRUNTIME |