Hi, here what i want to do :
blueprint template determine if component need a guid
when editor level is loaded, if item need one and doesn’t have one, we need to generate a guid
here is the code :
UPROPERTY(EditAnywhere, BlueprintReadWrite)
FGuid ComponentCustomGuid= FGuid(); // 0 0 0 0
UPROPERTY( EditDefaultsOnly, BlueprintReadWrite)
bool ComponentNeedCustomGuid= false;
void UMyComponent::OnComponentCreated()
{
Super::OnComponentCreated();
if (ComponentNeedCustomGuid&& !ComponentCustomGuid.IsValid())
{
ComponentCustomGuid= FGuid::NewGuid();
GetOutermost()->SetDirtyFlag(true);
}
}
i’m a bit lost because when i open my map, i get a guid, and if i save the map and reopen it, i get a new one …
here the 2 cases i see :
if OnComponentCreated is called before we load saved data from map ( previously generated guid ) then the new one should be overriden and i would have the “good” one.
if OnComponentCreated is called after, then the code should not be called as the loaded guid is valid
am i missing something ?