I'm not a coder, im an artist, so this stuff doesn't make a ton of sense to me. I know enough to know I don't know enough, and i'm old enough to know my brain doesn't 'get' code... that said for context of what level of help I need :) ...
I'm trying to get an AI path based on an object tag. When I instantiate the object this script is on, it should look for 'mytag' on another object in the scene, and set that as 'target'
public class pickAItarget : VersionedMonoBehaviour
{
/// <summary>The object that the AI should move to</summary>
private Transform target;
public string mytag;
IAstarAI ai;
void Start()
{
Debug.Log(GameObject.FindWithTag("mytag"));
GetComponent<pickAItarget>().target = GameObject.FindWithTag("mytag").transform;
}
The script compiles fine and im able to put in the tag I want to find in the inspector but when the object instantiates I get
UnityEngine.GameObject.FindWithTag (System.String tag) (at C:/buildslave/unity/build/Runtime/Export/Scripting/GameObject.bindings.cs:195)
Pathfinding.pickAItarget.Start () (at Assets/Scripts/pickAItarget.cs:26)
I feel like I HAVE defined mytag, but obviously I don't understand something.