A component that manages the visibility state of a game object. It hides the object if it is a proxy, or shows it unless the game is running in VR.
using Sandbox;
public sealed class Scope : Component
{
protected override void OnStart()
{
if ( IsProxy )
{
Hide();
}
}
public void Show()
{
if ( !IsProxy && Game.IsRunningInVR)
{
GameObject.Enabled = true;
}
}
public void Hide()
{
GameObject.Enabled = false;
}
}