Тёмный

What Exactly Is Get Component - Unity Tutorial 

All Things Game Dev
Подписаться 1,8 тыс.
Просмотров 2 тыс.
50% 1

Quick explanation of Get Component and how it works in Unity!
Link to my Upcoming Game - Survive the Uprising: store.steampowered.com/app/19...
Link to the Discord - / discord
#unity3d #unitytutorial #unitytutorial #csharp #csharpbasics #unitytutorials #unitytutorialforbeginners

Хобби

Опубликовано:

 

13 окт 2022

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 7   
@muhammadzain25
@muhammadzain25 10 месяцев назад
i like your video keep it up.
@Ctlyst0
@Ctlyst0 4 месяца назад
so you can only use get component to get another script on the same game object?
@-Plube-
@-Plube- 5 месяцев назад
How is this useful? I can just create a static instance of the object instead of doing this
@charperdove
@charperdove 5 месяцев назад
what do you mean? its for referencing a component in that object. do you know what a component is?
@-Plube-
@-Plube- 5 месяцев назад
@@charperdove I don't understand how it's any better than doing. "NameHolder n = new NameHolder();" It just looks like unity made a glorified way of creating new instances but I've barely learned unity so I wouldn't know.
@arsentoplak2635
@arsentoplak2635 4 месяца назад
You don't know shit boy
@mkit18
@mkit18 3 месяца назад
​@@-Plube- You don't understand, at all. What you're "trying" to do is to create a new instance of NameHolder. What get component can do is get a reference to an existing NameHolder which is attached to the gameobject it is called for. The key here , is that the component already exists, and may have values and references assigned to it, rather than a blank new NameHolder instance. Also, you can't create instances of NameHolder as you're trying to do, with the new operator. NameHolder is a class inheriting monobehaviour which can only be created by AddComponent, or manually attaching it in inspector. GetComponent is particularly useful for prefab gameobjects that get instantiated at runtime. As there would be no other way to reference the components on them.
Далее
What Exactly is Physics Raycast - Unity Tutorial
3:27
Просмотров 2,5 тыс.
НРАВИТСЯ ЭТОТ ФОРМАТ??
00:37
Просмотров 1,1 млн
How to ACTUALLY get into Gamedev
14:01
Просмотров 702 тыс.
A simple procedural animation technique
8:31
Просмотров 188 тыс.
Learn to Code in UE5 - 1 - Programming Basics
10:28
Просмотров 52 тыс.
How to Code (almost) Any Feature
9:48
Просмотров 666 тыс.
What are Events? (C# Basics)
15:05
Просмотров 381 тыс.
What Exactly Is A For Loop? Unity Tutorial
6:34
Обхитрили маму
0:24
Просмотров 2,7 млн
tractor rear light project #project
0:40
Просмотров 13 млн
Double Stacked Pizza @Lionfield @ChefRush
0:33
Просмотров 69 млн