0
Fixed

2.0.0a8 InvalidCastException: Invalid variable binding

TowerCrow 2 months ago updated by Lazlo Bonin (Lead Developer) 1 month ago 2

When trying to run the game in Generated mode I get the following errors.

On Inventory Manager object which references Inventory and Equipment Panel component classes and also holds a reference to an Item Class asset. Inventory and Equipment Panel references are overrides.

InvalidCastException: Invalid variable binding: 2e715cd1-84bc-4c27-90aa-3ce969a5566d is a Ludiq.Bolt.ClassComponent, expected Ludiq.Bolt.Generated.Inventory.Inventory.
Ludiq.Bolt.GeneratedClass`1[TInstance].BindVariable[T] (System.String guid) (at Assets/Ludiq/Bolt.Core/Runtime/Generation/GeneratedClass.cs:50)
Ludiq.Bolt.Generated.Inventory.InventoryManager.Bind () (at Assets/Ludiq.Generated/Transient/Scripts/InventoryManager.cs:50)
Ludiq.Bolt.ClassHost.InstantiateGenerated (System.Func`2[T,TResult] instantiator) (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:383)
Ludiq.Bolt.ClassHost.InstantiateGenerated () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:414)
Ludiq.Bolt.ClassHost.Instantiate () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:246)
Ludiq.Bolt.ClassHost.Initialize () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:213)
Ludiq.Bolt.UnityClassHost.Awake () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/UnityClassHost.cs:12)
Ludiq.Bolt.ClassComponent.Awake () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassComponent.cs:70)

And on Inventory object which has override references for ItemSlot component class and Item Class asset as well:

InvalidCastException: Invalid variable binding: bfa5516f-8e88-4f0d-8961-5b37a6d548ef is a Ludiq.Bolt.ClassAsset, expected Ludiq.Bolt.Generated.Items.Item.
Ludiq.Bolt.GeneratedClass`1[TInstance].BindVariable[T] (System.String guid) (at Assets/Ludiq/Bolt.Core/Runtime/Generation/GeneratedClass.cs:50)
Ludiq.Bolt.Generated.Inventory.Inventory.Bind () (at Assets/Ludiq.Generated/Transient/Scripts/Inventory.cs:57)
Ludiq.Bolt.ClassHost.InstantiateGenerated (System.Func`2[T,TResult] instantiator) (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:383)
Ludiq.Bolt.ClassHost.InstantiateGenerated () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:414)
Ludiq.Bolt.ClassHost.Instantiate () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:246)
Ludiq.Bolt.ClassHost.Initialize () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassHost.cs:213)
Ludiq.Bolt.UnityClassHost.Awake () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/UnityClassHost.cs:12)
Ludiq.Bolt.ClassComponent.Awake () (at Assets/Ludiq/Bolt.Core/Runtime/Architecture/ClassComponent.cs:70)

Scripts for Inventory Manager and Inventory:

Inventory.cs

InventoryManager.cs

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