GridVids
Sign in with YouTube

Object References in Unity - How to Communicate Between Scripts

Tarodev Jan 12, 2022 10:29
Create an account to hide videos, mark them watched, or save them to Don't Miss.
Don't Miss
Create an account to hide videos, mark them watched, or save them to Don't Miss.
Mark watched
Create an account to hide videos, mark them watched, or save them to Don't Miss.
Hide
Open in popup Open on YouTube
Share video

Share video

Copy the GridVids link or iframe code.

Video link
Iframe code
Iframe content

Chapters
PSA: The "Unit" class is a simple class I created to represent a unit in my game. It's NOT an inbuilt class. Sorry for the confusion. As a new dev, keeping references to game objects you need can be a little confusing. Learn how to store game objects for later use as well as allowing external scripts access to your goodies. Instead of trying to find an object, shift your thought pattern a little and ask "should I already know where this object is?". ❤️ Become a Tarobro on Patreon: https://www.patreon.com/tarodev ========= 🔔 SUBSCRIBE: https://bit.ly/3eqG1Z6 🗨️ DISCORD: https://discord.gg/tarodev ✅ MORE TUTORIALS: https://www.youtube.com/tarodev
Education
#object references #unity c# script interaction #talk to other scripts #gameobject reference #call function on another script #access another script #unity #unity3d #unity references #unity gameobject #c# #storing gameobjects #unity script interaction #unity c# interacting gameobjects #unity c# gameobject interaction #unity c# interact with scripts #Unity tutorial