So recently I had to work with components that automatically serialize id-like data (similar to lineID or constantID). And one of the issues I encountered was how to clear that data when item is copied or duplicated. The solution I eventually came up with was:
private bool freshlyInitialized = true;
private void OnValidate () //Unity Event
{
Event e = Event.current;
if (e != null && !string.IsNullOrEmpty(e.commandName))
{
// freshlyInitialized is used to avoid false flags when pasting values into component fields
bool componentPaste = (e.commandName == "Paste" && freshlyInitialized);
if (e.commandName == "Duplicate" || componentPaste)
{
ActionsOnCopyOrDuplicate();
}
}
freshlyInitialized = false;
}
Now I was wondering whether this is/could be handled in AC, since for example duplicating Hotspots is a thing I do pretty commonly. And after duplication lineID is retained (at least editor shows it this way). And when those hotspots have lineID, the next text gather while giving each one of them an unique ID has a small chance to link the existing translation to one of the copied/duplicated hotspots instead of the original one. Also are there other places where I should look out for risks with duplication?
Comments