This website uses cookies to improve our services and deliver relevant ads.
By interacting with this site, you agree to this use. For more information, see our Cookies Policy
The Avatar Unity package contains several prefabs you can drop into your existing Unity projects. This tutorial shows you how to start using them.
The SDK is packaged in a .zip archive file on our developer website.
To set up, import the Oculus Unity packages into a project.
The LocalAvatar prefab renders the player's avatar and hands. Check box options in the Inspector let you choose which parts of the avatar you want to render: body, hands, and Touch controllers.
To render avatar hands with controllers:
Click Play to test. Experiment with the built-in hand poses and animations by playing with the Touch controllers.

Click Play to test. Note how the finger joints transform to change hand poses as you squeeze and release the grips and triggers on the Touch controllers. You might sometimes want to use hand poses outside of these movements and we talk more about this in Custom Grip Poses.


The avatar packet recording system saves avatar movement data as packets you can send across a network to play back on a remote system.
To see a demonstration, open the RemoteLoopback scene in OvrAvatar > Samples > RemoteLoopback.
Let us have a look at the RemoteLoopbackManager script.
Setting RecordPackets to true starts the avatar packet recording system. We also subscribe to the event handler PacketRecorded so that we can do something useful each time a packet is recorded.
void Start () {
LocalAvatar.RecordPackets = true;
LocalAvatar.PacketRecorded += OnLocalAvatarPacketRecorded;
}Each time a packet is recorded, our code places the packet into a memory stream we are using as a stand-in for a real network layer.
void OnLocalAvatarPacketRecorded(object sender, args)
{
using (MemoryStream outputStream = new MemoryStream())
{
BinaryWriter writer = new BinaryWriter(outputStream);
writer.Write(packetSequence++);
args.Packet.Write(outputStream);
SendPacketData(outputStream.ToArray());
}
}The remainder of our code receives the packet from the memory stream and plays it back on our loopback avatar object.
void SendPacketData(byte[] data)
{
ReceivePacketData(data);
}
void ReceivePacketData(byte[] data)
{
using (MemoryStream inputStream = new MemoryStream(data))
{
BinaryReader reader = new BinaryReader(inputStream);
int sequence = reader.ReadInt32();
OvrAvatarPacket packet = OvrAvatarPacket.Read(inputStream);
LoopbackAvatar.GetComponent<OvrAvatarRemoteDriver>().QueuePacket(sequence, packet);
}
}