{"id":20983139,"url":"https://github.com/pozil/salesforce-unity-sdk","last_synced_at":"2025-05-14T16:32:03.513Z","repository":{"id":71932064,"uuid":"76189448","full_name":"pozil/salesforce-unity-sdk","owner":"pozil","description":"Salesforce SDK for Unity","archived":false,"fork":false,"pushed_at":"2020-02-26T09:32:05.000Z","size":92,"stargazers_count":16,"open_issues_count":0,"forks_count":9,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-04-02T20:38:36.808Z","etag":null,"topics":["salesforce","unity","unity3d","vr"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pozil.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-12-11T17:37:07.000Z","updated_at":"2023-10-23T01:02:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"b70503ab-52b3-4dec-8ca1-20c4baaa92ed","html_url":"https://github.com/pozil/salesforce-unity-sdk","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozil%2Fsalesforce-unity-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozil%2Fsalesforce-unity-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozil%2Fsalesforce-unity-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pozil%2Fsalesforce-unity-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pozil","download_url":"https://codeload.github.com/pozil/salesforce-unity-sdk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254183068,"owners_count":22028416,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["salesforce","unity","unity3d","vr"],"created_at":"2024-11-19T05:47:53.128Z","updated_at":"2025-05-14T16:32:03.492Z","avatar_url":"https://github.com/pozil.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cimg align=\"right\" src=\"/media/salesforce-unity-sdk.png?raw=true\" width=\"25%\" alt=\"Salesforce Unity SDK\"/\u003e\n\n# Salesforce Unity SDK\n\n## About\nThis project is a [Salesforce](https://www.salesforce.com) SDK for the popular game engine [Unity 3d](https://unity3d.com/).\u003cbr/\u003e\nThe SDK is written in C# and interact with the Force.com REST APIs.\n\nIt provides the following services:\n- OAuth authentication\n- Salesforce records query, insert, update, delete operations\n- Apex remote methods calls\n- Chatter feed interactions such as retrieving a feed and posting to it\n\nThis SDK is provided “as is“ without any warranty or support. Salesforce does not officially endorse it.\n\n## Installation\n\n### Sign up for a Salesforce Org (optional)\nIf you need a Salesforce Org, you can sign up for a free [Salesforce Developer Edition](https://developer.salesforce.com/signup) (DE) organization.\n\n### Create a Connected App in Salesforce\n1. Log in to your Salesforce org.\n1. At the top right of the page, select the gear icon and then click **Setup**.\n1. From Setup, enter `App Manager` in the Quick Find and select **App Manager**.\n1. Click **New Connected App**.\n1. Enter `Unity 3d API` as the **Connected App Name**\n1. Enter your **Contact Email**.\n1. Under **API (Enable OAuth Settings)**, check the **Enable OAuth Settings** checkbox.\n1. Enter `https://localhost/` as the **Callback URL**.\n1. Under **Selected OAuth Scope**, move **Access and manage your data (API)** to the Selected OAuth Scopes list.\n1. Click **Save**.\n1. From this screen, copy the connected app’s **Consumer Key** and **Consumer Secret** some place temporarily.\n\n### Install the Salesforce Client in Unity\n1. Copy the `src` folder from the SDK to the `Assets` folder of your Unity project\n1. Create an empty `GameObject` and give it a descriptive name like `Salesforce client`\n1. Drag and drop the `SalesforceClient` script that's in `Assets/src/sfdc-client` on the new `GameObject`\n1. Configure the client script with the **Consumer Key** and **Consumer Secret** you obtained earlier.\n\nIf you want to test the client, follow these extra instructions:\n1. Add the `Assets/src/sample/TestSalesforceClient` script on the same object that contains the `SalesforceClient` script\n1. Configure the test script with your Salesforce credentials\n1. Start the game and watch the Unity console\n\nIf you do not want to use the sample code, you can safely remove the `Assets/src/sample` directory.\n\n## Documentation\n\nThe `TestSalesforceClient` class highlights the following:\n- how to log in to Salesforce and how to diagnose client configuration errors\n- how to perform basic CRUD operations on Salesforce records (Case object in this sample).\n\nNote that all Salesforce Client operations require that you log in to Salesforce beforehand.\n\n### Support for standard or custom Salesforce objects\nIn order to support any standard or custom Salesforce objects, you must create a class per object.\u003cbr/\u003e\nThis class must inherit from `SalesforceRecord`. See the `Case` class for example.\n\n### Calling a custom Apex REST method\nAssuming that you have deployed the following Apex class in Salesforce:\n```apex\n@RestResource(urlMapping='/CustomRestApi/*')\nglobal class CustomRestApi {\n\n    @HttpPost\n    global static string sayHello(String name) {\n        return 'Hello '+ name;\n    }\n}\n```\n\nYou can call the custom Apex REST methods by using the following code:\n```C#\nCoroutine\u003cString\u003e routine = this.StartCoroutine\u003cString\u003e(\n    sfdcClient.runApex(\"POST\", \"CustomRestApi\", \"{\\\"name\\\": \\\"world\\\"}\", \"\")\n);\nyield return routine.coroutine;\nstring result = routine.getValue(); // Hello world\n```\n\n## Dependencies\n\n**JSONObject**\n\nThis project relies on JSONObject 1.4, a simple C# JSON parser.\u003cbr/\u003e\nCopyright (C) 2012 Boomlagoon Ltd.\n\n**Coroutine extension**\n\nAs a convenience, this project includes a utility class that provide Coroutines with supports for return values and exceptions.\nIt is important to always call the `getValue()` method even if there is no expected result as this triggers exceptions.\n\n```C#\nCoroutine\u003cbool\u003e routine = this.StartCoroutine\u003cbool\u003e(\n  sfClient.login(SFDC_USERNAME, SFDC_PASSWORD)\n);\nyield return routine.coroutine;\ntry {\n  bool isUserLoggedIn = routine.getValue();\n}\ncatch (Exception e) {\n  // Handle exception\n}\n```\n\nCredit for this Coroutine utility goes to @horsman from Twisted Oak Studios.\n\n## Credits\nOriginal code written by John Casimiro on 2014-01-30\n\nModified by Ammar Alammar\n\nModified by Bobby Tamburrino:\n- removed PlayMaker dependencies\n- added Chatter support\n- added approval process handling\n\nModified by Philippe Ozil:\n- refactored configuration to separate app/user authentication config\n- switched all request to IEnumerator for more async control\n- added exceptions to handle errors\n- removed response from client class to allow parallel processing\n- added debug mode for improved tracing\n- updated project to use UnityWebRequest\n- reduced complexity of CRUD operations on salesforce records (see SalesforceRecord class)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpozil%2Fsalesforce-unity-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpozil%2Fsalesforce-unity-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpozil%2Fsalesforce-unity-sdk/lists"}