Skip to main content

All Questions

1 vote
2 answers
59 views

How can I sort a list using multiple ways?

I have a ScriptableObject in unity [CreateAssetMenu(fileName = "New Food", menuName = "Prismalia/ScriptableObject/Food")] public class FoodScriptableObject : ScriptableObject, ...
Rudolf's user avatar
  • 31
1 vote
0 answers
31 views

How can i Assign all prefabs with a certain Tag to a List in Unity?

Im developing a Game in Unity and currently im having a hard time making the inventory System Work. Im a beginner in Unity so the problem is possiblie something obvious to some of you. The inventory ...
niemand geht's user avatar
-2 votes
2 answers
82 views

C# List<> with custom class returns null [closed]

I am developing a game in Unity and I came upon a problem. I am fetching data from file and I wanna store them into List<> with my own class Words. public class Words { private readonly ...
LoadingError404's user avatar
-1 votes
2 answers
61 views

Check if a list appear consecutively in any of the given lists

I have a main list: public List<List<string>> validOrders = new List<List<string>> { new List<string> { "01", "02", "03", "04",...
Yidi's user avatar
  • 75
0 votes
1 answer
50 views

remove the return of a function from a list

I am trying to code a card game in unity and i have a list called 'Deck' from which i want to draw a random card and then remove that card from the Deck and move it to another list called 'DiscardPile'...
Theo Nimz's user avatar
-3 votes
1 answer
50 views

converting object to json doesnt show empty List<object> unity

private void Start() { a data = new a { name = "karan", l = new List<object>() }; Debug.Log(JsonUtility.ToJson(data)); }...
Karan Gupta's user avatar
1 vote
2 answers
88 views

List of weapons that use own variable

Iteration of every variable in the foreach is not assigned to the weapon iterated. public class CharacterAttack : MonoBehaviour { #region Fields private Weapon weapon; public List<...
TryingToImprove's user avatar
0 votes
1 answer
127 views

Unity Sort list by object property with nulls?

I have a List of items that contain a WeaponData object -- however it could be null (if it's equipment and not a weapon) I'm trying to sort the list based on WeaponData.Type, and have the nulls be at ...
user3754283's user avatar
-2 votes
2 answers
74 views

How do I randomize the individual stats of elements in a list one-by-one in C#?

How can I randomize the individual stats of random elements in a list in C#? This is my line of code: public void RandomizePeople() { string path = "Assets/Resources/Texts/...
SaintSuspicious's user avatar
0 votes
0 answers
176 views

List returns count > 0 but prints empty list in Unity

I have a List of spawnedPieces that tracks the spawned pieces. After initiating the pieces I add the them to the list through spawnedPieces.Add(piece). When I print spawnedPieces.Count it returns ...
buolou's user avatar
  • 33
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&...
PinballJunior's user avatar
0 votes
0 answers
52 views

How to make a 2D List with the logic of 2D Array?

I have the array[100,10] and i wanna transfer it to a list(for example List<List> arrayToList = new List<List>();) By logic of array i mean that when i print the list(Console.WriteLine(...
zarza nefye's user avatar
1 vote
2 answers
177 views

How do I retrieve an "string" inside a List<string> stringName's ArrayList?

I'm quite new to C# and I'm currently faced with 1 issue while attempting to retrieve a "data" of object type during runtime of the program since this "data" is received from an ...
Jun's user avatar
  • 31
-3 votes
1 answer
239 views

creating a list of lists of tuples

So first of all this is my first stackoverflow pull so I am sorry if my explanation is shit. So I am working on a game right now in c#. It also does work right now so the solution I am looking for ...
Aijokoryu's user avatar
-1 votes
2 answers
308 views

How to get values from JSON file into C# List to use in Unity?

I'm doing a little exercise to get values from a JSON file and set those values into InputFields of a Unity project. When I read the file all I can get is that the Index is out of range, when counting ...
David Garcia's user avatar

15 30 50 per page
1
2 3 4 5
22