blob: bacb60a09808db952a01f87812d281dfdba2e6cc (
plain)
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
|
using UnityEngine;
public class ToggleUnparented : MonoBehaviour
{
private Unparent[] unparents;
private void Awake()
{
unparents = GetComponentsInChildren<Unparent>();
}
private void OnDisable()
{
for (int i = 0; i < unparents.Length; i++)
{
unparents[i].gameObject.SetActive(value: false);
}
GetComponent<Holding>().holdable.gameObject.SetActive(value: false);
}
private void OnEnable()
{
for (int i = 0; i < unparents.Length; i++)
{
unparents[i].gameObject.SetActive(value: true);
}
GetComponent<Holding>().holdable.gameObject.SetActive(value: false);
}
}
|