It's hard to tell without posting your entire script for Pathing and PathFollower. Displaying the lines for each error (along with the script) helps us better understand the problem; so I'm assuming the errors in question pertain to the code posted above.
Question: How is the variable *other* declared. Is it a reference to the Pathing script, a GameObject type, another type: int, float, string, etc.? Without the full code we can't tell what it is.
If you know what GameObject you need to grab the array from, simply declare the variable *other* as a public reference to the Pathing script and drag-and-drop the GameObject inside the inspector, like so:
PathFollower script
using UnityEngine;
using System.Collections;
public class PathFollower : MonoBehaviour {
public Pathing other;
public Transform[] path;
void Start () {
path = other.getPath();
}
}
The variable *other* will appear inside the inspector on the GameObject using the PathFollower script. As previously stated, just drag-and-drop the GameObject using the Pathing script onto the variable *other*.
I've just tested this myself and it works. Hope this helps!
↧