Hi!
I’m using the Instanced Static Mesh component in an actor. To create the instances I use cpp, but I want to modify a custom data value of one instance with this code:
The Set Custom Data Value node needs an Integer parameter, Instance Index. But, when I create a new Instance Static Mesh in CPP it returns a FPrimitiveInstanceId value:
/**
* ID of an instance within a primitive, persistent for the lifetime of the instance.
* Can be used as a linear index as the maximum possible value is never higher than the high-water-mark for the number of instances in the component.
*/
USTRUCT(BlueprintType)
struct FPrimitiveInstanceId
{
GENERATED_BODY()
inline bool IsValid() const { return Id != INDEX_NONE; }
inline bool operator==(const FPrimitiveInstanceId &Other) const { return Other.Id == Id;}
inline int32 GetAsIndex() const { return Id; }
friend FArchive& operator<<(FArchive& Ar, FPrimitiveInstanceId& InstanceData)
{
Ar << InstanceData.Id;
return Ar;
}
int32 Id = INDEX_NONE;
};
But I can’t use it with the Set Custom Data Value node.
Any advice?
Maybe I have to use the CPP version:
ENGINE_API void SetCustomDataValueById(FPrimitiveInstanceId InstanceId, int32 CustomDataIndex, float CustomDataValue);
Thanks!
