public void ApplyTheme() { theme.ApplyTheme(); //find all objects with ThemeItem component Scene scene = SceneManager.GetActiveScene(); var root_objects = scene.GetRootGameObjects(); foreach (GameObject root in root_objects) { foreach (var themeItem in root.transform.GetComponentsInChildren <ThemeItem>(true)) { switch (themeItem.type) { case ITEMTYPE.IAP_PRODUCTID: #if UNITY_IOS themeItem.UpdateSelf(iOSProductID); #elif UNITY_ANDROID themeItem.UpdateSelf(androidProductID); #endif break; default: break; } #if UNITY_EDITOR EditorFix.SetObjectDirty(themeItem); #endif } } }
public override void OnInspectorGUI() { DrawDefaultInspector(); QuizzedTheme myScript = (QuizzedTheme)target; if (GUILayout.Button("Apply Theme")) { myScript.ApplyTheme(); } }