Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

A Star Pathfinding not being recognised in Visual studio after working at first.

Discussion in 'Scripting' started by LMacalister, May 29, 2020.

  1. LMacalister

    LMacalister

    Joined:
    Jul 5, 2017
    Posts:
    9
    Suddenly got an issue where
    Using Pathfinding
    isn't coming up with an error but
    Private Path path;
    and
    Seeker seeker;
    are throwing errors saying they don't exist. The code that uses this work in game but if I removed the code from the game object it won't let me add it back on due to the errors. Help!

    Code (CSharp):
    1. using System.Collections;
    2. using System.Collections.Generic;
    3. using UnityEngine;
    4. using Pathfinding;
    5.  
    6. public class EnemySuiciderAI : MonoBehaviour
    7. {
    8.     public Transform[] targets;
    9.     public float speed = 200f;
    10.     public float nextWaypointDistance = 3f;
    11.  
    12.     public Transform enemyGFX;
    13.  
    14.     private Path path;
    15.     private int currentWaypoint = 0;
    16.     private bool reachedEndOfPath = false;
    17.  
    18.     private int targetCount = 0;
    19.     Seeker seeker;
    20.     Rigidbody2D rb;
    21.     private Transform target;
    22.  
    23.     // Start is called before the first frame update
    24.     void Start()
    25.     {
    26.         seeker = GetComponent<Seeker>();
    27.         rb = GetComponent<Rigidbody2D>();
    28.  
    29.         InvokeRepeating("UpdatePath", 0f, 0.5f);
    30.     }
     
  2. LotusOzap

    LotusOzap

    Joined:
    Feb 26, 2020
    Posts:
    3
    Having the same issue. Did you find a solution?
     
  3. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
    Are you running Unity 2019.3.13 or thereabouts? There was a bug in a recent Unity version that caused this.
    I think it’s fine on latest Unity version.
     
    LotusOzap likes this.
  4. LotusOzap

    LotusOzap

    Joined:
    Feb 26, 2020
    Posts:
    3
    We are using 2019.3.12. Should we update?

    Edit: Updated to 2019.3.15, this fixed the issue, THANK YOU.
     
    Last edited: Jun 8, 2020
    CityGen3D likes this.
  5. CityGen3D

    CityGen3D

    Joined:
    Nov 23, 2012
    Posts:
    680
  6. Drrtbag

    Drrtbag

    Joined:
    Mar 7, 2022
    Posts:
    1
    Is anyone else having this issue in 2021? Starting getting this same problem but updating Unity is not helping :(
     
    Aelcyx likes this.
  7. LordMcCloud35

    LordMcCloud35

    Joined:
    May 29, 2017
    Posts:
    1
    bump, same here. "using Pathfinding" doesn't seem to be doing anything.