I have 6 cars all with machine guns, so the potential for many bullets is very possible and likely so I’m wondering what performance impact this might have.
Bullets are empty game objects with a trigger, spawned from a pool. Once spawned they send a single raycast forwards over a set distance and if they hit anything they instantly move to that position where they trigger damage on the object and despawn.
Does that sound like a good idea or should I scrap it and use another method?
a single continous raycast per car, then you can just use hit distance and time to decide if bullets are hitting or not (if you want travel time for bullets).
6 raycasts a frame on mobile with decent collision mask is no time at all, and represents a gnat’s fart on mobile cpus.
Probably best to pre-cache links to their scripted components, figure out what object you’ve hit (either by tag, object id in a hash table, etc) and then directly trigger whichever method in the component.