Skip to content

EAUploader.Editor.Prefab.API

Public API related to operating on prefabs and getting their information. Defined in Editor/Public EAUploader API/EAUploader.Editor.Prefab.API.cs.

using EAUploader.Editor.Prefab.API;
ClassDescription
PrefabAPIProvides prefab operations and information
PrefabPreviewAPIProvides prefab preview images
ShaderAPIProvides shader checks
PrefabUtilityAPIProvides avatar information
VRMAPIProvides VRM import (only when VRM Converter for VRChat is installed)

PrefabAPI


MethodTypeDescription
UpdatePrefabInfoVoidUpdates the prefab information (PrefabManager.json)
ImportPrefabVoidBrings the prefab at the specified path into EAUploader
GetPrefabGameObjectGets the prefab at the specified path
ShowDeletePrefabDialogBoolShows the prefab deletion dialog
DeletePrefabPreviewVoidDeletes the preview image of the prefab at the specified path
PinPrefabVoidToggles pinning of the prefab at the specified path
GetAvatarDescriptorVRCAvatarDescriptorGets the VRCAvatarDescriptor of the prefab at the specified path
IsPinnedBoolChecks whether the prefab at the specified path is pinned
SavePrefabVoidSaves a prefab
public static void UpdatePrefabInfo();
public static void ImportPrefab(string prefabPath);
public static GameObject GetPrefab(string prefabPath);
public static bool ShowDeletePrefabDialog(string prefabPath);
public static void DeletePrefabPreview(string prefabPath);
public static void PinPrefab(string prefabPath);
public static VRCAvatarDescriptor GetAvatarDescriptor(string prefabPath);
public static bool IsPinned(string prefabPath);
public static void SavePrefab(GameObject prefab, string path);
  • GetPrefab and GetAvatarDescriptor return null if the prefab is not found.
  • ImportPrefab adds an EAUploaderMeta component to the prefab, generates a preview image, and updates the Manage Model list.
  • ShowDeletePrefabDialog deletes the prefab and its preview image and returns true if the user chooses to delete.
  • PinPrefab pins the prefab if it is not pinned, and unpins it if it is.
  • SavePrefab saves the GameObject as a prefab at the specified path and runs ImportPrefab.

PrefabPreviewAPI


MethodTypeDescription
GeneratePreviewTexture2DGenerates a preview image of a prefab
GenerateAndSaveAllPrefabPreviewsVoidGenerates and saves preview images for all prefabs that do not have one
SavePrefabPreviewVoidSaves a prefab’s preview image
LoadTextureFromFileTexture2DLoads a texture from a file
SaveTextureToFileVoidSaves a texture to a PNG file
GetPreviewImagePathStringGets the path of a prefab’s preview image
GetPrefabPreviewTexture2DGets a prefab’s preview image
public static Texture2D GeneratePreview(GameObject prefab);
public static void GenerateAndSaveAllPrefabPreviews();
public static void SavePrefabPreview(string prefabPath, Texture2D preview);
public static Texture2D LoadTextureFromFile(string filePath);
public static void SaveTextureToFile(Texture2D texture, string filePath);
public static string GetPreviewImagePath(string prefabPath);
public static Texture2D GetPrefabPreview(string prefabPath);
  • Preview images are saved to Assets/EAUploader/PrefabPreviews/{prefab name}.png.
  • GeneratePreview generates a 1080×1080 image.
  • GetPrefabPreview returns null if no preview image exists.

ShaderAPI


MethodTypeDescription
CheckShadersVoidChecks the shaders of all prefabs in Assets
GetExistingShadersListGets a list of the group names of shaders installed in the project
CheckShadersInPrefabsVoidChecks the shaders of the specified prefab
CheckAvatarHasShaderBoolChecks whether all shaders required by an avatar exist
public static void CheckShaders();
public static List<string> GetExistingShaders();
public static void CheckShadersInPrefabs(string prefabPath);
public static bool CheckAvatarHasShader(GameObject avatar);
  • CheckShaders and CheckShadersInPrefabs show a dialog if there are prefabs with missing shaders.
  • CheckAvatarHasShader returns true if no shaders are missing. It does not show a dialog.

PrefabUtilityAPI


MethodTypeDescription
GetAvatarHeightFloatGets the avatar’s height (viewpoint height)
CheckAvatarHasVRCAvatarDescriptorBoolChecks whether the avatar has a VRCAvatarDescriptor
CheckAvatarIsVRMBoolChecks whether the avatar is VRM
CheckAvatarHasTandOBoolChecks whether the avatar has AvatarOptimizer’s TraceAndOptimize
GetAvatarDescriptorVRCAvatarDescriptorGets the avatar’s VRCAvatarDescriptor
GetPipelineManagerPipelineManagerGets the avatar’s PipelineManager
public static float GetAvatarHeight(GameObject avatar);
public static bool CheckAvatarHasVRCAvatarDescriptor(GameObject avatar);
public static bool CheckAvatarIsVRM(GameObject avatar);
public static bool CheckAvatarHasTandO(GameObject avatar);
public static VRCAvatarDescriptor GetAvatarDescriptor(GameObject avatar);
public static VRC.Core.PipelineManager GetPipelineManager(GameObject avatar);
  • GetAvatarHeight returns the Y coordinate of the VRCAvatarDescriptor’s ViewPosition. Returns 0 if there is no VRCAvatarDescriptor.
  • CheckAvatarHasVRCAvatarDescriptor returns false if avatar is null.
  • CheckAvatarIsVRM always returns false if VRM Converter for VRChat is not installed.
  • CheckAvatarHasTandO always returns false if AvatarOptimizer is not installed.

VRMAPI


Available only when VRM Converter for VRChat is installed (when HAS_VRM is defined).

MethodTypeDescription
ImportVRMVoidImports a VRM file and shows the conversion window
public static void ImportVRM(string path = null);
  • If path is omitted, a file selection dialog is shown.
  • Files inside the project’s Assets cannot be specified.
  • The imported VRM is saved to Assets/VRM/{file name}.prefab.