I’m trying to do something a little different…I’m modifying @godlikemouse 's Topology script (link:Visualizing 3D Network Topologies Using Unity | Collaboradev) with the objective of only displaying node labels when the nodes are within the trigger area of a collider attached to the camera in order to reduce the work load of having so many gameObjects (I have ~16k nodes and 23k edges and all those gameObjects are a drag). I have a collider on my camera that reacts to the proximity of nodes, which I’ve tested through print() statements. It is indeed triggering when a node is nearby and it returns a node name. Unfortunately, every time it triggers it returns the same name…no matter which node hits the collider first. For example, I could hit nodes in this order: A, B, C and it will print W, W, W. Then I restart, go a different route and hit nodes E, F, G but it will still print W W W. I’ve tested it with godlikemouse’s default render settings and was able to see the names were legitimately propagating to individual NodeObject values, and I’ve reviewed the raw data I’m using so I’m pretty certain the graph data isn’t the problem.
I’ve also tried multiple collision Detection settings, which don’t seem to make a difference. The nodes I’m colliding with are all prefab cylinders with sphere colliders. Any ideas as to why it’s just repeating the same name over and over again for all nodes?
Here’s what the collider looks like:
private void OnTriggerEnter(Collider nearby_object)
{
if (nearby_object.tag == "NodeTag")
/// OBJECTIVE 1: Retrieve the `NodeText` attribute for a given node (the node's name)
/// OBJECTIVE 2: Instantiate game space canvas
/// OBJECTIVE 3: Render the name to the canvas
/// OBJECTIVE 4: Destroy canvas upon collider exit
///
{
//Get the nodeText attribute!
string node_name = nearby_object.GetComponent<Node>().nodeText.text;
print(node_name);
But then by golly, here’s my print statement for each-and-every node that enters the trigger area:
0020-0012-5980-1232
(a string of a node name)
UnityEngine.MonoBehaviour:print(Object)
Ad infinitum, same name. I’m stumped. If you have an idea of how to fix this, please lend a hand!