All Questions
Tagged with unity-game-engine dictionary
177
questions
-1
votes
2
answers
48
views
Is there any way to check if a KeyValuePair<string, int> contains a specific Key in a Dictionary in one line?
In my code I have a Dictionary, which at first was just <string, int>. However, I needed a way for two things with the same string to be separate elements in the Dictionary, so I made the Key ...
1
vote
1
answer
70
views
How can I load a dictionary with custom types and lists of custom types
I am working on a unity project where you can save a Dictionary that has key of custom type GraphNode and the values of each key are a list of the same type GraphNode Dictionary<GraphNode, List<...
0
votes
1
answer
56
views
ContainsKey returns true in Update() but false in other methods for the same value
I have a Dictionary containing positions that correspond to block values that I am using to get the current blocks the player is over (as an alternative to having each individual block have its own ...
1
vote
1
answer
126
views
Unity / C# - Track Class values inside a Dictionary
is it possible to store Class values into a dictionary?
Let me clarify the question a bit. For the sake of simplicity I'm reducing the amount of variables that I would like to store (otherwise I ...
-2
votes
1
answer
290
views
Is there any way to define a dictionary outside of a function in C#?
I am creating a 3D orbital mechanics simulator with Unity and C# and want to use dictionaries to store planet data for physics calculations. However, the only way I've found so far of declaring and ...
0
votes
1
answer
70
views
Why is this class not comparing equal to a string when it should?
I have a class that essentially wraps a string so that I can make a custom editor for this class easily. I want this class to act as if it is a string when comparing to other classes. I am using this ...
0
votes
0
answers
17
views
Reordering List Updates an Unrelated Dictionary
When I reorder a list by adding a value, a dictionary with the same value type updates.
Here is the code that I used. After swapping the order of lst in the Unity inspector, "dict["daveID&...
-1
votes
1
answer
79
views
C# Unity Dictionary or else [closed]
I'am making a game with unity where I will use Oxford 5000 english words and the translations in my native language and create a game focused on teaching english words to non native speakers.
I'am ...
-1
votes
1
answer
61
views
How to get max key that contains partial value in dictionary in unity
This is for Unity (C#)
I have a this Dictionary :
public Dictionary<int, string> lvl_dict = new Dictionary<int, string>()
{
//Dict tuplas index (Unity), moduleStepCode (...
-2
votes
1
answer
188
views
How De-serialize response JSON with dynamic keys?
I know that this question is asked many times but still I'm struggling to understand this. I have below json to c# converted class.
// Root myDeserializedClass = JsonConvert.DeserializeObject<Root&...
1
vote
3
answers
387
views
List to Dictionary and back again
I have read many posts about dictionaries and serialization etc. and they all have different ways of doing things.
Being new to coding (to an extent) I am having trouble figuring out how to get my ...
0
votes
0
answers
38
views
Delegate Dictionary vs. Switch Statement for Function Mapping [duplicate]
I am trying to create a function that can linearly interpolate between two objects without knowing the implementation details of the containing class. Specifically, I want to apply this to Unity's ...
8
votes
3
answers
405
views
C# Dictionary that uses an Unordered Pair as its Key?
I'm trying to create a Dictionary is C# that takes an Unordered Pair of Indices as its Key.
For example:
exampleDictionary[new UnorderedPair(x,y)] and exampleDictionary[new UnorderedPair(y,x)] should ...
0
votes
0
answers
121
views
I'm getting Member 'Version' was not found error sometimes, but not all times when using BinaryFormatter.Deserialize() with dictionaries
I have a Unity game on Steam that serializes game save state using BinaryFormatter, and stores and retrieves the data using Steam Cloud Saving. Rarely, the save files for users is failing to load and ...
-1
votes
1
answer
92
views
unity dictionary value return null
i have Dictionary "DebugCommands" in DebugCommandBase
public class DebugCommandBase
{
private string _id;
private string _description;
private string _format;
public ...