C# DataTypes in Unity! - Beginner Scripting Tutorial

preview_player
Показать описание
Watch this video in context on Unity Learn:

Learn the important differences between Value and Reference data types, in order to better understand how variables work.
Рекомендации по теме
Комментарии
Автор

This is one of the simplest yet one of the most important things to grasp in programming in Unity.

DenizBoz
Автор

I want to download the Sam-A-Flang's Assets.

cilekcigs
Автор

Something is a bit off with the first example, in concrete with the line pos = new Vector3(...). Even if Vector3 was a class (and of course it is not) this would not change the "original" value. It would simply override the instance stored in the local variable pos. To change the "original" value, we would then have to do smothing like pos.x = 20; or pos += new Vector3(...);. This might confuse people.

leckerkaffee
Автор

The first example with "currentPosition" (at 2:47) is kinda pointless. If currentPosition was a reference type the watermelon also wouldn't move - we'd just change the "address" that variable currentPosition points at. To actually showcase a difference between a reference and value type, something like this would be needed:
```
Vector3 currentPosition = transform.position;
currentPosition.x += 5;
```
Now, if Vector3 was a reference type, `transform.position` would also have its `.x` changed. But since it is a value type, when we assigned it on the first line it created a copy of `transform.position`. Now any changes are made to the copy and not to the original.

Anula
Автор

Okay then, you people said that, "Any variable that is an object of a class is a reference type".
And Microsoft states it as, the variables of reference types are known as object.
Both statements mean the same thing.

hasnainfareed
Автор

Charles is dead baby, Charles is dead...

Hoglet.Interactive
Автор

this is confusing, watched it three time and still don't understand lol

TheNamesJT
Автор

the more you talks like this less I wanna listen. Watch quill18 tutorials and make similar for beginners. His tutorials are too advanced for beginner. But way of explaining things is perfect.

niranjanwagh
welcome to shbcf.ru