Fix ColorSelector reset
This commit is contained in:
@@ -27574,7 +27574,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1591058970}
|
||||
m_Enabled: 0
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 01614664b831546d2ae94a42149d80ac, type: 3}
|
||||
m_Name:
|
||||
@@ -27635,7 +27635,7 @@ MonoBehaviour:
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1591058970}
|
||||
m_Enabled: 1
|
||||
m_Enabled: 0
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 2518c50cb3fc6a6458d4b743c2f69c7d, type: 3}
|
||||
m_Name:
|
||||
|
||||
@@ -15,7 +15,7 @@ public class StateManager : MonoBehaviour
|
||||
//root GO = goot
|
||||
foreach (var goot in SceneManager.GetActiveScene().GetRootGameObjects())
|
||||
{
|
||||
Resettables.AddRange(goot.GetComponentsInChildren<IResettable>());
|
||||
Resettables.AddRange(goot.GetComponentsInChildren<IResettable>(true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -29,18 +29,16 @@ public class ColorSelector : MonoBehaviour, IResettable
|
||||
{
|
||||
Vector3 off = i * offset;
|
||||
GameObject go = Spawn.GO(prefab, transform, off, "ColorButton_" + color);
|
||||
buttons.Add(go);
|
||||
go.GetComponent<UnityEngine.UI.Image>().color = color;
|
||||
go.GetOrAddComponent<ColorSelectorButton>().PortIndex = portIndex;
|
||||
go.SetActive(true);
|
||||
go.SetActive(true);
|
||||
buttons.Add(go);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetThis()
|
||||
{
|
||||
Parent.SetActive(false);
|
||||
|
||||
Debug.Log($"Destroying Old Color Buttons: {buttons.Count}");
|
||||
foreach (var go in buttons)
|
||||
{
|
||||
@@ -51,5 +49,6 @@ public class ColorSelector : MonoBehaviour, IResettable
|
||||
Destroy(go);
|
||||
}
|
||||
buttons.Clear();
|
||||
Parent.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user