wip : subtitles & flash hallu

This commit is contained in:
Ferlat Thibaud
2026-05-29 16:01:03 +02:00
parent 816ccb843f
commit 4e6a8b96e4
26 changed files with 18075 additions and 791 deletions
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 5564aaa81c1b4d24eb35804793f8b916
guid: abf831794caacbc4fa88f92c5ce17b78
folderAsset: yes
DefaultImporter:
externalObjects: {}
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 7b0cf15b9f21dee4d9563b5a93d3cfc3
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -1,5 +1,97 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &3240856531494141158
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 5953892496634016345}
- component: {fileID: 6813584513434362232}
- component: {fileID: 857898985169210507}
- component: {fileID: 4841448913584480605}
m_Layer: 0
m_Name: HallucinationFlashTwo
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &5953892496634016345
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3240856531494141158}
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: 8294780350256436151}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &6813584513434362232
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3240856531494141158}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3aa8c513a3632aa4aa3b8ca2da6ca926, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unheimlich.Features.Hallucination.HallucinationFlash
_image: {fileID: 4841448913584480605}
_fadeIn: 0.05
_hold: 0.2
_fadeOut: 0.1
--- !u!222 &857898985169210507
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3240856531494141158}
m_CullTransparentMesh: 1
--- !u!114 &4841448913584480605
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 3240856531494141158}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.43093073, g: 0, b: 0.509434, a: 0}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
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!1 &4369225580407928194
GameObject:
m_ObjectHideFlags: 0
@@ -32,7 +124,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7021944921972612920}
- {fileID: 4043674246065667140}
- {fileID: 8294780350256436151}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -51,7 +143,7 @@ Canvas:
serializedVersion: 3
m_RenderMode: 0
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PlaneDistance: 0.2
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
@@ -103,6 +195,136 @@ MonoBehaviour:
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!1 &6789321259219868148
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 8294780350256436151}
m_Layer: 0
m_Name: FlashHallus
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &8294780350256436151
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6789321259219868148}
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: 4043674246065667140}
- {fileID: 5953892496634016345}
- {fileID: 3944854789609493124}
m_Father: {fileID: 8886833518829962744}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &8160826245413525260
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 3944854789609493124}
- component: {fileID: 3473725938729132267}
- component: {fileID: 8140630728869724205}
- component: {fileID: 4647244026437678797}
m_Layer: 0
m_Name: HallucinationFlashThree
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &3944854789609493124
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8160826245413525260}
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: 8294780350256436151}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &3473725938729132267
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8160826245413525260}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 3aa8c513a3632aa4aa3b8ca2da6ca926, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unheimlich.Features.Hallucination.HallucinationFlash
_image: {fileID: 4647244026437678797}
_fadeIn: 0.05
_hold: 0.2
_fadeOut: 0.1
--- !u!222 &8140630728869724205
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8160826245413525260}
m_CullTransparentMesh: 1
--- !u!114 &4647244026437678797
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8160826245413525260}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.50980395, g: 0.3606034, b: 0, a: 0}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Sprite: {fileID: 0}
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!1 &8447621161027149062
GameObject:
m_ObjectHideFlags: 0
@@ -116,7 +338,7 @@ GameObject:
- component: {fileID: 8036775480842771334}
- component: {fileID: 6197325093082392848}
m_Layer: 0
m_Name: HallucinationFlash
m_Name: HallucinationFlashOne
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -129,12 +351,12 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8447621161027149062}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
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: 8886833518829962744}
m_Father: {fileID: 8294780350256436151}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
@@ -153,8 +375,10 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 3aa8c513a3632aa4aa3b8ca2da6ca926, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::Unheimlich.Features.Hallucination.HallucinationFlash
_image: {fileID: 0}
_defaultEvent: {fileID: 0}
_image: {fileID: 6197325093082392848}
_fadeIn: 0.05
_hold: 0.2
_fadeOut: 0.1
--- !u!222 &8036775480842771334
CanvasRenderer:
m_ObjectHideFlags: 0
@@ -176,8 +400,8 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.UI.Image
m_Material: {fileID: 0}
m_Color: {r: 0.5283019, g: 0.021597153, b: 0.021597153, a: 1}
m_RaycastTarget: 1
m_Color: {r: 0.5283019, g: 0.021597153, b: 0.021597153, a: 0}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
@@ -285,10 +509,6 @@ PrefabInstance:
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4718893142042823352, guid: 8d9eb1538a87d3648abb3fe58d3e4fb4, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3592ea7367272db4cb3e650549fb4a91
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
+8
View File
@@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: e5e2669b8fe4c0d43a7b522c57d6cb0d
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
@@ -85,10 +85,10 @@ RectTransform:
- {fileID: 7539442832499066999}
m_Father: {fileID: 2015949941464314001}
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: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 51}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7283724369255092777
GameObject:
@@ -107,7 +107,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &758297416926061702
RectTransform:
m_ObjectHideFlags: 0
@@ -195,13 +195,89 @@ RectTransform:
m_Children:
- {fileID: 7319637420139533510}
- {fileID: 5038437034765625679}
- {fileID: 2897991016890434984}
m_Father: {fileID: 4513853938089067031}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: -860, y: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &7807458575896534655
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2897991016890434984}
- component: {fileID: 7326819069936938483}
m_Layer: 0
m_Name: Subtitles
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2897991016890434984
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7807458575896534655}
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: 7539442832499066999}
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: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &7326819069936938483
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7807458575896534655}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 5170627695bd877419928fa9ca37865d, type: 3}
m_Name:
m_EditorClassIdentifier: OctoCore.Runtime::OctoCore.Components.OctoWorldEvent
_trigger: 3
_action: 0
_condition: 0
_tags: []
_targets: []
_tolerance: 0.5
_duration: 1
_execution: 0
_delay: 1
_onTrigger:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 0}
m_TargetAssemblyTypeName:
m_MethodName:
m_Mode: 1
m_Arguments:
m_ObjectArgument: {fileID: 0}
m_ObjectArgumentAssemblyTypeName:
m_IntArgument: 0
m_FloatArgument: 0
m_StringArgument:
m_BoolArgument: 0
m_CallState: 2
_onTriggerDelayed:
m_PersistentCalls:
m_Calls: []
--- !u!1 &8394717948743689443
GameObject:
m_ObjectHideFlags: 0
@@ -213,6 +289,8 @@ GameObject:
- component: {fileID: 5038437034765625679}
- component: {fileID: 2607575129878109721}
- component: {fileID: 8696521486180000959}
- component: {fileID: 1902417551726438888}
- component: {fileID: 3440793362475906848}
m_Layer: 0
m_Name: Dialogue
m_TagString: Untagged
@@ -234,10 +312,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 7539442832499066999}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 781, y: -109}
m_SizeDelta: {x: 1500, y: 50}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -78}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &2607575129878109721
CanvasRenderer:
@@ -269,8 +347,8 @@ MonoBehaviour:
m_Calls: []
m_text: 'Bonjour ! Comment allez vous ? '
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontAsset: {fileID: 11400000, guid: 9861d68f4cda1504f8e39cc1464e8bec, type: 2}
m_sharedMaterial: {fileID: -7153799593197912463, guid: 9861d68f4cda1504f8e39cc1464e8bec, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
@@ -301,8 +379,8 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_VerticalAlignment: 256
m_HorizontalAlignment: 2
m_VerticalAlignment: 512
m_textAlignment: 65535
m_characterSpacing: 0
m_characterHorizontalScale: 1
@@ -339,6 +417,47 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &1902417551726438888
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8394717948743689443}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2480089bca340ef4994895faaa7b6740, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PerLetterFontShifter
_fonts:
- {fileID: 11400000, guid: 9861d68f4cda1504f8e39cc1464e8bec, type: 2}
- {fileID: 11400000, guid: 043f9a7ac0bbbe84ba999d32c075d688, type: 2}
- {fileID: 11400000, guid: 19647d97bb8853949b67859c86da890f, type: 2}
- {fileID: 11400000, guid: d2b009825e5fdef4197bfa70e59bf349, type: 2}
- {fileID: 11400000, guid: d612f7901720205498d63ae1fd6b556d, type: 2}
- {fileID: 11400000, guid: d5dd43cfa59c82841a5110cf1c54cfd6, type: 2}
_shiftInterval: 0.5
_minLetterDelay: 0.05
_maxLetterDelay: 0.45
_fontSize: 0
_overrideColor: 0
_textColor: {r: 1, g: 1, b: 1, a: 1}
--- !u!114 &3440793362475906848
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8394717948743689443}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1023fdbb836c50f48bd4b52575ed3689, type: 3}
m_Name:
m_EditorClassIdentifier: OctoCore.Runtime::OctoCore.Localization.OctoLocalizedText
data: {fileID: 0}
text: {fileID: 0}
textMeshPro: {fileID: 0}
textMeshProUGUI: {fileID: 8696521486180000959}
--- !u!1 &9065357664704064494
GameObject:
m_ObjectHideFlags: 0
@@ -350,13 +469,14 @@ GameObject:
- component: {fileID: 7319637420139533510}
- component: {fileID: 5882626619475037183}
- component: {fileID: 8205287516134524828}
- component: {fileID: 9171639134918874129}
m_Layer: 0
m_Name: Speaker
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!224 &7319637420139533510
RectTransform:
m_ObjectHideFlags: 0
@@ -371,10 +491,10 @@ RectTransform:
m_Children: []
m_Father: {fileID: 7539442832499066999}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 176.83795, y: -46}
m_SizeDelta: {x: 291.6759, y: 50}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: -56}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &5882626619475037183
CanvasRenderer:
@@ -406,8 +526,8 @@ MonoBehaviour:
m_Calls: []
m_text: Interlocuteur
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontAsset: {fileID: 11400000, guid: 9861d68f4cda1504f8e39cc1464e8bec, type: 2}
m_sharedMaterial: {fileID: -7153799593197912463, guid: 9861d68f4cda1504f8e39cc1464e8bec, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
@@ -438,7 +558,7 @@ MonoBehaviour:
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_HorizontalAlignment: 1
m_HorizontalAlignment: 2
m_VerticalAlignment: 256
m_textAlignment: 65535
m_characterSpacing: 0
@@ -476,3 +596,28 @@ MonoBehaviour:
m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!114 &9171639134918874129
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 9065357664704064494}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2480089bca340ef4994895faaa7b6740, type: 3}
m_Name:
m_EditorClassIdentifier: Assembly-CSharp::PerLetterFontShifter
_fonts:
- {fileID: 11400000, guid: 9861d68f4cda1504f8e39cc1464e8bec, type: 2}
- {fileID: 11400000, guid: 043f9a7ac0bbbe84ba999d32c075d688, type: 2}
- {fileID: 11400000, guid: 19647d97bb8853949b67859c86da890f, type: 2}
- {fileID: 11400000, guid: d2b009825e5fdef4197bfa70e59bf349, type: 2}
- {fileID: 11400000, guid: d612f7901720205498d63ae1fd6b556d, type: 2}
- {fileID: 11400000, guid: d5dd43cfa59c82841a5110cf1c54cfd6, type: 2}
_shiftInterval: 0.5
_minLetterDelay: 0.05
_maxLetterDelay: 0.45
_fontSize: 0
_overrideColor: 0
_textColor: {r: 1, g: 1, b: 1, a: 1}
@@ -246,37 +246,6 @@ MonoBehaviour:
m_ShadowLayerMask: 1
m_RenderingLayers: 1
m_ShadowRenderingLayers: 1
--- !u!1 &646939579
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 646939580}
m_Layer: 0
m_Name: Test Text
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &646939580
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 646939579}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -80.76271, y: -0, z: -88.03677}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &744399716
GameObject:
m_ObjectHideFlags: 0
@@ -290,7 +259,7 @@ GameObject:
- component: {fileID: 744399719}
- component: {fileID: 744399718}
m_Layer: 5
m_Name: Text (TMP)
m_Name: WordWithFontShifter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -308,12 +277,12 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1394312810}
m_Father: {fileID: 1707232193}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: 1820, y: 980}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &744399718
MonoBehaviour:
@@ -533,7 +502,7 @@ RectTransform:
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1394312810}
- {fileID: 1707232193}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@@ -690,7 +659,7 @@ GameObject:
- component: {fileID: 1394312812}
- component: {fileID: 1394312811}
m_Layer: 5
m_Name: Image
m_Name: Background
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -703,18 +672,17 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1394312809}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
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: 744399717}
m_Father: {fileID: 904174085}
m_Children: []
m_Father: {fileID: 1707232193}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_SizeDelta: {x: 1820, y: 980}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1394312811
MonoBehaviour:
@@ -754,7 +722,7 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1394312809}
m_CullTransparentMesh: 1
--- !u!1 &1531450571
--- !u!1 &1707232192
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
@@ -762,83 +730,39 @@ GameObject:
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1531450574}
- component: {fileID: 1531450573}
- component: {fileID: 1531450572}
m_Layer: 0
m_Name: EventSystem
- component: {fileID: 1707232193}
m_Layer: 5
m_Name: FlashWord
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1531450572
MonoBehaviour:
--- !u!224 &1707232193
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1531450571}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
m_Name:
m_EditorClassIdentifier: Unity.InputSystem::UnityEngine.InputSystem.UI.InputSystemUIInputModule
m_SendPointerHoverToParent: 1
m_MoveRepeatDelay: 0.5
m_MoveRepeatRate: 0.1
m_XRTrackingOrigin: {fileID: 0}
m_ActionsAsset: {fileID: -944628639613478452, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_PointAction: {fileID: -1654692200621890270, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_MoveAction: {fileID: -8784545083839296357, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_SubmitAction: {fileID: 392368643174621059, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_CancelAction: {fileID: 7727032971491509709, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_LeftClickAction: {fileID: 3001919216989983466, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_MiddleClickAction: {fileID: -2185481485913320682, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_RightClickAction: {fileID: -4090225696740746782, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_ScrollWheelAction: {fileID: 6240969308177333660, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_TrackedDevicePositionAction: {fileID: 6564999863303420839, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_TrackedDeviceOrientationAction: {fileID: 7970375526676320489, guid: ca9f5fa95ffab41fb9a615ab714db018, type: 3}
m_DeselectOnBackgroundClick: 1
m_PointerBehavior: 0
m_CursorLockBehavior: 0
m_ScrollDeltaPerTick: 6
--- !u!114 &1531450573
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1531450571}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3}
m_Name:
m_EditorClassIdentifier: UnityEngine.UI::UnityEngine.EventSystems.EventSystem
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 10
--- !u!4 &1531450574
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1531450571}
serializedVersion: 2
m_GameObject: {fileID: 1707232192}
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: 0}
m_Children:
- {fileID: 1394312810}
- {fileID: 744399717}
m_Father: {fileID: 904174085}
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: 0, y: 0}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 1242676834}
- {fileID: 24656247}
- {fileID: 646939580}
- {fileID: 904174085}
- {fileID: 1531450574}
File diff suppressed because it is too large Load Diff
@@ -6,6 +6,13 @@ using UnityEngine.UI;
namespace Unheimlich.UI
{
/// <summary>
/// Splits a TextMeshProUGUI string into individual per-letter child objects,
/// then periodically reassigns a random font to each letter with a staggered delay.
/// Whitespace is preserved as sized spacers. Font size, color, and alignment are
/// inherited from the source TMP component by default.
/// Call <see cref="StartShifting"/> to begin, or enable <see cref="_playOnAwake"/>.
/// </summary>
[RequireComponent(typeof(TextMeshProUGUI))]
public class PerLetterFontShifter : MonoBehaviour
{
@@ -15,44 +22,53 @@ namespace Unheimlich.UI
[SerializeField] private TMP_FontAsset[] _fonts;
[Header("Timing")]
[SerializeField] private bool _playOnAwake = false;
[SerializeField] private float _shiftInterval = 3f;
[SerializeField] private float _minLetterDelay = 0.05f;
[SerializeField] private float _maxLetterDelay = 0.25f;
[Tooltip("Per-letter delay as a fraction of shift interval. 0 = all letters shift at once, 1 = stagger can span the full interval.")]
[SerializeField, Range(0f, 1f)] private float _shiftRandomness = 0.3f;
[Header("Style")]
[SerializeField] private float _fontSize = 36f;
[Tooltip("Leave at 0 to inherit font size from the source TMP component.")]
[SerializeField] private float _fontSize = 0f;
[Tooltip("When enabled, overrides the source TMP color with the value below.")]
[SerializeField] private bool _overrideColor = false;
[SerializeField] private Color _textColor = Color.white;
#endregion
#region Private Fields
private TextMeshProUGUI _originalTmp;
private string _originalText;
private TextMeshProUGUI _sourceTmp;
private string _sourceText;
private float _resolvedFontSize;
private TextAlignmentOptions _resolvedAlignment;
private readonly List<TextMeshProUGUI> _letterObjects = new List<TextMeshProUGUI>();
private Coroutine _shiftLoopRoutineHandle;
private Coroutine _shiftLoopHandle;
#endregion
#region Unity Lifecycle Methods
#region Unity Lifecycle
private void Awake()
{
_originalTmp = GetComponent<TextMeshProUGUI>();
_originalText = _originalTmp.text;
_originalTmp.enabled = false;
}
_sourceTmp = GetComponent<TextMeshProUGUI>();
_sourceText = _sourceTmp.text;
_resolvedFontSize = (_fontSize > 0f) ? _fontSize : _sourceTmp.fontSize;
_resolvedAlignment = _sourceTmp.alignment;
// Hide the original component; child letter objects take over rendering.
_sourceTmp.enabled = false;
private void OnEnable()
{
BuildLetterObjects();
_shiftLoopRoutineHandle = StartCoroutine(ShiftLoopRoutine());
}
private void OnDisable()
private void Start()
{
if (_shiftLoopRoutineHandle != null)
StopCoroutine(_shiftLoopRoutineHandle);
if (_playOnAwake)
StartShifting();
}
private void OnDestroy()
@@ -62,40 +78,115 @@ namespace Unheimlich.UI
#endregion
#region Public Methods
#region Public API
/// <summary>
/// Replaces the displayed text and rebuilds all letter objects.
/// </summary>
public void SetText(string newText)
{
_originalText = newText;
_sourceText = newText;
BuildLetterObjects();
}
/// <summary>
/// Begins the periodic font shuffle loop.
/// </summary>
public void StartShifting()
{
if (_shiftLoopHandle != null)
return;
_shiftLoopHandle = StartCoroutine(ShiftLoopRoutine());
}
/// <summary>
/// Stops the periodic font shuffle loop.
/// </summary>
public void StopShifting()
{
if (_shiftLoopHandle == null)
return;
StopCoroutine(_shiftLoopHandle);
_shiftLoopHandle = null;
}
#endregion
#region Private Methods
#region Letter Object Management
/// <summary>
/// Destroys existing letter objects, then creates one child GameObject per character.
/// Spaces become hardcoded-width spacers; newlines are skipped.
/// Assigns an initial random font to every letter instantly so the text
/// never appears in its default font before the first shuffle cycle.
/// </summary>
private void BuildLetterObjects()
{
DestroyLetterObjects();
foreach (char character in _originalText)
foreach (char c in _sourceText)
{
GameObject letterGo = new GameObject($"Letter_{character}");
letterGo.transform.SetParent(transform, false);
if (c == '\n')
continue;
TextMeshProUGUI letterTmp = letterGo.AddComponent<TextMeshProUGUI>();
letterTmp.text = character.ToString();
letterTmp.fontSize = _fontSize;
letterTmp.color = _textColor;
letterTmp.alignment = TextAlignmentOptions.Center;
GameObject go = new GameObject($"Letter_{c}");
go.transform.SetParent(transform, false);
_letterObjects.Add(letterTmp);
TextMeshProUGUI tmp = go.AddComponent<TextMeshProUGUI>();
tmp.fontSize = _resolvedFontSize;
tmp.color = _overrideColor ? _textColor : _sourceTmp.color;
tmp.alignment = _resolvedAlignment;
if (c == ' ')
{
// Space glyphs are unreliable across custom fonts; use a LayoutElement
// with a hardcoded width derived from the resolved font size instead.
tmp.text = "\u00A0";
tmp.color = new Color(0f, 0f, 0f, 0f);
LayoutElement le = go.AddComponent<LayoutElement>();
le.preferredWidth = _resolvedFontSize * 0.5f;
le.preferredHeight = _resolvedFontSize;
}
else
{
tmp.text = c.ToString();
ContentSizeFitter fitter = go.AddComponent<ContentSizeFitter>();
fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
}
_letterObjects.Add(tmp);
}
ArrangeLetters();
ShuffleFonts();
ConfigureLayoutGroup();
AssignInitialFonts();
}
/// <summary>
/// Assigns a random font to every letter instantly, with no stagger.
/// Called once after build so no brusque font switch occurs on the first cycle.
/// </summary>
private void AssignInitialFonts()
{
if (_fonts == null || _fonts.Length == 0)
return;
foreach (TextMeshProUGUI letter in _letterObjects)
{
if (letter.text == "\u00A0")
continue;
letter.font = _fonts[Random.Range(0, _fonts.Length)];
}
}
/// <summary>
/// Destroys all tracked letter child objects and clears the list.
/// </summary>
private void DestroyLetterObjects()
{
foreach (TextMeshProUGUI letter in _letterObjects)
@@ -107,30 +198,61 @@ namespace Unheimlich.UI
_letterObjects.Clear();
}
private void ArrangeLetters()
#endregion
#region Layout
/// <summary>
/// Ensures a HorizontalLayoutGroup is present and configured to match
/// the alignment of the source TMP component.
/// </summary>
private void ConfigureLayoutGroup()
{
HorizontalLayoutGroup layout = gameObject.GetComponent<HorizontalLayoutGroup>();
if (layout == null)
layout = gameObject.AddComponent<HorizontalLayoutGroup>();
layout.childAlignment = TextAnchor.MiddleCenter;
layout.childAlignment = TMPAlignmentToTextAnchor(_resolvedAlignment);
layout.childForceExpandWidth = false;
layout.childForceExpandHeight = false;
layout.childControlWidth = true;
layout.childControlHeight = true;
layout.spacing = 0f;
foreach (TextMeshProUGUI letter in _letterObjects)
{
ContentSizeFitter fitter = letter.gameObject.GetComponent<ContentSizeFitter>();
if (fitter == null)
fitter = letter.gameObject.AddComponent<ContentSizeFitter>();
fitter.horizontalFit = ContentSizeFitter.FitMode.PreferredSize;
fitter.verticalFit = ContentSizeFitter.FitMode.PreferredSize;
}
}
/// <summary>
/// Maps a TMP TextAlignmentOptions value to the closest Unity TextAnchor equivalent.
/// </summary>
private static TextAnchor TMPAlignmentToTextAnchor(TextAlignmentOptions alignment)
{
return alignment switch
{
TextAlignmentOptions.TopLeft
or TextAlignmentOptions.Left => TextAnchor.UpperLeft,
TextAlignmentOptions.Top => TextAnchor.UpperCenter,
TextAlignmentOptions.TopRight => TextAnchor.UpperRight,
TextAlignmentOptions.MidlineLeft
or TextAlignmentOptions.BaselineLeft => TextAnchor.MiddleLeft,
TextAlignmentOptions.Center
or TextAlignmentOptions.Midline
or TextAlignmentOptions.Baseline => TextAnchor.MiddleCenter,
TextAlignmentOptions.MidlineRight
or TextAlignmentOptions.BaselineRight => TextAnchor.MiddleRight,
TextAlignmentOptions.BottomLeft => TextAnchor.LowerLeft,
TextAlignmentOptions.Bottom => TextAnchor.LowerCenter,
TextAlignmentOptions.BottomRight => TextAnchor.LowerRight,
_ => TextAnchor.MiddleCenter,
};
}
#endregion
#region Font Shuffling
/// <summary>
/// Kicks off a staggered coroutine that assigns a new random font to each letter
/// in a shuffled order to avoid a predictable left-to-right sweep.
/// </summary>
private void ShuffleFonts()
{
if (_fonts == null || _fonts.Length == 0)
@@ -142,10 +264,12 @@ namespace Unheimlich.UI
StartCoroutine(ShuffleStaggeredRoutine());
}
/// <summary>
/// Returns a Fisher-Yates shuffled list of indices into <see cref="_letterObjects"/>.
/// </summary>
private List<int> GetShuffledIndices()
{
List<int> indices = new List<int>();
List<int> indices = new List<int>(_letterObjects.Count);
for (int i = 0; i < _letterObjects.Count; i++)
indices.Add(i);
@@ -162,8 +286,14 @@ namespace Unheimlich.UI
#region Coroutines
/// <summary>
/// Waits for <see cref="_shiftInterval"/> seconds, then triggers a new font shuffle.
/// Runs indefinitely until <see cref="StopShifting"/> is called.
/// </summary>
private IEnumerator ShiftLoopRoutine()
{
ShuffleFonts();
while (true)
{
yield return new WaitForSeconds(_shiftInterval);
@@ -171,20 +301,22 @@ namespace Unheimlich.UI
}
}
/// <summary>
/// Iterates over letter objects in shuffled order, assigning a random font to each
/// with a staggered delay of <see cref="_shiftRandomness"/> * <see cref="_shiftInterval"/>.
/// Spacer objects (non-breaking spaces) are skipped.
/// </summary>
private IEnumerator ShuffleStaggeredRoutine()
{
List<int> shuffledIndices = GetShuffledIndices();
foreach (int index in shuffledIndices)
foreach (int index in GetShuffledIndices())
{
TextMeshProUGUI letter = _letterObjects[index];
if (letter.text == " " || letter.text == "\n")
if (letter.text == "\u00A0")
continue;
letter.font = _fonts[Random.Range(0, _fonts.Length)];
yield return new WaitForSeconds(Random.Range(_minLetterDelay, _maxLetterDelay));
yield return new WaitForSeconds(_shiftInterval * Random.Range(0f, _shiftRandomness));
}
}