IAP Storefront for Atavism MMO Engine

In this lesson, we will guide you through the process of setting up the HNG Unity Store as a Windows service. This will allow the store to run automatically on system startup, ensuring it is always available to manage Unity-related store operations. The process involves downloading the required files, extracting them, and creating the necessary scripts to manage the service.


Step 1: Download the Store Front ZIP File

To begin, you need to download the HNG Unity Store Front ZIP file. This file contains all the necessary components to run the store on your Windows machine.

  1. Visit the official download page or use the provided link from your instructor.
  2. Click on the Download ZIP button and save the file to a convenient location on your system (e.g., C:\Downloads).

Step 2: Extract the ZIP File

After downloading the ZIP file, the next step is to extract its contents.

  1. Navigate to the folder where you downloaded the ZIP file (e.g., C:\Downloads).
  2. Right-click the ZIP file and select Extract All.
  3. Choose a destination for the extracted files. For this tutorial, we will use C:\HNGUnityStore.
  4. Click Extract to extract the files to the specified location.

You should now have a folder named HNGUnityStore containing the necessary files, including the HNGUnityStore.dll which will be used in the service setup.


Step 3: Creating a Script to Install the Service

To run the HNG Unity Store as a Windows service, we need to create a script that will install the service and configure it to start automatically when the system boots.

  1. Open Notepad or any text editor of your choice.
  2. Copy and paste the following script into the editor:
@echo off
REM Service Name
set SERVICE_NAME=HNGUnityStore
REM Path to the executable
set EXE_PATH=”C:\path\to\dotnet.exe”
set APP_PATH=”C:\path\to\HNGUnityStore.dll”

REM Install the service
sc create %SERVICE_NAME% binPath= “%EXE_PATH% %APP_PATH%” start= auto DisplayName= “HNG Unity Store Service”

REM Set the description (optional)
sc description %SERVICE_NAME% “HNG Unity Store Service for managing Unity-related store operations.”

REM Start the service
sc start %SERVICE_NAME%

echo Service %SERVICE_NAME% installed and started successfully.
pause

Important Notes:

  • Replace C:\path\to\dotnet.exe with the actual path to the dotnet.exe on your system. For example, it could be something like C:\Program Files\dotnet\dotnet.exe.
  • Replace C:\path\to\HNGUnityStore.dll with the path to the HNGUnityStore.dll file you extracted earlier (e.g., C:\HNGUnityStore\HNGUnityStore.dll).
  1. Save the file as InstallService.bat in the same directory where you extracted the store files (e.g., C:\HNGUnityStore).

Step 4: Running the Script to Install the Service

Now that we have the installation script ready, it’s time to run it and install the HNG Unity Store as a Windows service.

  1. Open the Command Prompt as an administrator:
    • Press Windows + X and select Command Prompt (Admin) or Windows Terminal (Admin).
  2. Navigate to the folder where you saved the InstallService.bat file. You can do this by typing:
    cd C:\HNGUnityStore
  3. Run the script by typing:
    InstallService.bat

The script will execute the following steps:

  • Create the HNG Unity Store service.
  • Set it to start automatically on system startup.
  • Provide a description for the service.
  • Start the service immediately after installation.

You should see a message indicating that the service was installed and started successfully.


Step 5: Verifying the Service Installation

After running the installation script, verify that the service has been installed and is running correctly.

  1. Open the Services app by typing services.msc in the Windows search bar.
  2. In the Services window, scroll down to find the HNGUnityStore service.
  3. Ensure that the status of the service is Running. If it’s not running, you can manually start it by right-clicking the service and selecting Start.

The service is now set up and will automatically run every time the system boots.


Step 6: Creating a Script to Remove the Service

If you ever need to stop and remove the HNG Unity Store service, you can create another script to handle this process.

  1. Open Notepad or your preferred text editor.
  2. Copy and paste the following script:
@echo off
REM Service Name
set SERVICE_NAME=HNGUnityStore
REM Stop the service
sc stop %SERVICE_NAME%

REM Delete the service
sc delete %SERVICE_NAME%

echo Service %SERVICE_NAME% stopped and removed successfully.
pause

Save this file as RemoveService.bat in the same folder (C:\HNGUnityStore).


Step 7: Running the Script to Remove the Service

To stop and remove the service:

  1. Open the Command Prompt as an administrator (same as Step 4).
  2. Navigate to the folder where you saved the RemoveService.bat file:
    cd C:\HNGUnityStore
  3. Run the script:
    RemoveService.bat

This will:

  • Stop the HNG Unity Store service.
  • Remove it from the list of Windows services.

Once the script finishes, you will see a message confirming that the service was stopped and removed successfully.


Conclusion

By following this lesson, you’ve successfully set up the HNG Unity Store as a Windows service, ensuring it runs automatically at startup and can be easily managed through scripts. You’ve also learned how to stop and remove the service if needed.

This configuration will allow you to manage the Unity store seamlessly on a Windows machine, ensuring it’s always up and running to handle in-game store operations.