My Convai NPC is not being destroyed when i unload the scene that it is in

Reply by newbietechbro | 2024-08-19 20:32:04

Attachments:

Reply by newbietechbro | 2024-08-19 20:34:10

if it is easier to hop on a call, let me know

Reply by k3kalinix | 2024-08-19 20:34:39

Could you please share your build settings window?

Reply by newbietechbro | 2024-08-19 20:35:19

Images:

Reply by newbietechbro | 2024-08-19 20:37:12

By the way, how this is structured is:

  1. Home Scene: user can click on camera button to go into MainScanner scene (loads main scanner scene)
  2. MainScanner: looks for tracked images, when a tracked image is detected, it will load an additive scene (CharacterTour or MainScene)
  3. Whenever a different tracked image is detected, the current additive scene will unload another additive scene will load

Reply by k3kalinix | 2024-08-19 20:43:55

  • Use Build Index
  • StartCoroutine (UnloadScene(index))

Attachments:

Reply by newbietechbro | 2024-08-19 20:47:36

So I need to use SceneManager.UnloadSceneAsync(currentAdditiveScene) and coroutine(unloadscene) ?

Reply by k3kalinix | 2024-08-19 20:47:47

No

Reply by k3kalinix | 2024-08-19 20:48:00

 private IEnumerator UnloadScene(int buildIndex)
    {
        Debug.Log("Unloading Scene: "+ buildIndex);
        yield return SceneManager.UnloadSceneAsync(buildIndex);
    }

Reply by k3kalinix | 2024-08-19 20:48:09

Just use call this.

Reply by k3kalinix | 2024-08-19 20:48:28

I can’t edit the code the way I want. There are too many comment lines.

Reply by newbietechbro | 2024-08-19 20:49:43

okay i will try

Reply by newbietechbro | 2024-08-19 20:50:53

So does this mean the NPC won’t be fully unloaded unless a coroutine is used?

Reply by k3kalinix | 2024-08-19 20:51:12

This is the ASYNC method so please use coroutine or ASYNC/Await

Replying to k3kalinix’s Message

Reply by k3kalinix | 2024-08-19 20:51:12
This is the ASYNC method so please use coroutine or ASYNC/Await

Reply by newbietechbro | 2024-08-19 20:53:13

are you referring to the unloadsceneasync?

Reply by newbietechbro | 2024-08-19 20:53:26

like either i use it with coroutine or await?

Reply by k3kalinix | 2024-08-19 20:54:09

Yes

Reply by newbietechbro | 2024-08-19 21:41:51

why did you disable the loadsceneasync aprts?

Reply by newbietechbro | 2024-08-19 21:41:54

parts*

Reply by newbietechbro | 2024-08-19 21:42:10

because I still need to load a new additive scene everytime a tracked image is detected