Input Scaling
Once you have selected the "Gameplay & Input" scaling strategy in Unity Editor or Creative Suite, you may need to define your input scaling strategy using the advanced settings.
Mechanics of input scaling
Luna Replay records the positions of the touch and click events. This means that changing the game resolution yet keeping the positions (just like Scale Gameplay mode does) might lead to the input events being replayed at wrong positions, leading to clicks missing the buttons as illustrated below:
![assets/replay/replay-video-input-scaling-missed-touch.png)
That is why both Creative Suite and Luna Replay Unity plugin have a set of advanced controls which denote how the touches from the recorded capture should land into the target resolution.
Configuring input scaling
In order to make touch positions end up in the correct places in the target area, you have to configure anchoring rules and offset values.
Where to find configuration controls
Both Creative Suite and Replay plugin have the scaling controls available next to the video resolution settings.
- Creative Suite
- Unity Editor
Anchors
Anchors describe how the source rect (original inputs) will be aligned with regards to the target rect (final inputs). There are options to either centre the area, fix the left edge to the left, right edge to the right, or stretch to simply "fill" the target area. Vertical anchors mimic horizontal anchors correspondingly.
- Creative Suite
- Unity Editor
Let's consider a few examples to make it more visual.
Example 1: stretching the input
Consider a game which has 3 buttons placed at the middle of the screen, each button occupies 1/3 of the available space of the original resolution and is centred. Switching the aspect ratio from 9:16 to 16:9 will keep the buttons centred, but their size will grow to account for wider screen:
![assets/replay/input-scenes/three-buttons-stretch-example.png)
In Luna Replay, setting the anchors to "Stretch" will cause the input coordinates to scale so that leftmost point on the original screen corresponds to leftmost point on the target screen, the rightmost corresponds to the rightmost, and so on.
The following example illustrates how the touch coordinates would be mapped onto the new resolution, by using stretch mode:
![assets/replay/replay-video-input-scaling-stretch.png)
Example 2: anchoring to a corner
Consider a game where there is a button placed at the top left corner. Switching the aspect ratio from 9:16 to 16:9 will keep the button in the very same corner, but the size stays the same.
![assets/replay/input-scenes/three-buttons-anchor-example.png)
Making the input rectangle align with top left corner will instruct Luna Replay to position the inputs so that the top left corner of the source area matches the top left corner of the target area, but no coordinate transformation will be applied further making sure that clicking even the edge of the button will still produce a click at the very same position. This ensures that clicks do not miss the button because of coordinate scaling.
The following example illustrates this:
![assets/replay/replay-video-input-scaling-anchor.png)
The Anchor is set at the Top Left.
Offsets
Offsets allow Luna Replay to adjust the size of the "resized" area when it gets remapped onto the new resolution. This is suitable when you either want to use anchoring yet still apply some scaling to the area or when using stretched anchors but need to have specific offsets from the edges.
For instance, consider the sketch from the previous example:
![assets/replay/replay-video-input-scaling-anchor-missed.png)
Since the aspect ratio changed from portrait to landscape, the rightmost edge of the area will not reach the rightmost edge of the target rectangle.
Changing the horizontal anchors to stretched will make the height respect the original aspect ratio:
![assets/replay/replay-video-input-scaling-anchor-adjusted.png)
Applying the bottom offset allows one to "amend" the aspect ratio if the game requires this to happen:
![assets/replay/replay-video-input-scaling-anchor-skewed.png)
Going interactive
Tweaking the settings to find the right combination could be challenging and time consuming. In order to simplify this workflow, Creative Suite exposes an interactive diagram that shows the remap happening as you change the settings:
![assets/replay/replay-video-input-scaling-playground.png)
It is advised to set these up in Creative Suite since the diagram provides instant visual feedback and makes it easier to understand the scaling strategy.