-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMeshRendererSwapper.cs
73 lines (68 loc) · 2.09 KB
/
MeshRendererSwapper.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
using UdonSharp;
using UnityEngine;
namespace UwUtils
{
[AddComponentMenu("UwUtils/MeshRendererSwapper")]
[UdonBehaviourSyncMode(BehaviourSyncMode.None)]
public class MeshRendererSwapper : UdonSharpBehaviour
{
[Header("Mesh Renderers Group 1 & 2")]
[SerializeField] private MeshRenderer[] RendererGroupOne;
[SerializeField] private MeshRenderer[] RendererGroupTwo;
[Header("Defaults")]
[SerializeField] private bool defaultsGroupOneOnPCVR = true;
[SerializeField] private bool defaultsGroupTwoOnQuest = true;
private bool isQuest = false;
private bool currentGroup = true;
void Start()
{
#if UNITY_ANDROID
isQuest = true;
#endif
if (!isQuest && currentGroup)
{
return;
}
if (defaultsGroupTwoOnQuest || currentGroup == false)
{
currentGroup = false;
_enableOne();
}
else return;
}
public void _switchGroup()
{
currentGroup = !currentGroup;
for (int i = 0; i < RendererGroupOne.Length; i++)
{
RendererGroupOne[i].enabled = !RendererGroupOne[i].enabled;
}
for (int i = 0; i < RendererGroupTwo.Length; i++)
{
RendererGroupTwo[i].enabled = !RendererGroupTwo[i].enabled;
}
}
public void _enableTwo()
{
for (int i = 0; i < RendererGroupOne.Length; i++)
{
RendererGroupOne[i].enabled = false;
}
for (int i = 0; i < RendererGroupTwo.Length; i++)
{
RendererGroupTwo[i].enabled = true;
}
}
public void _enableOne()
{
for (int i = 0; i < RendererGroupOne.Length; i++)
{
RendererGroupOne[i].enabled = true;
}
for (int i = 0; i < RendererGroupTwo.Length; i++)
{
RendererGroupTwo[i].enabled = false;
}
}
}
}