# Can't get scene manager to work

**URL:** <https://discourse.processing.org/t/cant-get-scene-manager-to-work/22195>\
**Category:** Libraries\
**Created:** [June 27, 2020, 1:15am UTC](https://discourse.processing.org/t/cant-get-scene-manager-to-work/22195 "2020-06-27T01:15:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![olorin](https://avatars.discourse-cdn.com/v4/letter/o/f17d59/32.png) [@olorin](https://discourse.processing.org/u/olorin)\
**Post date:** [June 27, 2020, 1:15am UTC](https://discourse.processing.org/t/cant-get-scene-manager-to-work/22195/1 "2020-06-27T01:15:31Z")

</div>

I cant seem to get this sketch to display anything. when I remove the this.setup and this.draw functions an image appears but i need it to loop as it does in draw. I’m using scene manager

```auto
var pages;
let gui;
let afterFive;
let afterNoon;
let beforeFive

function setup() {
createCanvas(400, 800);
pages = new SceneManager();
gui = createGui();
pages.addScene(Page1);
pages.addScene(Page2);
pages.addScene(Page3);
pages.addScene(Page4);
pages.addScene(Page5);

}

function draw() {
pages.draw();
}

function Page1() {

this.setup = function() {
gui.setTextSize(40);
beforeFive = createButton(“before 5 am”, 75, 250, 250, 60);
afterFive = createButton(“After 5 am”, 75, 380, 250, 60);
afterNoon = createButton(“After 12 pm”, 75, 510, 250, 60);
}
this.draw = function() {
background(220);
drawGui();
textSize(25);
text(‘What time do you plan on ariving?’, 12, 100, 390, 400);
if (afterFive.isPressed) {
print(afterFive.label + " is pressed.");
}
}
}

function Page2() {

}

function Page3() {

}

function Page4() {

}

function Page5() {

}

```

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [June 27, 2020, 10:10pm UTC](https://discourse.processing.org/t/cant-get-scene-manager-to-work/22195/2 "2020-06-27T22:10:24Z")

</div>

Hi,

Welcome to the community! 😉

First of all, you can format your code (to have correct indentations) by using Ctrl+T in the Processing IDE.

Then do you have a function called `createGui()` and `drawGui()` ? Because I can’t see it in your program.

I think that the solution might be that you need to write :

```auto
// In the setup() function
pages.showScene(Page1);

```

in order to display your first scene.

> <https://github.com/mveteanu/p5.SceneManager/blob/8a0fdb638eef579fbd3b522615d48d1341a77288/lib/scenemanager.js#L111>

---

<div class="post-metadata">

**Author:** ![olorin](https://avatars.discourse-cdn.com/v4/letter/o/f17d59/32.png) [@olorin](https://discourse.processing.org/u/olorin)\
**Post date:** [June 28, 2020, 9:02pm UTC](https://discourse.processing.org/t/cant-get-scene-manager-to-work/22195/3 "2020-06-28T21:02:25Z")

</div>

That was it! Thank you so much 🙂 thank you for the kind introduction. I love this community. ☀
