Files
webRtc/Packages/com.unity.renderstreaming@3.1.0-exp.9/Samples~/Example/Multiplay/FollowTransform.cs
2026-04-28 16:48:04 +08:00

22 lines
547 B
C#

using UnityEngine;
namespace Unity.RenderStreaming.Samples
{
class FollowTransform : MonoBehaviour
{
[SerializeField] Transform target;
[SerializeField] Vector3 offset;
[SerializeField] bool followPosition;
[SerializeField] bool followRotation;
private void Update()
{
if (followPosition)
transform.localPosition = target.localPosition + offset;
if (followRotation)
transform.localRotation = target.localRotation;
}
}
}