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 UnityEditor; | |
using UnityEngine; | |
public class SnapRectTransformAnchorsToCorners : MonoBehaviour | |
{ | |
[MenuItem("CONTEXT/RectTransform/Snap Anchors To Corners", priority = 50)] | |
private static void Execute(MenuCommand command) | |
{ | |
RectTransform rectTransform = command.context as RectTransform; | |
RectTransform parent = rectTransform.parent as RectTransform; |
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 UnityEngine; | |
namespace UnityLibrary | |
{ | |
[CustomEditor(typeof(SceneAsset))] | |
public class CustomThumbnail : Editor | |
{ | |
public override bool HasPreviewGUI() => true; |
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 UnityEditor; | |
using UnityEngine; | |
public class BenchmarkEnterPlayMode | |
{ | |
[InitializeOnLoadMethod] | |
private static void Initialize() | |
{ | |
void OnPlayModeStateChanged( PlayModeStateChange state ) | |
{ |
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; | |
using System.Collections.Generic; | |
using System.Reflection; | |
using System.Text; | |
using UnityEditor; | |
using UnityEngine; | |
using UnityEngine.UI; | |
#if UNITY_2021_2_OR_NEWER | |
using PrefabStage = UnityEditor.SceneManagement.PrefabStage; | |
using PrefabStageUtility = UnityEditor.SceneManagement.PrefabStageUtility; |
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
private const int CallDepth = 300; | |
public static class MorpehExt | |
{ | |
public static float DoGetterExt(this in MorpehBaseContext.Component3 c3) => c3.Value1 * c3.Value2; | |
} | |
public struct Component1 | |
{ | |
public int Value; |
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.Collections.Generic; | |
using System.Linq; | |
using UnityEngine; | |
using Random = System.Random; | |
// This source code is used for the video. It obviously requires heavy alterations to be used in a real project. | |
public class ExampleGrid : MonoBehaviour | |
{ | |
[SerializeField] private Vector2Int _size; | |
[SerializeField] private Vector2 _gap; |
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
//Call_StackDumper_Example.cs | |
protected void OpenFP64() | |
{ | |
luaState.OpenLibs(LuaDLL.luaopen_fp64); | |
StackDumper.StackDump(luaState);//加这句,dump出当前Lua虚拟栈 | |
luaState.LuaSetField(-3, "fp64"); | |
StackDumper.StackDump(luaState);//加这句,dump出当前Lua虚拟栈 | |
} |
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
name: Generate UML | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
jobs: | |
generate-uml: | |
name: 'Generate UML' |
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
#if UNITY_EDITOR | |
using System.IO; | |
using UnityEditor; | |
using UnityEditor.PackageManager; | |
using UnityEditor.PackageManager.Requests; | |
public static class PackageCreator | |
{ | |
public static void CreateTgzPackage(string packagePath, string sourcePath) | |
{ | |
PackRequest packRequest = Client.Pack(sourcePath, packagePath); |
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
public static class AnimatorExtensions | |
{ | |
public static AnimatorParametersState SaveState(this Animator anim) | |
{ | |
List<AnimatorStateInfo> animStates = new List<AnimatorStateInfo>(); | |
for (int i = 0; i < anim.layerCount; i++) | |
{ | |
animStates.Add(anim.GetCurrentAnimatorStateInfo(i)); | |
} |
NewerOlder