Skip to content

Commit

Permalink
Updating visual messages to remove textmeshpro references.
Browse files Browse the repository at this point in the history
  • Loading branch information
rorygames committed May 7, 2021
1 parent 1ec6e22 commit 6d79de2
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 139 deletions.
155 changes: 26 additions & 129 deletions Resources/Prefabs/PlaybackInterface/Message.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ GameObject:
m_Component:
- component: {fileID: 5203310682819402217}
- component: {fileID: 5151404250986416580}
- component: {fileID: 2041098009853792481}
- component: {fileID: 5327997034528197697}
- component: {fileID: 7514690874593287929}
- component: {fileID: 9149037912766264153}
- component: {fileID: 8465452907230972026}
m_Layer: 0
m_Name: Message
m_TagString: Untagged
Expand All @@ -28,7 +26,7 @@ RectTransform:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6232731038013856936}
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: 0.01, y: 0.01, z: 0.01}
m_Children: []
Expand All @@ -55,10 +53,11 @@ MeshRenderer:
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
- {fileID: 10100, guid: 0000000000000000e000000000000000, type: 0}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
Expand All @@ -79,23 +78,8 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &2041098009853792481
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6232731038013856936}
m_Mesh: {fileID: 0}
--- !u!222 &5327997034528197697
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6232731038013856936}
m_CullTransparentMesh: 0
--- !u!114 &7514690874593287929
m_AdditionalVertexStreams: {fileID: 0}
--- !u!114 &9149037912766264153
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
Expand All @@ -104,117 +88,30 @@ MonoBehaviour:
m_GameObject: {fileID: 6232731038013856936}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3}
m_Script: {fileID: 11500000, guid: 18cbb942033020a46801ef5944f85f35, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text:
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_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 36
m_fontSizeBase: 36
m_fontWeight: 400
m_enableAutoSizing: 1
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 0
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_VertexBufferAutoSizeReduction: 1
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 7514690874593287929}
characterCount: 0
spriteCount: 0
spaceCount: 0
wordCount: 0
linkCount: 0
lineCount: 0
pageCount: 0
materialCount: 1
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_hasFontAssetChanged: 0
m_renderer: {fileID: 5151404250986416580}
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_maskType: 0
--- !u!114 &9149037912766264153
MonoBehaviour:
--- !u!102 &8465452907230972026
TextMesh:
serializedVersion: 3
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6232731038013856936}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 18cbb942033020a46801ef5944f85f35, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Text: '
'
m_OffsetZ: 0
m_CharacterSize: 0.2
m_LineSpacing: 1
m_Anchor: 4
m_Alignment: 1
m_TabSize: 4
m_FontSize: 250
m_FontStyle: 0
m_RichText: 1
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_Color:
serializedVersion: 2
rgba: 4294967295
17 changes: 7 additions & 10 deletions Scripts/Interface/MessageController.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using TMPro;
using UnityEngine;

namespace PlayRecorder.Interface
{

public class MessageController : MonoBehaviour
{

private TextMeshPro _textmesh;
private TextMesh _text;

private float _timeRemaining = 1f;

private Transform _camera;

private void Awake()
{
_textmesh = GetComponent<TextMeshPro>();
if (_textmesh == null)
_text = GetComponent<TextMesh>();
if (_text == null)
{
Debug.LogError("Message prefab does not have a textmesh component.");
}
Expand All @@ -31,13 +28,13 @@ public void CreateMessage(Transform camera, string message, float time)

public void CreateMessage(Transform camera, string message, float time, Color textColor)
{
if(_textmesh == null)
if(_text == null)
{
Debug.LogError("Message cannot be shown as prefab lacks a textmesh component.");
return;
}
_textmesh.color = textColor;
_textmesh.text = message;
_text.color = textColor;
_text.text = message;
_timeRemaining = time;
_camera = FindObjectOfType<Camera>().transform;
gameObject.SetActive(true);
Expand Down

0 comments on commit 6d79de2

Please sign in to comment.