0
Pending Review

Bolt 2a10 The name 'ToGenerated' does not exist in the current context

TowerCrow 1 month ago updated 2 days ago 3

Graph: https://imgur.com/RiQLZXq

A component Class is trying to set itself as a Singleton class variable. No idea how to get the reference on the singleton otherwise, and it works in Live, just not after switching to Generated mode. 


Assets\Ludiq.Generated\Transient\Scripts\Inventory.cs(262,52): error CS0103: The name 'ToGenerated' does not exist in the current context

Inventory.cs

Bolt Version:
2.0.0a10
Unity Version:
2019.3.2f1
Platform(s):
PC
Scripting Backend:
Mono
.NET Version (API Compatibility Level):
.NET 4.x
Bolt 2

People in Discord report problems with event communication between singleton and component classes as well. 

Pending Review

Hi TowerCrow,

Thanks for the report and sorry for the late reply.

There is a good chance that this has been fixed already in my working version as I improved conversions to and from shell types in general, but I'll double-check.

The issue I think may be happening here is that ToGenerated may be an extension method, and C# doesn't allow implicit this referencing on extension methods, which might throw off the code generation.

Posting another warning I get from the graph after generating C# scripts for documenting purposes. I'll see if this keep happening in the next alpha.





Failed to infer type of ValueOutput#self
System.InvalidOperationException: Could not infer class for graph: Setup#07700696#725737216
at Ludiq.Bolt.XBoltClassGraph.GetClass (Ludiq.Bolt.IGraph graph) [0x00011] in C:\GameDev\Bolt2a10\Assets\Ludiq\Bolt.Core\Runtime\Architecture\IBoltClassGraph.cs:76
at Ludiq.Bolt.Self.InferType () [0x00001] in C:\GameDev\Bolt2a10\Assets\Ludiq\Bolt.Flow\Runtime\Units\Misc\Self.cs:25
at Ludiq.Bolt.ValueOutput.InferType () [0x00010] in C:\GameDev\Bolt2a10\Assets\Ludiq\Bolt.Flow\Runtime\Ports\ValueOutput.cs:63
UnityEngine.Debug:LogWarning(Object)
Ludiq.Bolt.ValueOutput:InferType() (at Assets/Ludiq/Bolt.Flow/Runtime/Ports/ValueOutput.cs:67)
Ludiq.Bolt.ValueOutput:AssignInferredType() (at Assets/Ludiq/Bolt.Flow/Runtime/Ports/ValueOutput.cs:90)
Ludiq.Bolt.Unit`1:OnGraphStructureChanged() (at Assets/Ludiq/Bolt.Flow/Runtime/Units/Unit.cs:267)
Ludiq.Bolt.FlowGraph:OnStructureChanged(Boolean) (at Assets/Ludiq/Bolt.Flow/Runtime/Graphs/FlowGraph.cs:71)
Ludiq.Bolt.Graph:OnElementsChanged(Object, NotifyCollectionChangedEventArgs) (at Assets/Ludiq/Bolt.Core/Runtime/Graphs/Graph.cs:209)
Ludiq.ParentMergedCollection`3:OnCollectionChanged(Object, NotifyCollectionChangedEventArgs) (at Assets/Ludiq/Ludiq.Core/Runtime/Collections/ParentMergedCollection.cs:53)
Ludiq.Bolt.GraphElementMergedCollection:Add(IEnumerable`1) (at Assets/Ludiq/Bolt.Core/Runtime/Graphs/GraphElementMergedCollection.cs:41)
Ludiq.Bolt.Graph:OnAfterDependenciesDeserialized() (at Assets/Ludiq/Bolt.Core/Runtime/Graphs/Graph.cs:168)
Ludiq.Serialization:CheckIfDependenciesMet(ISerializationDepender) (at Assets/Ludiq/Ludiq.Core/Runtime/Serialization/Serialization.cs:906)
Ludiq.Serialization:AwaitDependencies(ISerializationDepender) (at Assets/Ludiq/Ludiq.Core/Runtime/Serialization/Serialization.cs:832)
Ludiq.Bolt.Graph:OnAfterDeserialize() (at Assets/Ludiq/Bolt.Core/Runtime/Graphs/Graph.cs:162)
Ludiq.Bolt.FlowGraph:OnAfterDeserialize() (at Assets/Ludiq/Bolt.Flow/Runtime/Graphs/FlowGraph.cs:50)
Ludiq.OdinSerializer.BaseFormatter`1:Deserialize(IDataReader) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Core/Formatters/BaseFormatter.cs:256)
Ludiq.OdinSerializer.BaseFormatter`1:Ludiq.OdinSerializer.IFormatter.Deserialize(IDataReader) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Core/Formatters/BaseFormatter.cs:175)
Ludiq.OdinSerializer.ComplexTypeSerializer`1:ReadValue(IDataReader) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Core/Serializers/ComplexTypeSerializer.cs:294)
Ludiq.OdinSerializer.ListFormatter`1:DeserializeImplementation(List`1&, IDataReader) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Core/Formatters/ListFormatter.cs:91)
Ludiq.OdinSerializer.BaseFormatter`1:Deserialize(IDataReader) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Core/Formatters/BaseFormatter.cs:222)
Ludiq.OdinSerializer.ComplexTypeSerializer`1:ReadValue(IDataReader) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Core/Serializers/ComplexTypeSerializer.cs:366)
Ludiq.OdinSerializer.Serializer`1:ReadValueWeak(IDataReader) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Core/Serializers/Serializer.cs:261)
Ludiq.OdinSerializer.UnitySerializationUtility:DeserializeUnityObject(Object, IDataReader) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Unity Integration/UnitySerializationUtility.cs:1726)
Ludiq.OdinSerializer.UnitySerializationUtility:DeserializeUnityObject(Object, SerializationData&, DeserializationContext, Boolean, List`1) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Unity Integration/UnitySerializationUtility.cs:1451)
Ludiq.OdinSerializer.UnitySerializationUtility:DeserializeUnityObject(Object, SerializationData&, DeserializationContext) (at C:/Users/lazlo/Projects/LudiqOdinSerializer/OdinSerializer/Unity Integration/UnitySerializationUtility.cs:1171)
Ludiq.Serialization:OdinDeserializeInto(SerializationData, Object&) (at Assets/Ludiq/Ludiq.Core/Runtime/Serialization/Serialization.cs:434)
Ludiq.Serialization:OnAfterDeserializeImplementation(LudiqAsset, FullSerializationData, SerializationData, Boolean&) (at Assets/Ludiq/Ludiq.Core/Runtime/Serialization/Serialization.cs:728)
Ludiq.LudiqAsset:UnityEngine.ISerializationCallbackReceiver.OnAfterDeserialize() (at Assets/Ludiq/Ludiq.Core/Runtime/Unity/LudiqAsset.cs:26)