modify codes.

This commit is contained in:
hecomi
2016-11-15 02:29:38 +09:00
parent 0a39e37659
commit f8d8e64e46
4 changed files with 37 additions and 28 deletions
@@ -193,8 +193,9 @@ public class Manager : MonoBehaviour
for (int i = 0; i < monitorCount; ++i) {
if (i == monitors.Count) {
monitors.Add(new Monitor(i));
} else {
monitors[i].Reinitialize();
}
monitors[i].Reinitialize();
}
}
@@ -203,7 +203,7 @@ public class Monitor
set;
}
private Texture2D errorTexture_;
private static Texture2D errorTexture;
private static readonly string errorTexturePath = "uDesktopDuplication/Textures/NotAvailable";
private Texture2D texture_;
@@ -212,8 +212,8 @@ public class Monitor
get
{
if (!available) {
return errorTexture_ ??
(errorTexture_ = Resources.Load<Texture2D>(errorTexturePath));
return errorTexture ??
(errorTexture = Resources.Load<Texture2D>(errorTexturePath));
}
if (texture_ == null) {
CreateTexture();
@@ -245,11 +245,8 @@ public class Monitor
if (texture_) {
if (texture_.width != w || texture_.height != h) {
if (texture_) {
Object.Destroy(texture_);
texture_ = null;
}
shouldCreate = true;
Object.DestroyImmediate(texture_);
texture_ = null;
} else {
shouldCreate = false;
}