How to get nearest object from a tag?

Hello developers! I am in need of dire help. I’m ashamed to ask this for such a simple task but I’m new.
Using Unity Visual Scripting node graph, how to create a node graph that detects nearest object less or equal a fixed distance and change that object material color to a new one? Should update and iterate for all objects tagged “Prop” whenever a new object is near.
My current set up does work but only for one object in the scene. You can see in screenshot and GIF of the current game.

For some unknown reason it is not updating and iterating over all objects tagged “Prop”. I only have two objects! Cube is not the issue. If I remove tag from sphere, cube is detected. So issue lies with detecting and updating over multiple objects.


9454508--1327625--Untitled video - Made with Clipchamp.gif

There is a separate Visual Scripting forum, so questions like this should rather be asked there in the future :slight_smile:

I believe the key to the solution is to use two variables, nearestDistance and nearestObject.

Moved to correct forum.

Hello there!

The unit FindGameObjectsWithTag is not executed (it needs to be linked as it has an enter and exit port). So my is guess that your list is null.

9455588--1327829--upload_2023-11-7_16-5-20.png

Should be something like that:
9455588--1327826--upload_2023-11-7_16-5-6.png

You should check the value of the list in play mode.
See Live edit | Visual Scripting | 1.9.4

I tried that but it did not change anything.

Thank you. Yes sorry for the wrong forum. I’m not familiar with this . I’ll try your solution. How would I go into using nearestObject and nearestDistance?

I think this video explains the steps needed in detail: