Deleting special object at start of the scene

Hello, i have a question?

Can you make it so when your coming from a specific scene that you can delete an object in the scene you going to?

Thank you, Duck0

Hi Duck0,

You could use a CoSpace property to keep track of what scene you were on last: Something like this, and put the two “set CoSpace property” blocks at the start of every scene.

Cheers,
Stuart

1 Like

it works for 1 thing but i want it to work on more than 1 thing at a time zo can you make something with typescript?

Are you trying to test me? :rofl:
Scene 1:

let BookShelf = Scene.getItem(“EiE3tbXc”) as AnimatedItem

Space.setProperty (“LastScene”, Space.getProperty (“CurrentScene”));
Space.setProperty (“CurrentScene”, “Scene 1”);

if (Space.getProperty (“LastScene”) == “Scene 2”) {
BookShelf.delete();
}

Input.onKeyDown (function () {
Space.goToScene(1);
},‘space’)

Scene 2:

Space.setProperty (“LastScene”, Space.getProperty (“CurrentScene”));
Space.setProperty (“CurrentScene”, “Scene 2”);

Input.onKeyPressed (function () {
Space.goToScene(0);
},‘space’)

But it does the same thing. To delete more than item, just put the items into the if statement where I have put delete bookshelf. You can put as many as you like in there.

Cheers,
Stuart

1 Like

Just a note to say that every Scene has an index and a name, in Typescript, so you can reference that directly with Scene.index or Scene.name without the need for CoSpace Properties (though that’s a good solution too).

1 Like