I have 2 C# scripts: USend.cs and UReceive.cs
USend.cs has a variable I need to reference: public bool BHarray = new bool;
I wand UReceive to reference BHarray. How is this done?
In Unity, I have dragged both C# scripts onto the same "Empty" object.
You can get a reference to the instance of the script and the instance of the variable is public from there.
In UReceive, add this:
You could alternatively make BHarray static so that there is only one of it and you don't need a reference:
change BHarray to:
and in UReceive where you want to use BHarray:
If your accesses are uni-directional, you could also alternatively use SendMessage, sending an approrpiate object along with it.
Side Note (just a thought):
128 bools? You don't give your use case, so I can't say if it is right or wrong, but maybe separating them out into separate unsigned ints and doing some bit masks might be more reasonable. If any of the bools are exclusive, you might consider enums as well. Tracking down issues with an array of 128 bools becomes hard to follow and potentially unmanageable. Good luck.