Files
cloud-mainworld/ufm cloud/Assets/#User/Community Modules/Scripts/ARS Plugin/VideoPlayer/GetVideoPlayerTextureUI.cs
T
wub f0ff43f54a CLUB
clib lights and arragement along with fixes for new networking
2026-10-26 18:17:30 +00:00

52 lines
1.3 KiB
C#

using SomniumSpace.Bridge.Components;
using UnityEngine;
using UnityEngine.UI;
using WebSocketSharp;
namespace UFMTESTING1
{
public class GetVideoPlayerTextureUI : MonoBehaviour
{
[SerializeField] private GameObject _videoPlayerObject;
[SerializeField] private RawImage _rawImage;
private SomniumVideoPlayer _videoPlayerRef;
private Texture _videoTexture = null;
// Start is called before the first frame update
void Start()
{
InvokeRepeating(nameof(GetTexture), 1.0f, 1.0f);
}
private void GetTexture()
{
if (_rawImage == null ||
_videoPlayerObject == null)
return;
if (_videoPlayerRef == null) // _videoPlayerObject
_videoPlayerRef = _videoPlayerObject.GetComponent<SomniumVideoPlayer>();
if (_videoTexture == null)
{
_videoTexture = _videoPlayerRef.GetTexture();
AssignTexture();
}
}
private void AssignTexture()
{
_rawImage.texture = _videoTexture;
}
private void OnValidate()
{
if(_rawImage == null)
{
_rawImage = GetComponent<RawImage>();
}
}
}
}