> For the complete documentation index, see [llms.txt](/llms.txt)


# Give players a reason to return each day

Add three days of login rewards and a mission to complete three adventures.



Let players claim a reward on each day they log in, plus an extra reward for completing three adventures. Continue with the tutorial project and account you have been using.

## 1. Configure login rewards

Give 10 coins on day 1, 20 on day 2, and 30 on day 3. The day changes at midnight Japan Standard Time (JST, UTC+9). If a player skips a day, they resume from their next unclaimed reward.


**Studio**

Add **Login Rewards** and **Missions** from **Add features**.

Open **Tables → Login Rewards → LoginRewardCollection** and create the following row.

| Field | Value |
| --- | --- |
| ID | `daily` |
| Progression mode (mode) | `streaming` |
| Daily reset hour (resetHour) | `15` (15:00 UTC = midnight JST) |
| Repeat (repeat) | `disabled` |
| Missed reward relief (missedReceiveRelief) | `disabled` |

In **LoginReward**, add `day1`, `day2`, and `day3`, and set the bonus group to `daily` for all three.

For each row, open **Acquire actions → Add item → Not set**. Select `DepositByUserId` (money2) as the action and **None** as the target resource.

| Field | Value |
| --- | --- |
| namespaceName | `Currency` |
| userId | `#{userId}` |
| slot | `0` |

Add one entry to **depositTransactions**. Set `price` to `0` and `currency` to **No value**. Set `count` to `10` for `day1`, `20` for `day2`, and `30` for `day3`.


**SDK (Unity)**

Download the <a href="/samples/adventure/en/extensions/daily-sdk.json" download>login rewards and missions template</a>.

1. In the management console's Tokyo region, open **Deploy → Stack list → Create stack**.
2. Name the stack `adventure-daily`, select the downloaded JSON file under **Template data**, and create it.
3. Once the status is **Create complete**, you can use `adventure-login-reward` and `adventure-mission`.

The login reward settings are under `LoginRewardMaster → Properties → Settings → bonusModels`.

| Field | Value |
| --- | --- |
| name | `daily` |
| mode | `streaming` |
| resetHour | `15` |
| repeat | `disabled` |
| missedReceiveRelief | `disabled` |
| rewards | Three deposits: 10, 20, and 30 coins, in that order |

This stack adds only login reward and mission settings. Adventures, coins, and stamina continue to use the existing `adventure-game` stack.




## 2. Create a mission to complete three adventures

Create a mission counter that increases by one whenever an adventure is completed. Once it reaches three, let the player claim 30 coins with a button.


**Studio**

Open **Tables → Missions → MissionSetting** and click **Add row**. Set the reset hour to `15`, weekly reset day to `sunday`, and monthly reset day to `1`.

Next, add rows to these three tables.

| Table | ID | Settings |
| --- | --- | --- |
| Mission counter (MissionCounter) | `clear` | Enter only the ID |
| Mission group (MissionCollection) | `adventure` | Reset type `notReset`; leave the schedule empty |
| Mission (Mission) | `clear3` | Mission group `adventure`, progress counter `clear`, target `3` |

Add `DepositByUserId` (money2) to **Completion rewards** for `clear3`. Use the same settings as the login rewards: `namespaceName = Currency`, `userId = #{userId}`, `slot = 0`, and one `depositTransactions` entry with `price = 0`, no `currency` value, and `count = 30`.

Open **Tables → Quests → Quest**. Add the following action to **Completion rewards** for both `forest` and `cave`. Keep the existing coin deposit actions.

| Field | Value |
| --- | --- |
| Action | `IncreaseCounterByUserId` (mission) |
| Target resource | None |
| namespaceName | `Mission` |
| userId | `#{userId}` |
| counterName | `clear` |
| value | `1` |

Save and deploy from **Publish → Calculate server differences**, then run **Update the Unity project**.


**SDK (Unity)**

The `adventure-daily` stack you created already contains this mission.

| Setting | Value |
| --- | --- |
| Group | `adventure`, no reset |
| Counter | `clear`, cumulative total |
| Mission | `clear3`, target `3` |
| Reward | 30 coins in slot `0` of `adventure-coin` |

Open the template you used for `adventure-game`. In `contents → completeAcquireActions` for both `forest` and `cave`, add the following entry at the same level as the existing deposit action.

