diff --git a/README.md b/README.md index 6ec34262f..103626fae 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,8 @@ The library is designed to be easy to extend with additional extensions to the g - [Default Importer Selection](#default-importer-selection) - [Animation Import](#animation-import) - [Extensibility](#extensibility) - - [Example for custom plugin](#example-for-custom-plugin) + - [Example for custom export plugin](#example-for-custom-export-plugin) + - [Example for custom import plugin](#example-for-custom-import-plugin) - [Known Issues](#known-issues) - [Contributing](#contributing) - [Unity Package](#unity-package) @@ -457,7 +458,7 @@ If your plugin reads/writes custom extension data, you need to also implement `G > [!WARNING] > `ShouldNodeExport` callback: Using this callback requires understanding of how glTF works. For example, if you filter out some bones of a skeleton on export, the result might not be valid glTF or might not display what you expect. Use with caution -### Example for custom plugin +### Example for custom export plugin ```csharp public class MyExportPlugin : GLTFExportPlugin { @@ -480,6 +481,30 @@ public class MyExportPluginContext: GLTFExportPluginContext } ``` +### Example for custom import plugin +```csharp +public class MyImportPlugin: GLTFImportPlugin +{ + public override string DisplayName => "My Import Plugin"; + public override string Description => ""; + + public override GLTFImportPluginContext CreateInstance(GLTFImportContext context) + { + return new MyImportPluginContext(); + } +} + +public class MyImportPluginContext: GLTFImportPluginContext +{ + public override void OnAfterImportScene(GLTFScene scene, int sceneIndex, GameObject sceneObject) + { + // Set all to static + var objs = sceneObject.GetComponentsInChildren(); + foreach (var obj in objs) + obj.gameObject.isStatic = true; + } +} +``` > 🏗️ Under construction. You can take a look at `MaterialVariantsPlugin.cs` for an example. diff --git a/package.json b/package.json index 5f7970163..d52a6b56b 100644 --- a/package.json +++ b/package.json @@ -18,10 +18,12 @@ "author": "Khronos Group", "dependencies": { "com.unity.nuget.newtonsoft-json": "2.0.0", + "com.unity.modules.audio": "1.0.0", "com.unity.modules.imageconversion": "1.0.0", + "com.unity.modules.particlesystem": "1.0.0", "com.unity.shadergraph": "10.0.0", "com.unity.mathematics": "1.0.0" }, "samples": [ ] -} \ No newline at end of file +}