UStaticMesh

A StaticMesh is a piece of geometry that consists of a static set of polygons.

Windows
MacOS
Linux

Inheritance Hierarchy

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/Engine/StaticMesh.h

Include

#include "Engine/StaticMesh.h"

Syntax

class UStaticMesh :
    public UStreamableRenderAsset,
    public IInterface_CollisionDataProvider,
    public IInterface_AssetUserData

Remarks

A StaticMesh is a piece of geometry that consists of a static set of polygons. Static Meshes can be translated, rotated, and scaled, but they cannot have their vertices animated in any way. As such, they are more efficient to render than other types of geometry such as USkeletalMesh, and they are often the basic building block of levels created in the engine.

Variables

Name Description

Public variable

UAssetImportDat...

 

AssetImportData

Importing data and options used for this mesh

Protected variable

TArray< UAssetU...

 

AssetUserData

Array of user data stored with the asset

Public variable

uint8: 1

 

bAllowCPUAccess

If true, will keep geometry data CPU-accessible in cooked builds, rather than uploading to GPU memory and releasing it from CPU memory.

Public variable

uint8: 1

 

bAutoComputeLODScreenSize

If true, the screen sizees at which LODs swap are computed automatically.

Public variable

bool

 

bCustomizedCollision

If the user has modified collision in any way or has custom collision imported.

Public variable

uint8: 1

 

bGenerateMeshDistanceField

Whether to generate a distance field for this mesh, which can be used by DistanceField Indirect Shadows.

Public variable

uint8: 1

 

bHasNavigationData

If true, mesh will have NavCollision property with additional data for navmesh generation and usage.

Public variable

uint8: 1

 

bIsBuiltAtRuntime

If true, StaticMesh has been built at runtime

Public variable

UBodySetup *...

 

BodySetup

Physics data.

Protected variable

uint8: 1

 

bRenderingResourcesInitialized

Tracks whether InitResources has been called, and rendering resources are initialized.

Public variable

uint8: 1

 

bRequiresLODDistanceConversion

If true on post load we need to calculate Display Factors from the loaded LOD distances.

Public variable

uint8: 1

 

bRequiresLODScreenSizeConversion

If true on post load we need to calculate resolution independent Display Factors from the loaded LOD screen sizes.

Public variable

uint8: 1

 

bSupportGpuUniformlyDistributedSampling

If true, a GPU buffer containing required data for uniform mesh surface sampling will be created at load time.

Public variable

uint8: 1

 

bSupportPhysicalMaterialMasks

If true, complex collision data will store UVs and face remap table for use when performing PhysicalMaterialMask lookups in cooked builds.

Public variable

uint8: 1

 

bSupportUniformlyDistributedSampling

Mesh supports uniformly distributed sampling in constant time.

Public variable

FGuid

 

BuildCacheAutomationTestGuid

This transient guid is use by the automation framework to modify the DDC key to force a build.

Public variable

UStaticMesh ...

 

ComplexCollisionMesh

Public variable

float

 

DistanceFieldSelfShadowBias

Useful for reducing self shadowing from distance field methods when using world position offset to animate the mesh's vertices.

Public variable

UObject *

 

EditableMesh

The editable mesh representation of this static mesh

Public variable

FAssetEditorOrb...

 

EditorCameraPosition

The stored camera position to use as a default for the static mesh editor

Protected variable

int32

 

ElementToIgnoreForTexFactor

Index of an element to ignore while gathering streaming texture factors.

Public variable

FBoxSphereBound...

 

ExtendedBounds

Original mesh bounds extended with Positive/NegativeBoundsExtension

Public variable

int32

 

ImportVersion

The last import version

Public variable

FGuid

 

LightingGuid

Unique ID for tracking/caching this mesh during distributed lighting

Public variable

int32

 

LightMapCoordinateIndex

The light map coordinate index

Public variable

int32

 

LightMapResolution

Public variable

float

 

LightmapUVDensity

Public variable

int32

 

LightmapUVVersion

The lightmap UV generation version used during the last derived data build

Public variable

int32

 

LODForCollision

Specifies which mesh LOD to use for complex (per-poly) collision.

Public variable

int32

 

LODForOccluderMesh

Specifies which mesh LOD to use as occluder geometry for software occlusion Set to -1 to not use this mesh as occluder

Public variable

FName

 

LODGroup

The LOD group to which this mesh belongs.

Public variable

float

 

LpvBiasMultiplier

Bias multiplier for Light Propagation Volume lighting

Public variable

TArray< FMateri...

 

MaterialRemapIndexPerImportVersion

Public variable

FPerPlatformInt

 

MinLOD

Minimum LOD to use for rendering.

Public variable

UNavCollisionBa...

 

NavCollision

Pre-build navigation collision

Public variable

FVector

 

NegativeBoundsExtension

Bound extension values in the negative direction of XYZ, positive value increases bound size

Public variable

FPerPlatformInt

 

NumStreamedLODs

If non-negative, specify the maximum number of streamed LODs.

Public variable

TUniquePtr< cla...

 

OccluderData

Pointer to the occluder data used to rasterize this static mesh for software occlusion.

Public variable

FOnExtendedBoun...

 

OnExtendedBoundsChanged

Public variable

FOnMeshChanged

 

OnMeshChanged

Protected variable

TRefCountPtr< F...

 

PendingUpdate

Public variable

FVector

 

PositiveBoundsExtension

Bound extension values in the positive direction of XYZ, positive value increases bound size

Public variable

FRenderCommandF...

 

ReleaseResourcesFence

A fence which is used to keep track of the rendering thread releasing the static mesh resources.

Public variable

TUniquePtr< cla...

 

RenderData

Pointer to the data used to render this static mesh.

Public variable

TArray< class U...

 

Sockets

Array of named socket locations, set up in editor and used as a shortcut instead of specifying everything explicitly to AttachComponent in the StaticMeshComponent.

Public variable

TSharedPtr< cla...

 

SpeedTreeWind

Data that is only available if this static mesh is an imported SpeedTree

Public variable

TArray< FStatic...

 

StaticMaterials

Public variable

UThumbnailInfo ...

 

ThumbnailInfo

Information for thumbnail rendering

Constructors

Name Description

Public function

UStaticMesh

(
    const FObjectInitializer& ObjectIn...
)

Public function

UStaticMesh

(
    const FObjectInitializer& ObjectIn...
)

Default constructor

Functions

Name Description

Public function

FName

 

AddMaterial

(
    UMaterialInterface* Material
)

Adds a new material and return its slot name

Public function

void

 

AddSocket

(
    UStaticMeshSocket* Socket
)

Add a socket object in this StaticMesh.

Public function

FStaticMeshS...

 

AddSourceModel()

SourceModels API.

Public function

bool

 

AddUVChannel

(
    int32 LODIndex
)

Adds an empty UV channel at the end of the existing channels on the given LOD of a StaticMesh.

Public function Const

bool

 

AreRenderingResourcesInitialized()

Public function Static

void

 

BatchBuild

(
    const TArray< UStaticMesh* >&...,
    bool bInSilent,
    TFunction< bool*)>...,
    TArray< FText >* OutErrors
)

Rebuilds renderable data for a batch of static meshes.

Public function

void

 

BroadcastNavCollisionChange()

Public function

void

 

Build

(
    bool bInSilent,
    TArray< FText >* OutErrors
)

Rebuilds renderable data for this static mesh.

Public function

void

 

BuildFromMeshDescription

(
    const FMeshDescription& MeshDescri...,
    FStaticMeshLODResources& LODResour...
)

Builds a LOD resource from a MeshDescription

Public function

bool

 

BuildFromMeshDescriptions

(
    const TArray< const FMeshDescriptio...,
    bool bBuildSimpleCollision
)

Builds static mesh render buffers from a list of MeshDescriptions, one per LOD.

Public function

void

 

BuildFromStaticMeshDescriptions

(
    const TArray< UStaticMeshDescriptio...,
    bool bBuildSimpleCollision
)

