Logo video2dn
  • Сохранить видео с ютуба
  • Категории
    • Музыка
    • Кино и Анимация
    • Автомобили
    • Животные
    • Спорт
    • Путешествия
    • Игры
    • Люди и Блоги
    • Юмор
    • Развлечения
    • Новости и Политика
    • Howto и Стиль
    • Diy своими руками
    • Образование
    • Наука и Технологии
    • Некоммерческие Организации
  • О сайте

Скачать или смотреть Unity Tutorial - TIPS and TRICKS for Optimising Scripts

  • Zenva
  • 2019-10-10
  • 5211
Unity Tutorial - TIPS and TRICKS for Optimising Scripts
zenvazenva loungetutorialprogrammingcodingsoftware developmentweb developmentonline courseunitytipstricksoptimizingoptimisingscriptscanvascachefunctionvariablereferenceproperty
  • ok logo

Скачать Unity Tutorial - TIPS and TRICKS for Optimising Scripts бесплатно в качестве 4к (2к / 1080p)

У нас вы можете скачать бесплатно Unity Tutorial - TIPS and TRICKS for Optimising Scripts или посмотреть видео с ютуба в максимальном доступном качестве.

Для скачивания выберите вариант из формы ниже:

  • Информация по загрузке:

Cкачать музыку Unity Tutorial - TIPS and TRICKS for Optimising Scripts бесплатно в формате MP3:

Если иконки загрузки не отобразились, ПОЖАЛУЙСТА, НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если у вас возникли трудности с загрузкой, пожалуйста, свяжитесь с нами по контактам, указанным в нижней части страницы.
Спасибо за использование сервиса video2dn.com

Описание к видео Unity Tutorial - TIPS and TRICKS for Optimising Scripts

ACCESS the FULL COURSE here: https://academy.zenva.com/product/uni...

TRANSCRIPT

Hey, everyone. In this lesson we are gonna go over a couple different scripting opimizations that you can implement in your projects in order to increase performance. As with mobile games, especially, performance is something you always need to keep in mind. So, the first thing we're gonna look at is caching objects. Now, whenever you wanna access and object inside of Unity, you might think that, oh, the GameObject.Find function, I can just easily find objects that way or get a component. Here in this example, I'm finding the object, Ball, and accessing the MeshRenderer component to change the color to blue every single frame. Now, this is a very expensive line of code and when I say expensive, I mean that it is using a lot of processing power and it takes quite a long time to run in terms of a function. And what we can do with this is actually cache of the MeshRenderer component of the ball instead of having to find the ball every frame and find the MeshRenderer component every frame. So, instead, what we can do is cache it. We can create a private variable for that Ball MeshRenderer and in the Awake function, that is where we will call the GameObject.Find function to find the ball object and get the MeshRenderer component. What this will do is greatly reduce the amount of time it takes to run the Update function as we are only calling the GameObject.Find and GetCompnoent for the ball once in the whole game, whereas before, we were calling it probably around 60 times a second if you're at 60fps on a mobile. This is just a lot easier and this is really what you should be doing if you do have these sort of large and expensive functions being called quite regularly. Here is also a list of all the other sort of functions that you should really cache if you're calling them every frame or if you're calling them quite often. Your GameObject.Find and then you'll see we got GameObject.FindObjectOfType. Now, this is probably one of the most expensive ones as what this is doing is, like GameObject.Find, GameObject.Find is looking through the scene for a specific object with a specific name. Well, what GameObject.FindObjectOfType is doing is doing the exact same thing as Find but for each of those objects, it is actually pretty much calling the GetComponent function so it's looking through every object and every component for a specific one and that is actually quite a performance hitting function that you should only really be calling once for an object when it's been initialized. Then, there is FindObjectWithTag which looks through all the objects for a specific tag. This is actually what the camera does, the Camera.main. Whenever you call Camera.main, this is, behind the scenes, what it is calling. So, when you think of that, it's really something that you shouldn't really be calling every frame as well. Same with GetComponent, and of course, Camera.main. Something else you should also keep in mind when creating functions inside of Unity is reducing the amount of time you need to call them. Sometimes you'll have a really expensive function like something to do with path finding or calculating something quite large.

Комментарии

Информация по комментариям в разработке

Похожие видео

  • О нас
  • Контакты
  • Отказ от ответственности - Disclaimer
  • Условия использования сайта - TOS
  • Политика конфиденциальности

video2dn Copyright © 2023 - 2025

Контакты для правообладателей [email protected]