Unity C# How to pass a variable from one script to another script

preview_player
Показать описание
Unity 5 C# How to pass a variable from one script to another script
Рекомендации по теме
Комментарии
Автор

take my whole day searching on google, stackflow, unity, forums and other bullshit. Finally found on youtube
thanks a lot

krazymon
Автор

this is the most simple way I have seen somebody do this. i subbed

isaacqsnl
Автор

Fantastic, This is perfect. I have been looking at all kinds of videos and tutorials on a simple way to do this and they were all way too complicated. I knew there must be an easier way to do it and you have just shown it. Many thanks you have just saved my Unity programming learnig motivation as I was about to give up bothering if I couldnt do something as simple as pass a variable without a lot of fuss. I have used it to pass int values as well and it works perfectly. The part where you just change the monobehaviour to the name of the other script seems so logical and so simple but nobody else has mentioned it and I never thought of it. Thanks again

themasteradder
Автор

I have been trying to find this for 4 hours now. THANK YOU!!

sawyerjohnson
Автор

THANK YOU, simplest tutorial i could find on this!

sabaideebee
Автор

really helpful... I've been looking for this for days now. Thanks a lot ❤❤❤

iffatfatima
Автор

I hate how simple this is, ive been trying for an hour. thanks so much :')

nikims_
Автор

To anyone wondering what is happening. Each script will create a class and classes can inherit values from each other. I would look up some vids on inheritance and it will make a bit more sense.

truebandit
Автор

THANKS SO MUCH! Couldn't find a solution ANYWHERE! You, have earned a sub!

duckking
Автор

That's an easier alternative and simple to understand.Thanks !

ΓιώργοςΦραντζεσκάκης-πχ
Автор

Thanks a million! This helped me solve many problems!

GeorgTheGr
Автор

i having a problem i show it is there on the second script but will not change and have no value even though the first script does

waterbottleexplosionpeople
Автор

Thank you! This is very helpful, and I love your voice!

mayonez
Автор

I really wish you would have used int instead of text. And put both scripts side by side. And name them differently so we know which one is meant to be sending and which one is receiving.

MJ-kmju
Автор

wow i learned so much from this video!

MrFarkasOfficial
Автор

Thank you so much! I’ve been looking for hours on how to do this! Brilliant video!

trolsnot
Автор

I tried this with a boolean and it stays with false even though it should become true

dasmaffin
Автор

how can i pass an Gameobject array from an other script? Can you help pls : (

XNCR
Автор

_"in unity we attach the function, äh, not the function, the class - this is here... ähm... sorry, i mean... so now we delete, and here... ähm, sorry... now we can"_ - click click click. PLEASE: Focus for 1 minute, what you will say and show, than record it. If that not work out, take another shot of an simple 5min tutorial. This is so hard to watch.

SirSnowman
Автор

I' m sorry but I just can' t handle this pronounciation...

Decimalis