Builds static mesh LODs from the array of StaticMeshDescriptions passed in

Public function

void

 

CacheDerivedData()

Caches derived renderable data.

Public function

void

 

CalculateExtendedBounds()

Calculates the extended bounds

Public function Static

void

 

CancelAllPendingStreamingActions()

Cancels any pending static mesh streaming actions if possible.

Public function Const

bool

 

CanLODsShareStaticLighting()

Returns true if LODs of this static mesh may share texture lightmaps.

Public function Static

void

 

CheckLightMapUVs

(
    UStaticMesh* InStaticMesh,
    TArray< FString >& InOutAssetsWith...,
    TArray< FString >& InOutAssetsWith...,
    TArray< FString >& InOutAssetsWith...,
    bool bInVerbose
)

Static: Processes the specified static mesh for light map UV problems

Public function

void

 

ClearMeshDescription

(
    int32 LodIndex
)

Public function

void

 

ClearMeshDescriptions()

Public function Const

bool

 

CloneMeshDescription

(
    int32 LodIndex,
    FMeshDescription& OutMeshDescripti...
)

Clone the MeshDescription associated to the LODIndex.

Public function

void

 

CommitMeshDescription

(
    int32 LodIndex,
    const FCommitMeshDescriptionParams ...
)

Serialize the mesh description into its more optimized form.

Public function

void

 

CreateBodySetup()

Create BodySetup for this staticmesh if it doesn't have one

Create BodySetup for this staticmesh

Public function

FMeshDescrip...

 

CreateMeshDescription

(
    int32 LodIndex,
    FMeshDescription MeshDescription
)

Public function

FMeshDescrip...

 

CreateMeshDescription

(
    int32 LodIndex
)

Public function

void

 

CreateNavCollision

(
    const bool bIsUpdate
)

Calculates navigation collision for caching

Public function Static

UStaticMeshD...

 

CreateStaticMeshDescription

(
    UObject* Outer
)

Create an empty StaticMeshDescription object, to describe a static mesh at runtime

Public function

void

 

EnforceLightmapRestrictions

(
    bool bUseRenderData
)

Make sure the Lightmap UV point on a valid UVChannel

Public function Const

UStaticMeshS...

 

FindSocket

(
    FName InSocketName
)

Find a socket object in this StaticMesh by name.

Public function

bool

 

FixLODRequiresAdjacencyInformation

(
    const int32 LODIndex,
    const bool bPreviewMode,
    bool bPromptUser,
    bool* OutUserCancel
)

Verify that a specific LOD using a material needing the adjacency buffer have the build option set to create the adjacency buffer.

Public function

void

 

FixupMaterialSlotName()

Internal function use to make sure all imported material slot name are unique and non empty.

Public function

void

 

GenerateLodsInPackage()

Public function Const

FBox

 

GetBoundingBox()

Returns the bounding box, in local space including bounds extension(s), of the StaticMesh asset

Public function Const

FBoxSphereBo...

 

GetBounds()

Returns the number of bounds of the mesh.

Public function Const

const FGuid ...

 

GetLightingGuid()

Public function Const

const FStati...

 

GetLODForExport

(
    int32 LODIndex
)

Returns the render data to use for exporting the specified LOD.

Public function Static

void

 

GetLODGroups

(
    TArray< FName >& OutLODGroups
)

Retrieves the names of all LOD groups.

Public function Static

void

 

GetLODGroupsDisplayNames

(
    TArray< FText >& OutLODGroupsDispl...
)

Retrieves the localized display names of all LOD groups.

Public function Const

UMaterialInt...

 

GetMaterial

(
    int32 MaterialIndex
)

Gets a Material given a Material Index and an LOD number

Public function Const

FBox

 

GetMaterialBox

(
    int32 MaterialIndex,
    const FTransform& Transform
)

Returns the material bounding box. Computed from all lod-section using the material index.

Public function Const

int32

 

GetMaterialIndex

(
    FName MaterialSlotName
)

Gets a Material index given a slot name

Public function Const

int32

 

GetMaterialIndexFromImportedMaterialSlotName

(
    FName ImportedMaterialSlotName
)

Public function Const

FMeshDescrip...

 

GetMeshDescription

(
    int32 LodIndex
)

Return the MeshDescription associate to the LODIndex.

Public function Const

int32

 

GetMinimumLODForPlatform

(
    const FName& PlatformName
)

Public function Const

void

 

GetMinimumLODForPlatforms

(
    TMap< FName, int32 >& PlatformMini...
)

Public function Const

const UNavCo...

 

GetNavCollision()

Public function Const

int32

 

GetNumLODs()

Returns the number of LODs used by the mesh.

Public function Const

int32

 

GetNumSections

(
    int32 InLOD
)

Returns number of Sections that this StaticMesh has, in the supplied LOD (LOD 0 is the highest)

Public function Const

int32

 

GetNumSectionsWithCollision()

Return the number of sections of the StaticMesh with collision enabled

Public function Const

int32

 

GetNumSourceModels()

Public function

int32

 

GetNumUVChannels

(
    int32 LODIndex
)

Returns the number of UV channels for the given LOD of a StaticMesh.

Public function Const

int32

 

GetNumVertices

(
    int32 LODIndex
)

Returns the number of vertices for the specified LOD.

Public function

FOnExtendedB...

 

GetOnExtendedBoundsChanged()

Public function

FOnMeshChang...

 

GetOnMeshChanged()

Public function Const

const FMeshS...

 

GetOriginalSectionInfoMap()

Public function

FMeshSection...

 

GetOriginalSectionInfoMap()

Public function Const

FMeshReducti...

 

GetReductionSettings

(
    int32 LODIndex
)

Get a copy of the reduction settings for a specified LOD index.

Public function

FMeshSection...

 

GetSectionInfoMap()

Public function Const

const FMeshS...

 

GetSectionInfoMap()

Public function Const

const FStati...

 

GetSourceModel

(
    int32 Index
)

Public function

FStaticMeshS...

 

GetSourceModel

(
    int32 Index
)

Public function

TArray< FSta...

 

GetSourceModels()

Public function Const

const TArray...

 

GetSourceModels()

Public function Const

const FMeshU...

 

GetUVChannelData

(
    int32 MaterialIndex
)

Returns the UV channel data for a given material index.

Public function

void

 

GetVertexColorData

(
    TMap< FVector, FColor >& VertexCol...
)

Returns vertex color data by position.

Public function Const

bool

 

HasValidRenderData

(
    bool bCheckLODForVerts,
    int32 LODIndex
)

Returns true if the mesh has data that can be rendered.

Public function Virtual

void

 

InitResources()

Initialize the static mesh's render resources.

Initializes the static mesh's render resources.

Public function

bool

 

InsertUVChannel

(
    int32 LODIndex,
    int32 UVChannelIndex
)

Inserts an empty UV channel at the specified channel index on the given LOD of a StaticMesh.

Public function Const

bool

 

IsMeshDescriptionValid

(
    int32 LodIndex
)

Public function Const

bool

 

IsReductionActive

(
    int32 LODIndex
)

Return true if the reduction settings are setup to reduce a LOD

Public function Const

bool

 

IsSourceModelValid

(
    int32 Index
)

Public function

void

 

LinkStreaming()

Public function

void

 

MarkAsNotHavingNavigationData()

Configures this SM as bHasNavigationData = false and clears stored NavCollision

Public function

FOnPostMeshB...

 

OnPostMeshBuild()

Get multicast delegate broadcast after mesh building

Public function

FOnPreMeshBu...

 

OnPreMeshBuild()

Get multicast delegate broadcast prior to mesh building

Public function Virtual

void

 

ReleaseResources()

Releases the static mesh's render resources.

Public function

void

 

RemoveSocket

(
    UStaticMeshSocket* Socket
)

Remove a socket object in this StaticMesh by providing it's pointer.

Public function

void

 

RemoveSourceModel

(
    int32 Index
)

Public function

bool

 

RemoveUVChannel

