๐ Looking for detailed implementation docs?
This page gives you a high-level overview, but you can always dive deeper in the official SDK documentation on GitHub:
This page provides a technical breakdown of the core classes, traits, scripting APIs, and utility functions available in the URT3D SDK for Unity.
๐น Core Classes
Asset
The base class for all .urta files.
public abstract class Asset
{
public Actor Actor { get; }
public Preview Preview { get; }
public Metadata Metadata { get; }
public ReadOnlyCollection<Trait> Traits { get; }
public ReadOnlyCollection<Script> Scripts { get; }
public static Task<Asset> Construct(string pathToAsset);
public void Destroy();
public T GetTrait<T>() where T : Trait;
public void AddScript(Script script);
public void RemoveScript(Script script);
}
Wrapper
Unity MonoBehaviour that links a URT3D asset to a GameObject.
public class Wrapper : MonoBehaviour
{
public enum ModeType { Local_File = 0, Remote_Guid = 1 }
public string Json { get; set; }
public ModeType Mode { get; set; }
public Guid Guid { get; }
public string Path { get; set; }
public Asset Asset { get; }
public ScriptExecutionMode ExecutionMode { get; set; }
public void Reload();
public bool RunScriptReference(Script script);
public void RunScriptsByTrigger(ScriptTriggerType triggerType);
public void TriggerCustomEvent(string eventName);
public void StopScripts();
}
Actor
public class Actor
{
public GameObject GameObject { get; }
public static Task<Actor> Construct(string pathToGlb);
public void Destroy();
}
Metadata
public class Metadata
{
public Guid GuidDefinition { get; }
public Guid GuidInstance { get; set; }
public string NameDefinition { get; }
public string NameInstance { get; set; }
public Type TypeDefinition { get; }
public Type TypeInstance { get; set; }
public static Task<Metadata> Construct(string pathToMetadata);
public void Destroy();
}
Preview
public class Preview
{
public Texture2D Texture { get; }
public static Task<Preview> Construct(string pathToImage);
public void Destroy();
}
๐น Traits System
Trait (base class)
public abstract class Trait
{
public string Name { get; protected set; }
public Asset Asset { get; internal set; }
public virtual void Initialize(Asset asset);
public virtual void Deinitialize();
}
TraitPosition3d
public class TraitPosition3d : Trait
{
public Vector3 Value { get; }
public Vector3 GetValue();
public void SetValue(Vector3 position);
}
TraitRotation3d
public class TraitRotation3d : Trait
{
public Vector3 Value { get; }
public Vector3 GetValue();
public void SetValue(Vector3 rotation);
}
TraitScale3d
public class TraitScale3d : Trait
{
public Vector3 GetValue();
public void SetValue(Vector3 scale);
public void SetValue(float uniformScale);
}
TraitAnimatable
public class TraitAnimatable : Trait
{
public event Action<string> OnAnimationStart;
public event Action<string> OnAnimationComplete;
public ReadOnlyCollection<string> AvailableAnimations { get; }
public void PlayAnimation(string name, bool loop = false);
public void StopAnimation(string name);
public void StopAllAnimations();
public bool IsPlaying(string name);
}
TraitInteractable
public class TraitInteractable : Trait
{
public event Action<InteractionEventArgs> OnClicked;
public event Action<InteractionEventArgs> OnHoverEnter;
public event Action<InteractionEventArgs> OnHoverExit;
public bool IsHovered { get; }
public void EnableInteraction(bool enable);
}
๐น Scripting API (MiniScript Runtime)
Script
public class Script
{
public Guid Guid { get; set; }
public string Name { get; set; }
public bool Enabled { get; set; }
public ScriptTriggerType TriggerType { get; set; }
public string CustomEventName { get; set; }
public string ScriptContent { get; set; }
}
public enum ScriptExecutionMode
{
EditorOnly = 0,
RuntimeOnly = 1,
Both = 2
}
UrtScriptEngine
public class UrtScriptEngine
{
public event Action<Guid, bool, string> OnScriptCompleted;
public event Action<Guid, string> OnScriptOutput;
public UrtScriptEngine(Asset asset);
public bool ExecuteScript(Script script);
public void ExecuteScriptsByTrigger(List<Script> scripts, ScriptTriggerType triggerType);
public void ExecuteScriptsByCustomEvent(List<Script> scripts, string eventName);
public void StopAllScripts();
}
๐น Utilities
AssetFinder
public static class AssetFinder
{
public static Task<string> Find(Guid guid);
public static bool IsValid(string path);
}
Decrypt
public static class Decrypt
{
public static Task<string> Extract(string pathToAsset);
}
JsonUtil
public static class JsonUtil
{
public static string ToJson(object obj);
public static T FromJson<T>(string json);
public static void FromJson(string json, object target);
}