Search code examples
c#androidunity-game-engineaugmented-realityarcore

Text disappears once ARCore loads in Unity app


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?


Solution

  • 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."