```yaml
- action: Gs2Mission:IncreaseCounterByUserId
  request: |-
    {"namespaceName":"adventure-mission","userId":"#{userId}","counterName":"clear","value":1}
```

Open **Deploy → adventure-game → Update stack**, select the edited file under **Template data**, and update the stack. Wait for **Update complete**. Quest completion now deposits coins and increases the counter.




## 3. Add reward buttons in Unity


**Studio**

Add login reward and mission reward buttons to the adventure screen. Continue using `OnGUI()` to display them.

### Add the handlers

Stop Play Mode in Unity and add the following components to `Gs2` in the Hierarchy.

- Login Reward Collection Handler
- Mission Handler
- Mission Counter Handler

### Add reward buttons to the adventure screen

1. Download <a href="/samples/adventure/en/extensions/studio/AdventureStudioView.cs" download>this chapter's AdventureStudioView.cs</a> and replace `Assets/AdventureStudioView.cs`.
2. In **Adventure Studio View** on `Gs2`, assign the handlers you just added to **Login Reward**, **Mission**, and **Counter**. Set **Mission Group** to `adventure` and **Mission Name** to `clear3`.
3. Enter Play Mode and log in. Reward buttons and progress appear below the stamina shop.

The existing `OnGUI()` calls the new `DrawDailyRewards()` method. Button actions follow the same pattern as starting and completing adventures.

```csharp
if (GUILayout.Button("Claim today's login reward"))
    Run(() => loginReward.Binder.Receive());

if (GUILayout.Button("Claim 30-coin mission reward"))
    Run(() => mission.Binder.Receive());
```

The downloadable code disables actions while loading or processing, and enables the mission reward button once the mission is complete.

The Binder waits for the transaction to finish internally, so the view does not need to call `WaitAsync()`. Read the Handler's `Model` when rendering. Changes from claiming rewards and completing adventures are reflected in the Handler too.

Enter Play Mode, log in, and click **Claim today's login reward**. Day 1 becomes “Claimed” and the adventure screen shows 10 more coins. Clicking again on the same day does not add more coins.

Next, complete Forest exploration three times. After deployment, the new counter action can take up to five minutes to take effect. If the count does not increase, wait a little, then start and complete another forest quest. Once the total reaches `3`, **Claim 30-coin mission reward** becomes available. Claim it to mark the mission “Claimed” and receive 30 coins in addition to the normal adventure rewards.


**SDK (Unity)**

Stop Play Mode and create an empty GameObject named `Extensions`. Place <a href="/samples/adventure/en/extensions/sdk/AdventureDaily.cs" download>AdventureDaily.cs</a> in `Assets/AdventureExtensions`, then add **Adventure Daily** to `Extensions`. Assign the scene's `AdventureLogin` to **Login**, set **Mission Group** to `adventure`, and **Mission Name** to `clear3`.

In the sample, `Client` returns the GS2 client and `Session` returns the signed-in player's session. Both come from `AdventureLogin`.

Reward buttons call through `RunWrite()`. It assigns a key to each request and passes it as `requestId` to `ReceiveLogin()` or `ReceiveMission()`. After a connection error, **Retry the same operation** sends the same request. As in chapter 8, keep Play Mode running and retry as soon as the connection is restored.

This sample uses `OnGUI()` to draw reward buttons and progress to the right of the adventure screen. Widen the Game view so both panels are visible, enter Play Mode, and log in. Click **Claim today's login reward**. Day 1 becomes “Claimed” and the coin balance on the left increases by 10. Clicking again does not grant the same day's reward twice.

Claim status and mission progress are subscribed to with `SubscribeWithInitialCallAsync()`. Change notifications update the display when an adventure is completed or a reward is claimed.

On subsequent days, players can claim day 2 and then day 3. The following API claims the reward.

```csharp
private async UniTask ReceiveLogin(string requestId)
{
    var transaction = await Client.LoginReward.Namespace(LoginNamespace).Me(Session).Bonus()
        .ReceiveAsync("daily", speculativeExecute: false, duplicationAvoider: requestId);
    if (transaction != null) await transaction.WaitAsync(all: true);
}
```

Next, complete Forest exploration three times using the left panel. After deployment, the new counter action can take up to five minutes to take effect. If the count does not increase, wait a little, then start and complete another forest quest. When the total on the right reaches `3`, click **Claim 30-coin mission reward**. The status becomes “Claimed” and the coin balance on the left increases by 30, in addition to the usual adventure rewards.

