Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • API and SDK Questions /
avatar image
Question by khattabkhairdeen · Dec 23, 2021 at 01:02 AM · apisPlayer DataCustom Game Servers

Azure Functions in Unity

I have a couple of questions: can i use azure functions to read and write player data, acting as the actual server? and also, do i need an azure account if im only using these functions in unity? if i can use this as the server, how do i enable the server api on it since its an entirely new project. the docs for it say to use an azure template in vs so its not even attatched to the unity project.. i assume i have to just paste the http result in and the function name, wondering if i have to first register that to the azure website or if i can just do it without registration, just via playfab.

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

1 Reply

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Sarah Zhang · Dec 23, 2021 at 08:00 AM

>> I have a couple of questions: can i use azure functions to read and write player data, acting as the actual server?

Azure Functions can implement your requirement. You can read and write the player read-only, internal data on Azure Functions using PlayFab server API, then handle them in your own server-side logic and return the function results as responses.

But you may need to note, Azure Functions is a serverless function that can be used to handle the light-level server-side logic. For example, executing serverless functions is an event-driven computing experience, it is different from actual servers that allow you to deploy the services and run them on the ongoing basis. Azure functions cannot completely replace servers.

Please check the Azure Functions documentation series - Azure Functions Overview | Microsoft Docs to learn more about Azure Functions and check our documentation - PlayFab CloudScript using Azure Functions Quickstart Guide - PlayFab | Microsoft Docs to learn about how to integrate and use it with PlayFab.

>> and also, do i need an azure account if im only using these functions in unity?

To use Azure functions, you need to have a separate Azure account and Azure Subscription. And the usage of Azure Functions will be charged separately. You can navigate to specifical Azure Functions Pricing Page - Pricing – Functions | Microsoft Azure for more information about its price.

Besides, after you deploy your Azure Functions, clients can access them using REST API. Such backend services are cross-platform. It does not depend on how many platforms you use as clients.

>> if i can use this as the server, how do i enable the server api on it since its an entirely new project. the docs for it say to use an azure template in vs so its not even attatched to the unity project..

The Azure Functions project is a separate project that supports be built using C# program language. It does not support be attached to Unity and does not need to use any Unity SDK.

For your case, please follow our tutorials to import C# PlayFab All SDK to your C# Azure Functions project, then do the continued steps. You can refer to this documentation - Quickstart - PlayFab Client library for C# - PlayFab | Microsoft Docs to learn more about our C# SDK. In PlayFab C# SDK, the calls of server API are enabled by default.

Besides, if you use Unity as the development platform of clients. Our PlayFab Unity SDK contains the method definition of ExecuteFunction for player to execute Azure Functions.

>> i assume i have to just paste the http result in and the function name, wondering if i have to first register that to the azure website or if i can just do it without registration, just via playfab.

To use the backend service that provide by Aure Functions, you must deploy it to Azure first, then register it to PlayFab. Azure Functions documentation - Create a C# function using Visual Studio Code - Azure Functions | Microsoft Docs and our documentation - PlayFab CloudScript using Azure Functions Quickstart Guide - PlayFab | Microsoft Docs will provide you with guidance. You can also check out our overview video - PlayFab + Azure Functions + Visual Studio Code - Crazy Awesome Games! - YouTube.

If you want to locally test it before you deploy it to Azure, you can follow this documentation - Local debugging for Cloudscript using Azure Functions - PlayFab | Microsoft Docs to do the locally debugging. For clarification, locally debugging of Azure Functions also depends on Azure Functions core tool provided by Azure.

Comment
khattabkhairdeen

People who like this

1 Show 2 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image khattabkhairdeen · Dec 24, 2021 at 03:07 AM 0
Share

If the azure functions would be on a new project, how would i use the playfab api? where do i download the playfab SDK for non unity projects?

avatar image Sarah Zhang khattabkhairdeen · Dec 29, 2021 at 03:43 PM 1
Share

As the answer said, for C# project, you can refer to this documentation - Quickstart - PlayFab Client library for C# - PlayFab | Microsoft Docs to learn more about how to use PlayFab C# SDK.

If you need the SDK for other platforms or other languages, you can search them in our SDK documentation - Azure PlayFab SDKs - PlayFab | Microsoft Docs.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    8 People are following this question.

    avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

    Related Questions

    Server API limitations 1 Answer

    Saving data in Unity on Pause/Quit/Lose Focus 1 Answer

    Since Azure Function Only change, Examples are invalid 1 Answer

    Multiplayer 2.0 StartGame Procedure? 2 Answers

    PurchaseItem - ServiceUnavailable/BadRequest 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges