This commit is contained in:
2025-05-13 03:30:23 +03:00
parent 224cfc8cf6
commit 5c489bb6ee
554 changed files with 1114771 additions and 0 deletions
@@ -0,0 +1,20 @@
using UnityEngine;
using UnityEditor;
[InitializeOnLoad]
public class AutosaveOnRun
{
static AutosaveOnRun()
{
EditorApplication.playmodeStateChanged = () =>
{
if(EditorApplication.isPlayingOrWillChangePlaymode && !EditorApplication.isPlaying)
{
Debug.Log("Auto-Saving scene before entering Play mode: " + EditorApplication.currentScene);
EditorApplication.SaveScene();
EditorApplication.SaveAssets();
}
};
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b9a811bc67f439d42af246b9e870de83
timeCreated: 1451992256
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,75 @@
using UnityEditor;
using UnityEngine;
class InputEditor : EditorWindow {
[MenuItem ("L/InputEditor")]
static void ShowWindow () {
EditorWindow.GetWindow (typeof(InputEditor));
}
public enum AxisType{
KeyOrMouseButton = 0,
MouseMovement = 1,
JoystickAxis = 2
}
private bool _renameAxis;
void OnGUI () {
_renameAxis = GUILayout.Toggle (_renameAxis, "Rename axis");
if (GUILayout.Button ("Reset input axes")) {
var serializedObject = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath("ProjectSettings/InputManager.asset")[0]);
int axisId = 0;
while(true){
var axesProperty = serializedObject.FindProperty("m_Axes");
axesProperty.Next(true);
axesProperty.Next(true);
axesProperty.Next(true);
bool fail = false;
for(int i = 0; i < axisId; ++i){
if(!axesProperty.Next(false)){
fail = true;
break;
}
}
if(fail){
break;
}
int propId = 0;
//go deeper - into axis properties
axesProperty.Next(true);
do{
switch(propId){
case 0:
if(_renameAxis){
axesProperty.stringValue = "Axis" + axisId;
}
break;
case 9: //sensitivity
axesProperty.floatValue = 1.0f;
break;
case 10: //snap
case 11: //invert
break;
case 12: //type
axesProperty.enumValueIndex = (int)AxisType.JoystickAxis;
break;
case 13: //axis
axesProperty.intValue = axisId;
break;
}
propId++;
}while(axesProperty.Next(false) && propId < 15);
axisId++;
}
serializedObject.ApplyModifiedProperties();
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1583d288f90da744085ad61412896bb2
timeCreated: 1423910048
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,23 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
[CustomEditor(typeof(MotorPlot))]
public class MotorEditor : Editor {
public override void OnInspectorGUI() {
base.OnInspectorGUI();
if (GUILayout.Button("Update unbound plots")) {
(target as MotorPlot).DrawUnboundPlots();
}
if (GUILayout.Button("Update plots")) {
(target as MotorPlot).IntegratePlotsVisual();
}
if (GUILayout.Button("Optimize")) {
(target as MotorPlot).Optimize();
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 074d4210038f618409b1f613122e619f
timeCreated: 1452020381
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,22 @@
using UnityEngine;
using System.Collections;
using UnityEditor;
[CustomEditor(typeof(Transform))]
public class TransformEditor : Editor {
public override void OnInspectorGUI (){
base.OnInspectorGUI ();
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button ("Reset rotaton")) {
(target as Transform).rotation = Quaternion.identity;
}
if (GUILayout.Button ("R +90")) {
(target as Transform).Rotate(0, 90, 0);
}
if (GUILayout.Button ("R -90")) {
(target as Transform).Rotate(0, -90, 0);
}
EditorGUILayout.EndHorizontal();
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 72c86113d776a354397477e591e59d48
timeCreated: 1425919706
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
@@ -0,0 +1,59 @@
using UnityEngine;
using UnityEditor;
using System.Linq;
using System;
public class UnityResourcesEditor : EditorWindow {
public string resourcesAssetPath = @"Assets/unity editor resources.asset";
public GUISkin LightSkin;
public GUISkin DarkSkin;
[MenuItem ("L/UnityResourcesEditor")]
static void Init () {
UnityResourcesEditor window = (UnityResourcesEditor)EditorWindow.GetWindow (typeof (UnityResourcesEditor));
window.Show();
}
void CopyProperties<T>(T from, T to, string[] exclude = null){
var props = typeof(T).GetProperties ().Where(v=>v.CanWrite && v.CanWrite).ToArray();
foreach (var p in props) {
Debug.Log(p.Name);
if(exclude != null && exclude.Any(v => v == p.Name)){
Debug.Log("Skin property: " + p.Name);
continue;
}
p.SetValue(to, p.GetValue(from, null), null);
}
}
void CopyGuiSkin(GUISkin from, GUISkin to){
Debug.Log ("Copy skins");
CopyProperties (from, to, new []{"name"});
CopyProperties (from.settings, to.settings);
}
void OnGUI () {
GUILayout.Label ("Asset path", EditorStyles.boldLabel);
resourcesAssetPath = GUILayout.TextField (resourcesAssetPath);
if (GUILayout.Button ("Load resources")) {
var resources = AssetDatabase.LoadAllAssetsAtPath (resourcesAssetPath);
var skins = resources.Where(v=>v is GUISkin).Cast<GUISkin>().ToArray();
var lightSkin = skins.First(v=>v.name.ToLower() == "LightSkin".ToLower());
var darkSkin = skins.First(v=>v.name.ToLower() == "DarkSkin".ToLower());
CopyGuiSkin(darkSkin, lightSkin);
Debug.Log("Light skin name: " + lightSkin.name);
Debug.Log("Dark skin name: " + darkSkin.name);
AssetDatabase.SaveAssets();
}
}
}
@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 7a576cb8317355048a2b1652b6df62a2
timeCreated: 1425716261
licenseType: Free
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: