Advertisement
Guest User

Unity3D class array

a guest
Jun 25th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. [System.Serializable]
  5. public class test
  6. {
  7.     public string name;// поле для отображаемого в инспекторе названии
  8.     public int value;// значение
  9. };
  10.  
  11. public class MyScript : MonoBehaviour
  12. {
  13.     public test[] array;
  14.  
  15.     void Start()
  16.     {
  17.         for (int i = 0; i < array.Length; i++)
  18.         {
  19.             Debug.Log(array[i].name + ": " + array[i].value.ToString());
  20.         }
  21.     }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement