整合SLSUtilities
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
{
|
||||
"name": "LunaWolfStudiosEditor.ScriptableSheets.Samples.SubAssets",
|
||||
"rootNamespace": "LunaWolfStudiosEditor.ScriptableSheets.Samples.SubAssets",
|
||||
"references": [
|
||||
"GUID:d49571fccb860614e952a061794f07b2"
|
||||
],
|
||||
"includePlatforms": [
|
||||
"Editor"
|
||||
],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 458e60867288b364d981c0c74f72a068
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 284559
|
||||
packageName: Scriptable Sheets
|
||||
packageVersion: 1.8.0
|
||||
assetPath: Packages/com.lunawolfstudios.scriptablesheets/Samples~/SubAssets/Editor/LunaWolfStudiosEditor.ScriptableSheets.Samples.SubAssets.asmdef
|
||||
uploadId: 823456
|
||||
@@ -0,0 +1,62 @@
|
||||
using LunaWolfStudios.ScriptableSheets.Samples.SubAssets;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace LunaWolfStudiosEditor.ScriptableSheets.Samples.SubAssets
|
||||
{
|
||||
public class SubAssetGenerator
|
||||
{
|
||||
[MenuItem("Assets/Create/Scriptable Sheets/Color Theme")]
|
||||
public static void CreateColorTheme()
|
||||
{
|
||||
var colorTheme = ScriptableObject.CreateInstance<ColorTheme>();
|
||||
colorTheme.Description = "This is a color theme.";
|
||||
|
||||
var path = "Assets/ColorTheme.asset";
|
||||
AssetDatabase.CreateAsset(colorTheme, path);
|
||||
|
||||
var backgroundColor = ScriptableObject.CreateInstance<BackgroundColors>();
|
||||
backgroundColor.name = "BackgroundColors";
|
||||
colorTheme.BackgroundColor = backgroundColor;
|
||||
AssetDatabase.AddObjectToAsset(backgroundColor, colorTheme);
|
||||
|
||||
var foregroundColor = ScriptableObject.CreateInstance<ForegroundColors>();
|
||||
foregroundColor.name = "ForegroundColors";
|
||||
colorTheme.ForegroundColor = foregroundColor;
|
||||
AssetDatabase.AddObjectToAsset(foregroundColor, colorTheme);
|
||||
|
||||
var textColor = ScriptableObject.CreateInstance<TextColors>();
|
||||
textColor.name = "TextColors";
|
||||
colorTheme.TextColor = textColor;
|
||||
AssetDatabase.AddObjectToAsset(textColor, colorTheme);
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
|
||||
[MenuItem("Assets/Create/Scriptable Sheets/Sample Main Asset with Sub Assets")]
|
||||
public static void CreateSampleMainAssetWithSubAssets()
|
||||
{
|
||||
var sampleMainAsset = ScriptableObject.CreateInstance<SampleMainAsset>();
|
||||
sampleMainAsset.Description = "This is a sample Main Asset.";
|
||||
|
||||
var path = "Assets/MainAsset.asset";
|
||||
AssetDatabase.CreateAsset(sampleMainAsset, path);
|
||||
|
||||
sampleMainAsset.SubAssets = new SampleSubAsset[3];
|
||||
for (var i = 0; i < 3; i++)
|
||||
{
|
||||
var sampleSubAsset = ScriptableObject.CreateInstance<SampleSubAsset>();
|
||||
sampleSubAsset.name = $"SubAsset{i}";
|
||||
sampleSubAsset.Description = $"This is sample Sub Asset.";
|
||||
sampleSubAsset.Index = i;
|
||||
sampleSubAsset.SomeBoolValue = i % 2 == 0;
|
||||
sampleMainAsset.SubAssets[i] = sampleSubAsset;
|
||||
AssetDatabase.AddObjectToAsset(sampleSubAsset, sampleMainAsset);
|
||||
}
|
||||
|
||||
AssetDatabase.SaveAssets();
|
||||
AssetDatabase.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d30ef548929683048bed88253b644cd0
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 284559
|
||||
packageName: Scriptable Sheets
|
||||
packageVersion: 1.8.0
|
||||
assetPath: Packages/com.lunawolfstudios.scriptablesheets/Samples~/SubAssets/Editor/SubAssetGenerator.cs
|
||||
uploadId: 823456
|
||||
Reference in New Issue
Block a user