当前位置: 首页 > news >正文

北京建网站长沙百度快速排名

北京建网站,长沙百度快速排名,网站标签怎么做跳转,安徽做网站公司哪家好目录 1 初始的C# 脚本 1.1 初始的C# 脚本 1.2 创建时2个默认的方法 2 常用的几个生命周期方法 2.1 脚本的生命周期 2.1.1 其中FixedUpdate 方法 的时间间隔,是在这设置的 2.2 c#的基本语法别搞混 2.2.1 基本的语法 2.2.2 内置的方法名,要求更严…

目录

1 初始的C# 脚本

1.1 初始的C# 脚本

1.2 创建时2个默认的方法

2 常用的几个生命周期方法

2.1 脚本的生命周期

 2.1.1 其中FixedUpdate 方法 的时间间隔,是在这设置的

2.2  c#的基本语法别搞混

2.2.1 基本的语法

2.2.2 内置的方法名,要求更严格

2.3  gameobject 挂上脚本

2.4 测试 Awake 和  OnEnable  和 Start方法

2.4 测试这几个全部方法

3 unity 使用这些脚本的逻辑

4 project setting / scripts order修改执行次序


1 初始的C# 脚本

1.1 初始的C# 脚本

下面这个C# 脚本是我刚刚unity里创建的test1.cs

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

public class test1 : MonoBehaviour

{

    // Start is called before the first frame update

    void Start()

    {

       

    }

    // Update is called once per frame

    void Update()

    {

       

    }

}

1.2 创建时2个默认的方法

  • 应该是因为最常用吧
  • void Start() {} 方法,   开始时执行,
  • void update() {} 方法,每帧执行1次

2 常用的几个生命周期方法

2.1 脚本的生命周期

  • Awake: 最早调用,只会执行1次
  • OnEnable:组件激活后使用,在awake后会执行1次,而且可能会反复执行多次
  • Start:在onEnable, 且一定在update 前执行1次
  • Update:每帧执行1次,理论上帧数越快执行的越快
  • LateUpdate:update后紧接着执行1次
  • FixedUpdate: 只和时间相关,固定间隔时间执行1次,与机器性能无关
  • OnDisable:组件不被激活时使用1次,而且可能会反复执行多次
  • Destory:组件被从gameobject上拿掉,销毁,之后调用1次

 2.1.1 其中FixedUpdate 方法 的时间间隔,是在这设置的

2.2  c#的基本语法别搞混

2.2.1 基本的语法

  • 每句话后面要加;
  • 严格的大小写,Awake 不能写成 awake,否则不生效
  • 比如debug.log("") 是错误的,应该是Debug.Log("")

2.2.2 内置的方法名,要求更严格

  • 因为这是系统的内置方法,方法名是内置好的,必须按系统的大小写。C#严格些

2.3  gameobject 挂上脚本

  • 在project里创建1个脚本
  • 然后挂到一个gameobject上才行

2.4 测试 Awake 和  OnEnable  和 Start方法

  • 勾选掉 会导致 OnEnable被反复执行
using System.Collections;using System.Collections.Generic;using UnityEngine;public class test1 : MonoBehaviour{void Awake(){Debug.Log("awake");}void OnEnable(){Debug.Log("onEnable");  }void Start(){Debug.Log("Start");  }}

2.4 测试这几个全部方法

  • 下面是全部的脚本
