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

UAssetImportData *

 

AssetImportData

Importing data and options used for this mesh

Protected variable

TArray< UAssetUserData * >

 

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

 

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

FAssetEditorOrbitCameraPosition

 

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

FBoxSphereBounds

 

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< FMaterialRemapIndex >

 

MaterialRemapIndexPerImportVersion

Public variable

FPerPlatformInt

 

MinLOD

Minimum LOD to use for rendering.

Public variable

UNavCollisionBase *

 

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< class FStaticMeshOccluderData >

 

OccluderData

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

Public variable

FOnExtendedBoundsChanged

 

OnExtendedBoundsChanged

Public variable

FOnMeshChanged

 

OnMeshChanged

Protected variable

TRefCountPtr< FRenderAssetUpdate >

 

PendingUpdate

Public variable

FVector

 

PositiveBoundsExtension

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

Public variable

FRenderCommandFence

 

ReleaseResourcesFence

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

Public variable

TUniquePtr< class FStaticMeshRenderData >

 

RenderData

Pointer to the data used to render this static mesh.

Public variable

TArray< class UStaticMeshSocket * >

 

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< class FSpeedTreeWind >

 

SpeedTreeWind

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

Public variable

TArray< FStaticMaterial >

 

StaticMaterials

Public variable

UThumbnailInfo *

 

ThumbnailInfo

Information for thumbnail rendering

Constructors

Name Description

Public function

UStaticMesh

(
    const FObjectInitializer& ObjectInitializer
)

Public function

UStaticMesh

(
    const FObjectInitializer& ObjectInitializer
)

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

FStaticMeshSourceModel &

 

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* >& InStaticMeshes,
    bool bInSilent,
    TFunction< bool*)> InProgressCallback,
    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& MeshDescription,
    FStaticMeshLODResources& LODResources
)

Builds a LOD resource from a MeshDescription

Public function

bool

 

BuildFromMeshDescriptions

(
    const TArray< const FMeshDescription* >& MeshDescriptions
)

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

Public function

void

 

BuildFromStaticMeshDescriptions

(
    const TArray< UStaticMeshDescription* >& StaticMeshDescriptions
)

Builds static mesh LODs from the array of StaticMeshDescriptions passed in

Public function

bool

 

BuildSimpleCollision()

Builds simple collisions at runtime

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 >& InOutAssetsWithMissingUVSets,
    TArray< FString >& InOutAssetsWithBadUVSets,
    TArray< FString >& InOutAssetsWithValidUVSets,
    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& OutMeshDescription
)

Clone the MeshDescription associated to the LODIndex.

Public function

void

 

CommitMeshDescription

(
    int32 LodIndex,
    const FCommitMeshDescriptionParams& Params
)

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

FMeshDescription *

 

CreateMeshDescription

(
    int32 LodIndex,
    FMeshDescription MeshDescription
)

Public function

FMeshDescription *

 

CreateMeshDescription

(
    int32 LodIndex
)

Public function

void

 

CreateNavCollision

(
    const bool bIsUpdate
)

Calculates navigation collision for caching

Public function Static

UStaticMeshDescription *

 

CreateStaticMeshDescription

(
    UObject* Outer
)

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

Public function

void

 

EnforceLightmapRestrictions()

Make sure the Lightmap UV point on a valid UVChannel

Public function Const

UStaticMeshSocket *

 

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

FBoxSphereBounds

 

GetBounds()

Returns the number of bounds of the mesh.

Public function Const

const FGuid &

 

GetLightingGuid()

Public function Const

const FStaticMeshLODResources &

 

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 >& OutLODGroupsDisplayNames
)

Retrieves the localized display names of all LOD groups.

Public function Const

UMaterialInterface *

 

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

FMeshDescription *

 

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 >& PlatformMinimumLODs
)

Public function Const

const UNavCollisionBase *

 

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

FOnExtendedBoundsChanged &

 

GetOnExtendedBoundsChanged()

Public function

FOnMeshChanged &

 

GetOnMeshChanged()

Public function Const

const FMeshSectionInfoMap &

 

GetOriginalSectionInfoMap()

Public function

FMeshSectionInfoMap &

 

GetOriginalSectionInfoMap()

Public function Const

FMeshReductionSettings

 

GetReductionSettings

(
    int32 LODIndex
)

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

Public function

FMeshSectionInfoMap &

 

GetSectionInfoMap()

Public function Const

const FMeshSectionInfoMap &

 

GetSectionInfoMap()

Public function Const

const FStaticMeshSourceModel &

 

GetSourceModel

(
    int32 Index
)

Public function

FStaticMeshSourceModel &

 

GetSourceModel

(
    int32 Index
)

Public function

TArray< FStaticMeshSourceModel > &

 

GetSourceModels()

Public function Const

const TArray< FStaticMeshSourceModel > &

 

GetSourceModels()

Public function Const

const FMeshUVChannelInfo *

 

GetUVChannelData

(
    int32 MaterialIndex
)

Returns the UV channel data for a given material index.

Public function

void

 

GetVertexColorData

(
    TMap< FVector, FColor >& VertexColorData
)

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

FOnPostMeshBuild &

 

OnPostMeshBuild()

Get multicast delegate broadcast after mesh building

Public function

FOnPreMeshBuild &

 

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* NewMaterial
)

Sets a Material given a Material Index

Public function

void

 

SetNumSourceModels

(
    int32 Num
)

Public function

bool

 

SetUVChannel

(
    int32 LODIndex,
    int32 UVChannelIndex,
    const TMap< FVertexInstanceID, FVector2D >& TexCoords
)

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 >& VertexColorData
)

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

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

(
    TMap< FName, FAssetRegistryTagMetadata >& OutMetadata
)

Gathers a collection of asset registry tag metadata

Public function Virtual Const

void

 

GetAssetRegistryTags

(
    TArray< FAssetRegistryTag >& OutTags
)

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& CumulativeResourceSize
)

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& PropertyChangedEvent
)

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

(
    UProperty* PropertyAboutToChange
)

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* CollisionData,
    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< UAssetUserData * > *

 

GetAssetUserDataArray()

Public function Virtual

UAssetUserData *

 

GetAssetUserDataOfClass

(
    TSubclassOf< UAssetUserData > InUserDataClass
)

Public function Virtual

void

 

RemoveUserDataOfClass

(
    TSubclassOf< UAssetUserData > InUserDataClass
)

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< UMaterialInterface * >

 

Materials_DEPRECATED

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

Public variable

FMeshSectionInfoMap

 

OriginalSectionInfoMap

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

Public variable

FMeshSectionInfoMap

 

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< FStaticMeshSourceModel >

 

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

Select Skin
Light
Dark

Welcome to the new Unreal Engine 4 Documentation site!

We're working on lots of new features including a feedback system so you can tell us how we are doing. It's not quite ready for use in the wild yet, so head over to the Documentation Feedback forum to tell us about this page or call out any issues you are encountering in the meantime.

We'll be sure to let you know when the new system is up and running.

Post Feedback