I work on a 2 player game and when I have a character finished for Player 1, I have to copy/paste the string of that Character and just replace the objects (P1model with P2model, P1bullets with P2bullets etc)
But I can't replace a thing, when both, the Player 1 and Player 2 objects are inside the string.
E.g. When hit player 2, reduce P1Stats.Damage from P2Stats.Health. (P1Stats is just an invisible object to safe information like damage, speed, health etc. so I can change it easily later)
Now when I replace P1Stats with P2Stats, there will be obviously only P2Stats left inside the string so I cannot just replace the missing P2Stats.
I kind of "solved" it by making an placeholderStats object so I can replace them first with it, and then with the actual object but isn't there an easier solution?