```csharp
private async UniTask ReceiveMission(string mission, string requestId)
{
    var transaction = await Client.Mission.Namespace(MissionNamespace).Me(Session).Complete(missionGroup)
        .ReceiveRewardsAsync(mission, speculativeExecute: false, duplicationAvoider: requestId);
    if (transaction != null) await transaction.WaitAsync(all: true);
}
```




## 4. Add a Monday-only mission

Add a mission that grants 30 coins for completing one adventure on Monday. Once completed on Monday, its reward can also be claimed from Tuesday through Sunday. Completion and claim status reset at midnight on the next Monday, allowing another attempt. All days and times in this example use JST (UTC+9).

Keep `clear3`, and add `monday_clear` to a new weekly group named `weekly`.


**Studio**

### Create a Monday schedule

Under **Tables → Scheduling → Schedule**, add the following row. For the start and end dates, open each cell, switch to **Local (UTC+9)**, and select the date and time.

| Field | Value |
| --- | --- |
| ID | `monday` |
| Schedule type | `absolute` |
| Start | `2020-01-01 00:00` (JST) |
| End | `2099-01-01 00:00` (JST) |
| Repeat type | `weekly` |
| Start day | `sunday` |
| Start hour | `15` |
| End day | `monday` |
| End hour | `15` |

The start and end dates define the overall period during which this weekly event runs. The repeat settings make it active only on Mondays within that period. The weekday and hour fields use UTC, so midnight Monday through midnight Tuesday in JST is `sunday 15` through `monday 15`.

### Create the weekly mission

The reset occurs at midnight Monday JST (`sunday` and `15` in the mission settings).

1. Add `weekly` to **MissionCollection**. Set the reset type to `weekly` and schedule to `monday`.
2. Add `monday_clear` to **Mission**. Set the group to `weekly`, counter to `clear`, and target to `1`. The completion reward is 30 coins, as for `clear3`.
3. Save and deploy from **Publish → Calculate server differences**, then run **Update the Unity project**.
4. Stop Play Mode. In **Adventure Studio View** on `Gs2`, change **Mission Group** to `weekly` and **Mission Name** to `monday_clear`.


**SDK (Unity)**

1. Download the <a href="/samples/adventure/en/extensions/daily-period-sdk.json" download>Monday-only mission template</a>.
2. Open **Deploy → adventure-daily → Update stack**, select the file under **Template data**, and update. Wait for **Update complete**.
3. Stop Play Mode. In **Adventure Daily**, change **Mission Group** to `weekly` and **Mission Name** to `monday_clear`.

The template includes the login rewards, the original `clear3`, and these additional settings. You do not need to change any dates.

| Setting | Details |
| --- | --- |
| Schedule `monday` | Active every Monday from midnight until midnight Tuesday (JST) |
| Group `weekly` | Resets completion and claim status every Monday at midnight (JST) |
| Mission `monday_clear` | Counter `clear`, target `1`, reward 30 coins |

The schedule's repeat settings are shown below. GS2 uses UTC for weekdays and hours, so midnight Monday through midnight Tuesday JST is specified as Sunday 15:00 through Monday 15:00.

```json
"repeatSetting": {
  "repeatType": "weekly",
  "beginDayOfWeek": "sunday",
  "beginHour": 15,
  "endDayOfWeek": "monday",
  "endHour": 15
}
```

The mission's `challengePeriodEventId` references this schedule. The group reset settings are `resetType = weekly`, `resetDayOfWeek = sunday`, and `resetHour = 15`.




The new mission settings can take up to five minutes to take effect after deployment. Wait five minutes, enter Play Mode, log in, and complete Forest exploration once. On Monday, the screen says “You can claim the 30-coin mission reward.” From Tuesday through Sunday, that completion does not fulfill the mission.

The counter uses the existing cumulative total. Mission completion is evaluated when an adventure increases the counter, so even if the total is already at least one, you must complete another adventure on Monday.

| When | Mission behavior |
| --- | --- |
| Complete an adventure on Monday | Completes the mission; 30 coins can be claimed |
| Tuesday through Sunday | Cannot newly complete the mission; a reward earned on Monday can still be claimed |
| Midnight on the next Monday | Completion and claim status reset; unclaimed rewards from the previous week do not carry over |

[Next: Build items and a shop]()



