If you are going to run a behavior like raycast or proximity just once but in 1000 different objects would that cause lag? To ask is better, does casting a proximity 1000 times in a single instance cause a significant amount of lag?
Yeah, I believe so. However, if it doesn’t cause lag, it will slow down the game’s loading time when the page loads. This likely won’t affect the performance of the game when its fully loaded.
Yeah, what Gamougg said.
If you just put a still-shot loading screen as a UI object, then have it destroy itself on a Once, it’ll destroy itself when the game’s fully loaded, acting as a loading screen.
So there are too many variables to say whether running a specific behavior will cause lag. It depends a lot on the other aspects of your game’s level. The only way to tell for sure is to try it, and look in the Performance Metrics Panel to see if the game is spending a lot of time running proximity checks.
In general, a proximity check has to analyze the positions of all the physics objects in your level in order to see if they fall within the proximity boundary. If you have a lot of physics object to check, then proximity checks can take a while. As a rough idea, think of it this way: If you have 1000 objects, and each of them is checking against each other, that’s 1000x1000 = 1 million checks. This might still be fast enough, because the checks themselves are pretty fast, but you’ll have to test to know for sure.
does it check for every object or just the object selected in the behavior?
For example, if I have 1000 object checking for “player”, but there is only 1 player object, would there be 1000 checks (1 for each object)?
Yes, because each individual object has its own proximity, and if they were all based off of one proximity it wouldn’t be accurate because that would only be coming from one place.