Starting at scene via HTML Variable

I have a large document and I would like to be able to start this document at different scenes on different HTML pages.

Is it possible to have a variable of some sort on the HTML page that equals the desired scene in the document. Then on document load, it checks the variable and changes to it using a modified version of this code:

Var = 'Second_Scene'



Thanks for the suggestion! I didn’t really want it to be a URL but it sent me into the right direction.

I’ve kinda figured it out, but i’m having a little trouble, here’s what I’ve done so far:

First scene - onSceneLoad:JS:

if (count == 0) {
} else {
count = 1;

Then in my HTML i have:

scene_name = 'Menu';
count = '0';

This should ensure that the scene change only happens when the page first loads. However, whenever I go to the first scene, the onSceneLoad still occurs, and the scene transition happens. Any ideas?


I’ve fixed the problem by doing this:

if (count == 0) {
        count = 1;

But I don’t know why it works. I’m always interested in learning, and if you could explain I would really appreciate it!


Here if count == 0 , then it will always equal 0 and never get to the second part ( else ) which set the count to 1.

Look at it this way.

what you had was.
if count Of First Run is false then do some stuff and don’t set count Of First Run to true because it’s false and we will always leave it as false…

What you now have correctly is:

if countOfFirstRun is false then do some stuff and set countOfFirstRun to true so we can skip doing this stuff again on the next run

1 Like

Yes I see now, very silly of me. I placed the count = 0 in the HTML JS to make it external / global. Is that the right thing to do?

A global var can be placed in a number of areas but this does not mean they will be seen in time or by the correct scope.
It is always easier to answer questions if we have a working example so we can be more specific