Need Assistance with a project

So I have not used Unity much before, but just have some basic ideas of 3d structuring and building.

ask Overview:

We are developing a Unity-based system to visualize node connections and implement pathfinding using Dijkstra’s Algorithm. The nodes are manually connected using the NodeConnectionManager script, where each connection between nodes has a defined cost. This script uses a LineRenderer to display green lines for the static connections between nodes in both the scene and play modes. The goal is to integrate a pathfinding system that computes the shortest path between two nodes and highlights this path in red.

Problem:

We are facing issues where, after implementing the shortest path algorithm (using Dijkstra’s or A*), the red lines indicating the shortest path are not appearing in the Unity scene or play mode. Instead, only the green lines from the NodeConnectionManager are visible. Despite properly calling the LineRenderer to create red lines for the shortest path, these lines do not show up, and the existing connections remain unaffected. There is no visible indication of the red path being drawn, which prevents users from seeing the computed shortest path in the visual output.

We need assistance in making the shortest path appear with red lines while ensuring the green connections remain intact and visible as per the original setup.

As a new user I cannot upload the documents for code and model that I have created. Please reply here if you have a solution for this and I’ll share the contact or discord link.

Thank you.

This just sounds like you wrote a bug. Break the problems apart and find what isn’t working.

For instance, write code that makes two nodes and then a bit more code to connect them with a line render.

When you have that 100% absolutely positively working, no question whatsoever, move onto feeding the data from your pathing algorithm into that system.

Do not attempt to do those two things at the same time, as a bug in either side won’t be fixable until you find where the bug is.

By debugging you can find out exactly what your program is doing so you can fix it.

Use the above techniques to get the information you need in order to reason about what the problem is.

You can also use Debug.Log(...); statements to find out if any of your code is even running. Don’t assume it is.

Once you understand what the problem is, you may begin to reason about a solution to the problem.

Remember with Unity the code is only a tiny fraction of the problem space. Everything asset- and scene- wise must also be set up correctly to match the associated code and its assumptions.

Ideally your debugging lets you fix the problem. If not, keep debugging until you can frame the question as follows:

How to report your problem productively in the Unity3D forums:

http://plbm.com/?p=220

This is the bare minimum of information to report:

  • what you want
  • what you tried
  • what you expected to happen
  • what actually happened, log output, variable values, and especially any errors you see
  • links to actual Unity3D documentation you used to cross-check your work (CRITICAL!!!)

The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven’t put effort into finding the documentation, why should we bother putting effort into replying?

If you post code, only post the relevant code and always use the format button above. Do not post photographs of code.