add skin color modifier

This commit is contained in:
2025-01-07 21:43:47 +02:00
parent bf4bdfdfd1
commit 090ffeb17d
34 changed files with 532 additions and 15 deletions
@@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: acffe3033e9199c449338af38acaa7b5
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+359 -15
View File
@@ -176,7 +176,7 @@ Transform:
m_GameObject: {fileID: 12970580}
serializedVersion: 2
m_LocalRotation: {x: 0.04843845, y: -0.16129155, z: 0.007705574, w: 0.98568726}
m_LocalPosition: {x: -0.43195614, y: 0.00000012122656, z: 0.00000006702976}
m_LocalPosition: {x: -0.43195617, y: 0.00000012122656, z: 0.00000006702977}
m_LocalScale: {x: 0.99999994, y: 1.0000001, z: 1.0000002}
m_ConstrainProportionsScale: 0
m_Children:
@@ -209,7 +209,7 @@ Transform:
m_GameObject: {fileID: 14005835}
serializedVersion: 2
m_LocalRotation: {x: 0.8632436, y: 0.004357842, z: -0.49878618, w: 0.07748528}
m_LocalPosition: {x: -0.47571135, y: 0.00000015153321, z: 0.00000002879131}
m_LocalPosition: {x: -0.47571138, y: 0.00000015153321, z: 0.000000028791312}
m_LocalScale: {x: 0.8588262, y: 0.858826, z: 1.0299177}
m_ConstrainProportionsScale: 0
m_Children:
@@ -2148,7 +2148,7 @@ Transform:
m_GameObject: {fileID: 381621452}
serializedVersion: 2
m_LocalRotation: {x: 0.71245664, y: 0.000003157182, z: -0.7017162, w: -0.000004015861}
m_LocalPosition: {x: -0.1066259, y: 0.03498028, z: 0.11798748}
m_LocalPosition: {x: -0.10662589, y: 0.03498028, z: 0.117987484}
m_LocalScale: {x: 0.9319945, y: 0.9319944, z: 0.9319945}
m_ConstrainProportionsScale: 0
m_Children:
@@ -2309,7 +2309,7 @@ Transform:
m_GameObject: {fileID: 443406964}
serializedVersion: 2
m_LocalRotation: {x: 0.05731216, y: 0.13909282, z: 0.010532074, w: 0.9885634}
m_LocalPosition: {x: -0.27796406, y: -0.0000006061543, z: 0.000000019202567}
m_LocalPosition: {x: -0.2779641, y: -0.0000006061543, z: 0.000000019202565}
m_LocalScale: {x: 1.007843, y: 1.007843, z: 1.0078433}
m_ConstrainProportionsScale: 0
m_Children:
@@ -2530,7 +2530,7 @@ Transform:
m_GameObject: {fileID: 484889716}
serializedVersion: 2
m_LocalRotation: {x: 0.0034723869, y: 0.059761748, z: 0.0069949906, w: 0.9981822}
m_LocalPosition: {x: -0.99282926, y: 0.0038169392, z: 0.012913245}
m_LocalPosition: {x: -0.9928292, y: 0.0038169392, z: 0.012913244}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
@@ -2723,7 +2723,7 @@ Transform:
m_GameObject: {fileID: 525464111}
serializedVersion: 2
m_LocalRotation: {x: 0.00000007450579, y: -0.07920218, z: 0.0000001370208, w: 0.99685854}
m_LocalPosition: {x: -0.053878445, y: 0.0000000037883296, z: 0.0000000175447}
m_LocalPosition: {x: -0.05387845, y: 0.0000000037883296, z: 0.000000017544702}
m_LocalScale: {x: 0.9726985, y: 0.97269875, z: 0.9726985}
m_ConstrainProportionsScale: 0
m_Children:
@@ -2788,7 +2788,7 @@ Transform:
m_GameObject: {fileID: 560864357}
serializedVersion: 2
m_LocalRotation: {x: -0.0584441, y: 0.11143424, z: -0.020151377, w: -0.99184716}
m_LocalPosition: {x: -0.03607323, y: 0.000000010278215, z: -0.00000037028494}
m_LocalPosition: {x: -0.03607323, y: 0.000000010278216, z: -0.00000037028494}
m_LocalScale: {x: 0.9999998, y: 0.9999999, z: 0.99999964}
m_ConstrainProportionsScale: 0
m_Children: []
@@ -3793,7 +3793,7 @@ Transform:
m_GameObject: {fileID: 776001980}
serializedVersion: 2
m_LocalRotation: {x: 0.71245664, y: -0.0000031329675, z: -0.7017162, w: 0.0000041779113}
m_LocalPosition: {x: -0.10662587, y: -0.03498022, z: 0.117987506}
m_LocalPosition: {x: -0.10662586, y: -0.03498022, z: 0.11798751}
m_LocalScale: {x: 0.9319945, y: 0.9319944, z: 0.9319945}
m_ConstrainProportionsScale: 0
m_Children:
@@ -3940,6 +3940,111 @@ Transform:
m_Children: []
m_Father: {fileID: 1159553977}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &833195172
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 833195173}
- component: {fileID: 833195175}
- component: {fileID: 833195174}
- component: {fileID: 833195176}
m_Layer: 5
m_Name: SkinColor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &833195173
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 833195172}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1934676612}
m_Father: {fileID: 1521816925}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -266.16113, y: 17}
m_SizeDelta: {x: 157.9128, y: 120.4398}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &833195174
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 833195172}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 21300000, guid: 1e236fb6472e26d4eb8ebe8a9a9eb4bb, type: 3}
m_Type: 0
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!222 &833195175
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 833195172}
m_CullTransparentMesh: 1
--- !u!114 &833195176
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 833195172}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2f3eb60cba57441478f606990bede4d9, type: 3}
m_Name:
m_EditorClassIdentifier:
selectedColor: {r: 0, g: 0, b: 0, a: 0}
OnColorPicked:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 3567185079414178321}
m_TargetAssemblyTypeName: CharacterDescriptor, Assembly-CSharp
m_MethodName: ChangeSkinColor
m_Mode: 0
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
--- !u!1 &853129254
GameObject:
m_ObjectHideFlags: 0
@@ -4282,7 +4387,7 @@ Transform:
m_GameObject: {fileID: 861806337}
serializedVersion: 2
m_LocalRotation: {x: -0.12615739, y: -0.0624886, z: 0.9890081, w: 0.045194127}
m_LocalPosition: {x: 0.017580127, y: -0.10129672, z: 0.0031646655}
m_LocalPosition: {x: 0.017580127, y: -0.10129672, z: 0.0031646658}
m_LocalScale: {x: 0.9999998, y: 1, z: 0.99999994}
m_ConstrainProportionsScale: 0
m_Children:
@@ -4806,7 +4911,7 @@ Transform:
m_GameObject: {fileID: 991729265}
serializedVersion: 2
m_LocalRotation: {x: -0.06516428, y: 0.099858984, z: -0.0074422555, w: 0.99283755}
m_LocalPosition: {x: -0.2779642, y: 0.00000025533507, z: 0.000000056519735}
m_LocalPosition: {x: -0.2779642, y: 0.00000025533507, z: 0.00000005651973}
m_LocalScale: {x: 1.007843, y: 1.007843, z: 1.0078431}
m_ConstrainProportionsScale: 0
m_Children:
@@ -5246,6 +5351,7 @@ Transform:
- {fileID: 1976674304}
- {fileID: 856666919}
- {fileID: 2048219381}
- {fileID: 1382388607}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1114185447
@@ -5991,7 +6097,7 @@ Transform:
m_GameObject: {fileID: 1348709675}
serializedVersion: 2
m_LocalRotation: {x: -0.006602823, y: -0.11711359, z: -0.014619218, w: 0.992989}
m_LocalPosition: {x: -0.43195647, y: 0.00000009091991, z: 0.0000000301409}
m_LocalPosition: {x: -0.4319565, y: 0.00000009091991, z: 0.000000030140903}
m_LocalScale: {x: 0.9999999, y: 0.9999998, z: 0.9999999}
m_ConstrainProportionsScale: 0
m_Children:
@@ -6195,6 +6301,107 @@ Transform:
- {fileID: 747385878}
m_Father: {fileID: 525464112}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1382388606
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1382388607}
- component: {fileID: 1382388610}
- component: {fileID: 1382388609}
- component: {fileID: 1382388608}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1382388607
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1382388606}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1098219117}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &1382388608
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1382388606}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &1382388609
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1382388606}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &1382388610
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1382388606}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 0
m_AdditionalShaderChannelsFlag: 0
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!1 &1399987722
GameObject:
m_ObjectHideFlags: 0
@@ -6687,6 +6894,7 @@ RectTransform:
- {fileID: 920299843}
- {fileID: 936630612}
- {fileID: 479900565}
- {fileID: 833195173}
m_Father: {fileID: 2048219381}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -7108,7 +7316,7 @@ Transform:
m_GameObject: {fileID: 1572129935}
serializedVersion: 2
m_LocalRotation: {x: 0.83057964, y: 0.00729414, z: -0.55598825, w: -0.031005535}
m_LocalPosition: {x: -0.4757118, y: -0.00000012122655, z: 0.00000010076955}
m_LocalPosition: {x: -0.47571182, y: -0.00000012122655, z: 0.000000100769554}
m_LocalScale: {x: 0.8588258, y: 0.8588258, z: 1.0299175}
m_ConstrainProportionsScale: 0
m_Children:
@@ -7884,7 +8092,7 @@ Transform:
m_GameObject: {fileID: 1864941247}
serializedVersion: 2
m_LocalRotation: {x: -0.8097095, y: 0.05499314, z: 0.011317698, w: 0.5841389}
m_LocalPosition: {x: -0.28055188, y: 0.00000035522953, z: -0.000000005316525}
m_LocalPosition: {x: -0.28055188, y: 0.00000035522956, z: -0.0000000053165246}
m_LocalScale: {x: 0.88392353, y: 0.8839235, z: 0.88392353}
m_ConstrainProportionsScale: 0
m_Children:
@@ -8317,7 +8525,7 @@ Transform:
m_GameObject: {fileID: 1930194042}
serializedVersion: 2
m_LocalRotation: {x: 0.7881416, y: -0.008899444, z: -0.020339722, w: 0.6150935}
m_LocalPosition: {x: -0.28055263, y: -0.00000012264957, z: -0.000000050493487}
m_LocalPosition: {x: -0.28055266, y: -0.00000012264958, z: -0.00000005049349}
m_LocalScale: {x: 0.8839231, y: 0.8839235, z: 0.88392353}
m_ConstrainProportionsScale: 0
m_Children:
@@ -8328,6 +8536,142 @@ Transform:
- {fileID: 1936758673}
m_Father: {fileID: 443406965}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1934676611
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1934676612}
- component: {fileID: 1934676614}
- component: {fileID: 1934676613}
m_Layer: 0
m_Name: Text (TMP) (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1934676612
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1934676611}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 833195173}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -82.83887, y: 50}
m_SizeDelta: {x: 201, y: 20}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1934676613
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1934676611}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Skin color
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_StyleSheet: {fileID: 0}
m_TextStyleHashCode: -1183493901
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_fontSize: 18
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_TextWrappingMode: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_linkedTextComponent: {fileID: 0}
parentLinkedComponent: {fileID: 0}
m_enableKerning: 0
m_ActiveFontFeatures: 6e72656b
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_EmojiFallbackSupport: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 1
m_isCullingEnabled: 0
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_IsTextObjectScaleStatic: 0
m_VertexBufferAutoSizeReduction: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!222 &1934676614
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1934676611}
m_CullTransparentMesh: 1
--- !u!1 &1936758672
GameObject:
m_ObjectHideFlags: 0
@@ -8421,7 +8765,7 @@ Transform:
m_GameObject: {fileID: 1983820102}
serializedVersion: 2
m_LocalRotation: {x: -0.13757263, y: 0.13247034, z: 0.98158556, w: 0.003912025}
m_LocalPosition: {x: 0.017578645, y: 0.10990167, z: 0.0031647424}
m_LocalPosition: {x: 0.017578645, y: 0.10990167, z: 0.0031647426}
m_LocalScale: {x: 0.9999999, y: 0.99999994, z: 0.9999999}
m_ConstrainProportionsScale: 0
m_Children:
@@ -4,6 +4,7 @@ using UMA;
using UMA.CharacterSystem;
using System.Collections.Generic;
using UnityEngine.UI;
using static UnityEngine.Rendering.DebugUI;
public class CharacterDescriptor : MonoBehaviour
{
@@ -79,4 +80,10 @@ public class CharacterDescriptor : MonoBehaviour
_dna["belly"].Set(value);
_avatar.BuildCharacter();
}
public void ChangeSkinColor(Color color)
{
_avatar.SetColor("Skin",color);
_avatar.UpdateColors(true);
}
}
+40
View File
@@ -0,0 +1,40 @@
using System;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.UI;
public class ImageColorPicker : MonoBehaviour, IPointerClickHandler
{
public Color selectedColor;
[Serializable]
public class ColorEvent : UnityEvent<Color> { }
public ColorEvent OnColorPicked = new ColorEvent();
public void OnPointerClick(PointerEventData eventData)
{
selectedColor = GetColor(GetPointUVPosition());
OnColorPicked.Invoke(selectedColor);
}
private Color GetColor(Vector2 pos)
{
Texture2D texture = GetComponent<Image>().sprite.texture;
Color selected = texture.GetPixelBilinear(pos.x, pos.y);
selected.a = 1;
return selected;
}
private Vector2 GetPointUVPosition()
{
Vector3[] imageCorners = new Vector3[4];
gameObject.GetComponent<RectTransform>().GetWorldCorners(imageCorners);
float texWidth = imageCorners[2].x - imageCorners[0].x;
float texHeight = imageCorners[2].y - imageCorners[0].y;
float uvX = (Input.mousePosition.x - imageCorners[0].x) / texWidth;
float uvY = (Input.mousePosition.y - imageCorners[0].y) / texHeight;
return new Vector2(uvX, uvY);
}
}
@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 2f3eb60cba57441478f606990bede4d9
Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

+117
View File
@@ -0,0 +1,117 @@
fileFormatVersion: 2
guid: 1e236fb6472e26d4eb8ebe8a9a9eb4bb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
flipGreenChannel: 0
isReadable: 1
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMipmapLimit: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: 1
aniso: 1
mipBias: 0
wrapU: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
swizzle: 50462976
cookieLightType: 0
platformSettings:
- serializedVersion: 4
buildTarget: DefaultTexturePlatform
maxTextureSize: 128
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 4
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
customData:
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spriteCustomMetadata:
entries: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant: