This question already has answers here:
Differences between a multidimensional array "[,]" and an array of arrays "[][]" in C#?
(12 answers)
Closed 5 months ago.
I'm having some trouble creating a 2D array game object.
I would write in Java
Gameobject[][] gameobjects= new Gameobject[x][y];
As far as I know, c# is based on Java and much works like in Java. But I'm having some troubles when creating a 2D array gameobject because it shows me an error in the second dimension parameter
I couldn't find anything about my problem on YouTube, so I hope you can help me.
https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/arrays/multidimensional-arrays
So, for your case...
Gameobject[,] gameobjects= new Gameobject[x,y];
Related
This question already has answers here:
Creating a task wrapper around an existing object
(3 answers)
Closed 2 years ago.
Is there a way to convert a list from List<> to Task<List<>> ? I know Task<List<>> to List<> but I don't know to other direction.
Thanks,
Have you tried Task.FromResult(list)? Where list is the variable storing reference to your Collection.
I think you want Task.FromResult(* your List<> here *)
This question already has answers here:
What does it mean when there is a comma inside an array declaration? e.g. float[,]
(4 answers)
Closed 2 years ago.
So I'm trying to learn from other peoples code and I saw this at the end of a list and could not find it anywhere I looked
List<IMyShipMergeBlock>[,] merges = new List<IMyShipMergeBlock>[3, 2];
What is [,] and [3,2] called and could you point me to where I could learn more about it thanks
its a multidimensional array of List<IMyShipMergeBlocks>
The [3,2] is the initialiser for the array
so imagine a 3x2 grid and in each square there is a space for a List<IMyShipMergeBlocks>
EDIT: And important to note: You would then need to initialise each list separately as with the above you have an array of nulls to start with
This question already has answers here:
Differences between a multidimensional array "[,]" and an array of arrays "[][]" in C#?
(12 answers)
Closed 4 years ago.
While coding a server, I came across something that I didn't recognize, which is byte[][].
What does this syntax mean, and how do I get rid of the message?
It's a Jagged Array in C#. To be short, it's an Array of Arrays holding bytes.
This question already has answers here:
Need a JSON parser for Unity3d
(2 answers)
Serialize and Deserialize Json and Json Array in Unity
(9 answers)
Closed 5 years ago.
I'm building a game and I need to store multiple data about levels:
A list of strings for dialogs
An int for the countdown time of each level
A float for right answer
Strings for dynamically loaded asset names.
probably some other data..
Coming from a web background, the most obvious path is to make this with JSON, but Unity 3D does not provide JSON support out of the box.. so I thought of XML, but still, no native support.. then I thought about multidimentional array, but there are limitations, such as the data types must be the same.
As a student, I want to do things according to the development pattern of the engine without external libraries, and my question is How do Unity Game Developers store data like this? What is the best way to deal with this problem?
This question already has answers here:
How to share data between forms?
(2 answers)
Closed 8 years ago.
I'm trying to use one array that I declared in one form, to plot a graph with zedgraph, in a different form.
How do I need to declare the array and where?
Short answer: Don't declare your array in the first form.
Declare it in a separate component/class/whatever instead, and let both forms access the array there. That way, the array should be independent of the forms, and both can use it.