License: Unity 3D is paid while Cocos2DX is an open-source game engine.
Community Support: Unity3D has huge community support in comparison to Cocos2DX.
In Cocos2DX: Many Famous games like 2048, BADLAND is developed using Cocos2DX.
In Unity3D: Many famous games like Pokémon Go, monument valley, Temple Run 2, Angry Birds Epic are developed on Unity.
Size: The minimum size of a game developed on Cocos2DX-x can be as low as 1.5MB while the minimum size of a game developed on unity is around 8MB.
Compatibility: Cocos2DX supports both 2D and 3D but mainly used for 2D while unity3D supports both 2D and 3D but mainly used for 3D only because developing 3D games on unity is very easy as compared to other platforms.
Platforms: Cocos2DX supports Android, Tizen, Windows 8, Windows Phone 8, Linux, Mac OS X, iOS while Unity3D supports Android, Apple TV, BlackBerry 10, iOS, Linux, Nintendo 3DS line, OS X, PlayStation 3, PlayStation 4, PlayStation Vita, Unity Web Player (including Facebook), Wii, Wii U, Windows Phone 8, Windows, Xbox 360, and Xbox One.