Init
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace QFSW.QC.Editor.Tools
|
||||
{
|
||||
public static class PrefabUtil
|
||||
{
|
||||
public static void RecordPrefabInstancePropertyModificationsFullyRecursive(GameObject objRoot)
|
||||
{
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(objRoot);
|
||||
foreach (Component comp in objRoot.GetComponents<Component>())
|
||||
{
|
||||
PrefabUtility.RecordPrefabInstancePropertyModifications(comp);
|
||||
}
|
||||
|
||||
for (int i = 0; i < objRoot.transform.childCount; i++)
|
||||
{
|
||||
Transform child = objRoot.transform.GetChild(i);
|
||||
RecordPrefabInstancePropertyModificationsFullyRecursive(child.gameObject);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8efd6ec275d0caa46920e3c03f6e3925
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "QFSW.QC.Editor.Tools",
|
||||
"references": [],
|
||||
"optionalUnityReferences": [],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": []
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a02547252a8685b458cb58325927f320
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,79 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using UnityEditor;
|
||||
|
||||
namespace QFSW.QC.Editor.Tools
|
||||
{
|
||||
public static class SymbolEditor
|
||||
{
|
||||
public static IEnumerable<T> AsEnumerable<T>(this T val)
|
||||
{
|
||||
yield return val;
|
||||
}
|
||||
|
||||
private static IEnumerable<BuildTargetGroup> GetPresentBuildTargetGroups()
|
||||
{
|
||||
foreach (BuildTarget target in (BuildTarget[])Enum.GetValues(typeof(BuildTarget)))
|
||||
{
|
||||
BuildTargetGroup group = BuildPipeline.GetBuildTargetGroup(target);
|
||||
if (BuildPipeline.IsBuildTargetSupported(group, target))
|
||||
{
|
||||
yield return group;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void AddSymbol(string symbol)
|
||||
{
|
||||
AddSymbols(symbol.AsEnumerable());
|
||||
}
|
||||
|
||||
public static void AddSymbols(IEnumerable<string> symbols)
|
||||
{
|
||||
AddSymbols(GetPresentBuildTargetGroups(), symbols);
|
||||
}
|
||||
|
||||
public static void AddSymbols(IEnumerable<BuildTargetGroup> groups, IEnumerable<string> symbols)
|
||||
{
|
||||
foreach (BuildTargetGroup group in groups)
|
||||
{
|
||||
string currentSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
||||
foreach (string symbol in symbols)
|
||||
{
|
||||
if (!currentSymbols.Contains(symbol))
|
||||
{
|
||||
currentSymbols = $"{currentSymbols};{symbol}";
|
||||
}
|
||||
}
|
||||
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, currentSymbols);
|
||||
}
|
||||
}
|
||||
|
||||
public static void RemoveSymbol(string symbol)
|
||||
{
|
||||
RemoveSymbols(symbol.AsEnumerable());
|
||||
}
|
||||
|
||||
public static void RemoveSymbols(IEnumerable<string> symbols)
|
||||
{
|
||||
RemoveSymbols(GetPresentBuildTargetGroups(), symbols);
|
||||
}
|
||||
|
||||
public static void RemoveSymbols(IEnumerable<BuildTargetGroup> groups, IEnumerable<string> symbols)
|
||||
{
|
||||
foreach (BuildTargetGroup group in groups)
|
||||
{
|
||||
string currentSymbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(group);
|
||||
foreach (string symbol in symbols)
|
||||
{
|
||||
currentSymbols = Regex.Replace(currentSymbols, symbol, string.Empty);
|
||||
}
|
||||
|
||||
currentSymbols = string.Join(";", currentSymbols.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries));
|
||||
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, currentSymbols);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1078e30699e62674ca299f95eb835efc
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user