Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 additions and 0 deletions

View File

@@ -0,0 +1,46 @@
namespace Com.LuisPedroFonseca.ProCamera2D
{
using UnityEngine;
using UnityEditor;
public static class Cleanup
{
[MenuItem("Edit/Cleanup Missing Scripts")]
static void CleanupMissingScripts()
{
for (int i = 0; i < Selection.gameObjects.Length; i++)
{
var gameObject = Selection.gameObjects[i];
// We must use the GetComponents array to actually detect missing components
var components = gameObject.GetComponents<Component>();
// Create a serialized object so that we can edit the component list
var serializedObject = new SerializedObject(gameObject);
// Find the component list property
var prop = serializedObject.FindProperty("m_Component");
// Track how many components we've removed
int r = 0;
// Iterate over all components
for (int j = 0; j < components.Length; j++)
{
// Check if the ref is null
if (components[j] == null)
{
// If so, remove from the serialized component array
prop.DeleteArrayElementAtIndex(j - r);
// Increment removed count
r++;
Debug.Log("Removed missing script");
}
}
// Apply our changes to the game object
serializedObject.ApplyModifiedProperties();
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9598d346dbf444e8fb812b1274e34da2
timeCreated: 1455621342
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,61 @@
using UnityEngine;
using UnityEditor;
namespace Com.LuisPedroFonseca.ProCamera2D
{
[CustomEditor(typeof(ConstantShakePreset))]
public class ConstantShakePresetEditor : Editor
{
GUIContent _tooltip;
ConstantShakePreset _preset;
void OnEnable()
{
_preset = (ConstantShakePreset)target;
}
public override void OnInspectorGUI()
{
serializedObject.Update();
// Intensity
_tooltip = new GUIContent("Intensity", "How fast the camera moves towards the amplitude");
EditorGUILayout.PropertyField(serializedObject.FindProperty("Intensity"), _tooltip);
// Layers
_tooltip = new GUIContent("Layers", "");
EditorGUILayout.PropertyField(serializedObject.FindProperty("Layers"), _tooltip, true);
EditorGUILayout.Space();
EditorGUILayout.Space();
EditorGUILayout.Space();
// Shake test buttons
GUI.enabled = Application.isPlaying && ProCamera2DShake.Exists;
if (GUILayout.Button("Constant Shake!"))
{
ProCamera2DShake.Instance.ConstantShake(_preset);
}
if (GUILayout.Button("Stop!"))
{
ProCamera2DShake.Instance.StopConstantShaking();
}
GUI.enabled = true;
if (GUILayout.Button("Go to ProCamera2D"))
{
if (ProCamera2D.Instance != null)
{
Selection.activeGameObject = ProCamera2D.Instance.gameObject;
}
}
if (_preset.Intensity < .01f)
_preset.Intensity = .01f;
serializedObject.ApplyModifiedProperties();
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 85cdbf63cb8f64a508a733af6bd0f58e
timeCreated: 1487344181
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,37 @@
// https://gist.github.com/frarees/9791517
using UnityEngine;
using UnityEditor;
namespace Com.LuisPedroFonseca.ProCamera2D
{
[CustomPropertyDrawer(typeof(MinMaxSliderAttribute))]
class MinMaxSliderDrawer : PropertyDrawer
{
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
if (property.propertyType == SerializedPropertyType.Vector2)
{
Vector2 range = property.vector2Value;
float min = range.x;
float max = range.y;
var attr = attribute as MinMaxSliderAttribute;
EditorGUI.BeginChangeCheck();
EditorGUI.LabelField(position, label.text + " (" + min.ToString("F3") + " - " + max.ToString("F3") + ")");
EditorGUI.MinMaxSlider(position, label, ref min, ref max, attr.min, attr.max);
if (EditorGUI.EndChangeCheck())
{
range.x = min;
range.y = max;
property.vector2Value = range;
}
}
else {
EditorGUI.LabelField(position, label, "Use only with Vector2");
}
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e624fc6d0e51945a1b48d32407f6f06b
timeCreated: 1487610199
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,80 @@
using System;
using System.Linq;
using System.Threading.Tasks;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.PackageManager;
using UnityEditor.PackageManager.Requests;
#if UNITY_2019_3_OR_NEWER
namespace Com.LuisPedroFonseca.ProCamera2D
{
public static class RenderPipelineDefines
{
private const string HDRP_PACKAGE = "com.unity.render-pipelines.high-definition";
private const string URP_PACKAGE = "com.unity.render-pipelines.universal";
private const string TAG_HDRP = "USING_HDRP";
private const string TAG_URP = "USING_URP";
[UnityEditor.Callbacks.DidReloadScripts]
private static void OnScriptsReloaded()
{
var packagesRequest = Client.List(true);
LoadPackages(packagesRequest);
}
private static void LoadPackages (ListRequest request)
{
if (request == null)
return;
// Wait for request to complete
while (!request.IsCompleted)
{
Task.Delay(1_000).Wait();
}
if (request.Result == null)
return;
// Find out what packages are installed
var packagesList = request.Result.ToList();
var hasHDRP = packagesList.Find(x => x.name.Contains(HDRP_PACKAGE)) != null;
var hasURP = packagesList.Find(x => x.name.Contains(URP_PACKAGE)) != null;
DefinePreProcessors(hasHDRP, hasURP);
}
private static void DefinePreProcessors(bool defineHDRP, bool defineURP)
{
string originalDefineSymbols;
string newDefineSymbols;
List<string> defined;
var platform = EditorUserBuildSettings.selectedBuildTargetGroup;
originalDefineSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(platform);
defined = originalDefineSymbols.Split(';').Where(x => !String.IsNullOrWhiteSpace(x)).ToList();
void AppendRemoveTag(bool stat, string tag)
{
if (stat && !defined.Contains(tag))
defined.Add(tag);
else if (!stat && defined.Contains(tag))
defined.Remove(tag);
}
AppendRemoveTag(defineHDRP, TAG_HDRP);
AppendRemoveTag(defineURP, TAG_URP);
newDefineSymbols = string.Join(";", defined);
if(originalDefineSymbols != newDefineSymbols)
{
PlayerSettings.SetScriptingDefineSymbolsForGroup(platform, newDefineSymbols);
}
}
}
}
#endif

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 77fbe9dcb24d4479e8b96aed7c8648f5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,42 @@
// http://wiki.unity3d.com/index.php?title=CreateScriptableObjectAsset
using UnityEngine;
using UnityEditor;
using System.IO;
namespace Com.LuisPedroFonseca.ProCamera2D
{
public static class ScriptableObjectUtility
{
/// <summary>
/// This makes it easy to create, name and place unique new ScriptableObject asset files.
/// </summary>
public static T CreateAsset<T>(string name = null) where T : ScriptableObject
{
T asset = ScriptableObject.CreateInstance<T>();
string path = AssetDatabase.GetAssetPath(Selection.activeObject);
if (path == "")
{
path = "Assets";
}
else if (Path.GetExtension(path) != "")
{
path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
}
var assetPathAndName = "";
if(string.IsNullOrEmpty(name))
assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/New " + typeof(T) + ".asset");
else
assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/New " + name + ".asset");
AssetDatabase.CreateAsset(asset, assetPathAndName);
AssetDatabase.SaveAssets();
AssetDatabase.Refresh();
return asset;
}
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8350fbe69d9444d73a37d4be985af32f
timeCreated: 1487180818
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: