Quantcast
Channel: Answers by "ThePersister"
Viewing all articles
Browse latest Browse all 99

Answer by ThePersister

$
0
0
Hmmm, tough one. If you'd like to track down your perfomance issues, I'd suggest using the Unity Profiler, look up some tutorials on Youtube, etc. Once you get the hang of the profiler, you can track down all the way to your methods where your performance is being used the most and how much % of the total. Right now, it's pretty hard to see / understand how the script applies in the game. I mean, I can see a hovervehicle flying about, and the player being able to trust it about, but **pictures of your scene would help**. Performance tricks: - Each .transform is actually a "GetComponent()", so consider storing it in a variable at start once, and use that variable in the rest of the script. (Saves 11+ GetComponents per frame) *Code for that:* Transform mTransform, mHoverPointTransform; void Start() { // Use further down below :) mTransform = transform; mHoverPointTransform = hoverPoint.transform; carBody = GetComponent(); layerMask = 1 << LayerMask.NameToLayer("Characters"); layerMask = ~layerMask; } - Furthermore, you're using OnDrawGizmos, these will only aid you in the scene view, and I'm not sure how heavy they are on your system, but for as far as game performance, you can ignore it. So, testing your actual performance, perhaps you should close the scene view, or point the camera to an inactive area, so Unity doesn't have to process too much there. If this does cause issues, you'll see this in the profiler as "Overhead", that's when you know the scene view or Debug.Logs are fcking you over :3 Aside from the performance tricks, it seems weird having to apply 2 raycasts to stop you from going up, you should add your own friction based on your velocity. Add more scene pictures, and I might be able to help with the whole, don't fly away hovercraft please issue. :) But the performance tricks should help in general :)

Viewing all articles
Browse latest Browse all 99

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>