2016年6月7日 星期二

C#的Structure

在Unity內、使用C#時,創造並使用Structure的方式:
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class MainProcess : MonoBehaviour {
  5.  
  6.     private struct tempStructure
  7.     {
  8.         public int tempIndex;
  9.         public string tempName;
  10.     }
  11.  
  12.     void Start ()
  13.     {
  14.         tempStructure xxx = new tempStructure();
  15.  
  16.         xxx.tempIndex = 1;
  17.         xxx.tempName = "Name";
  18.  
  19.         Debug.log( xxx.tempIndex  );
  20.         Debug.log( xxx.tempName );
  21.     }
  22. }

沒有留言:

張貼留言