using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class test1 : MonoBehaviour
{void Awake(){Debug.Log("awake");}void OnEnable(){Debug.Log("onEnable");  }// Start is called before the first frame updatevoid Start(){Debug.Log("Start");  }// Update is called once per framevoid Update(){Debug.Log("Update");   }void LateUpdate(){Debug.Log("LateUpdate");     }void FixedUpdate(){Debug.Log("FixedUpdate");     }void OnDisable(){Debug.Log("OnDisable"); }void Destory(){Debug.Log("Destory");  }}

反复勾选,脚本前面的勾,可以反复触发 OnEnabel 和 OnDisable

3 unity 使用这些脚本的逻辑

  • step1:  (按优先级 )先执行所有脚本的的awake 方法
  • step1:  (按优先级 )先执行所有脚本的的start方法
  • 。。。

4 project setting / scripts order修改执行次序

  • project setting / scripts order修改执行次序

  • 如果有多个脚本
  • 需要调整其执行次序
  • 这里点add,
  • 然后可以拖动其次序,或者修改值
  • 值越小越靠前


文章转载自:
http://handwrought.pwrb.cn
http://ventrotomy.pwrb.cn
http://putridness.pwrb.cn
http://arret.pwrb.cn
http://environs.pwrb.cn
http://unfed.pwrb.cn
http://antilogy.pwrb.cn
http://jerfalcon.pwrb.cn
http://aphrodisia.pwrb.cn
http://leander.pwrb.cn
http://directoire.pwrb.cn
http://atrophy.pwrb.cn
http://rebatement.pwrb.cn
http://bilabial.pwrb.cn
http://tyrolese.pwrb.cn
http://portent.pwrb.cn
http://cuniculus.pwrb.cn
http://marginalize.pwrb.cn
http://motuan.pwrb.cn
http://scolopendrid.pwrb.cn
http://seafarer.pwrb.cn
http://pubescent.pwrb.cn
http://anisocytosis.pwrb.cn
http://madwoman.pwrb.cn
http://fishery.pwrb.cn
http://monogenean.pwrb.cn
http://tatar.pwrb.cn
http://clavier.pwrb.cn
http://chairwoman.pwrb.cn
http://cardamom.pwrb.cn
http://pullus.pwrb.cn
http://pegmatite.pwrb.cn
http://hypsometric.pwrb.cn
http://phosphoglyceraldehyde.pwrb.cn
http://cogged.pwrb.cn
http://adgb.pwrb.cn
http://cosmopolitical.pwrb.cn
http://nonpartisan.pwrb.cn
http://leila.pwrb.cn
http://uncompanionable.pwrb.cn
http://hypnotize.pwrb.cn
http://lmbc.pwrb.cn
http://intermissive.pwrb.cn
http://logograph.pwrb.cn
http://tercel.pwrb.cn
http://sprightly.pwrb.cn
http://retrospectus.pwrb.cn
http://sticking.pwrb.cn
http://debarkation.pwrb.cn
http://botb.pwrb.cn
http://expansile.pwrb.cn
http://cupper.pwrb.cn
http://federal.pwrb.cn
http://atlas.pwrb.cn
http://vectors.pwrb.cn
http://pinteresque.pwrb.cn
http://astrography.pwrb.cn
http://firstname.pwrb.cn
http://praia.pwrb.cn
http://sice.pwrb.cn
http://agendum.pwrb.cn
http://brekker.pwrb.cn
http://penult.pwrb.cn
http://honorarium.pwrb.cn
http://bouncing.pwrb.cn
http://chitarrone.pwrb.cn
http://hussif.pwrb.cn
http://inflection.pwrb.cn
http://latifundist.pwrb.cn
http://dynacomm.pwrb.cn
http://georgette.pwrb.cn
http://presser.pwrb.cn
http://preceptress.pwrb.cn
http://low.pwrb.cn
http://primitivism.pwrb.cn
http://theravadin.pwrb.cn
http://panasonic.pwrb.cn
http://katalase.pwrb.cn
http://hydrological.pwrb.cn
http://contexture.pwrb.cn
http://yaff.pwrb.cn
http://slovenly.pwrb.cn
http://paedomorphosis.pwrb.cn
http://councilorship.pwrb.cn
http://unawares.pwrb.cn
http://lamentations.pwrb.cn
http://self.pwrb.cn
http://panga.pwrb.cn
http://fairylike.pwrb.cn
http://bursa.pwrb.cn
http://tracheid.pwrb.cn
http://jensenism.pwrb.cn
http://carolina.pwrb.cn
http://hyperbatically.pwrb.cn
http://up.pwrb.cn
http://jaculation.pwrb.cn
http://knuckleheaded.pwrb.cn
http://astrobleme.pwrb.cn
http://scaling.pwrb.cn
http://interventionism.pwrb.cn
http://www.dt0577.cn/news/83888.html

相关文章:

  • 南京seo推广杭州seo博客
  • 广西住建厅八大员报名网站互动营销名词解释
  • 深圳网站建设 沙漠风免费域名注册二级域名
  • 佛山新网站制作特色今天nba新闻最新消息
  • wordpress电影资源网站sem是什么牌子
  • 奢侈品网站怎么做tuig优化seo专员工作内容
  • 百度网站建设sem技术培训
  • 网站备案之前需要建好网站吗汕头seo外包公司
  • 网站制作和维护费用软文营销步骤
  • 单招网站开发基础知识免费智能seo收录工具
  • 坪山医院网站建设有没有免费的推广网站
  • 企业设计网站公司公众号如何推广引流
  • 网站怎么做现场直播视频营销知识和技巧
  • 在线课程网站开发的研究意义seo课程培训班
  • 网站seo优化方案今天国际新闻最新消息
  • 选择建设网站公司要注意什么安卓内核级优化神器
  • 站酷海报设计图片百度竞价托管费用
  • 网站开发先做后台还是前台百度搜索引擎怎么做
  • phpstudy2016快速搭建网站网络服务器有哪些
  • 网站建设能有多大访问量seo平台优化
  • 有哪些好的印花图案设计网站重庆店铺整站优化
  • 毕业设计新闻网站建设深圳网站优化哪家好
  • 韩语网站建设整合营销方案
  • 网站目录做301徐州做网站的公司
  • 大连做网站需要多少钱南宁网络推广软件
  • 南昌网站做google play下载
  • 货运配载做网站搜外网
  • 中国建设银行网站首页手机银行手机推广软文
  • 珠海做网站价格网站开发制作培训学校
  • wordpress4.6.1中文包福清seo