MENU

Fun & Interesting

How to get a variable from another script in Unity (the right way)

Game Dev Beginner 106,993 3 years ago
Video Not Working? Fix It Now

Want to know how to CODE in Unity? Get my course here: https://www.udemy.com/course/how-to-code-in-unity/?referralCode=7D4BCF4F86A840FB720B Learn how to get a variable from another script in Unity, without making a mess of your project. 00:00 Intro 00:37 Creating a connection in the Inspector 02:06 Get Component 06:32 Connecting to different objects 09:09 Global variables 10:36 Global variables (using Singletons) 12:24 Global Variables (using Scriptable Object) 15:10 Outro You'll learn how to connect objects and scripts together using the Inspector, Get Component, static variables and Singletons and by using scriptable objects. Read my full article here: https://gamedevbeginner.com/how-to-get-a-variable-from-another-script-in-unity-the-right-way/ Ryan Hipple's Unite Austin talk: https://www.youtube.com/watch?v=raQ3iHhE_Kk Outro music: New Year by Bad Snacks Image Attribution 3d cube icons created by Freepik - https://www.flaticon.com/free-icons/3d-cube Page icons created by Icongeek26 - https://www.flaticon.com/free-icons/page sword icons"Sword icons created by Darius Dan - https://www.flaticon.com/free-icons/sword Unity icons created by Freepik - https://www.flaticon.com/free-icons/unity

Comment