mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2024-12-18 20:05:52 +01:00
36 lines
646 B
C#
36 lines
646 B
C#
using UnityEngine;
|
|
|
|
namespace uWindowCapture
|
|
{
|
|
|
|
[RequireComponent(typeof(Renderer))]
|
|
public class UwcCursorTexture : MonoBehaviour
|
|
{
|
|
Renderer renderer_;
|
|
Material material_;
|
|
|
|
UwcCursor cursor
|
|
{
|
|
get { return UwcManager.cursor; }
|
|
}
|
|
|
|
void Awake()
|
|
{
|
|
renderer_ = GetComponent<Renderer>();
|
|
material_ = renderer_.material; // clone
|
|
cursor.onTextureChanged.AddListener(OnTextureChanged);
|
|
}
|
|
|
|
void Update()
|
|
{
|
|
cursor.CreateTextureIfNeeded();
|
|
cursor.RequestCapture();
|
|
}
|
|
|
|
void OnTextureChanged()
|
|
{
|
|
material_.mainTexture = cursor.texture;
|
|
}
|
|
}
|
|
|
|
} |