Hey,
I have a system where three scripts are placed on one parent object and reference each other using a technique like this:
From the first script:
var Character:Component; function Awake(){ Character = GetComponent("Saki_Character"); //SakiCharacter is the name of the other script or component in the object. } function Update(){ if (!Character.Loaded) return; }
From SakiCharacter.js:
var Loaded:int = 0; //some stuff that requires loading and initialization. Loaded = 1
This was working fine, until I realized a few things were chugging and decided to optimize based on the instructions in the Performance Optimization guide.
I added the #pragma strict line to the beginning of all the script files, and now I'm getting the error from the title of this post. I declared the variable in the other Component! This also affects functions, arrays, and class instances, not just variables.
It makes sense that with #pragma strict, it wouldn't be able to find added-on members, at least with some modification. But I've tried everything I know and I'm fresh out of ideas.
Any clues on how I can get my own Components' members to be recognized and referenced by code in other Components?
Thanks!