0
Will Not Fix

2.0.0a8 KeyNotFoundException: Could not find a local mapped to 'ItemSlot'.

Ex-Crow 2 years ago updated by Lazlo Bonin (Lead Developer) 2 years ago 1

The graph works as intended in Live mode but also throws this error when trying to cache the Item Slot which is a Class Component. Both the input and the output target port and the Assign Unit itself are of type Class Component. 

Graph: https://imgur.com/iZxUVvI

KeyNotFoundException: Could not find a local mapped to 'ItemSlot'.
Ludiq.Bolt.AliasedHandlePool`2[TAlias,THandle].Get (TAlias alias) (at Assets/Ludiq/Bolt.Core/Editor/Generation/AliasedHandlePool.cs:71)
Ludiq.Bolt.AliasedHandlePool`2[TAlias,THandle].get_Item (TAlias alias) (at Assets/Ludiq/Bolt.Core/Editor/Generation/AliasedHandlePool.cs:74)
Ludiq.Bolt.MethodBaseGeneration`1[TMethod].Local (System.Object alias) (at Assets/Ludiq/Bolt.Core/Editor/Generation/Generations/MethodBaseGeneration.cs:113)
Ludiq.Bolt.AssignGenerator.GenerateOutputExpression (Ludiq.Bolt.MethodGeneration method) (at Assets/Ludiq/Bolt.Flow/Editor/Units/Flow/AssignGenerator.cs:68)
Ludiq.Bolt.UnitGenerator`1[TUnit].GenerateValueOutputExpression (Ludiq.Bolt.MethodGeneration method, Ludiq.Bolt.ValueOutput valueOutput) (at Assets/Ludiq/Bolt.Flow/Editor/Units/UnitGenerator.cs:160)
Rethrow as CodeGenerationException: Failed to generate value output expression.
Rethrow as GraphPingException:
UnityEngine.Debug:LogException(Exception)
Ludiq.Bolt.CodeGenerationConsole:PingAndLogException(CodeGenerationException) (at Assets/Ludiq/Bolt.Core/Editor/Generation/CodeGenerationConsole.cs:176)
Ludiq.Bolt.CodeGenerationConsole:DrawEntry(Entry, Boolean) (at Assets/Ludiq/Bolt.Core/Editor/Generation/CodeGenerationConsole.cs:116)
Ludiq.Bolt.CodeGenerationConsole:OnGUI() (at Assets/Ludiq/Bolt.Core/Editor/Generation/CodeGenerationConsole.cs:30)
Ludiq.Bolt.CodePreviewWindow:_OnGUI() (at Assets/Ludiq/Bolt.Core/Editor/Generation/CodePreviewWindow.cs:294)
Ludiq.LudiqEditorWindow:OnGUI() (at Assets/Ludiq/Ludiq.Core/Editor/Windows/LudiqEditorWindow.cs:136)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr) (at C:/buildslave/unity/build/Modules/IMGUI/GUIUtility.cs:179)

Same issue if using a Class Variable:

The issue was resolved by using Get CachedSlot unit instead of wiring the value directly from Set CachedSlot or Assign units.

Bolt Version:
2.0.0a8
Unity Version:
2019.2.19
Platform(s):
PC
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2
Will Not Fix

Hi,

This is by design for the Assign unit, but since it got obsoleted in Alpha 9, I won't get into to much details. Basically it had inconsistent behaviour in codegen because the scope was more restrictive than in live runtime.