Class AssetLoaderOptions
Represents a series of Model loading settings, like Unity Model Importer settings.
Namespace: TriLibCore
Assembly: TriLibCore.dll
Syntax
public class AssetLoaderOptions : ScriptableObject
Constructors
AssetLoaderOptions()
Declaration
public AssetLoaderOptions()
Fields
AddAllBonesToSkinnedMeshRenderers
Turn on this field to add all available bones to every created SkinnedMeshRenderer.
Declaration
public bool AddAllBonesToSkinnedMeshRenderers
Field Value
Type | Description |
---|---|
bool |
AddAssetUnloader
Turn on this field to add the Asset Unloader Component to the loaded Game Object, which deallocates resources automatically.
Declaration
public bool AddAssetUnloader
Field Value
Type | Description |
---|---|
bool |
AlphaMaterialMode
Chooses the way TriLib creates alpha materials. The options are: None: Does not create any alpha material and uses opaque materials instead. Cutout: Creates cutout alpha materials where applicable. Transparent: Creates transparent (alpha) materials where applicable. Cutout + Transparent: Creates both materials and uses the second one as a copy from the semi-transparent mesh. This field is ignored when the Material Mapper uses a Shader Variant Collection.
Declaration
public AlphaMaterialMode AlphaMaterialMode
Field Value
Type | Description |
---|---|
AlphaMaterialMode |
AnimationClipMappers
Mappers used to process Animation Clips.
Declaration
public AnimationClipMapper[] AnimationClipMappers
Field Value
Type | Description |
---|---|
AnimationClipMapper[] |
AnimationType
Model rigging type.
Declaration
public AnimationType AnimationType
Field Value
Type | Description |
---|---|
AnimationType |
AnimationWrapMode
Default wrap-mode to apply to Animations.
Declaration
public WrapMode AnimationWrapMode
Field Value
Type | Description |
---|---|
WrapMode |
ApplyAvatarHipsCompensation
Turn off this field if your avatars seem to hover over the ground. That will disable avatar hips height compensation.
Declaration
public bool ApplyAvatarHipsCompensation
Field Value
Type | Description |
---|---|
bool |
ApplyGammaCurveToMaterialColors
When this field is on, TriLib will also apply the gamma curve to the material colors.
Declaration
public bool ApplyGammaCurveToMaterialColors
Field Value
Type | Description |
---|---|
bool |
ApplyTexturesOffsetAndScaling
Turn on this field to apply Textures offset and scaling.
Declaration
public bool ApplyTexturesOffsetAndScaling
Field Value
Type | Description |
---|---|
bool |
AutomaticallyPlayLegacyAnimations
Turn on this field to play Legacy Animation Clips automatically (The first available Clip will be played).
Declaration
public bool AutomaticallyPlayLegacyAnimations
Field Value
Type | Description |
---|---|
bool |
Avatar
Source Avatar to use when copying from another Avatar.
Declaration
public Avatar Avatar
Field Value
Type | Description |
---|---|
Avatar |
AvatarDefinition
Type of Avatar creation for the Model.
Declaration
public AvatarDefinitionType AvatarDefinition
Field Value
Type | Description |
---|---|
AvatarDefinitionType |
BlendShapeMapper
Use this field to set a BlendShapeMapper to use with the loaded model. BlendShapeMappers can replace the Unity built-in blend shape playback system.
Declaration
public BlendShapeMapper BlendShapeMapper
Field Value
Type | Description |
---|---|
BlendShapeMapper |
BufferizeFiles
Change this field to define how TriLib will load files into memory before processing the file (When enabled, it decreases loading times but increases memory usage).
Declaration
public FileBufferingMode BufferizeFiles
Field Value
Type | Description |
---|---|
FileBufferingMode |
CalculateBlendShapeNormals
Turn on this field to calculate Mesh Blend Shape normals when none can be imported.
Declaration
public bool CalculateBlendShapeNormals
Field Value
Type | Description |
---|---|
bool |
CloseStreamAutomatically
Turn on this field to close the Model loading Stream automatically.
Declaration
public bool CloseStreamAutomatically
Field Value
Type | Description |
---|---|
bool |
CollectCG
Turn off this field to disable GC collection after model loading.
Declaration
public bool CollectCG
Field Value
Type | Description |
---|---|
bool |
CompactHeap
Turn on this field to enable .NET Large Object Heap compaction (UWP only).
Declaration
public bool CompactHeap
Field Value
Type | Description |
---|---|
bool |
CompressMeshes
Turn on this field to compress meshes "normal", "tangent", "uv0", "uv1", "uv2", "uv4" and "color" values to 16 bits (Experimental).
Declaration
[Obsolete("Not working yet")]
public bool CompressMeshes
Field Value
Type | Description |
---|---|
bool |
ConvertMaterialTextures
Turn off this field to disable "Metallic/Smoothness/Specular/Roughness" automatic texture creation.
Declaration
public bool ConvertMaterialTextures
Field Value
Type | Description |
---|---|
bool |
ConvertMaterialTexturesUsingHalfRes
Turn off this field to set the "Metallic/Smoothness/Specular/Roughness" texture sizes to the full original resolution.
Declaration
public bool ConvertMaterialTexturesUsingHalfRes
Field Value
Type | Description |
---|---|
bool |
ConvertTexturesAs2D
Turn off this field to keep processed/composed textures as RenderTextures.
Declaration
public bool ConvertTexturesAs2D
Field Value
Type | Description |
---|---|
bool |
ConvexColliders
Turn on this field to generate convex Colliders when the GenerateColliders field is enabled.
Declaration
public bool ConvexColliders
Field Value
Type | Description |
---|---|
bool |
CreateMaterialsForAllModels
Turn on this field to make TriLib create materials for every loaded model, even those without an original material.
Declaration
public bool CreateMaterialsForAllModels
Field Value
Type | Description |
---|---|
bool |
DestroyOnError
Turn on this field to destroy the loaded Game Object automatically when there is any loading error.
Declaration
public bool DestroyOnError
Field Value
Type | Description |
---|---|
bool |
DisableObjectsRenaming
Turn on this field to disable objects renaming. Remarks: this feature may break animation compatibility as they won't work with duplicate object names.
Declaration
public bool DisableObjectsRenaming
Field Value
Type | Description |
---|---|
bool |
DisableTesselation
Turn on this field to disable polygon tessellation.
Declaration
public bool DisableTesselation
Field Value
Type | Description |
---|---|
bool |
DiscardUnusedTextures
Turn off this field to keep unused Textures.
Declaration
public bool DiscardUnusedTextures
Field Value
Type | Description |
---|---|
bool |
DoPBRConversion
Turn off this field to disable Phong to PBR conversion based on: https://learn.microsoft.com/en-us/azure/remote-rendering/reference/material-mapping
Declaration
public bool DoPBRConversion
Field Value
Type | Description |
---|---|
bool |
DoubleSidedMaterials
Turn on this field to create double-sided Materials (TriLib does that by duplicating the original Meshes).
Declaration
[Obsolete("This method has issues and has been removed temporarily.")]
public bool DoubleSidedMaterials
Field Value
Type | Description |
---|---|
bool |
EmbeddedDataExtractionPath
Path to extract embedded resources. Keep in mind this is an absolute path. If this value is "null", Unity will use the "Persistent Data Path" to store the embedded data.
Declaration
public string EmbeddedDataExtractionPath
Field Value
Type | Description |
---|---|
string |
EnableProfiler
Turn on this field to display profiler messages while loading your model.
Declaration
public bool EnableProfiler
Field Value
Type | Description |
---|---|
bool |
EnforceAlphaChannelTextures
Turn on this field to enforce an alpha channel on texture creation.
Declaration
public bool EnforceAlphaChannelTextures
Field Value
Type | Description |
---|---|
bool |
EnforceAnimatorWithLegacyAnimations
Turn on this field to add an Animator when the AnimationType is set to Legacy.
Declaration
public bool EnforceAnimatorWithLegacyAnimations
Field Value
Type | Description |
---|---|
bool |
EnforceTPose
Turn on this field to enforce the loaded Model to the T-pose when rigging.
Declaration
public bool EnforceTPose
Field Value
Type | Description |
---|---|
bool |
EnsureQuaternionContinuity
Turn on this field to realign quaternion keys to ensure the shortest interpolation paths.
Declaration
public bool EnsureQuaternionContinuity
Field Value
Type | Description |
---|---|
bool |
ExternalDataMapper
Mapper used to find data Streams on external sources.
Declaration
public ExternalDataMapper ExternalDataMapper
Field Value
Type | Description |
---|---|
ExternalDataMapper |
ExtractEmbeddedData
Turn off this field to disable embedded resource extraction. When this field is on, embedded textures and resources are extracted to disk and can work as a cache system.
Declaration
public bool ExtractEmbeddedData
Field Value
Type | Description |
---|---|
bool |
FixNormalMaps
Turn on this field to change the normal map channel order to ABBR instead of RGBA.
Declaration
public bool FixNormalMaps
Field Value
Type | Description |
---|---|
bool |
ForcePowerOfTwoTextures
Turn on this field to enforce power-of-two resolution when loading textures (needed for texture compression and on some platforms).
Declaration
public bool ForcePowerOfTwoTextures
Field Value
Type | Description |
---|---|
bool |
GenerateColliders
Turn on this field to generate Colliders for imported Meshes.
Declaration
public bool GenerateColliders
Field Value
Type | Description |
---|---|
bool |
GenerateMipmaps
Turn on this field to enable Textures mip-map generation.
Declaration
public bool GenerateMipmaps
Field Value
Type | Description |
---|---|
bool |
GenerateNormals
Turn off this field to disable Mesh normals generation.
Declaration
public bool GenerateNormals
Field Value
Type | Description |
---|---|
bool |
GenerateTangents
Turn off this field to disable Mesh tangents generation.
Declaration
public bool GenerateTangents
Field Value
Type | Description |
---|---|
bool |
GetCompatibleTextureFormat
Turn on this field to ensure Unity will create textures that can be sampled on the current platform.
Declaration
public bool GetCompatibleTextureFormat
Field Value
Type | Description |
---|---|
bool |
HumanDescription
Human Description used to create the humanoid Avatar, when the humanoid rigging type is selected.
Declaration
public HumanDescription HumanDescription
Field Value
Type | Description |
---|---|
HumanDescription |
HumanoidAvatarMapper
Mapper used to map the humanoid Avatar bones when the humanoid rigging type is selected.
Declaration
public HumanoidAvatarMapper HumanoidAvatarMapper
Field Value
Type | Description |
---|---|
HumanoidAvatarMapper |
ImportBlendShapeNormals
Turn on this field to import Mesh Blend Shape normals.
Declaration
public bool ImportBlendShapeNormals
Field Value
Type | Description |
---|---|
bool |
ImportBlendShapes
Turn on this field to import Mesh Blend Shapes.
Declaration
public bool ImportBlendShapes
Field Value
Type | Description |
---|---|
bool |
ImportCameras
Turn on this field to enable Cameras importing.
Declaration
public bool ImportCameras
Field Value
Type | Description |
---|---|
bool |
ImportColors
Turn on this field to import Mesh colors.
Declaration
public bool ImportColors
Field Value
Type | Description |
---|---|
bool |
ImportLights
Turn on this field to enable Lights importing.
Declaration
public bool ImportLights
Field Value
Type | Description |
---|---|
bool |
ImportMaterials
Turn on this field to import Materials.
Declaration
public bool ImportMaterials
Field Value
Type | Description |
---|---|
bool |
ImportMeshes
Turn on this field to import Model Meshes.
Declaration
public bool ImportMeshes
Field Value
Type | Description |
---|---|
bool |
ImportNormals
Turn on this field to import Mesh normals. If disabled, normals will be calculated instead.
Declaration
public bool ImportNormals
Field Value
Type | Description |
---|---|
bool |
ImportTangents
Turn on this field to import Mesh tangents. If disabled, tangents will be calculated instead.
Declaration
public bool ImportTangents
Field Value
Type | Description |
---|---|
bool |
ImportTextures
Turn on this field to import Textures.
Declaration
public bool ImportTextures
Field Value
Type | Description |
---|---|
bool |
ImportVisibility
Turn on this field to apply the visibility property to Mesh Renderers/Skinned Mesh Renderers.
Declaration
public bool ImportVisibility
Field Value
Type | Description |
---|---|
bool |
IndexFormat
Mesh index format (16 or 32 bits).
Declaration
public IndexFormat IndexFormat
Field Value
Type | Description |
---|---|
IndexFormat |
KeepQuads
Turn on this field to maintain Mesh quads. (Useful for DX11 tessellation)
Declaration
public bool KeepQuads
Field Value
Type | Description |
---|---|
bool |
LODScreenRelativeTransitionHeightBase
Defines the initial screen relative transition height when creating LOD Groups.
Declaration
public float LODScreenRelativeTransitionHeightBase
Field Value
Type | Description |
---|---|
float |
LimitBoneWeights
Turn on this field to limit bone weights to 4 per bone.
Declaration
public bool LimitBoneWeights
Field Value
Type | Description |
---|---|
bool |
LipSyncMappers
Mappers used to configure Lip-Sync Blend Shapes.
Declaration
public LipSyncMapper[] LipSyncMappers
Field Value
Type | Description |
---|---|
LipSyncMapper[] |
LoadDisplacementTextures
Turn on this field to load displacement textures.
Declaration
public bool LoadDisplacementTextures
Field Value
Type | Description |
---|---|
bool |
LoadPointClouds
Turn on this field to keep isolated vertices when loading the model (PLY and OBJ only).
Declaration
public bool LoadPointClouds
Field Value
Type | Description |
---|---|
bool |
LoadTexturesAsSRGB
Turn off this field to load textures as linear, instead of sRGB.
Declaration
public bool LoadTexturesAsSRGB
Field Value
Type | Description |
---|---|
bool |
LoadTexturesAtOnce
When this field is disabled, TriLib will read the texture resolution before creating it, which could increase memory usage. The new texture loading method doesn't do that. This option is left here for compatibility reasons.
Declaration
public bool LoadTexturesAtOnce
Field Value
Type | Description |
---|---|
bool |
LoadTexturesViaWebRequest
Turn on this field to load textures using the UnityWebRequest class (experimental). UnityWebRequest is the fastest way to load PNG/JPG textures but uses more memory than other methods and does not work with embedded textures.
Declaration
public bool LoadTexturesViaWebRequest
Field Value
Type | Description |
---|---|
bool |
MarkMeshesAsDynamic
Turn on this field to mark created meshes as dynamic.
Declaration
public bool MarkMeshesAsDynamic
Field Value
Type | Description |
---|---|
bool |
MarkTexturesNoLongerReadable
Turn on this field to set textures as no longer readable and release memory resources.
Declaration
public bool MarkTexturesNoLongerReadable
Field Value
Type | Description |
---|---|
bool |
MaterialMappers
Mappers used to create suitable Unity Materials from original Materials.
Declaration
public MaterialMapper[] MaterialMappers
Field Value
Type | Description |
---|---|
MaterialMapper[] |
MaxCoroutineDelayInMS
Use this field to set a maximum number of milliseconds a Coroutine can take without waiting for a main thread frame to execute.
Declaration
public long MaxCoroutineDelayInMS
Field Value
Type | Description |
---|---|
long |
MaxObjectsToRename
Use this field to set the maximum number of objects TriLib can rename. Renaming is an expensive process, so it's advised to keep this value low.
Declaration
public int MaxObjectsToRename
Field Value
Type | Description |
---|---|
int |
MaxTexturesResolution
Use this field to limit texture resolution. Textures with resolutions higher than this value (when the value is not zero) will not be loaded.
Declaration
public int MaxTexturesResolution
Field Value
Type | Description |
---|---|
int |
MaxVertexDataInitialCapacity
Use this field to set the maximum initial capacity of mesh vertex buffers. Vertex counts higher than that will use the default .NET exponential capacity-increasing method.
Declaration
public int MaxVertexDataInitialCapacity
Field Value
Type | Description |
---|---|
int |
MergeSingleChild
Turn on this field to merge single child models into a single GameObject.
Declaration
public bool MergeSingleChild
Field Value
Type | Description |
---|---|
bool |
MergeVertices
Turn on this field to merge model duplicated vertices where possible.
Declaration
public bool MergeVertices
Field Value
Type | Description |
---|---|
bool |
MeshWorldTransform
Use this field to define a transformation applied in world space to all mesh vertices.
Declaration
public Matrix4x4 MeshWorldTransform
Field Value
Type | Description |
---|---|
Matrix4x4 |
NameMapper
Use a custom NameMapper to define how the final GameObjects will be named based on the input model data.
Declaration
public NameMapper NameMapper
Field Value
Type | Description |
---|---|
NameMapper |
OptimizeMeshes
Turn on this field to optimize imported Meshes for GPU access.
Declaration
public bool OptimizeMeshes
Field Value
Type | Description |
---|---|
bool |
PivotPosition
Use this field to realign the Model pivot based on the given value.
Declaration
public PivotPosition PivotPosition
Field Value
Type | Description |
---|---|
PivotPosition |
PositionThreshold
Position simplification threshold. The smaller the values, the more precision.
Declaration
public float PositionThreshold
Field Value
Type | Description |
---|---|
float |
ReadEnabled
Turn on this field to leave imported Meshes readable.
Declaration
public bool ReadEnabled
Field Value
Type | Description |
---|---|
bool |
ResampleFrequency
Defines the FBX Rotation Animation Curve resampling frequency. (1 = every frame, 2 = every 2 frames, 3 = every 3 frames, and so on)
Declaration
public float ResampleFrequency
Field Value
Type | Description |
---|---|
float |
RootBoneMapper
Mapper used to find the Model root bone.
Declaration
public RootBoneMapper RootBoneMapper
Field Value
Type | Description |
---|---|
RootBoneMapper |
RotationThreshold
Rotation simplification threshold (in degrees). The smaller the values, the more precision.
Declaration
public float RotationThreshold
Field Value
Type | Description |
---|---|
float |
SampleBindPose
Turn on this field to sample the loaded Model to the bind-pose when rigging.
Declaration
public bool SampleBindPose
Field Value
Type | Description |
---|---|
bool |
ScaleFactor
Model scale multiplier.
Declaration
public float ScaleFactor
Field Value
Type | Description |
---|---|
float |
ScaleThreshold
Scale simplification threshold. The smaller the values, the more precision.
Declaration
public float ScaleThreshold
Field Value
Type | Description |
---|---|
float |
ScanForAlphaPixels
Turn on this field to scan Textures for alpha-blended pixels in order to generate transparent Materials.
Declaration
public bool ScanForAlphaPixels
Field Value
Type | Description |
---|---|
bool |
SearchTexturesRecursively
Turn off this field if you don't want TriLib to search for textures inside all folders where the model is located.
Declaration
public bool SearchTexturesRecursively
Field Value
Type | Description |
---|---|
bool |
SetUnusedTexturePropertiesToNull
Turn on this field to set the unused Material Texture Properties to null
.
Declaration
public bool SetUnusedTexturePropertiesToNull
Field Value
Type | Description |
---|---|
bool |
ShowLoadingWarnings
Turn on this field to display Model loading warnings on the Console.
Declaration
public bool ShowLoadingWarnings
Field Value
Type | Description |
---|---|
bool |
SimplifyAnimations
Turn on this field to simplify animation curves.
Declaration
public bool SimplifyAnimations
Field Value
Type | Description |
---|---|
bool |
SmoothingAngle
Normals calculation smoothing angle.
Declaration
public float SmoothingAngle
Field Value
Type | Description |
---|---|
float |
SortHierarchyByName
Turn on this field to sort the Model hierarchy by name.
Declaration
public bool SortHierarchyByName
Field Value
Type | Description |
---|---|
bool |
Static
Turn on this field to import the Model as a static Game Object.
Declaration
public bool Static
Field Value
Type | Description |
---|---|
bool |
SwapUVs
Turn on this field to swap Mesh UVs. (uv1 into uv2)
Declaration
public bool SwapUVs
Field Value
Type | Description |
---|---|
bool |
TextureCompressionQuality
Texture compression to apply on loaded Textures.
Declaration
public TextureCompressionQuality TextureCompressionQuality
Field Value
Type | Description |
---|---|
TextureCompressionQuality |
TextureMappers
Mappers used to find native Texture Streams from custom sources.
Declaration
public TextureMapper[] TextureMappers
Field Value
Type | Description |
---|---|
TextureMapper[] |
Timeout
Model loading timeout in seconds (0=disabled).
Declaration
public int Timeout
Field Value
Type | Description |
---|---|
int |
UpdateSkinnedMeshRendererWhenOffscreen
Turn on this field to update SkinnedMeshRenderers when they're offscreen.
Declaration
public bool UpdateSkinnedMeshRendererWhenOffscreen
Field Value
Type | Description |
---|---|
bool |
UseCoroutines
Turn off this field to disable TriLib coroutines. Coroutines ensure that model data loads with the fewest possible main thread stalls.
Declaration
public bool UseCoroutines
Field Value
Type | Description |
---|---|
bool |
UseFileScale
Turn on this flag to use the file's original scale.
Declaration
public bool UseFileScale
Field Value
Type | Description |
---|---|
bool |
UseMaterialKeywords
Turn on this field to use shader keywords on generated Materials. This field is useful when using Shader Variants to get more control over generated Materials. This field is ignored when enabling the UsesShaderVariantCollection field.
Declaration
public bool UseMaterialKeywords
Field Value
Type | Description |
---|---|
bool |
UseSharedMaterials
Turn off this field to use the renderers' "materials" property instead of "sharedMaterials".
Declaration
public bool UseSharedMaterials
Field Value
Type | Description |
---|---|
bool |
UseSharedMeshes
Turn on this field to use mesh filters' "mesh" property instead of "sharedMesh". It is recommended to turn on this field if you don't need to modify your meshes at runtime.
Declaration
public bool UseSharedMeshes
Field Value
Type | Description |
---|---|
bool |
UseUnityNativeNormalCalculator
Turn on this field to use the built-in Unity normal calculator. Disabling this field allows TriLib to accept more texture file formats but uses more memory to load textures.
Declaration
public bool UseUnityNativeNormalCalculator
Field Value
Type | Description |
---|---|
bool |
UseUnityNativeTextureLoader
Turn on this field to use the Unity built-in Texture loader instead of stb_image.
Declaration
public bool UseUnityNativeTextureLoader
Field Value
Type | Description |
---|---|
bool |
UserPropertiesMapper
Mapper used to process User Properties from Models.
Declaration
public UserPropertiesMapper UserPropertiesMapper
Field Value
Type | Description |
---|---|
UserPropertiesMapper |
Methods
Deserialize(string)
Deserialize the specified JSON representation into this class.
Declaration
public void Deserialize(string json)
Parameters
Type | Name | Description |
---|---|---|
string | json | Json. |
Serialize()
Serializes this instance to a JSON representation.
Declaration
public string Serialize()
Returns
Type | Description |
---|---|
string |