# One Scene multiple themes??

**URL:** <https://discussions.unity.com/t/one-scene-multiple-themes/642294>\
**Category:** Scripting\
**Tags:** Scripting\
**Created:** [October 7, 2016, 1:09pm UTC](https://discussions.unity.com/t/one-scene-multiple-themes/642294 "2016-10-07T13:09:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![harraj128](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@harraj128](https://discussions.unity.com/u/harraj128)\
**Post date:** [October 7, 2016, 1:09pm UTC](https://discussions.unity.com/t/one-scene-multiple-themes/642294/1 "2016-10-07T13:09:02Z")

</div>

How would I go about implementing a system in which I could change the theme of the game and the objects and background would change?? It is a endless runner meaning it uses just one scene for the game, and I feel creating a new scene would not be most efficient.

At the moment the standard objects are pooled and spawn on the game with the background set to the camera.

```csharp
using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class ObjectPooler : MonoBehaviour {

    public GameObject pooledObject;

    public int pooledAmount;

    List<GameObject> pooledObjects;

    // Use this for initialization
    void Start ()
    {
        pooledObjects = new List<GameObject>();

        for (int i = 0; i < pooledAmount; i++)
       
        {
            GameObject obj = Instantiate (pooledObject);
            obj.SetActive (false);
            pooledObjects.Add (obj);

        }
   
    }

    public GameObject GetPooledObject()
    {
        for (int i = 0; i < pooledObjects.Count; i++)
        {
            if (!pooledObjects [i].activeInHierarchy)
            {
                return pooledObjects[i];
            }
        }

        GameObject obj = Instantiate (pooledObject);
        obj.SetActive (false);
        pooledObjects.Add (obj);
        return obj;
    }

}

```

That is my Object Pooling Script but tbh I am unsure what I should do. I have read about XML Serialization but not really sure if that is what I would need!

Thanks,

Harraj

---

<div class="post-metadata">

**Author:** ![Zaflis](https://avatars.discourse-cdn.com/v4/letter/z/85e7bf/32.png) [@Zaflis](https://discussions.unity.com/u/Zaflis)\
**Post date:** [October 8, 2016, 2:00am UTC](https://discussions.unity.com/t/one-scene-multiple-themes/642294/2 "2016-10-08T02:00:13Z")

</div>

You didn’t give much details, but how about making prefabs of the themes? That’s a quick thing that i can think of that you can plan in advance and then instantiate when needed.

---

<div class="post-metadata">

**Author:** ![takatok](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/takatok/32/586449_2.png) [@takatok](https://discussions.unity.com/u/takatok)\
**Post date:** [October 8, 2016, 4:49am UTC](https://discussions.unity.com/t/one-scene-multiple-themes/642294/3 "2016-10-08T04:49:12Z")

</div>

Couldn’t you create a Theme class that had data about textures your using for your game:

```csharp
public class Theme
{
       Texture2D background;
       Texture2D[] platformTextures = Texture2d[10];
       AudioClip gbMusic;
        //etc
}

```

Then you could either load an array of these themes at game start up or (depending on memory requirements) load up a new theme after a set amount of time, staggering the load across multiple frames while the game was being played.

Then after the Theme was all loaded, you just set all the new textures to the various correct places, change your bg music, etc.

---

<div class="post-metadata">

**Author:** ![Kiwasi](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/kiwasi/32/351502_2.png) [@Kiwasi](https://discussions.unity.com/u/Kiwasi)\
**Post date:** [October 8, 2016, 7:01am UTC](https://discussions.unity.com/t/one-scene-multiple-themes/642294/4 "2016-10-08T07:01:36Z")

</div>

I would approach it a different way. Have your pool responsible for swapping out objects. So when it’s time to change theme your pool removes the old objects and puts in new ones.
