Recursive calling of ObjectExporters from a SceneExporter, icons
This commit is contained in:
13
Runtime/PSXObjectExporter.cs
Normal file
13
Runtime/PSXObjectExporter.cs
Normal file
@@ -0,0 +1,13 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace PSXSplash.Runtime
|
||||
{
|
||||
public class PSXObjectExporter : MonoBehaviour
|
||||
{
|
||||
public void Export()
|
||||
{
|
||||
Debug.Log($"Export: {this.name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
11
Runtime/PSXObjectExporter.cs.meta
Normal file
11
Runtime/PSXObjectExporter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: bea0f31a495202580ac77bd9fd6e99f2
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: e11677149a517ca5186e32dfda3ec088, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
40
Runtime/PSXSceneExporter.cs
Normal file
40
Runtime/PSXSceneExporter.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
using UnityEngine.SceneManagement;
|
||||
|
||||
namespace PSXSplash.Runtime
|
||||
{
|
||||
public class PSXSceneExporter : MonoBehaviour
|
||||
{
|
||||
public void Export()
|
||||
{
|
||||
Debug.Log($"Exporting scene: {SceneManager.GetActiveScene().name}");
|
||||
|
||||
Scene activeScene = SceneManager.GetActiveScene();
|
||||
foreach (GameObject obj in activeScene.GetRootGameObjects())
|
||||
{
|
||||
ExportAllPSXExporters(obj.transform);
|
||||
}
|
||||
}
|
||||
|
||||
void ExportAllPSXExporters(Transform parentTransform)
|
||||
{
|
||||
PSXObjectExporter exporter = parentTransform.GetComponent<PSXObjectExporter>();
|
||||
|
||||
if (exporter != null)
|
||||
{
|
||||
exporter.Export();
|
||||
}
|
||||
|
||||
foreach (Transform child in parentTransform)
|
||||
{
|
||||
ExportAllPSXExporters(child);
|
||||
}
|
||||
}
|
||||
|
||||
void OnDrawGizmos()
|
||||
{
|
||||
Gizmos.DrawIcon(transform.position, "Packages/net.psxsplash.splashedit/Icons/PSXSceneExporter.png", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Runtime/PSXSceneExporter.cs.meta
Normal file
11
Runtime/PSXSceneExporter.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ab5195ad94fd173cfb6d48ee06eaf245
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {fileID: 2800000, guid: 0be7a2d4700082dbc83b9274837c70bc, type: 3}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
14
Runtime/net.psxsplash.splashedit.Runtime.asmdef
Normal file
14
Runtime/net.psxsplash.splashedit.Runtime.asmdef
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "net.psxsplash.splashedit.Runtime",
|
||||
"rootNamespace": "",
|
||||
"references": [],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
||||
7
Runtime/net.psxsplash.splashedit.Runtime.asmdef.meta
Normal file
7
Runtime/net.psxsplash.splashedit.Runtime.asmdef.meta
Normal file
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1afaf17520143848ea52af093808349d
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user