This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Usage example: | |
| // using System.Collections.Generic; | |
| // using System.Text.RegularExpressions; | |
| // public enum AudioCategory { | |
| // Undefined, | |
| // Music, | |
| // Narration, | |
| // } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Select:End="100000" RelativeTo="Project" Start="40" Track="0" TrackCount="1" | |
| Delete: | |
| Select:End="2" RelativeTo="ProjectEnd" Start="0" | |
| Copy: | |
| SelectNone: | |
| Paste: | |
| SelectTracks:Mode="Set" Track="0" TrackCount="2" | |
| CrossfadeTracks:curve="0" direction="Automatic" type="ConstantGain" | |
| MixAndRender: | |
| SelectNone: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Select:End="5" RelativeTo="ProjectStart" Start="0" Track="0" TrackCount="1" | |
| Delete: | |
| Select:End="5" RelativeTo="ProjectEnd" Start="0" Track="0" TrackCount="1" | |
| Delete: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Add this to convert a local position to an anchored position | |
| public static Vector2 GetLocalToAnchoredPositionOffset(this RectTransform rectTransform) { | |
| var parentRT = (RectTransform) rectTransform.parent; | |
| var pivotAnchor = new Vector2(Mathf.LerpUnclamped(rectTransform.anchorMin.x, rectTransform.anchorMax.x, rectTransform.pivot.x), Mathf.LerpUnclamped(rectTransform.anchorMin.y, rectTransform.anchorMax.y, rectTransform.pivot.y)); | |
| return -parentRT.rect.size * (pivotAnchor - parentRT.pivot); | |
| } | |
| // Add this to convert a local position to an anchored position | |
| public static Vector2 GetAnchoredToLocalPositionOffset(this RectTransform rectTransform) { | |
| return -rectTransform.GetLocalToAnchoredPositionOffset(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System.IO; | |
| using UnityEditor; | |
| using UnityEditor.Presets; | |
| using System.Linq; | |
| // This script automatically applies Presets to assets when they are imported into a folder containing a Preset. | |
| // It also adds any labels on the Preset file to the asset. | |
| public class PresetImportPerFolder : AssetPostprocessor { | |
| void OnPreprocessAsset() { | |
| // Make sure we are applying presets the first time an asset is imported. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Released under MIT License | |
| using System.Reflection; | |
| using TMPro; | |
| using UnityEngine; | |
| using UnityEngine.EventSystems; | |
| using UnityEngine.UI; | |
| // Workaround for Unity's inability to keep an input field selected when you click a button. | |
| // Call ReactivateInputField to immediately activate and restore caret position/selection. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // RiveUIRenderer.cs created by Tom Kail. This file is licensed under the MIT License. | |
| // Renders a Rive asset to Unity UI using a RenderTexture in a similar manner to RawImage. | |
| // Supports pointer events and masking. | |
| using Rive; | |
| using UnityEditor; | |
| using UnityEngine; | |
| using UnityEngine.EventSystems; | |
| using UnityEngine.Rendering; | |
| using UnityEngine.UI; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using UnityEngine; | |
| using UnityEngine.EventSystems; | |
| public class BeginDragImmediately : MonoBehavior, IInitializePotentialDragHandler, IBeginDragHandler, IDragHandler { | |
| public void OnInitializePotentialDrag(PointerEventData eventData) { | |
| eventData.pointerDrag = gameObject; | |
| eventData.dragging = true; | |
| eventData.useDragThreshold = false; | |
| ExecuteEvents.ExecuteHierarchy(transform.gameObject, eventData, ExecuteEvents.beginDragHandler); | |
| } |
OlderNewer