How to reduce drawcalls in unity? - unity3d

I'm a beginner developer in Unity 3D and I'm working on a mobile game (Android). Everything works fine when I test my game on the editor (150 FPS) and on my latest phone (One plus 5, 60 FPS), but when I try it on my old phone (LG optimus G5 with android 6.0) I have only 15 FPS.
I try to test an empty scene with only a 3D cube and I can reach 25 FPS. I used the profiler to inspect my game and I see that I have more than 1300 draw calls on my home scene (which I use about 40 differents sprites and 30 differents meshes). I try to put some materials in static batching, enabled GPU instancing, reduce most of the quality settings, but nothing solves my issue. I also tried to disabled every GameObjects of the scene (except the camera) but it doesn't increase FPS (or only 5 FPS).
Here's my profiler on the empty scene (on the LG G5) :
I developped another game with only UI elements and it works fine on this mobile LG G5.
Do i make a mystake in settings ? Or is my phone just too old for my game ? (I try to download crossy road which was made with unity and it works really nice on my old phone..)
How can i improve the graphics performances ?
I'm using universal render pipeline and unity 2019.3.5f.
Thanks in advance ! And please apologize my english isn't perfect.

Related

Problems recording my 2d game made with Unity (laggy / stuttering)

I'm pretty new to Unity and have a problem. I programmed a small 2D game in Unity that works fine, runs smoothly and doesn't lag at 60 fps. The problem occurs when I try to record a video of my game. No matter which screen recorder I tried (on Windows 10 with Xbox recorder as well as on Android Samsung Galaxy S8 and S5 with different recorders), the video doesn't run smoothly (seems stuttering). I have already tried different quality settings, different fps and switched off vSync, but nothing helped. When I set my game below 60 FPS, the game starts to stutter itself and the FPS is not kept constant. The screen resolution is 1920 x 1080.
I am now very desperate and frustrated about this problem, because I would like to make good quality videos of the game. So if anyone has any idea or suggestions how to solve this problem I would be very thankful!
try this link
it will take you VideoCapture, a free asset made for exactly your purposes. since its free you can add it right to your packages and start using it without trouble, and it elemenates the pesky problem of third party recordings.

Unity 4k 360 Video for iOS and Android

I would like to integrate a 360 video player into an existing app for mobile.
I use the Skybox/Panoramic shader and a RenderTexture for the Video pluged in the VideoPlayer component. In 2k (2048x1024 or 2048x2048 for 3D) everything is fine but when I try to take a 4k video (4096x2048 or 4096x4096 for 3D) the app crashes instantly on an iPhone 6 Plus. I also tested it with a video clip in 3840x1920 but all I got from the debugger is:
INFO [vr/gvr/capi/src/gvr.cc:116] Initialized GVR version 1.120.0
[VRDevice] Successfully created device cardboard.
Message from debugger: Terminated due to memory issue
I thought, it has something to do with the max texture size but 4096x4096 should be OK for most devices today.
Do you guys have an idea whats going on here?
Thanks!

Unity Game Crashes on IOS with Message didRecieveMemoryWarnining

I have developed a game in unity. Which works fine on android but when I tested it on IOS my game crashes after playing 3 levels. I have tested it using XCODE 8. Before crashing didRecieveMemeoryWarning() appear and then "game terminated due to memory issue" . I have compressed my all textures. Double checked my code.I did everything that I can think of. Plz guys help me.
Right After building your game, You can see how big your game is and how many space is taking every file included, to see this, right click on the console tab and select "Open Editor Log" as mentioned in this link. If there is some files that are taking too many space, consider reducing its size, with textures/sprites is as easy as setting a max size to a lower value.
If your build is fine in Android it may be that your textures/sprites are not in a size power of 2 (like 128x128, 256x256, 512x512, and so on...). Unity can't compress this images unless they are power of 2 in iOS.
To solve the above problem without having to manually change every texture of your game, I recommend using packing tags in your sprite options, you can assign the same tags to sprites so they create an atlas, see documentation here. Normally you want to pack together sprites that belong to the same level or menu and try avoiding having atlases bigger than 2048x2048, to see your atlases you can go to the Sprite Packer Window.

how to use the cardboard sdk for pc vr game?

so I want to create a vr game using unity3d and cardboard sdk for PC(windows), which I'll stream to my phone screen using kinoConsol. I created a simple scene when I build it for android,it works fine , I mean it shows the dual sbs camera(screen), but a windows build shows only one normal camera(screen).. is there a way I can use the cardboard sdk to show the sbs camera(screen) in a windows build ?? if not is there any thing else available to achieve this ?
Side by side is easy, just place two cameras where the eyes should be and change their viewport rect to half width. Now you have a side by side stereo renderer without any external library. Cardboard also adds some distortion to the lenses, but it is not that important to use it in your case.
Your second, and much bigger problem is the gyroscope - you have to somehow communicate the position of your headset to your unity app on your pc. This is not trivial and probably will require finding or building an persistent service on your android device that will send the orientation data to your desktop app.

cocos2d 2.x iphone 4 frame rate drop

I recently ported a project from Cocos2d 1.1 to 2.0. So far everything is working great, but I've noticed that the frame rate drops from 60 fps to around 40-50 fps on the iPhone 4 and the iPod Touch 4. Other devices I have tried (iPads 1 & 3, iPhone 4s) still run at 60.
At first I thought I had too many draw calls, but after reducing the calls from 54 to 17, I still had the same fps on both devices. I should note that I don't have this problem on the default Hello World template, nor do I have any openGL errors in the console. My memory footprint is around 50mb, so I don't think that's the problem either. Any ideas?
Looks like you have a simple performance problem. The other devices running at 60 fps (at least iPad 3 and iPhone 4S) have more computing power and better graphics processors than the iPhone 4 and iPod Touch 4.
Since this happened after upgrading from cocos2d 1.1 to 2.0, there's the possibility that the 4th generation iPhone devices don't run OpenGL ES 2.0 code (shaders) as fast as the other devices. It could also be an issue with cocos2d 2.0 itself. Unless you really need to use a feature of cocos2d 2.0 (ie shaders) the easiest approach would be to simply go back to cocos2d 1.1. If you aren't writing shaders, cocos2d v1.1 is just the same as 2.0 in terms of features (at this point in time).
Finally, test performance only with release builds. If you run Debug builds things like logging and assertions can totally skew any performance results.