Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums
  1. Home
  2. Cloud Code
  3. get custom entities associated to a player at login.

get custom entities associated to a player at login.

Scheduled Pinned Locked Moved Cloud Code
entitycloud code scriptcustom entities
3 Posts 1 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gibuspi
    wrote on last edited by
    #1

    Hi,
    a player custom entity is not returned event when
    "Return User Entities during Authenticate and ReadPlayerState methods" is enabled in app settings

    the methods ReadEntity in custom entity api require and entityId.

    how do we read a player custom data (custom entities) ? at login for example ?
    thank

    G 1 Reply Last reply
    0
    • G gibuspi

      Hi,
      a player custom entity is not returned event when
      "Return User Entities during Authenticate and ReadPlayerState methods" is enabled in app settings

      the methods ReadEntity in custom entity api require and entityId.

      how do we read a player custom data (custom entities) ? at login for example ?
      thank

      G Offline
      G Offline
      gibuspi
      wrote on last edited by
      #2

      ok, when defining a custon entity you create a field owner , that you set as an index later in the dasboard.

      {
        "owner": "",
        "id": "",
        "code": "",
        "gunType": "basic",
        "ammo": 10,
        "lifes": 3
      }
      

      when creating a custon entity , you set the field owner with th current player profileId
      then you can retrieve it with a call to GetEntityPage

      {
        "entityType": "playerData",
        "context": {
          "pagination": {
            "rowsPerPage": 50,
            "pageNumber": 1
          },
          "searchCriteria": {
            "data.owner": "[current player profileId]"
          },
          "sortCriteria": {
            "createdAt": 1
          }
        }
      }
      
      1 Reply Last reply
      0
      • G Offline
        G Offline
        gibuspi
        wrote on last edited by
        #3

        Edit . you can get all custom entities for the current user with the query

        {
          "entityType": "[entitytype]",
          "ownerId": "[profileId]",
          "context": {
            "pagination": {
              "rowsPerPage": 50,
              "pageNumber": 1
            },
            "searchCriteria": {
             // other search criteria here
            },
            "sortCriteria": {
              "createdAt": 1
            }
          }
        }
        
        1 Reply Last reply
        0

        Hello! It looks like you're interested in this conversation, but you don't have an account yet.

        Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

        With your input, this post could be even better 💗

        Register Login
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Solved
        • Unsolved
        • Users