+4
Fixed

Issues with SceneVariables singleton

Lazlo Bonin (Lead Developer) 3 years ago updated 2 years ago 36 2 duplicates

The 1.2.2 updated introduced Isolated scene variables, which allowed for a finer control over scoping for advanced uses: each set of scene variables now belongs to its scene, and doesn't get merged with others when additive scene loading is used.

This required a new "scene singleton" system. Unfortunately, it wasn't tested thoroughly enough and some users are experiencing issues:

  • Multiple 'Bolt.SceneVariables' singleton in scene '{Scene Name}'
  • Trying to destroy invalid instance of 'Bolt.SceneVariables' singleton in scene '{Scene Name}'
  • 'Player' variable not found from the HUD scene in the tutorial, because it should now be replaced with an Application variable instead of a Scene variable.

Fortunately, this should be an easy issue to fix once it can be reproduced, and it should incur no data loss in your projects.

Once a fix is issued, the only step you will have to take is to delete all the empty Scene Variables in your scenes.

Bolt Version:
Unity Version:
Platform(s):
Scripting Backend:
.NET Version (API Compatibility Level):

Duplicates 2

I have a similar problem

+2
Pending Review

Argh, sorry everyone, this seems like a regression introduced by isolating scene variables in v.1.2.2.

I'll try to get it fixed ASAP.

In the mean time, you can try disabling "Create Scene Variables" in the Bolt editor preferences (at the very bottom). Haven't tested yet, but I think it might fix it in the mean time.

Can I get a refund, or do I just dispute the transaction on my card?

Hi Vinilly, 

You can ask for a refund in a private support ticket, however this issue is already fixed in the alpha builds available here: http://ludiq.io/bolt/builds. It should be in the official version in January when I come back from Holidays.

on  1.2.2   ,unity  2017.2

I meet the same problem When I learning the Bolt Platform Tutorial 

on  Unity 2017.2.of3 Personal  and Bolt 1.22 

Bolt will automatically create one scene variable in a scene,I can't delete it.

+1
Pending Review

Hi Fox Kin,

Yes, this is a regression introduced in v.1.2.2, sorry about that. I'm quite sick with the flu at the moment but I'll get to fixing it ASAP when I get better.

Can you try disabling "Create Scene Variables" in the Bolt editor preferences (at the very bottom) and see if it helps? Haven't tested yet, but I think it might fix it in the mean time.

if  I disabling "Create Scene Variables" ,the will be same error 

so,I  think  I should wait  for your fixing。

I sincerely hope you will soon get well

I get similar errors. I tried disabling Create Scene Variables but it didn't help.

Is there a temporary work around?

On Start

