Beispiel #1
0
 private static void WriteAllGameObjectAssets(AssetDatabaseBuilder builder)
 {
     foreach (var gameObject in Object.FindObjectsOfType <GameObject>())
     {
         if (!gameObject.activeInHierarchy)
         {
             continue;
         }
         foreach (var component in gameObject.GetComponents <Component>())
         {
             var componentType = component.GetType();
             SceneObjectExportHandlerBase handler = null;
             if (ExportHandlers.TryGetValue(componentType, out handler))
             {
                 handler.Export(builder, component);
             }
             else
             {
                 foreach (var a in ExportHandlers.Values)
                 {
                     if (componentType.IsSubclassOf(a.TargetType))
                     {
                         a.Export(builder, component);
                         break;
                     }
                 }
             }
         }
     }
 }
Beispiel #2
0
 public static void RegisterExportHandler(SceneObjectExportHandlerBase handler)
 {
     ExportHandlers.Add(handler.TargetType, handler);
 }