This file contains 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.U2D; | |
using System.IO; | |
/// <summary> | |
/// The SpriteAtlasUVTextureMaker class is responsible for encoding the UV information of sprites within a provided SpriteAtlas into a texture. | |
/// This encoded UV data can then be saved to a specified path. This utility can be especially useful in scenarios where sprite metadata | |
/// is required to be embedded within a texture for shaders or other graphical processes. | |
/// | |
/// Usage: |
This file contains 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; | |
using UnityEngine.UI; | |
/// <summary> | |
/// The RectTransform with this script attached is zoomed by scrolling and | |
/// moved up, down, left, or right by dragging. | |
/// This script will only work if the Canvas setting is either | |
/// * ScreenSpace - Overlay | |
/// * ScreenSpace - Camera |
This file contains 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 UnityEditor; | |
using UnityEngine; | |
// A custom editor window for managing object references in the Unity editor. | |
public class ObjectReferencesEditorWindow : EditorWindow | |
{ | |
const string ObjectFieldPrefsKey = "ObjectReferencesEditorWindow.ObjectField"; | |
const int FieldCount = 10; | |
[MenuItem("Window/Object References")] |
This file contains 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; | |
/// <summary> | |
/// EfficientObjectRenderer is a class designed to render specific objects | |
/// more efficiently by rendering them to a RenderTexture and displaying | |
/// that texture on a plane in front of the camera. | |
/// </summary> | |
public class EfficientObjectRenderer : MonoBehaviour | |
{ | |
[SerializeField] Camera mainCamera; |
This file contains 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.Collections; | |
using System.Threading; | |
using UnityEngine; | |
/// <summary> | |
/// Sample code to run processing in the background while keep 60fps. | |
/// </summary> | |
public class BackgroundProcessing60fps : MonoBehaviour | |
{ | |
const int TargetFrameRate = 60; |
This file contains 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; | |
using System.Collections.Generic; | |
using NUnit.Framework; | |
using UnityEngine; | |
using Unity.Mathematics; | |
using Unity.PerformanceTesting; | |
//TestRunnerでの実行結果 | |
//Index, Test Name, Version, SampleGroup Name, Unit, IncreaseIsBetter, Min, Max, Median, Average, StandardDeviation, Sum, Values, | |
//0,"Tests.TestPerformance.Test1",1,"Time","Millisecond",False,12438.2421,12881.16,12617.7891,12627.81142,150.106165086222,252556.2284,12490.3192,12588.2658,12568.1306,12473.9098,12459.1209,12438.2421,12725.6194,12778.6197,12863.0169,12465.9704,12707.7957,12857.5514,12617.7891,12767.8108,12777.468,12463.3161,12480.823,12524.9632,12881.16,12626.3363, |
This file contains 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.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
// Shear 2D shadows with only Transform | |
// https://zenn.dev/articles/37c65400e0fae9 | |
[ExecuteAlways] | |
public class ShearSprite : MonoBehaviour | |
{ | |
[SerializeField] SpriteRenderer spriteRenderer; |