Struggling with Mobile build on phone, looking different on phone and Pc - unity3d

Firstly I'm still fairly new to coding, saw people making games and fell in love with the idea of making your own game. So the past few months I've been learning unity tutorials and practicing basic games. I've come so far to be basically done with my first game. Everything is ready and I want to load and post it on playstore, but there's one last issue. When I run it on Unity on my pc it looks perfect but I loaded it onto my phone and the UI and some objects is either not showing or looking different than on the pc.Example1Example2Example3 These are examples of my problem. The IMG above is the way it should look like and the one underneath is how it shows on my phone when loaded.

It doesn´t look the same, due to the different resolutions.
Try to use a Canvas Scaler component. Set a reference resolution and the mode how you want to scale it.
If you want your UI elements to be anchored to the center/top/left etc. you should also set the anchor points. Here is a good Tutorial
A good way to instantly check the result is the "device simulator" It is a unity package

That's because of your Canvas settings & your UI GameObjects Anchor. But I think the easiest way to solve this for you - because you don't have that much experience about it - is to separate canvases for mobile & pc. This is the code:
private void Start()
{
if (Application.platform == RuntimePlatform.WindowsPlayer) // If your game's running on android
{
pcCanvas.SetActive(true); // Use PC designed canvas
mobileCanvas.SetActive(false); // Disable Mobile designed canvas
}
else // Your game is running on mobile
{
pcCanvas.SetActive(false);
mobileCanvas.SetActive(true);
}
}
Add this to a GameObject, Design 2 Canvases & assign them to script. (This will be a litte complicated, but will work) This link for more info
But if you want to use 1 canvas, you have to set its settings & its GameObjects anchors.

Related

Built game looks duller than what is seen in the editor

I built my unity game through Xcode into an iOS device for testing, and the colors look duller and more pastel-like than in the game view in the editor. The exact same thing has also happened on a modern android device. How can I make it so that the colors as seen in the built game better reflect the colors in the editor?
EDIT: I have sent a file to my phone and found out that the phone perceives colors differently than my monitor. I'm sorry if I'm asking for quite a bit here, but... is there any way to make the game look as I intend it to? The fact that I never see exactly how my game will turn out seems kinda... awkward. Thanks.
I'm not sure if you already tried this, but you might want to use Unity Remote for your iOS device, so you can check the color differences in real time instead of having to build it every time.
But other than what the comments said, it sounds like you should try to adjust your monitor's display settings for better color correlation between the built game and the one in the editor.

Project Solution | Architecture | Scenes and Views

Im new in Game Dev and new in development with Unity
(Come from Windows and Web development)
Now I want to make my first game. This will simple game (but with retrieve data from API etc.)
So I have some basic questions:
1) How to decide if I need to make new scene or build just make a lot canvases and switch between them?
In my game I see
1 scene - Loading
2 scene - Main screen with buttons--
1 button - open Store
2 button Open leaderborad
3 button - open something like map
etc...
Now I think
I need make 2 scenes - Loading and Game scene
In Game scene make some canvases
(MainState Canvas, Shop Canvas, MapCanvas, Leader board canvas etc...)
And when user clicks on button - show this canvas (its must be display like Popup)
2) If I want that map will grow up with more and more stop points (like in Candy Crush) - I need to set its to Assets Bundle and load new bundle ?
3) Best practices for Login/Authorization
I check many sites and I see that best practices for Game Authorization today - this is Google/Apple Game service and not Facebook. Right?
If I understand not correct - Can you guys give me a links what I need to read/learn ?
Thank you guys so much.
I suppose you are targeting mobiles.
1) On mobiles the decision is simple in this case. One simple scene, that is loading fast, to show your logo, game title etc. and the second scene to all other stuff. If the game has very complex levels you can start thinking about more scenes. (If it's simple and easy to change to next level, e.g change background, some enemies etc. like in your case I would use one scene)
2) Sorry I don't know what you want to achieve, but you can read about Asset Bundles here and in unity docs. Again it depends on the complexity of the project. For a simple game it may not be a big difference. Official unity video on Asset Bundles and about Bundle browser
3) I have no idea about Apple Game service so I will talk only about Google Services. It's really simple to setup. However some steps may be tricky, but take your time and try to setup everything as you need. The github page of google play games plugin for unity, where you can download the latest build of the plugin, contains a lot of information on how to configure it. Docs I mentioned above and some testing was enough to implement it in my games. However if you have troubles with setting it up there are a few videos on youtube when you can see how to configure it step by step. Also here is the site on which you can see how your code should look after implementing google play games

Unity 3D: Rear camera in device is behaving weird

Am working on taking snap from my device camera. The front camera is working good,but the rear camera is not upto the mark. It is showing upside down. I donno why it is behaving strange.
Can anyone help me out.
Cheers!!
It's difficult to come up with a simple answer for your problem, this depends on wether you run it on iOS and Android. In general you need to adjust ( rotate and flip ) the resulting image based on the mirror and rotate value in the WebCamTexture.
There is a toolkit available that help you with solving some of these issues that you can take a look at. It's called Camera Capture Kit and is available on the assetstore ( https://www.assetstore.unity3d.com/en/#!/content/56673 ) - since the source is included for both iOS and Android it might be a good foundation for helping you tweak and solve your issue in your game or maybe it will just be a plug'n'play solution for your needs. It might let you save literally weeks in the long run since there is a lot of tweaking to get camera capturing right in Unity. Furthermore there is a functionality available to enable and disable flash light which might come in handy as well.
There is also a demo app included which is quite similar to what you have already been doing on your screens.
Cheers!

ios zxing with front or rear camera

Im using ZXing, is working fine on my new app, but i would like to integrate the option of front or rear camera,
so far the only reference to this i've found is on the google group
But is not very clear what they mean with that,
so any pointers on what i have to do to accomplish this?
thanks !
ZXWidgetController doesn't provide that functionality and it's not really set up to make it easy to change.
The code that needs to change is in - (void)initCapture. It calls [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]. This returns the default camera and you don't want the defalt.
You need code similar to that in - (ZXCaptureDevice*)device in ZXCapture.mm. That code won't work out of the box (it's designed to work with both AVFF and QTKit) but it's the same idea. Instead of using the default video input device, go through the devices and look at device position to find the device you want.
Be nice to port that code to the widget but that hasn't happened at this point.

water effect in cocos2d

I'd like to have a water effect on a background layer in my app. The effect doesn't need to react to touch or anything - it just needs to wave an image a little bit.
CCWaves3D seem ok, but leave have nasty black artifacts around the edges when I run it. Similarly CCShaky3D. CCLiquid brings my app down from 20fps to 5fps..
Is there any other effect I might want to try out? Or perhaps I'm using the current effects in a wrong way?
id shaky = [CCShaky3D actionWithRange:4 shakeZ:NO grid:ccg(15,10) duration:4];
id liquid = [CCLiquid actionWithSize:ccg(15,10) duration:1];
id wave = [CCWaves3D actionWithWaves:18 amplitude:80 grid:ccg(15,10) duration:10];
Bonus question - where can I find any good documentation for cocos2d effects? I found default cocos2d docs utterly useless & wasted a couple of hours trying to google before asking this question :/
I have noticed performance issues when building/running in debug mode. Have you tried to build/run in release mode? Also, are you experiencing this on the device and not just on the simulator?
Unfortunately, I have not found alternate documentation specifically for cocos2d effects. Here are a few links to posts and sites I have gathered for many different resources including tutorials, tools for making tile map games, using zwoptex for making sprite sheets, using vertex helper for making a verticies plist file for box2d/chipmunk collision detection instead of just rectangles, and sites for images & sounds:
Cocos2d Resources
Need 2D iPhone graphics designed
http://www.learn-cocos2d.com/knowledge-base/tutorial-professional-cocos2d-xcode-project-template/
I have found Ray's Tutorials especially helpful along with viewing the test applications included with cocos2d.
Happy coding!