I want to detect if something is coming closer and I want to get its distance and name.
1 Answer
1I won’t post the explicit code, but this is how you could do it:
-
Have a sphere/box whatever trigger, that trigger would detect objects in a certain radius of your object.
-
Have a list/array/dictionary of the GameObjects in that trigger.
-
Whenever a new object enters the trigger, add it to that list.
-
Have a dictionary that stores the distance from the previous frame from the player.
-
Compare the 2 distances.
Did you try the "strip engine code" option in the build settings? (Just a wild guess) https://docs.unity3d.com/Manual/iphone-playerSizeOptimization.html
– doublemax
Pleas note that I don't want to use raycast
– SimonClintonIv