spatialsys / spatial-unity-sdk Goto Github PK
View Code? Open in Web Editor NEWThis package allows creators to build content in Unity and publish it to Spatial
Home Page: https://openupm.com/packages/io.spatial.unitysdk
License: MIT License
This package allows creators to build content in Unity and publish it to Spatial
Home Page: https://openupm.com/packages/io.spatial.unitysdk
License: MIT License
esp since i got here while googling SpatialUI - unity's shabby prefabs for VisionOS UI
https://cs.spatial.io/api/SpatialSys.UnitySDK.ActorProfilePictureRequest.html
Simple example showing how to set a RawImage's texture property with the texture returned from the ActorProfilePictureRequest
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;
});
}
}
No response
No response
No response
https://cs.spatial.io/api/SpatialSys.UnitySDK.VisualScriptingUtility.TriggerCustomEvent.html
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.
Additionally, the "message" parameter of the TriggerCustomEvent function is misleading. I would have expected it to be something like "eventName", "vsEventName", or even "visualScriptEventName".
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);
}
}
No response
No response
No response
https://cs.spatial.io/api/SpatialSys.UnitySDK.SpatialBridge.html
Show an example of using the bridge
void Start()
{
SpatialBridge.coreGUIService.DisplayToastMessage("Hello World");
}
alanSherba
https://cs.spatial.io/api/SpatialSys.UnitySDK.IInputActionsListener.html
BEFORE
Called when input capture has stopped.
FIX
Called when input capture has started.
No response
rhy.voxbox
RhyGuyVoxbox
rhyguy5760
https://cs.spatial.io/reference/SpatialSys.UnitySDK.IMarketplaceService.PurchaseItem
Andi shared this code snippet in one of the external developer Slack channels.
SpatialBridge.marketplaceService.PurchaseItem("SKU_ID", 1, true).SetCompletedEvent(request =>
{
if (request.succeeded)
{
// Do something here
}
});
No response
No response
No response
https://cs.spatial.io/api/SpatialSys.UnitySDK.IAdService.html
Added code sample to use the ad service's two functions.
void WatchAd()
{
if (!SpatialBridge.adService.isSupported)
return;
SpatialBridge.adService.RequestAd(SpatialAdType.Rewarded).SetCompletedEvent(request =>
{
if (request.succeeded)
{
Debug.Log("Ad succeeded");
}
});
}
Andres Cartin
andi
andicr
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.