fix manager non-initialization bug.
This commit is contained in:
@@ -22,6 +22,7 @@ public class MultipleMonitorCreator : MonoBehaviour
|
|||||||
|
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
uDesktopDuplication.Manager.CreateInstance();
|
||||||
Create();
|
Create();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -68,6 +69,8 @@ public class MultipleMonitorCreator : MonoBehaviour
|
|||||||
{
|
{
|
||||||
ResetRemoveTimer();
|
ResetRemoveTimer();
|
||||||
|
|
||||||
|
Debug.Log(uDesktopDuplication.Manager.monitorCount);
|
||||||
|
|
||||||
// Create monitors
|
// Create monitors
|
||||||
for (int i = 0; i < uDesktopDuplication.Manager.monitorCount; ++i) {
|
for (int i = 0; i < uDesktopDuplication.Manager.monitorCount; ++i) {
|
||||||
// Create monitor obeject
|
// Create monitor obeject
|
||||||
|
|||||||
@@ -11,21 +11,7 @@ public class Manager : MonoBehaviour
|
|||||||
private static Manager instance_;
|
private static Manager instance_;
|
||||||
public static Manager instance
|
public static Manager instance
|
||||||
{
|
{
|
||||||
get
|
get { return CreateInstance(); }
|
||||||
{
|
|
||||||
if (instance_) {
|
|
||||||
return instance_;
|
|
||||||
}
|
|
||||||
|
|
||||||
var manager = FindObjectOfType<Manager>();
|
|
||||||
if (manager) {
|
|
||||||
manager.Awake();
|
|
||||||
return manager;
|
|
||||||
}
|
|
||||||
|
|
||||||
var go = new GameObject("uDesktopDuplicationManager");
|
|
||||||
return go.AddComponent<Manager>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<Monitor> monitors_ = new List<Monitor>();
|
private List<Monitor> monitors_ = new List<Monitor>();
|
||||||
@@ -63,6 +49,22 @@ public class Manager : MonoBehaviour
|
|||||||
public delegate void ReinitializeHandler();
|
public delegate void ReinitializeHandler();
|
||||||
public static event ReinitializeHandler onReinitialized;
|
public static event ReinitializeHandler onReinitialized;
|
||||||
|
|
||||||
|
public static Manager CreateInstance()
|
||||||
|
{
|
||||||
|
if (instance_) {
|
||||||
|
return instance_;
|
||||||
|
}
|
||||||
|
|
||||||
|
var manager = FindObjectOfType<Manager>();
|
||||||
|
if (manager) {
|
||||||
|
manager.Awake();
|
||||||
|
return manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
var go = new GameObject("uDesktopDuplicationManager");
|
||||||
|
return go.AddComponent<Manager>();
|
||||||
|
}
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
Lib.SetDebugMode(debugMode);
|
Lib.SetDebugMode(debugMode);
|
||||||
|
|||||||
Reference in New Issue
Block a user