Unity C# - How to interact between scripts

Share this & earn $10
Danndx
Published at : 12 Jan 2021
56908 views
879
35

Here's a tutorial on how to have one script interact with another in unity, using c#.

The 3 main methods I use are:
- Triggering a function in a script, from another script
- Querying variables in a script, from another script
- Setting new values to a script's variables, from another script

Hope it helps!
unity c# script interactionunity script interactionunity script to script

This Supercharged Jaguar XF is a Reliable and Elegant Alternative to German Luxury

This Supercharged Jaguar XF is a Reliable and Elegant Alternative to German Luxury

Quadriceps stretches for relieving patellofemoral pain syndrome

Quadriceps stretches for relieving patellofemoral pain syndrome

All time Best Mouse Trap | Trap Rat Trap Homemade | Bucket Mouse Trap

All time Best Mouse Trap | Trap Rat Trap Homemade | Bucket Mouse Trap

Ronald A. Heifetz: Leadership, Adaptability, Thriving

Ronald A. Heifetz: Leadership, Adaptability, Thriving

Alina Baraz & Galimatias - Maybe

Alina Baraz & Galimatias - Maybe

How To Style Jeans And A T-Shirt | Everyday Outfit Ideas

How To Style Jeans And A T-Shirt | Everyday Outfit Ideas

Gordon - ***Under Offer***So, You're Searching In  ...

Gordon - ***Under Offer***So, You're Searching In ...

They Think It's All Over: No Holds Barred (1996)

They Think It's All Over: No Holds Barred (1996)

Here's What I Really Think of Joe Biden and What He Just Did for America

Here's What I Really Think of Joe Biden and What He Just Did for America

Using the Glorious Model O Wireless for PvP | WATCH BEFORE YOU BUY!!!

Using the Glorious Model O Wireless for PvP | WATCH BEFORE YOU BUY!!!

Legal case for Trump’s impeachment is ‘relatively weak’: constitutional attorney

Legal case for Trump’s impeachment is ‘relatively weak’: constitutional attorney

Free Premium Web Hosting | Free Premium Hosting 2021

Free Premium Web Hosting | Free Premium Hosting 2021

RECOMMENDED ROUTINE - Reddit Bodyweight Fitness

RECOMMENDED ROUTINE - Reddit Bodyweight Fitness

Very smart person explains different music genres

Very smart person explains different music genres

Буба 🏆 Полоса препятствий ☕ Серия 75 - Весёлые мультики для детей - БУБА МультТВ

Буба 🏆 Полоса препятствий ☕ Серия 75 - Весёлые мультики для детей - БУБА МультТВ

F2FREESTYLERS PRACTICE SESSION | SHOOTING CHALLENGE! ⚽💥

F2FREESTYLERS PRACTICE SESSION | SHOOTING CHALLENGE! ⚽💥

It is given that `/_X Y Z=64o` and XY is produced to point P. Draw a figure from the given infor...

It is given that `/_X Y Z=64o` and XY is produced to point P. Draw a figure from the given infor...

Dr Norman Swan discusses Germany's concerns around the AstraZeneca vaccine in the elderly | ABC News

Dr Norman Swan discusses Germany's concerns around the AstraZeneca vaccine in the elderly | ABC News

sad alex - all the way over [Audio]

sad alex - all the way over [Audio]

REMINISCENCE // NELA FEAT GAMYS VIDEOCLIP

REMINISCENCE // NELA FEAT GAMYS VIDEOCLIP

Mushroom Cultivation, kannada 1

Mushroom Cultivation, kannada 1

Don't apply the Paperlike without watching this first! A step by step How-To.

Don't apply the Paperlike without watching this first! A step by step How-To.

Vlog - Life update and Annie's Post-Op Appointment!

Vlog - Life update and Annie's Post-Op Appointment!

The Convenience Store 夜勤事件: Freaky Japanese Cursed VHS Horror Game Set in a Creepy Convenience Store

The Convenience Store 夜勤事件: Freaky Japanese Cursed VHS Horror Game Set in a Creepy Convenience Store

Leopard chasing cheetah

Leopard chasing cheetah

My opinions on politics (and other stuff). Answering your questions!

My opinions on politics (and other stuff). Answering your questions!

The Calling - Anything (VIDEO)

The Calling - Anything (VIDEO)

Science Bulletins: Acid Oceans

Science Bulletins: Acid Oceans

Johny Johny Yes Papa

Johny Johny Yes Papa

Zebra Luminae Walkthrough

Zebra Luminae Walkthrough

BELI PET MONYET IMUT LUCU PARAH! BOM, GLOW WALL BISA JAUH + TEMBUS BERASA PAKE CHEAT KILL 23!!!

BELI PET MONYET IMUT LUCU PARAH! BOM, GLOW WALL BISA JAUH + TEMBUS BERASA PAKE CHEAT KILL 23!!!

Woog Riots - Football Round The Clock

Woog Riots - Football Round The Clock

A DAY IN THE LIFE WITH CRISTAL (39 weeks pregnant)

A DAY IN THE LIFE WITH CRISTAL (39 weeks pregnant)

2 Storey Dwelling House

2 Storey Dwelling House

🔎Seeking Arrangement Review 🤷 [Is Seeking Arrangement Legit?]

🔎Seeking Arrangement Review 🤷 [Is Seeking Arrangement Legit?]

What A Beautiful Name - Hillsong Worship - cover by Reese Oliveira and Friends

What A Beautiful Name - Hillsong Worship - cover by Reese Oliveira and Friends

Kid Ran Away From Home.. His Grandparents Were MEAN! (Roblox Bloxburg)

Kid Ran Away From Home.. His Grandparents Were MEAN! (Roblox Bloxburg)

ANF Merit List Interview And Training Date Announced ||Anti Narcotics Force Merit List

ANF Merit List Interview And Training Date Announced ||Anti Narcotics Force Merit List

SEPARATE YOURSELF: Your Breakthrough Is Very Close!

SEPARATE YOURSELF: Your Breakthrough Is Very Close!

Picturesque "Necessary" (Official Music Video)

Picturesque "Necessary" (Official Music Video)

How I Dominated and Controlled a Town in DayZ!

How I Dominated and Controlled a Town in DayZ!

Van Canto - The Seller of Souls live @Prague 10/2011

Van Canto - The Seller of Souls live @Prague 10/2011

WRC - Rally Italia Sardegna 2016: The 19 Stages

WRC - Rally Italia Sardegna 2016: The 19 Stages

Maroon 5 - Memories (1 hour version)

Maroon 5 - Memories (1 hour version)

Severe weather causes flooding in several Midwest states

Severe weather causes flooding in several Midwest states

Why YOU should change your ENTIRE brow routine to fit YOUR face

Why YOU should change your ENTIRE brow routine to fit YOUR face

(LIVE) The Most Epic Short Squeeze In History // R/Wallstreetbets 🚀💎

(LIVE) The Most Epic Short Squeeze In History // R/Wallstreetbets 🚀💎

Modern Warfare Remastered "All Ghillied Up" Sniper Mission Gameplay

Modern Warfare Remastered "All Ghillied Up" Sniper Mission Gameplay

Drake - Worst Behavior

Drake - Worst Behavior