(
    int32 LODIndex,
    int32 UVChannelIndex
)

Removes the UV channel at the specified channel index on the given LOD of a StaticMesh.

Public function

void

 

RemoveVertexColors()

Removes all vertex colors from this mesh and rebuilds it (Editor only

Public function

void

 

SetLightingGuid()

Public function

void

 

SetLODGroup

(
    FName NewGroup,
    bool bRebuildImmediately
)

Public function

void

 

SetMaterial

(
    int32 MaterialIndex,
    UMaterialInterface* NewMateria...
)

Sets a Material given a Material Index

Public function

void

 

SetNumSourceModels

(
    int32 Num
)

Public function

bool

 

SetUVChannel

(
    int32 LODIndex,
    int32 UVChannelIndex,
    const TMap< FVertexInstanceID, FVec...
)

Sets the texture coordinates at the specified UV channel index on the given LOD of a StaticMesh.

Public function

void

 

SetVertexColorData

(
    const TMap< FVector, FColor >& Ver...
)

Sets vertex color data by position.

Public function

void

 

UnlinkStreaming()

Public function

void

 

UpdateUVChannelData

(
    bool bRebuildAll
)

Update missing material UV channel data used for texture streaming.

Overridden from UStreamableRenderAsset

Name Description

Public function Virtual Const

int32

 

CalcCumulativeLODSize

(
    int32 NumLODs
)

Public function Virtual Const

int32

 

CalcNumOptionalMips()

Public function Virtual

bool

 

CancelPendingMipChangeRequest()

Tries to cancel a pending LOD change request.

Public function Virtual Const

bool

 

DoesMipDataExist

(
    const int32 MipIndex
)

Public function Virtual Const

int32

 

GetLODGroupForStreaming()

Get an integer representation of the LOD group

Public function Virtual Const

bool

 

GetMipDataFilename

(
    const int32 MipIndex,
    FString& BulkDataFilename
)

Public function Virtual Const

int32

 

GetNumMipsForStreaming()

Get the total number of LODs including non-streamable and optional LODs

Public function Virtual Const

int32

 

GetNumNonStreamingMips()

Returns the number of LODs in this asset that are not able to be streamed

Public function Virtual Const

int32

 

GetNumRequestedMips()

When the asset is being updated from StreamIn() or StreamOut(), returns the number of LODs requested

Public function Virtual Const

int32

 

GetNumResidentMips()

The number of LODs currently in memory

Public function Virtual Const

bool

 

HasPendingUpdate()

Public function Virtual Const

bool

 

IsPendingUpdateLocked()

Public function Virtual Const

bool

 

IsReadyForStreaming()

Public function Virtual

bool

 

StreamIn

(
    int32 NewMipCount,
    bool bHighPrio
)

Loads mips from disk to memory. Only usable if the asset is streamable.

Public function Virtual

bool

 

StreamOut

(
    int32 NewMipCount
)

Unload some mips from memory. Only usable if the asset is streamable.

Public function Virtual

bool

 

UpdateStreamingStatus

(
    bool bWaitForMipFading
)

Updates the streaming status of the asset and performs finalization when appropriate.

Overridden from UObject

Name Description

Public function Virtual

void

 

BeginDestroy()

Called before destroying the object.

Public function Virtual Const

void

 

GetAssetRegistryTagMetadata

Gathers a collection of asset registry tag metadata

Public function Virtual Const

void

 

GetAssetRegistryTags

(
    TArray< FAssetRegistryTag >& OutTa...
)

Gathers a list of asset registry searchable tags which are name/value pairs with some type information This only needs to be implemented for asset objects

Public function Virtual

FString

 

GetDesc()

Returns a one line description of an object for viewing in the thumbnail view of the generic browser

Public function Virtual

void

 

GetResourceSizeEx

(
    FResourceSizeEx& CumulativeResourc...
)

Get the size of the object/resource for use in memory tools or to display to artists/LDs in the Editor This is the extended version which separates up the used memory into different memory regions (the actual definition of which may be platform specific).

Public function Virtual Const

bool

 

IsPostLoadThreadSafe()

Called during async load to determine if PostLoad can be called on the loading thread.

Public function Virtual

bool

 

IsReadyForFinishDestroy()

Called to check if the object is ready for FinishDestroy.

Public function Virtual

void

 

PostDuplicate

(
    bool bDuplicateForPIE
)

Called after duplication & serialization and before PostLoad.

Public function Virtual

void

 

PostEditChangeProperty

(
    FPropertyChangedEvent& PropertyCha...
)

Called when a property on this object has been modified externally

Public function Virtual

void

 

PostEditUndo()

Called after applying a transaction to the object.

Public function Virtual

void

 

PostInitProperties()

Called after the C++ constructor and after the properties have been initialized, including those loaded from config.

Public function Virtual

void

 

PostLoad()

Do any object-specific cleanup required immediately after loading an object.

Public function Virtual

void

 

PreEditChange

(
    FProperty* PropertyAboutToChan...
)

This is called when a property is about to be modified externally

Public function Virtual

void

 

Serialize

(
    FArchive& Ar
)

UStaticMesh::Serialize

Overridden from UObjectBaseUtility

Name Description

Public function Virtual Const

bool

 

CanBeClusterRoot()

Called after load to determine if the object can be a cluster root

Overridden from IInterface_CollisionDataProvider

Name Description

Public function Virtual Const

bool

 

ContainsPhysicsTriMeshData

(
    bool InUseAllTriData
)

Interface for checking if the implementing objects contains triangle mesh collision data

Public function Virtual

void

 

GetMeshId

(
    FString& OutMeshId
)

An optional string identifying the mesh data.

Public function Virtual

bool

 

GetPhysicsTriMeshData

(
    FTriMeshCollisionData* Collisi...,
    bool InUseAllTriData
)

Interface for retrieving triangle mesh collision data from the implementing object

Public function Virtual

bool

 

WantsNegXTriMesh()

Do we want to create a negative version of this mesh

Overridden from IInterface_AssetUserData

Name Description

Public function Virtual

void

 

AddAssetUserData

(
    UAssetUserData* InUserData
)

Public function Virtual Const

const TArray...

 

GetAssetUserDataArray()

Public function Virtual

UAssetUserDa...

 

GetAssetUserDataOfClass

(
    TSubclassOf< UAssetUserData > InUse...
)

Public function Virtual

void

 

RemoveUserDataOfClass

(
    TSubclassOf< UAssetUserData > InUse...
)

Classes

Name

Description

Public struct

FCommitMeshDescriptionParams

Structure that defines parameters passed into the commit mesh description function

Typedefs

Name

Description

FOnExtendedBoundsChanged

Notification when bounds changed

FOnMeshChanged

Notification when anything changed

Constants

Name

Description

MinimumAutoLODPixelError

Deprecated Variables

Name Description

Public variable

uint8: 1

 

bStripComplexCollisionForConsole_DEPRECATED

If true, strips unwanted complex collision data aka kDOP tree when cooking for consoles.

Public variable

TArray< UMateri...

 

Materials_DEPRECATED

Materials used by this static mesh. Individual sections index in to this array.

Public variable

FMeshSectionInf...

 

OriginalSectionInfoMap

Please do not access this member directly; use UStaticMesh::GetOriginalSectionInfoMap().

Public variable

FMeshSectionInf...

 

SectionInfoMap

Please do not access this member directly; use UStaticMesh::GetSectionInfoMap().

Public variable

FString

 

SourceFilePath_DEPRECATED

Path to the resource used to construct this static mesh

Public variable

FString

 

SourceFileTimestamp_DEPRECATED

Date/Time-stamp of the file from the last import

Public variable

TArray< FStatic...

 

SourceModels

Please do not access this member directly; use UStaticMesh::GetSourceModel(LOD) or UStaticMesh::GetSourceModels().

Deprecated Functions

Name Description

Public function Static

void

 

RegisterMeshAttributes

(
    FMeshDescription& MeshDescription
)

Please use FStaticMeshAttributes::Register to do this.

See Also

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss