calling upon another function in another script and error fun times

Hello Internet, please help me.

First off, my school only supports Unity 2 and I don't have the pro version, so that's what I'm using. Secondly, my game is fairly complex, so explaining the exact problem would take a long while. I'm just gonna be basic about it.

In multiple places I've tried to refer to function in another script and it's not working. An example of it would be something like this:

var objectBScript : ObjectB;

fuction Update () {
 if (ray hits Object A)
   objectBScript.DoStuff();
}

----Another Script named ObjectB on another GameObject------

function DoStuff () {
  turn some stuff on;
  turn more stuff on;
  Destroy Gameobject;
}

The game would tell me it couldn't destroy the object, and I would change it to turn off the renderer instead and it wouldn't do it. I tried to make functions in a similar manner and call them in other places and it just wouldn't do it. I would put a debug or print in DoStuff function and it wouldn't show.

I also have other weird problems like variables not showing up in the inspector or using a prefab for a long while and then clicking on it in the project window and the inspector is empty even though the instance of it in the hierarchy is fine, and it won't let me update it. Sometimes I'll open Unity and it will tell me I have two audio listeners or something is wrong with my mesh and I can't find what is wrong with it, so I close Unity and open it again and the error will be gone and not come up again.

Would updating to Unity 3 help me in anyway?

As per the FAQ, listing off a whole litany of unrelated problems makes this a very bad question as it becomes nearer to impossible for any one answer to fully address your issues.

Your code is too pseudo to know for certain what is wrong. In order to call a function on another script, you would need an instance of the script attached to some GameObject in the scene (as you appear to have) or a static class or function, and the function would have to be public in any case. Also, maybe you didn't know, but you cannot set script variable instances in the inspector. This code will work:

ScriptA.js

function Update() {
    var hit : RaycastHit;
    if(Physics.Raycast(transform.position, transform.forward, hit)
       && hit.Transform.tag == "objectA"){
        var script : ScriptB = hit.transform.GetComponent(ScriptB);
        if(script) script.Die();
        else Debug.LogError("No ScriptB attached to " + hit.transform.name);
    }
}

or ScriptA.js

var target : Transform;
private var script : ScriptB;
function Start() {
    script = target.GetComponent(ScriptB);
    if(!script) Debug.LogError("No ScriptB attached to " + target.name);
}

function Update() {
    if(!script) return;
    var hit : RaycastHit;
    if(Physics.Raycast(transform.position, transform.forward, hit)
       && hit.transform == target) script.Die();
}

ScriptB.js

function Die() {
    Destroy(gameObject);
}

Only public non-static serializable variables and arrays thereof will serialize in the inspector by default.

Not being able to connect a prefab instance to the original prefab would indicate that your instance has lost its connection to the prefab completely somehow or that such a bug exists in that older version of Unity. The description is too general to know for certain what is happening.

You have two AudioListeners when you have two active cameras (which have AudioListeners attached by default) whose AudioListeners are active or if you have an active AudioLister component that you've added elsewhere. If this appears suddenly upon opening the scene, but not a subsequent time opening the same scene without changing it, then it appears to be a bug in that version of Unity or some corruption of your files perhaps.

Mesh errors can be caused by numerous things and the description is too generic. These error may disappear upon re-opening of the project because the automatic mesh import for the asset in question may have been disabled or something to that effect or perhaps the mesh importer dies one time, but not another, indicating a possible problem with the application that exported it or the application in use for the import. You could also be changing the mesh at run-time in some erroneous way.

It's possible that upgrading to Unity 3 may alleviate some of your intermittent errors above, but without more detail about each of the specific problems, it's very hard to say which if any will be affected.