UnityException: Trying to destroy invalid instance of 'Bolt.SceneVariables' singleton in scene ''.
Ludiq.SceneSingleton`1[Bolt.SceneVariables].OnDestroy (Bolt.SceneVariables instance) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Unity/SceneSingleton.cs:170)
Bolt.SceneVariables.OnDestroy ()

On Stop

ArgumentException: An element with the same key already exists in the dictionary.
System.Collections.Generic.Dictionary`2[UnityEngine.SceneManagement.Scene,Bolt.SceneVariables].Add (Scene key, Bolt.SceneVariables value) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Collections.Generic/Dictionary.cs:404)
Ludiq.SceneSingleton`1[Bolt.SceneVariables].Instantiate (Scene scene) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Unity/SceneSingleton.cs:109)
Ludiq.SceneSingleton`1[Bolt.SceneVariables].InstanceIn (Scene scene) (at C:/Users/Lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Unity/SceneSingleton.cs:63)
Bolt.SceneVariables.Instance (Scene scene)
Bolt.SceneVariables.For (Scene scene)
Bolt.Variables.Scene (Scene scene)
Bolt.GetVariable.Get (Ludiq.Recursion recursion)
Bolt.Unit+<>c__DisplayClass56_0`1[System.Object].<ValueOutput>b__0 (Ludiq.Recursion recursion)
Bolt.ValueOutput.GetValue (Ludiq.Recursion recursion)


Hi,

Also have the same problem with any project I try to use Bolt. Hope you get well soon! :)

Any other tips as a temporary remedy? My project is completely unusable until this fix is released.  :(

Brian have you downloaded the Alfa build from the forum, it fixes the issue?

Just tried. I'm getting the following error after entering my invoice number:

Internal Server Error

Property "Craft\AssetStore_InvoiceModel.package" is not defined.

To clarify, that's an error with the downloading mechanism.  Just to be clear.

Ok. Please post that error in a separate post in the Bug forum pls. I'm sure Lazlo will want to know. Not sure if it's just you or something else.

The internal server error should be fixed now!

Its also a bug in Version 1.2.1. I was running 1.2.2 that made me find another bug. and told to go one version back. Being I am learning I think I may try alpha build if this is better moving forward but please fix these bugs soon.

Yours, Wayne.

And... Just try the current alpha version - same problems. So all system to a stop until this is fix :( sad face.

Hmm... Are you sure your binaries are being replaced?  The Scene Singleton wasn't introduced until 1.2.2, so it should be impossible to get this error in 1.2.1.  Given that it happened to you in 1.2.3a3 (where it is supposed to be fixed, I can't say if it is, I get other problems in that build) and 1.2.1 (where it should be impossible), are you sure the version actually changed?


Regardless, Lazlo will be back from holiday/vacation on Monday.  I too am looking forward to this being resolved :-D

Ok. Tonight I will delete the whole folder and re-install into Unity.

This is NOT FIXED as of 1.2.3 Beta 1.

What I tried:

- turn off "Create Scene Variables" on the User Prefrences

- deleted the "Scene Variables" object (which is re-created after pressing Play)

[Edit 1]

I did not successfully turn off "Create Scene Variable" as my game creates these scene variables dynamically. It checks for the existence of the scene variable..and creates a new one if one does not already exist.

I still get the error


This is pretty serious as there seems to be no clean way of creating Scene Variables, I currently move all my variables to Application level just to get rid of the error. THIS IS NOT GOOD.


Hello Lazlo,

I think I'm having the same problem here. I'm using the 1.2.2 build, and have just completed the Platformer tutorial up to where colliding with the enemy deals damage to the player. I'm getting these unity exceptions:


Disabling "Create Scene Variables" did fix the issue for me. I just wanted to double check that this is the correct work around to use for now, and to ask if this setting will still need to be disabled (if not done so automatically) in 1.2.3.

Thanks, Dan

Fixed

Hi Daniel,

The issue is fixed in the official stable version (v.1.2.3). You can just update and leave this setting checked now.

Hello Lazlo,

I bough version 1.3.1 of Bolt and this problem is still happening.


UnityException: More than one 'Bolt.SceneVariables' singleton in scene 'Race'.
Ludiq.SceneSingleton`1[Bolt.SceneVariables].Awake (Bolt.SceneVariables instance) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Unity/SceneSingleton.cs:171)
Bolt.SceneVariables.Awake ()

I have a single variable there:


Is there any other report on this issue after version 1.2.3 fix? Are there any impact on the game ? So far I haven't observed any negative issue besides the exception itself. Everything work as expected.

Best regards and I love this product by the way!

Thanks, Iskander

Hi Iskander! I think I found the final cause of this error and I have re-re-re-fixed it for v.1.4 (currently in Alpha). I don't recommend updating to the alpha on a production project at the moment, but yes, currently, it is a harmless error and shouldn't impact your game.

Having the same issue and it appears to trigger Events like On Enter twice according to Debug Log.

+1

It is nice to know! Thanks

I'm a long time hardcore software developer and I'm enjoying visual development with Bolt like a kid. Good job with this piece of art!

Best regards, Iskander

I'm suddenly getting the same error now.


UnityException: More than one 'Bolt.SceneVariables' singleton in scene 'GameScene'.
Ludiq.SceneSingleton`1[Bolt.SceneVariables].Awake (Bolt.SceneVariables instance) (at C:/Users/lazlo/Projects/Ludiq/Ludiq.Core/Runtime/Unity/SceneSingleton.cs:171)
Bolt.SceneVariables.Awake ()

Is there a workaround yet?

It will be fixed in v.1.4 (currently in Alpha only).