LoadScene() error

Announcements, support questions, and discussion for Scene Streamer.
Post Reply
ilanbps
Posts: 2
Joined: Fri Jul 10, 2015 10:34 am

LoadScene() error

Post by ilanbps »

Hi,

I'v setup your project like your example and work fine :-)

Now I try to load scene by code but this not work, just SceneStreamer.SetCurrentScene("wld1lvl1sub1"); work's but it's not possible to used : SceneStreamer.IsSceneLoaded("wld1lvl1sub1");

Can you provide a simple example code to use this ?


Thanks
User avatar
Tony Li
Posts: 22083
Joined: Thu Jul 18, 2013 1:27 pm

Re: LoadScene() error

Post by Tony Li »

Hi,

Use SceneStreamer.LoadScene():

Code: Select all

SceneStreamer.LoadScene("wld1lvl1sub1");
The line above will load "wld1lvl1sub1" as the current scene. It will also load the correct number of neighbors (set this with SceneStreamer.maxNeighborDistance) and unload any neighbor scenes that are beyond maxNeighborDistance.
Last edited by Tony Li on Wed Jul 15, 2015 7:36 pm, edited 1 time in total.
Reason: Wrong method. It's LoadScene().
ilanbps
Posts: 2
Joined: Fri Jul 10, 2015 10:34 am

Re: LoadScene() error

Post by ilanbps »

Hi Toni,

thanks for reply, i tried your code but :

error CS0120: An object reference is required to access non-static member `PixelCrushers.SceneStreamer.SceneStreamer.LoadCurrentScene(string)'

LoadCurrentScene not exist in SceneStreamer.cs

Thanks
User avatar
Tony Li
Posts: 22083
Joined: Thu Jul 18, 2013 1:27 pm

Re: LoadScene() error

Post by Tony Li »

[EDIT: Sorry, I was going from memory. It's not

Code: Select all

FindObjectOfType<SceneStreamer>().LoadCurrentScene("wld1lvl1sub1"); //incorrect  
it's

Code: Select all

SceneStreamer.LoadScene("wld1lvl1sub1"); //correct  
Last edited by Tony Li on Wed Jul 15, 2015 7:37 pm, edited 1 time in total.
Post Reply