Hello,
I’m wondering if it’s possible to add a unique struct to a UInstancedStaticMeshComponent
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::DontSpawnIfColliding;
auto SpawnedActorRef = GetWorld()->SpawnActor<ATestActor>(ATestActor::StaticClass(), FVector(0,0,0), FRotator(0, 0, 0), SpawnParameters);
FRotator rotation = FRotator(0, 0, 0);
for (auto XPos = initX; XPos <= endX; XPos += 10) {
for (auto YPos = initY; YPos <= endY; YPos += 10) {
for (auto ZPos = initZ; ZPos <= endZ; ZPos += 10) {
FStar Star = FStar("Some random text" + XPos + ","+ YPos+ ","+ ZPos+ ".");
FVector(XPos,YPos,ZPos);
SpawnedActorRef->StarInfo = Star;
SpawnedActorRef->Star->AddInstanceWorldSpace(FTransform(rotation, Loc, FVector(1.0)));
}
}
}
Obviously, the code above only adds the Star info to the actor, not the instance.
I have a click event on the actor so when it clicked I can see the information about it. At the moment it shows the same info for each instance clicked it.
So wondering if there is a way to get some unique info on instances?
Thanks