40047人加入学习
(83人评价)
Unity中的C#编程 - 零基础(Unity 2017)

完成于2017-11-06

价格 免费

编程语言;通过编写的程序控制

C#script大路通用

 

[展开全文]
念卉 · 2020-06-22 · 该任务已被删除 0

浮点类型号;

[展开全文]
念卉 · 2020-06-22 · 该任务已被删除 0

//注释不能破坏原有的结构

//通过注释来解释这个代码是干什么的,方便别人去理解和阅读代码

/*这是多行注释的开头

*/这是多行注释的结尾

两个符号的中间都是注释的范畴

 

[展开全文]
念卉 · 2020-06-22 · 该任务已被删除 0

ctrl+k 后,再按 crtl+c 

[展开全文]
deli · 2020-06-21 · 该任务已被删除 0

Debug.Log("字符串");

Debug.Log(int);//提示信息

Debug.LogWarning("string");//提示警告

Debug.LogError("string");//

[展开全文]
deli · 2020-06-21 · 该任务已被删除 0
  •  
[展开全文]
真正有影 · 2020-06-21 · 该任务已被删除 0

使用循环遍历数组元素,

for(类型加i+i<可以确定数组长度+i++)

for(类型加i+i<数组名+length+i++)

第二种在不确定数组长度情况下,是比较灵活的

[展开全文]
真正有影 · 2020-06-21 · 该任务已被删除 0

for循环语句:

for(类型加上一个i+循环次数终止条件+是否增值i++)

[展开全文]
真正有影 · 2020-06-21 · 该任务已被删除 0

代码输出方式:

1.针对组件输出:print('alksjdlkjasd');

2.什么都能输出:Debug.Log('sdfsdfsfd');

3.警告输出:Debug.LogWarning('sdfsdfsfd');

4错误输出:Debug.LogError(''46546);

[展开全文]
真正有影 · 2020-06-20 · 该任务已被删除 0

//单行注释

/* */多行注释

一般多行注释结构如下:

/*lasdajh

*asdkaskd

*

*

*/

[展开全文]
真正有影 · 2020-06-20 · 该任务已被删除 0

//可以有多个类,但是用的时候需要在头部 using MyGame;

public class Player :MonoBehaviour{

void Start(){

//初始方法

GameData data;

}

void Update(){

只调用一次

}

}

 

namespace MyGame{

classGameData{

}

}

 

[展开全文]
liu012661 · 2020-06-20 · 该任务已被删除 0

//获取鼠标的左右按钮

input 类 GetAxis方法 Horizontal参数

private void Update(){

Input.GetAxis("Horizontal");

}

[展开全文]
liu012661 · 2020-06-20 · 该任务已被删除 0

int,声明变量,变量可在运行期间变化,单纯的数字不行

[展开全文]
期为应说 · 2020-06-18 · 该任务已被删除 0

1.Debug.Log在什么时候都能用(输出正常)

2.Debug.LogWarning在什么时候都能用(输出警告)

3.Debug.LogError在什么时候都能用(输出错误)

4.print需要在有MonoBehaviour的情况下才能用(输出正常)

[展开全文]
期为应说 · 2020-06-18 · 该任务已被删除 0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour {


      // Use this for intitialization
      void  start () {
      //print(1);// (  ) () ; ;
      //print (3223);
      //Debug.Log(1);
      //Debug.Log("3223");
      //Debug.logWarning("23423");
       //Debug.logError("23423");
    //变量
    //赋值 = 把右边的赋值付给左边的变量
    int hp = 100; // int hp; 声明变量
hp = 90;
print(100);
    print(hp);//初始化
int hp;
//
       
}
   //Update is called once per frame
   void Update () {
    //print(2);

 

[展开全文]
塞巴斯蒂安·米卡艾 · 2020-09-01 · 该任务已被删除 0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour {


      // Use this for intitialization
      void  start () {
      //print(1);// (  ) () ; ;
      //print (3223);
      //Debug.Log(1);
      //Debug.Log("3223");
      //Debug.logWarning("23423");
       //Debug.logError("23423");
    //变量
    //赋值 = 把右边的赋值付给左边的变量
    int hp = 100; // int hp; 声明变量
hp = 90;
print(100);
    print(hp);//初始化
int hp;
//
       
}
   //Update is called once per frame
   void Update () {
    //print(2);

 

[展开全文]
塞巴斯蒂安·米卡艾 · 2020-06-15 · 该任务已被删除 0

int是整数类型,只允许附整数的值。

[展开全文]
GreenT666 · 2020-06-13 · 该任务已被删除 0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour {


      // Use this for intitialization
      void  start () {
      //print(1);// (  ) () ; ;
      //print (3223);
      //Debug.Log(1);
      //Debug.Log("3223");
      //Debug.logWarning("23423");
       //Debug.logError("23423");
    //变量
    //赋值 = 把右边的赋值付给左边的变量
    int hp = 100; // int hp; 声明变量
hp = 90;
print(100);
    print(hp);
       
}
   //Update is called once per frame
   void Update () {
    //print(2);
//变量
//赋值 = 把右边的赋值付给左边的变量
int hp = 100; // int hp;
print(hp);
注意:变量不能以数字开头!
       

 

[展开全文]
塞巴斯蒂安·米卡艾 · 2020-06-15 · 该任务已被删除 0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour {


      // Use this for intitialization
      void  start () {
print(1);// (  ) () ; ;
print (3223);
Debug.Log(1);
Debug.Log("3223");
Debug.logWarning("23423");
Debug.logError("");
       
          }

     // Update is called once per frame
     void Update () {

     }
   }
// sf sfsd sdfsdf 第三方斯蒂芬斯蒂芬斯蒂芬

/*
sldkfjlsdkjfa lkjd 
*/

/*
 *
 *
 *
 *
 */
注意:Error是错误,warning是警告
通过print是正常的输出,通过Debug是可以把日志输出分为三列

 

[展开全文]
塞巴斯蒂安·米卡艾 · 2020-06-08 · 该任务已被删除 0
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class player : MonoBehaviour {


      // Use this for intitialization
      void  start () {
       
          }

     // Update is called once per frame
     void Update () {

     }
   }
// sf sfsd sdfsdf 第三方斯蒂芬斯蒂芬斯蒂芬

/*
sldkfjlsdkjfa lkjd 
*/

/*
 *
 *
 *
 *
 */

 

[展开全文]
塞巴斯蒂安·米卡艾 · 2020-06-08 · 该任务已被删除 0

授课教师

问问题加入A计划,有专门负责答疑的老师哦!!!

课程特色

下载资料(2)
视频(37)

学员动态