This week’s Quick Dev Tip can be used in so many places across the entire editor. It’s one you should definitely include in your workflow as it will save you a lot of time and hassle.
Did you know that you can really easily copy variable information around, using copy and paste?
In the example below I want to take the location of the cube on the right and apply it to the cube on the left. We could go in and copy-paste each of the X, Y, Z values, but there is a quicker way. Right-clicking on the variable name (in this case Location) will give you the option to Copy the variable as a whole. Hit copy.
If you then Right-Click on the location of the other cube that we want to move but this time hit Paste, it’s going to copy all X, Y, Z values to that cubes location. making them effectively sit on top of each other.
For this technique to work the variable types must be the same. For example, If I take that same location value we just copied and try to past it into the Rotation variable nothing is going to happen.
If we copy-paste the values of the Location (1st line) and the Rotation (second line) into a notepad document we can see why. Their formatting is different and so they are incompatible. As you use Unreal more you should start to learn what variable types things are. For example, Location and Scale both use a Vector value so you are able to copy Location into Scale and vice versa.
A place I tend to use this is when working with arrays and structures. In the example below I have a blueprint array of names and you can see by Right-clicking on the variable name in the defaults I get the option to copy and paste. This is useful if I want to copy information between arrays and or back up my information.
A more practicable example of copying between arrays can be seen when setting up static and skeletal mesh materials as the material slots variable is actually an array. So in the example below, you can see we have two separate but identical cubes with the second cube having no materials. We could go through setting them one by one but an easier way would be to simply Right-click Copy on the Material slots variable and Paste into the material slots of the cube with no materials assigned. Quick, easy and painlessly.
Another example of a common use I have for this is when working with UMG in Unreal. For example below we are copying the Style structure from the left button into the right button. This one is great because, if you customise a button fully there can be a lot of values that you would have to manually copy across one by one otherwise. Because I am colourblind I also I personally use it a bunch to help keep my colours consistent across my UI, by copy-pasting colour values around and even storing them in a notepad while i’m working.
If you don’t know what variable type something is I wouldn’t worry too much about it, Right-click away and see if you can copy-paste info into it, blueprints are pretty safe!
If you want more tips and tricks make sure to FOLLOW ME ON TWITTER @cbGameDev
Also, check out the parkour game I'm solo developing called Freerunners. Give it a wishlist if you like the way it looks!: https://store.steampowered.com/app/1430330/Freerunners/