using System.Collections;using System.Collections.Generic;using UnityEngine;public class Demo : MonoBehaviour{//常量-int基本数据类型const int intData = 0;//变量-float基本数据类型float floatData = ...

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Demo : MonoBehaviour
{
//常量-int基本数据类型
const int intData = 0;
//变量-float基本数据类型
float floatData = 0.5f;
//变量-bool基本数据类型
bool boolData = true;
//定义一个string数据
string[] strArray = { "1", "2" };
//定义一个长度为3的int数组
int[] intArray = new int[3];
//构造函数
public Demo(float floatData, bool boolData)
{
this.floatData = floatData;
this.boolData = boolData;
}
void Start()
{
//定义Demo实例,输出实例的字段信息
Demo demo = new Demo(0.8f, false);
Debug.Log("demo.floatData = " + demo.floatData);
Debug.Log("demo.boolData = " + demo.boolData);
}
}
织梦狗教程
本文标题为:游戏开发(Unity&iOS)总结01 - 常量&数组&构造函数


基础教程推荐
猜你喜欢
- IOS 播放系统提示音使用总结(AudioToolbox) 2023-03-01
- 解决Android Studio突然不显示logcat日志的问题 2023-02-04
- IOS应用内跳转系统设置相关界面的方法 2022-11-20
- Android开发使用RecyclerView添加点击事件实例详解 2023-06-15
- Flutter手势密码的实现示例(附demo) 2023-04-11
- Android多返回栈技术 2023-04-15
- Android中的webview监听每次URL变化实例 2023-01-23
- android studio按钮监听的5种方法实例详解 2023-01-12
- iOS开发教程之XLForm的基本使用方法 2023-05-01
- Flutter绘图组件之CustomPaint使用详解 2023-05-12