Udon sharp script communication

I’m working with multiple scripts in udon sharp that have to communicate to each other for the world to work properly.
how would I get the script to do that?
I only need to change a boolean in an array if that helps with the explanation.
side note: the method I’m trying now gives me an error that says “Object reference not set to an instance of an object”

Well, first two questions,

  1. Are you using udon# or udon
  2. Did you make a public variable in script A that’s of type script B?

Essentially, “object reference not set to an instance of an object” means you’re trying to set something but unity doesn’t really understand what you’re trying to set.

A good example would be this case;
There is a fruits script which handles all fruits, and my fruits script wants to set my apple to be the colour red. I’ve added a public variable in the apple script that allows the fruit script to set the apple’s colour. But when the Fruit script calls said function, it doesn’t really understand which of the apples in the pile of apples it should turn red. And it’ll throw that exact error.

To get around this, we’ll put a reference in the Fruits script of the type Apples.
( e.g public Apple apple;) This allows us to drag and drop the apple script onto the Fruits script in unity, and now when we do apple.setColour(‘red’); unity will know which apple to turn red.

That said, this explanation is from the theory side and simplified. But it should allow you to understand why you’re getting the error :slight_smile:

I’m using Udon# but I need 9 different scripts to communicate with one master script for an array of booleans to be changed and I am using functions to communicate with the main one from the other scripts before your answer and that is what’s giving me the error. can you give some more specifics of how to deal with this please?