I have read Overview: Accessing Other Game Objects
but could not get the concept
//in ProjectileManager.js script
var projectile : GameObject ;
function Start () {
projectile = AssetDatabase.LoadAssetAtPath( "Assets/cannonball.prefab", typeof(GameObject) );
}
I need to know what is assigned to the projectile in ProjectileManager.js While coding in the GunType.js
//My wrong GunType.js file
internal var gunName : Projectile;
gunName = GetComponent(Projectile);
function Start () {
}
function Update () {
print(gunName.projectile.transform.name + "from GUI");
}
I need to have access to name of the gameObject assigned to projectile, (in this case “cannonball”)
it should be an easy situation, hope you can help