- Home /
Other: Question is not answerable.
Help with basic variable byte
why cant i do this? How can i do this:
byte levelData[x, y, z] = gameObject;
It looks like what you are trying to do is convert your gameobject to a byte array. To do this you need a BinarySerializer. This will change it into a one dimensional byte array and not a three dimensional byte array.
What need do you have for the x y and z? I would imagine you expect some existing values in the game object to be stored, but this is not a correct use of a byte array.
I would read about how a multidimensional array works. http://msdn.microsoft.com/en-us/library/2yd9wwz4.aspx
What is your expected outcome from the psuedo code you posted above? What are you trying to accomplish (the result)?
Answer by Bunny83 · Dec 05, 2014 at 11:47 PM
-1
Uhm your code makes no sense at all so the simple answer is:
Not at all
Some more points:
Having the type "byte" in front of an identifier usually declares a variable of type "byte".
When declaring a type you can't use indexing brackets on the name at the same time. If you want to declare an array the brackets belong to the type.
In case the "byte" word is removed the line of code would be valie if levelData is a 3 dimensional array of GameObject. However if it's a 2d array of byte values you can't store a GameObject in it.
All in all your question makes no sense at all. You should explain what you want to do because we can't derive that from that code snippet.
Follow this Question
Related Questions
Assigning current color to a variable for fade out (C#) 0 Answers
Distribute terrain in zones 3 Answers
How to access gameObject variable script 2 Answers
Debug.Log a gameobject in C ? 2 Answers
Multiple Cars not working 1 Answer