2018. 8. 29. 11:23ㆍEnglish translation
When developing with Unity, you may have to use multidimensional arrays.
Unity uses the C# language when coding some script, so you can use [, ] like a regular multidimensional array, but we can't use this way in the Inspector window.
This is typically a one-dimensional array that can be represented in Inspector window.
If you declare a variable with the same array as above,
One-dimensional array declaration is possible in the Inspector window like above picture.
But if you need declare a multidimensional array like this picture,
You need another declaration, not increasing number of commas.
Just display the Inspector in class, not MonoBehaviour class.
In other words, you declare a GameObject in another script and call that variable in your main script.
The source code is shown below.
[System.Serializable] //Displaying non-MonoBehaviour classes in the Inspector. public class MapArray { public GameObject[] Map; } public class Run_World : MonoBehaviour { static public float Speed = 4; public GameObject[] StartPrefabs; public MapArray[] JunglePrefabs; //0 = Start, 5~10 = End
If you declare a one-dimensional array in other class and call it,
You can use the multidimensional array in the Inspector window.
'English translation' 카테고리의 다른 글
SpaceX renames its under-development rocket 'BFR' to 'Starship' (0) | 2018.11.23 |
---|---|
Intel is giving up to develop on its smart glasses called Vaunt. (2) | 2018.10.30 |
How to make solar cellular cell phone charger (2) | 2018.08.19 |
[Python]Live object detection with webcam using Tensorflow API (0) | 2018.07.13 |