# SDK Tutorial

## Package Structure

The Renovi package is organized into the following folders, each serving a specific purpose:

**Download**

Contains essential packages utilized within Renovi:

* **DOTween for Animations**: Provides optimized animations compared to Unity's animation system.
* **Starter Assets**: Unity package featuring a first-person controller for initial project setup.

**Materials**

Houses shaders and materials catering to different project lighting settings:

* **Lit Shader**: Designed for projects utilizing lighting, URP, and HDRP settings, accompanied by materials for testing purposes.
* **Unlit Shader**: Ideal for projects with no lighting settings, accompanied by materials suitable for testing.

**Models**

Provides a generic poster model for testing purposes. Developers are encouraged to replace it with their own models if desired.

**Prefabs**

Offers pre-configured prefabs using both lit and unlit shaders, along with materials. These prefabs are organized and separated for ease of use with the SDK Manager script.

**Resources**

Contains essential resources such as LocalData for offline game functionality and standard images.

**Scenes**

Includes the Playground scene from starter assets for testing purposes. While not configured for URP or HDRP, it seamlessly integrates upon import.

**Scripts**

* Essential scripts powering Renovi's functionalities:
  * **ADCamera**: Tracks players' visibility of ads and handles ad visibility changes.
  * **ADAnimation**: Facilitates panel animation when ads are updated.
  * **ADObject**: Placed on panels designated for displaying ads.
  * **SDKManager**: Central script responsible for server connectivity, data retrieval, token management, data loading, tracking, and sending data back to the server.

**Sprites**

Features sprites of various resolutions for testing purposes, including 1x1, 2x1, and 1x2 resolutions. Additionally, it includes a banner with images for ads requiring visuals.

## Dependencies

The Renovi project relies on the following dependencies:

* **DOTween Package**: Utilized for smooth and optimized panel animations within the platform.

## Build and Deployment

Renovi's build and deployment process require no specific settings. You can seamlessly deploy your project without any additional configurations.

## Asset Pipeline

Renovi's asset pipeline revolves around the usage of two essential packages:

* **DOTween**: Enhances panel animations for a more engaging user experience.
* **Unity Starter Assets FPS**: Provides foundational assets for implementing a first-person perspective within your project.

### Tutorials and Examples

Renovi offers tutorials and examples to streamline your development process:

* **Quick Test**: Follow these steps for a quick test of Renovi's capabilities:
  1. Open the "Playground" scene located in the "SDK" folder within the "Scenes" directory.
  2. In the SDKManager script, populate the required information for login and game ID to simulate a real-world scenario.

<figure><img src="https://634848191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEOr4BfxLrI853j6xta6%2Fuploads%2F4xeJA8kAQIW9QKdw0ces%2F4.1.gif?alt=media&#x26;token=4e0aa520-bb6d-4609-82c9-b68fb3b06a55" alt=""><figcaption></figcaption></figure>

* In the SDKManager script, populate the required information for login and game ID to simulate a real-world scenario.

<figure><img src="https://634848191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEOr4BfxLrI853j6xta6%2Fuploads%2FDi4PEz0VahwtFwKP7Jrf%2F5.1.gif?alt=media&#x26;token=abbf0886-3a00-4e5e-a41b-f7f8d520ee97" alt=""><figcaption></figcaption></figure>

**Add Package to Your Project**:

* Import the Renovi package into your Unity project.
* Note: You can relocate the package folder without affecting functionality.

<figure><img src="https://634848191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEOr4BfxLrI853j6xta6%2Fuploads%2FIuEng2kZhJjeNa19xMho%2F2.1.gif?alt=media&#x26;token=a8fae1d7-762f-490b-a7d6-ee9666774381" alt=""><figcaption></figcaption></figure>

**Explore Prefabs**:

* Navigate to the "Prefabs" folder within the package.
* You'll find two subfolders: one with prefabs using a lit shader and the other with prefabs using an unlit shader.
* Simply drag and drop your desired prefabs into the scene.

<figure><img src="https://634848191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEOr4BfxLrI853j6xta6%2Fuploads%2FC3fChQIhS3d5K77fKoV1%2F3.1.gif?alt=media&#x26;token=1f16e28c-f964-420b-abe7-1f8e3182133e" alt=""><figcaption></figcaption></figure>

**Configure SDKManager Script**:

* Locate the object named "SDKManager" in your scene hierarchy.
* Access the SDKManager script attached to this object.
* Input your email, password for the studio, and game ID to establish a connection with the API server.

<figure><img src="https://634848191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEOr4BfxLrI853j6xta6%2Fuploads%2F4xeJA8kAQIW9QKdw0ces%2F4.1.gif?alt=media&#x26;token=4e0aa520-bb6d-4609-82c9-b68fb3b06a55" alt=""><figcaption></figcaption></figure>

**Configure Panel Objects**:

* Within the child object named "Panels" under SDKManager, find the ADObject script.
* Input the panel ID obtained from your profile where you created these panels.

<figure><img src="https://634848191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEOr4BfxLrI853j6xta6%2Fuploads%2FDi4PEz0VahwtFwKP7Jrf%2F5.1.gif?alt=media&#x26;token=abbf0886-3a00-4e5e-a41b-f7f8d520ee97" alt=""><figcaption></figcaption></figure>

**Ensure Proper Tagging**:

* Verify that every panel in your scene has a tag set to "AD-Panel" for proper identification.

**Configure Main Camera**:

* Attach the AdCamera script to your main camera to track ad visibility.

<figure><img src="https://634848191-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FoEOr4BfxLrI853j6xta6%2Fuploads%2FdkK9DfBfe1pPtlMfKRwY%2F6.gif?alt=media&#x26;token=2a5226ac-f16f-473f-9771-bf7880ab6fd6" alt=""><figcaption></figcaption></figure>

#### Custom Setup

* For a customized setup tailored to your project's needs, follow these steps:

  1. **Add SDKManager Script**: Place the SDKManager script in your scene and populate it with the required information.
  2. **Create Panels**: Design panels using built-in models or custom models. Ensure each panel has the ADObject and ADAnimation scripts attached. Additionally, add a collider and tag them with "AD-Panel". You can utilize one of the Lit or Unlit prefabs from the Prefabs folder for convenience. Note that panels do not need to be children of the SDKManager object.
  3. **Configure ADAnimation**: For ADAnimation, arrange two panels as children of the object to switch positions for animation. Customize these scripts to enhance animation effects.
  4. **Add ADCamera Script**: Attach the ADCamera script to your camera to track ad visibility.

  Now you're ready to test your custom setup!

## Troubleshooting and FAQ

Encountering issues? Here are some common troubleshooting tips:

* **Null Tag Error**: If you receive an error regarding a null or unset tag, ensure you've added the "AD-Panel" tag to the panels and checked all panels used for displaying ads to have this tag.
* **Duplicate Conflicts**: Check for duplicate conflicts by verifying if you've already downloaded the following packages:
  * Unity Starter Assets First-Person
  * DoTween Ensure these packages are up-to-date to avoid conflicts.

If you encounter any difficulties, refer to the "Playground" scene in the SDK folder for comparison with settings and configurations.

Feel free to reach out for further assistance or clarification!

Now, go ahead and test your setup with confidence!&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://renovi.gitbook.io/renovi/game-studios/sdk-tutorial.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
