Start(). If they are disabled, they will never register: Realtime will neither initialize them nor connect them to the datastore. Instead, you can use a custom RealtimeComponent to enable/disable child game objects, scripts, or renderers directly. No. Scene RealtimeViews register with Realtime in `Start()`. If they are disabled, they will never register: Realtime will neither initialize them nor connect them to the datastore.
Instead, you can use a custom RealtimeComponent to enable/disable child game objects, scripts, or renderers directly.isOwnedLocallyInHierarchyWhen there are two avatars in a room, your scripts that live on the avatar prefab are instantiated for each avatar (not just the local player). This means that your code will execute on local and remote avatars, once for every player in the scene. If you’d like logic to only apply to a single player, use RealtimeView’s `isOwnedLocallyInHierarchy` property.using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Normal.Realtime;
public class RequestOwnership : MonoBehaviour
{
private RealtimeView realtimeView;
private RealtimeTransform realtimeTransform;
void Start(){
Request();
}
// Update is called once per frame
void Awake(){
Request();
}
public void Request(){
realtimeView = GetComponent<RealtimeView>();
if (realtimeView != null) realtimeView.RequestOwnershipOfSelfAndChildren();
realtimeTransform = GetComponent<RealtimeTransform>();
if (realtimeTransform != null) realtimeTransform.RequestOwnership();
}
}