+2
Cannot Reproduce

Prefabs Lose Variables / Macro Reference

Xefier Games 4 months ago • updated by laalami 1 month ago 19 1 duplicate

Bolt 1.4.1

Unity 2018.3.6f1

No matter how many times I revert the nested prefab it always resets the State Machine and Variables components to default settings making it unusable.

Bolt Version:
1.4.1
Unity Version:
2018.3.6f1
.NET Version:
4.7.03190

Duplicates 1

Under Review

Hi Xefier,

Is there any chance this is on a prefab that was created in a version of Unity before nested prefabs? If so, you would need to Reimport the prefab asset to fix the issue (see this section of the Known Issues).

This Unity Project was started in 2018.3

Something is very wrong in 2018.3, I had been working on a Macro half a day and there's nothing in the Macro at all now.

The project was started in 2018.3

Exacly same issue on our end but it's not happend only for prefabs but also for regular gameobjects. I just close and open scene and macro just gone from state/flow machine .... 

I had a Windows Update just before this happened and they've caused instability issues with Unity before, does this sound relevant to anyone else?

Other than that nothing has been updated, ported etc.

Upon further inspection, the problem might be unrelated to git. Object variables simply won't be applied to instances. Neither will the assigned flow or state macros.

This sounds very similar to the issues I'm experiencing. +1 to this.

Under Review

Hi Syver,

Can you post some simple reproduction steps to recreate the issue?

Hi everyone!

As always, clear repro steps is the only way I can track & fix this bug.

What exactly is resetting? How did you configure the prefabs and the variables? 

Please give a step-by-step list of instructions to trigger the bug from a blank scene/project.

Hi,

I encountered the same issue. I try to describe how it happened.

1.) Made a GameObject and put prefab children inside it in the scene. (Parent object "BrickSpawnMachine" has no flow machine on it)

2.) Pulled parent object from scene in prefab folder. 

3.) Then deleted GameObject from 1.) from scene

4.) Pulled it later back from my prefab folder.

5.) Variables and Macros from the child prefabs (BrickSpawner) are missing

The child prefab itself (BrickSpawner) is still alright on itself. But the variables and macros ont BrickSpawner prefabs inside the BrickSpawnMachine prefab are gone.

+1

Hi Limpertus,

I tried reproducing your exact example, but variables seem to persist at every step of the way. Here's a video of it, tell me if I did anything wrong:


Ok, looking at your video, I found out that I forgot one important detail. I captured a video too, so you can see my workflow (may be better than writing too much text). Hopefully it isn't a Bolt problem, but only me being too stupid too understand the new nested prefab workflow correctly :D

I see, so from what I understand, the data loss occurs when you apply all prefab overrides on the parent prefab. I'll try reproducing this on the most recent Unity version (2018.3.14) and let you know what I find.

Cannot Reproduce

Alright, so I tried reproducing this but I don't see a data loss still.

Unity: 2018.3.14f1

Bolt: 1.4.2

Steps:

  1. Create empty "Child" game object
  2. Add test variable
  3. Turn Child into prefab
  4. Remove Child instance from scene
  5. Create empty "Parent" game object
  6. Add new Child prefab instance as child
  7. Duplicate a few times
  8. Turn Parent into a prefab
  9. Delete Parent instance from scene
  10. Spawn new Parent instance from prefab
  11. Add new object variable to one of the Child instances of Parent instance
  12. Apply all overrides via Parent inspector
  13. Delete Parent instance from scene
  14. Spawn new Parent instance from prefab

At this point in your video, there would be a data loss. In my attempt, there was none. 

Video of my reproduction: https://streamable.com/bvp9s

If you can provide precise steps that reproduce your issue on the latest Unity+Bolt version in a clean project, please post them. For now, I'll have to mark this as Cannot Reproduce again.

While slightly different, I think mine is a related issue, but in 2018.3.7f (1.4.2 net4) creating a variant prefab would have the variant lose Object Variables and the State Machine reference, no matter how many time you apply/revert changes.

Updating to 2018.3.12f1 seems to have fixed it, putting down repro steps in case it helps.

1. Make Cube Gameobject. Attach Flow/State Machine. Set an Object variable test = 10
2. Drag in to Project to make Prefab
3. Change value of test to 200 or something
4. Drag in to Project and make it a Variant Prefab.
5. (I forget if you need to instantiate a new Variant or if it affects the current one in the scene)
6. Check Variant. All object variables are missing. Flow Macro reference may be missing, or the component may be empty altogether.

Hi AiSard, 

If your issue was resolved by updating Unity, I'll assume it's an internal prefab bug that they addressed and won't pursue reproducing it any further.

Our team all the time have a problem with missing reference to macro or missing variables.  

1.I make a playtest in editor  and everything working
2.I generate a build for my team members
3.Got message that some part is not working
4.Open scene and I see that bolt  unlink macro from flow/state machine ....


This issue happend radomly for example few builds in row will work but in next one it will unlink macro. I also add that object which one got unlinked macro is not a prefab.

I can also point that we  open a same scene in same time and version and for example all macros on my end are fine but on his end  some of them are unlinked

Ok Today I  was able to reproduce that in other way : 

1. Enter play mode 
2. Attach debuger 
3. When unity  back to life after attaching debuger I got console error from one of object that have a state machine attached ( I will put stacktrace at the end )
4. I dont stop a play mode and just take a look on gameobject but it still have a macro on state machine
5. But when I just stop a play mode macro just gone.



Here is a stack trace :

