Giter VIP home page Giter VIP logo

spatial-unity-sdk's People

Contributors

alansherba avatar spatialsystemsdev avatar waldobronchart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

spatial-unity-sdk's Issues

[DOC SUGGESTION]: ActorProfilePictureRequest

Doc Page Links

https://cs.spatial.io/api/SpatialSys.UnitySDK.ActorProfilePictureRequest.html

Explain Suggestion

Simple example showing how to set a RawImage's texture property with the texture returned from the ActorProfilePictureRequest

Code Suggestion

using SpatialSys.UnitySDK;
using UnityEngine;
using UnityEngine.UI;

public class YourCSharpScript : MonoBehaviour
{
    [SerializeField]
    RawImage profilePicture;

    public void SetProfilePicture()
    {
        SpatialBridge.actorService.localActor.GetProfilePicture().SetCompletedEvent((evt) =>
        {   
            profilePicture.texture = evt.texture;
        });
    }
}

Contribution Credit

No response

Spatial.io handle

No response

Discord handle

No response

[DOC SUGGESTION]: VisualScriptingUtility.TriggerCustomEvent

Doc Page Links

https://cs.spatial.io/api/SpatialSys.UnitySDK.VisualScriptingUtility.TriggerCustomEvent.html

Explain Suggestion

With so many spaces having been built with Visual Scripting, it would be helpful to include a simple example on how to use those script graphs with C#. In my simple example I set up a Sphere with a Spatial Interactable as a child. In the interactable's On Interact Event section, I made two entries - one for each of the example C# functions that raise a visual script event. The events simply print values to the Debug.LogWarning console.
image
image

Additionally, the "message" parameter of the TriggerCustomEvent function is misleading. I would have expected it to be something like "eventName", "vsEventName", or even "visualScriptEventName".

Code Suggestion

using SpatialSys.UnitySDK;
using UnityEngine;

public class ScriptWithFunctions : MonoBehaviour
{
    [SerializeField]
    GameObject objectWithScriptMachine;

    readonly string eventName = "RaisedFromCSharp";
    readonly string eventNameWithParameters = "RaisedFromCSharpWithParameters";

    public void RaiseVisualScriptingEvent()
    {
        VisualScriptingUtility.TriggerCustomEvent(objectWithScriptMachine, eventName);        
    }

    public void RaiseVisualScriptingEventWithParameters()
    {
        int param1 = 1;
        int param2 = 2;
        VisualScriptingUtility.TriggerCustomEvent(objectWithScriptMachine, eventNameWithParameters, param1, param2, this);
    }
}

Contribution Credit

No response

Spatial.io handle

No response

Discord handle

No response

[DOC SUGGESTION]: Watch Ad using Ad Service

Doc Page Links

https://cs.spatial.io/api/SpatialSys.UnitySDK.IAdService.html

Explain Suggestion

Added code sample to use the ad service's two functions.

Code Suggestion

void WatchAd()
{
    if (!SpatialBridge.adService.isSupported)
        return;
    
    SpatialBridge.adService.RequestAd(SpatialAdType.Rewarded).SetCompletedEvent(request =>
    {
        if (request.succeeded)
        {
            Debug.Log("Ad succeeded");
        }
    });
}

Contribution Credit

Andres Cartin

Spatial.io handle

andi

Discord handle

andicr

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.