modify component requirements.
This commit is contained in:
@@ -5,8 +5,7 @@ using System.Collections.Generic;
|
|||||||
namespace uDesktopDuplication
|
namespace uDesktopDuplication
|
||||||
{
|
{
|
||||||
|
|
||||||
[AddComponentMenu("uDesktopDuplication/Cursor"),
|
[AddComponentMenu("uDesktopDuplication/Cursor"), RequireComponent(typeof(Texture))]
|
||||||
RequireComponent(typeof(Texture))]
|
|
||||||
public class Cursor : MonoBehaviour
|
public class Cursor : MonoBehaviour
|
||||||
{
|
{
|
||||||
[SerializeField] Vector2 modelScale = Vector2.one;
|
[SerializeField] Vector2 modelScale = Vector2.one;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
namespace uDesktopDuplication
|
namespace uDesktopDuplication
|
||||||
{
|
{
|
||||||
|
|
||||||
[AddComponentMenu("uDesktopDuplication/Texture")]
|
[AddComponentMenu("uDesktopDuplication/Texture"), RequireComponent(typeof(Cursor))]
|
||||||
public class Texture : MonoBehaviour
|
public class Texture : MonoBehaviour
|
||||||
{
|
{
|
||||||
private Monitor monitor_;
|
private Monitor monitor_;
|
||||||
@@ -105,10 +105,7 @@ public class Texture : MonoBehaviour
|
|||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
if (!GetComponent<Cursor>())
|
AddCursorIfNotAttached();
|
||||||
{
|
|
||||||
gameObject.AddComponent<Cursor>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnEnable()
|
void OnEnable()
|
||||||
@@ -130,6 +127,14 @@ public class Texture : MonoBehaviour
|
|||||||
UpdateMaterial();
|
UpdateMaterial();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AddCursorIfNotAttached()
|
||||||
|
{
|
||||||
|
if (!GetComponent<Cursor>())
|
||||||
|
{
|
||||||
|
gameObject.AddComponent<Cursor>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Reinitialize()
|
void Reinitialize()
|
||||||
{
|
{
|
||||||
// Monitor instance is released here when initialized.
|
// Monitor instance is released here when initialized.
|
||||||
|
|||||||
Reference in New Issue
Block a user