Failed to deserialize behaviour.
System.Runtime.Serialization.SerializationException: Deserialization into 'Bolt.StateMachine' failed. ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentNullException: Value cannot be null.

Parameter name: instance

at Ludiq.EnsureThat.IsNotNull[T] (T value) [0x00010] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Ensure\EnsureThat.Objects.cs:29

at Ludiq.GraphInstances.Instantiate (Ludiq.GraphReference instance) [0x00010] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\GraphInstances.cs:20

at Ludiq.Machine`2[TGraph,TMacro].InstantiateNest () [0x00008] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\Machines\Machine.cs:169

at Ludiq.GraphNest`2[TGraph,TMacro].AfterGraphChange () [0x0001e] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\GraphNest.cs:170

at Ludiq.GraphNest`2[TGraph,TMacro].set_macro (TMacro value) [0x00026] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Graphs\Runtime\GraphNest.cs:57

at Ludiq.InstancePropertyAccessor`2[TTarget,TProperty].SetValueUnsafe (System.Object target, System.Object value) [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Reflection\Optimization\InstancePropertyAccessor.cs:144

at Ludiq.InstancePropertyAccessor`2[TTarget,TProperty].SetValue (System.Object target, System.Object value) [0x000b2] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Reflection\Optimization\InstancePropertyAccessor.cs:125

--- End of inner exception stack trace ---

at Ludiq.InstancePropertyAccessor`2[TTarget,TProperty].SetValue (System.Object target, System.Object value) [0x000c0] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Reflection\Optimization\InstancePropertyAccessor.cs:133

at Ludiq.OptimizedReflection.SetValueOptimized (System.Reflection.PropertyInfo propertyInfo, System.Object target, System.Object value) [0x00000] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Reflection\Optimization\OptimizedReflection.cs:196

at Ludiq.FullSerializer.fsMetaProperty.Write (System.Object context, System.Object value) [0x00052] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\Reflection\fsMetaProperty.cs:130

at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x000b3] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsReflectedConverter.cs:105

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001a] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:899

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:889

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0015c] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:864

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0011c] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:768

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00049] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:713

at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:666

at Ludiq.FullSerializer.fsReflectedConverter.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Object& instance, System.Type storageType) [0x00082] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\Converters\fsReflectedConverter.cs:97

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_5_Converter (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x0001a] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:899

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_4_Cycles (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type resultType, System.Object& result) [0x00032] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:889

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_3_Inheritance (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0015c] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:864

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_2_Version (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x0011c] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:768

at Ludiq.FullSerializer.fsSerializer.InternalDeserialize_1_CycleReference (System.Type overrideConverterType, Ludiq.FullSerializer.fsData data, System.Type storageType, System.Object& result, System.Collections.Generic.List`1[Ludiq.FullSerializer.fsObjectProcessor]& processors) [0x00049] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:713

at Ludiq.FullSerializer.fsSerializer.TryDeserialize (Ludiq.FullSerializer.fsData data, System.Type storageType, System.Type overrideConverterType, System.Object& result) [0x0003d] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Dependencies\FullSerializer\fsSerializer.cs:666

at Ludiq.Serialization.DeserializeJson (Ludiq.FullSerializer.fsSerializer serializer, System.String json, System.Object& instance, System.Boolean forceReflected) [0x00015] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Serialization\Serialization.cs:171

at Ludiq.Serialization.DeserializeInto (Ludiq.SerializationData data, System.Object& instance, System.Boolean forceReflected) [0x0002e] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Serialization\Serialization.cs:113

--- End of inner exception stack trace ---

at Ludiq.Serialization.DeserializeInto (Ludiq.SerializationData data, System.Object& instance, System.Boolean forceReflected) [0x0007f] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Serialization\Serialization.cs:127

at Ludiq.LudiqBehaviour.UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize () [0x00010] in C:\Users\lazlo\Projects\Bolt1\Package\Ludiq.Core\Runtime\Unity\LudiqBehaviour.cs:46
UnityEngine.Debug:LogError(Object, Object)
Ludiq.LudiqBehaviour:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() (at C:/Users/lazlo/Projects/Bolt1/Package/Ludiq.Core/Runtime/Unity/LudiqBehaviour.cs:52)


Hi Lazlo,

Got an issue with prefabs losing data as well (2018.3.5f1 and bolt 1.4.1) but with prefab variant specifically.

Reprosteps:
1/ Create a new prefab
2/ Add a flow machine from a macro and fill some variables
3/ Create a prefab variant
4/ Open the prefab variant in prefab mode and change the variables values
5/ Save changes in prefab variant

Current behavior:

The variables and macro are removed from the prefab variant.

Expected behavior:

Variables and macro should be saved in the prefab variant.

Data and flow machine are missing from the instantiated prefab variant in Play mode.
When in PrefabMode, variables and flow machine are missing in the variants. Reverting component to the prefab variant is not saved (see video and yes I save the prefab before switching ;)

BoltPrefabVariant.mp4

I tried changing non-bolt component (Tint on the sprite renderer) and that works just fine :(

Let me know if you can't reproduce this one and I will try to reproduce it in a new project.
Project was started in 2018.2 but has been running with 2018.3 since November.

UPDATE: I copied my project in a different folder and updated it to 1.4.3 and the issue still occurs. I also made sure I was working from a newly created prefab and updated the reprosteps above.

WORKAROUND: I use regular prefabs instead of prefab variant for now but I planned to use that for 100+ abilities and I will need prefab variant at some point.