Add class RealAPI to any active gameObject and add your login information.
using REAL;
using REAL.Networks;
[RequireComponent(typeof(RealAPI))]
public class RendererScene : MonoBehaviour
{
public RealAPI real;
private void Awake()
{
real = GetComponent<RealAPI>();
}
}
Get Real API scene (binary scene)
You can render whole scene or even some GameObjects of your scene it depends upon your requirement
// Step 1: Get scene from whole Scene
Camera camera = myCam; // Optional
Scene scene = myScene; // Required
var realScene = Real.RealScene(scene, camera);
OR
// Step 1: Get scene from some gameobjects in Scene
Camera camera = myCam; // Optional
List<GameObject> allObjects = requiredObject; // Required
var realScene = Real.RealScene(allObjects, camera);
Note:
camera is an Optional parameter in this function.
If you have multipleCamera in scene or list , the camera you want to render can be named as REAL_EYE or you can bypass directly to the function Real.RealScene(allObjects, camera)
Create new job
// Step 2: Apply new job
var apiResponse = await ApiRequests.PostRequest(login, AskService.NewJob);
var resData = apiResponse.data;
var uri = resData.url;
using REAL;
using REAL.Networks;
using UnityEngine;
using UnityEngine.SceneManagement;
[RequireComponent(typeof(RealAPI))]
public class RendererScene : MonoBehaviour
{
public RealAPI real;
private void Awake()
{
real = GetComponent<RealAPI>();
}
public async void RenderScene()
{
var login = real.login;
// Step 1: Get Scene
var camera = Camera.main;
var scene = SceneManager.GetActiveScene();
var realScene = Real.RealScene(scene, camera);
// Step 2: Apply new job
var apiResponse = await ApiRequests.PostRequest(login, AskService.NewJob);
var resData = apiResponse.data;
var uri = resData.url;
// Step 3: Upload scene
bool uploaded = await ApiRequests.PutRequest(uri, realScene);
// Step 4: Submit job
await ApiRequests.PostRequest(login, AskService.Submit, resData.jobID);
}
}