Vertex Animation Subsystem
This is a subsystem that makes it easy to create and update instances without worrying about the technology under the hood.
It provides functions for handling instances which are exposed to blueprint.
warning
The material of the static mesh must have Used with Instanced Static Meshes enabled, otherwise the instances render with the default material. Enable it in the material Details panel under Usage and save the material.
Functions
//When this function is called, the subsystem will create an ISM for the mesh if needed. It will also apply the given world transform.
int AddInstance(UStaticMesh* StaticMesh, const FTransform& Transform);
TArray<int> AddInstances(UStaticMesh* StaticMesh, const TArray<FTransform>& Transforms);
TArray<FVertexAnimationInstanceInfo> GetInstances(UStaticMesh* StaticMesh) const;
bool RemoveInstanceByIndex(UStaticMesh* StaticMesh, int Index);
bool RemoveInstanceById(UStaticMesh* StaticMesh, int Id);
bool RemoveInstancesByIndex(UStaticMesh* StaticMesh, const TArray<int>& Indices);
bool RemoveInstancesById(UStaticMesh* StaticMesh, const TArray<int>& Ids);
bool UpdateInstanceTransformById(UStaticMesh* StaticMesh, int Id, const FTransform& Transform);
bool UpdateInstanceTransformByIndex(UStaticMesh* StaticMesh, int Index, const FTransform& Transform);
bool BatchUpdateInstancesTransform(UStaticMesh* StaticMesh, int StartIndex, int Num, const FTransform& Transform);
bool BatchUpdateInstancesTransforms(UStaticMesh* StaticMesh, int StartIndex, const TArray<FTransform>& Transforms);
bool SetCustomDataById(UStaticMesh* StaticMesh, int Id, int CustomDataIndex, float Value);
bool SetCustomDataByIndex(UStaticMesh* StaticMesh, int Index, int CustomDataIndex, float Value);
int GetIndexFromId(UStaticMesh* StaticMesh, int Id) const;
int GetIdFromIndex(UStaticMesh* StaticMesh, int Index) const;