Scenes:
1.Splash,
one image with the IEnumerator Start() code as described below.
2.Menu,
Canvas UI with a few buttons and a some gameobjects in the scene as background. Camera has a tonemapping and depth of field script.
Stats: Batches 96, tris 20.4k, 41.5k
3.Main
Main scene of the game.
Bug, happend on android device and on pc in the editor:
1.Splash scene loads the menu scene using:
IEnumerator Start()
{
AsyncOperation async = SceneManager.LoadSceneAsync("Menu");
while (!async.isDone)
{
yield return null;
}
}
2.The canvas UI of the Menu scene appears with a black background, the gameobjects in the scene are not visible, for a few seconds.
3.The canvas UI + the scene is visible.
Same bug happens when the Menu scene is loaded from the Main scene.
Unity version = 2017.3.0f3
Using vuforia in the main scene.
EDIT:
I disabled all the objects and camera effects in the Menu scene except for a plane and the canvas, the canvas still appears a few seconds before the plane.
To describe the bug better, the camera seems to active a second after the canvas UI is shown.
EDIT2:
I created a new camera in the menu scene and the problem still persists.
I found my fix by adding an AR camera to the scene and disabling the the VuforiaBehavior component which was making the black screen when the scene was loading.
In my case, I just had checked Split Application Binary in Publishing settings to be able to upload my game to Play Store. (Play Store does not accept apk files to be bigger than 100mb, so you split your big apk into a smaller apk & a obb file)
However, if you do that, you need to put both your .apk and .obb files to specific folders in your phone, when you are manually testing the game.
.obb needs to be in a specifically named folder, with a specific name, as explained here: http://graphicdna.blogspot.com/2017/06/manually-copying-unitys-apk-and-obb.html
Shortly, name should be in the format:
main.[FIRST_PART_OF_VERSION_NUMBER].[PACKAGE_NAME].obb
Where [FIRST_PART_OF_VERSION_NUMBER] is the highest digit of the version number you can find in the Player Settings. For instance, if your version is 1.0.0, [FIRST_PART_OF_VERSION_NUMBER] is 1.
And [PACKAGE_NAME] is the package name specified in the same screen, right above the version number.
The game will expect to find that OBB file in a location like:
[INSTALL_LOCATION]\Android\obb\[PACKAGE_NAME]
Where [PACKAGE_NAME] is the same value described above, and INSTALL_LOCATION refers to whether the game is installed in the internal memory or the external SD-Card (this depends on your own settings).
Related
I have been successfully building and running a Unity 2D game, but started receiving a Blue Screen during one of my operations. Specifically, when I close a popup and remove all of its child Game Objects, the entire Game Screen turns dark blue (the default background color of the main camera). The music for the game still plays and clicks are still registered if you click in the right area (I can still press the back button, just can't see it).
If I remove 1 gameobject, this problem doesn't come up. But once I have to remove 2 game objects, the entire screen turns blue.
This is my function for removing my game object in case it helps, which works perfectly when it comes to actually removing the gameObjects correctly (game objects to be removed are created from prefabs). I think the problem may be with the camera for some reason, but I have no clue as to why it happens on this function.
public void Remove(int index)
{
float toggleWidth = toggle.GetComponent<RectTransform>().sizeDelta.x;
DestroyImmediate(scrollSnap.pagination.transform.GetChild(scrollSnap.NumberOfPanels - 1).gameObject);
scrollSnap.Remove(index);
scrollSnap.pagination.transform.position += new Vector3(toggleWidth / 2f, 0, 0);
}
I don't receive any errors or warnings in the console. Just a blue screen once more than one GameObject is removed
EDIT:
Turns out my main Canvas's planeDistance was being changed from 100 to 3200. I still have no clue as to why this change occurred...but for anyone else having a similar issue with a dark blue screen appearing in the middle or start of their game, then please check the values your canvas and camera in the Inspector. Simply controlling the planeDistance did the trick for me!
Made a new scene next to the sample scene when i started my sprite learning game. Forgot all about that.
When I had to publish it, In the Build Settings, I had the wrong scene selected. So It published an empty scene instead of my game.
I solved it by putting game in 3d mode and realized that the camera is positioned very far from the sprites, just change the z-axis and again go to 2d mode.
Just Move your camera in Z-axis position, it could be too far from object or it is behind the object, you can also check it by 3D mode the check the object position and change it in positive and negative values.
I recently encountered a problem with UI. I opened a new 2D project and created a canvas with a GameObject with a Image component. I then added a sprite by right-clicking Assets > Create > Sprites > Circle. This added a circle sprite to my Assets folder.
The problem is when I choose the Source Image for the Image component as the circle, it still displays as a rectangle.
The circle sprite is imported as Sprite for Texture Type.
This problem also happens with the other shapes, such as triangle.
I am using Unity 5.6.0b9 Personal. Build target is PC, Mac, Linux Standalone.
I am probably missing something very simple. Any help is appreciated!
It doesn't work like that. Circle and all other type of Sprites under the Assets > Create > Sprites Menu are only made to work with SpriteRenderers. This would have worked if you used SpriteRenderer from GameObject--> 2D Object--> Sprite. They do not work with the UI.
For the UI, this has to be done with the Mask component. Just get any round image then use it to cut out circle from your target square image.
Create a UI Image called "TargetSquare" which is the image you want to round.
Duplicate it then name this "MaskCircle" and then resize it to make it smaller than the "TargetSquare" until that circle shape is what you want.
Make the "MaskCircle" object to be the parent of the "TargetSquare" object then use this round Sprite I made as it's source image.
Attach the Mask component to the "MaskCircle" object.
Done. Your "TargetSquare" object will have the shape of the "MaskCircle" object.
If you get jagged edges, select the sprite you used for the "MaskCircle" image and then make sure that Mipmap is disabled.
Maybe it is bug, in unity 5.6.1f1 same story.
Just try to download new version unity 5.6.2f. I dont know, that bug is fixed or not.
Or
Use some image editor, for example photoshop.
P.S. My fail, all ok, it works on SpriteRenderer component. Unity generates white square, and in this sprite properties setting Sprite Mode to Polygon and creates some shape using vertices.
I am new to SceneKit and not able to get a hold of the Xcode Scene Editor. I am doing some research on iOS ARKit which was introduced recently. I created a sample project with SceneKit template. It comes with a default ship.scn.
I deleted this ship.scn and created a new SCN, drag and dropped a sample .DAE model into this SCN. I am able to view the object that I placed in .SCN file clearly with all the textures.
But when I run it in the device, the object appears on top of camera and zoomed in and not positioning properly in the camera frame.
I had to give the position of the object as x: 0, y: -60, z: -60 in Xcode Scene Editor to make it available in the center of the camera frame. But if I do this, the object will always be -60 degree from camera and I will not be able to move/resize it correctly with touch gestures.
Anyone please help me on how to make the object available at the center of camera frame such that the object also supports rotation/resize/movement etc.
I created the scene like below and added it to scene view:
let scene = SCNScene(named: "art.scnassets/Lowpoly_Notebook_2.scn")!
I have used Apple's link as reference for moving/resizing objects.
As orangenkopf quoted, My problem was with the model size. It was huge and hence didn't get rendered properly. When i change the scale of the object in Xcode Scene editor to a minimum value, i am able to view the object correctly and place it anywhere needed.
The best way is adding .dae file into the project and then Editor -> convert to SceneKit scene file format (.scn).
I have just upgraded Unity to version 4.6 and tried to create a button by Create -> UI -> Button.
However, this button doesn't show up in #Screen tab but it does in Game tab.
Please look at the screen shoot below:
Another question is: The default width and height when creating a new button is 160 x 30. When I change the source image with my own image button, I have to change the width and height parameters in rect transform. Is there any faster way to automatically obtain new width and height based on the image which I insert?
Thank you very much!
First, double click the button in your hierarchy and see that it indeed does not show in the Scene view, excluding any kind of zoom problem. (By the way, I'm assuming you mean "Scene" and not "Screen", right?) Things in different cameras or canvases might have very different scales but appear correctly in the Game view. I don't know how used you are to Unity, so I'm sorry if this sounds obvious. :)
Next, check the dropdown labeled "Layers" on top of Unity's editor, to the right of the Play, Pause and Step buttons. See if the layer of your button (which in this case is "UI") is visible. It should have an open eye icon next to it.
Regarding your other question, after dragging your sprite to the Image component, you can press the "Set Native Size" button, which will set the size of your object to the dimensions of your Sprite. Regarding the new UI, I think this is as automatic as it gets. Note that "Set Native Size" will only appear if your Image type is set to Simple (probably what you want) or Filled in the component.
I had the same problem before and here's a possible solution.
By default, the editor camera (Scene Tab) renders the World Space,
so your Canvas component's render mode should be set to "World Space".
The problem may only occur when you're trying to (or supposedly) render your UI in Screen Space - Overlay or Screen Space - Camera in the Canvas component.
So if you want to properly edit UI objects in the scene tab/window; set the Canvas component's render mode to World Space.
We don't have this problem in Unity 4.x before because I think Unity automatically renders any render mode from the Canvas component, however, that doesn't happen in Unity 5.x. I'm guessing it's either intentional that they do that or it's a bug on Unity UI feature.
I have an animated .3ds max file. I have imported the file in unity3D. The animation works in preview of animation tab in bottom right corner of the image, have attached the screen shot of it. But, while i play the scene, It comes with a blank scene, i am not able to see man and the animation. Cant able to find the solution for it. Please help me to fix the issue.
Reference screenshot is placed in the below link
https://www.hightail.com/download/OGhlYnU3TERCTWxMWE1UQw
https://www.hightail.com/download/OGhjeFlTSWVUME5qQTlVag
Make sure that your object is visible by your camera. Select your camera in objects list and you will see small preview.