Код
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void Update() {
ScriptName other;
other = gameObject.GetComponent("ScriptName") as ScriptName;
other.DoSomething();
other.someVariable = 5;
}
}
Добавлено (09.07.2013, 14:40)
---------------------------------------------
Если на объекте нет этого скрипта, то other = 0;
Добавлено (09.07.2013, 14:41)
---------------------------------------------
Либо:
Код
void Update() {
ScriptName other = gameObject.GetComponent<ScriptName>();
other.DoSomething();
other.someVariable = 5;
}