inkle / ink

inkle's open source scripting language for writing interactive narrative.
http://www.inklestudios.com/ink
MIT License
4.07k stars 489 forks source link

Dialogue restarts when scene changes!! #795

Closed Akua12 closed 2 years ago

Akua12 commented 2 years ago

Hello!

I m trying to make a VN through Unity and it was going well until I needed to change the background image. The background image DOES change using the tag, but it also resets the dialogue and I am not sure why. I am wondering if I even need to change scenes or if there is a way to just change the image that's already set in the MainScene. I am pretty new to Unity and coding in general, so if anyone is able to help it would be highly appreciated!

private void ChangeBackground()
    {
        if (_story.currentTags.Contains("bedroom"))
        {
            UnityEngine.SceneManagement.SceneManager.LoadScene("BedroomScene");
        }
        else
        {
            Debug.Log("Bedroom Scene is not showing!");
        }

    }
Selsynn commented 2 years ago

Hi, It's always nice to see some new person around.

You can swap image without changing the scene. You should have in your scene hierarchy the image itself. Instead of doing your scene change,

That should do and update your background image. You can have the same idea for loading anything else in your scene. For example, the expression, and the portrait of the characters.

I hope my wall of text didn't discourage you. It's a bit verbose, but it's an easy way, and I tried to explain what I was doing.

Akua12 commented 2 years ago

Thank you so much! I really appreciate that you explained each step too! It works now :D