Advertisement

如何利用全局静态变量? Unity的对象

阅读量:

在具体实践过程中,为防止代码重复,有时会采用全局静态变量的方式进行处理。

本文以全局静态数组作为案例,进行详细阐述。

----------------------------------------------------------------------

建立一个全局静态类

复制代码
 using System.Collections;

    
 using System.Collections.Generic;
    
 using UnityEngine;
    
  
    
 public static class ReferenceTable
    
 {
    
     public static string[] gv_str_array = { "hello", "hello_1", "hello_2", "hell123",
    
     };
    
 }
    
  
    
    
    
    
复制代码
 using System.Collections;

    
 using System.Collections.Generic;
    
 using UnityEngine;
    
  
    
 public class Test_List : MonoBehaviour

全部评论 (0)

还没有任何评论哟~