Copie depuis Unity VCS vers GitHub

This commit is contained in:
Denis L.
2025-12-10 18:51:40 +01:00
parent 5cfd9de581
commit 7383621db3
902 changed files with 588195 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
using System;
using UnityEditor;
using UnityEngine;
namespace CharacterCustomizationTool.Editor.MaterialManagement
{
public class MaterialOnDemand
{
private readonly string[] _paths;
private Material _value;
public Material Value => _value ? _value : LoadMaterial();
public MaterialOnDemand(params string[] paths)
{
_paths = paths;
}
private Material LoadMaterial()
{
foreach (var path in _paths)
{
var loadedMaterial = AssetDatabase.LoadAssetAtPath<Material>(path);
if (loadedMaterial != null)
{
return loadedMaterial;
}
}
throw new Exception();
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 64d9492e12b140e5a5d41e01cd21f244
timeCreated: 1733383656
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/MaterialManagement/MaterialOnDemand.cs
uploadId: 780839

View File

@@ -0,0 +1,20 @@
using System.Linq;
namespace CharacterCustomizationTool.Editor.MaterialManagement
{
public static class MaterialPaths
{
private static readonly string[] MainColorNames = { "Material", "Color" };
private static readonly string GlassName = "Glass";
private static readonly string EmissionName = "Emission";
public static readonly string[] MainColorPaths = MainColorNames.Select(GetMaterialPath).ToArray();
public static readonly string GlassPath = GetMaterialPath(GlassName);
public static readonly string EmissionPath = GetMaterialPath(EmissionName);
private static string GetMaterialPath(string materialName)
{
return $"{AssetsPath.Folder.Materials}{materialName}.mat";
}
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: dcdec3d40fc84864a9f14ccc7367a694
timeCreated: 1733383685
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/MaterialManagement/MaterialPaths.cs
uploadId: 780839

View File

@@ -0,0 +1,15 @@
using UnityEngine;
namespace CharacterCustomizationTool.Editor.MaterialManagement
{
public class MaterialProvider
{
private readonly MaterialOnDemand _mainColor = new(MaterialPaths.MainColorPaths);
private readonly MaterialOnDemand _glass = new(MaterialPaths.GlassPath);
private readonly MaterialOnDemand _emission = new(MaterialPaths.EmissionPath);
public Material MainColor => _mainColor.Value;
public Material Glass => _glass.Value;
public Material Emission => _emission.Value;
}
}

View File

@@ -0,0 +1,10 @@
fileFormatVersion: 2
guid: 706da59b74ca42979c0359ece9905274
timeCreated: 1733381019
AssetOrigin:
serializedVersion: 1
productId: 304841
packageName: Creative Characters FREE - Animated Low Poly 3D Models
packageVersion: 2.2
assetPath: Assets/ithappy/Creative_Characters_FREE/Scripts/Editor/MaterialManagement/MaterialProvider.cs
uploadId: 780839