Text disappears once ARCore loads in Unity app - c#

I am using ARCore on Unity. I have a canvas in camera space and a text UI component as a child of the canvas to be used to display information to the user while they use the app. When my app first loads I can see the text on my mobile phone (during the initial loading screens where it says "Unity" and the screen is black). As soon as the app loads and the camera screen is displayed the text UI component for the most part disappears. I can still see a gray line where the top of the text should be. I am not doing anything programmatic at runtime to the mesh or anything. I am updating the actual text value. I don't see any crashes or errors logged using adb. Is there something I am missing with using UI and ARCore?

Press Play, switch to Scene view, select your text UI in the hierarchy, on the top menu open GameObject->Align View to Selected.
If you see your text ui in the scene then you know it's still there, just need to figure out why it's not displaying. My guess is it could be a scale issue, where the text ui scales in AR mode.
Start with Canvas Scaler component (attached to your canvas) and set "UI Scale Mode" to "Scale with Screen Size." Then in your Canvas Component (attached to your Canvas) change "Render Mode" to "Screen Space - Overlay."

Related

Button Command On click() Isn't enabling it's Image

I am trying to do something like X and O game, and I want the image of button be showed if it was pressed but it's not working, I made sure that button is working by reversing the command it worked fine! Here is screenshot
I tried to reverse the command and it worked so the button is working fine
Have in mind that a UI.Button requires at least one active and enabled visual component (Image/Text/etc) with RaycastTarget enabled ... I suspect since you disabled the image you simply disabled the interactions with this button
=> solution could be to simply have two Images like e.g.
- Button (with Button + Image component)
|-- Icon (with Image component)
The Button object is your main button with a background image - can be completely transparent, but can also react to interaction and have color for hover, press etc. This you always leave enabled and here you enable the RaycastTarget.
Then in Icon you assign the according circle or cross sprite and can enable / disable it accordingly. Here you can also deactivate the RaycastTarget to save some performance. You could even have two different child icons according to the sprites then you don't need to assign the sprite on runtime either but just activate according child object

Scrolling Object Collection do not render item elements based on standard MRTK button properly

I'm making a HoloLens app that is intended to display a list of users from a ser in a Holographic UI, for this I'm using the scrolling object collections, My prefab is based on the one provided in the Examples scenes, but displaying a 3x3 grid that can be scrolled horizontally. The items are a based on the default 32x32 HoloLens 2 button. I have created a new icon set to display a custom icon.
At this moment I'm having these issues:
The items are not being rendered properly. Once I make a button child of the GridObjectCollection it displays all the icons ignoring the Button Config Helper setup (set to use a Sprite in the Icon style property).
When I scroll the collection, my custom icon keeps rendering outside the clipping box, it only disappears once the item is deactivated because is fully outside the clipping box:
This issue happens in the Unity editor and the HoloLens device.
I'm using MRTK 2.6.1 and Unity 2019.4.24f1
TBH I don't know what to do to solve this issue, I made my prefab hierarchy basically by hand putting all values form one project to another.

How can I make that the ui text will be in front of anything else?

I want that the text to be always on the top left corner and always above in front of anything else, objects ui everything.
I want to use this ui text for saving message.
Screenshot of the Canvas settings and where the text is show in the scene window and the game window :
And the text settings using Text - TextMeshPro :
A couple things:
Camera-space UI draws on top of everything except other camera-space UI objects and screen-space UI
Screen-space UI draws on top of everything except other screen-space UI objects
Your objects is attached to a World-space canvas
While in theory you could fiddle with drawing order with shaders, this does not apply to UI objects (as the world is rendered first, then camera-space UI, then other cameras and their UIs, then screen-space UI).
As such you will not be able to make that text draw "in front" of anything else. It exists in 3D space and is subject to all of the rules that that entails, such as being behind screen-space canvases.
You can move your text material up in the render queue if the defaults aren't working for you.

Bounds of a picture box inside a panel not updating when the panel is moved

I am creating a side scrolling platform game in c#. This is done by moving a panel containing several picture boxes all with the same tag. The player can sit on top of these platforms. This all works perfectly until the panel moves. When it moves the bounds of the picture boxes no longer align with their actual location meaning the character falls through the visible platform but will be able to stand on the invisible place it was formerly in. Can the bounds not change from their original location or is there something that should be added to the code to update them?

Scaling issue in Unity

I am trying to make a game scene for Unity. However, I can't seem to get rid of this border. Or I can't seem to stretch my background to fit the whole screen. I need this scaling to work for all screen sizes. Here is an image of what is happening.
You can clearly see the blue edging, when I don't want that to be happening. This happens when I test on my Tablet as well. The camera is of size 5, however, when I do some debugging, I notice it gives me positions such as 7.15 when I touch on the screen. How can I scale everything down, I have searched through tons of forums and no one seems to be having this issue.
Are you using UI panel for the background? if so try these step.
1st strech the background Panel to fit the whole canvas size
then change the background panel to stretch in all directions
Then select the canvas object and render mode for screen space camera, assign your camera to it and change the UI scale mode to 'scale with Screen size'

Categories

Resources