Forum rules - please read before posting.

Attach texture(s) to Main Camera?

Hi! Is it possible to attach fixed textures to the main camera?

In my game protoype all the actions occur in to layer 0. So i need one texture as a background in layer (-1) and another one as frame above, in layer (1).

It is possible to attach those 2 textures to the Main Camera? To avoid to repeat and clone manually the same 2 textures, all over the other Game Cameras? And to avoid also this 2 textures to be affectedy the camera fade effect everytiem the camera switch to another one.

References:
https://imgur.com/dEYPenp
https://imgur.com/crxT5bp
https://imgur.com/BkzZhhY

Comments

  • You can't really "attach" a texture to a camera - at least, not now that Unity's deprecated the GUI Texture component.

    You can, however, display such images in Unity UI using full-screen Image components. This wouldn't have to involve AC or the Menu Manager.

    If you then set the Canvas component's "Render Mode" to "Screen Space - Camera", and then assign the MainCamera as the Render Camera, you can set the Plane Distance to either be further from, or closer than, the other objects in your scene.

  • Thanks @ChrisIceBox I'll try it that way :smile:

  • @ChrisIceBox I was testing around, and this is so far what i've achieved. The main background texture works great. So now i have a Canvas for the main background texure and another Canvas for the frame border texture. But here's come the problem. The Canvas for the video frame texture still occupy the entire Main Camera size area. And not only around the Video Player area. There's any way to resize it?

    So far i have a:
    1 Canvas for the background texture of 1920x1080px.
    Layer Order: -1

    1 Canvas for the the video frame texture of 1000x500px.
    Layer Order: 1

    The video player texture. (where the videos are rendered) of 1000x500px.
    Layer Order: 0

    I've been trying also with the Plane Distance. But it's not working. What might be doing wrong?

    Reference: https://imgur.com/OjLyMCM

    Settings: https://imgur.com/gGpxHte

    Thank you!

  • This is more to do with configuring Unity UI components, than anything AC-related. But you have your Image component attached to the Canvas root - meaning it'll always be full-screen.

    Move your Image component to a child of the Canvas, and you'll be able to reduce its size relative to the screen area. Alternatively, you could incorporate the border's padding into the border texture itself (so that this image too is 1920x1080).

  • edited June 2020

    Thanks @ChrisIceBox ! It works that way! Now i can change the size. But there's a problem. When i change the resolution, this children does not maintain the same proportion like the rest of the elements that are renderded under the Main Camera control. So It will be rendered always on a fixed scale/position on the screen even if i change the resolution.

    At 16:9
    https://imgur.com/difl3t3

    At 16:10
    https://imgur.com/reOgMZD

    Also is there any way that these Canvas are not affected by the fade effects of the Main Camera?

    I regret so many questions. I am reading and looking for a possible solution in to the Unity manual. Maybe with some script?

    Thank you so much for your patience!

  • To have it scale with the screen - both width and height - try setting the Canvas Scaler's UI Scale Mode to Scale With Screen Size, then set the Match to 0.5.

    Are you enforce the aspect ratio within AC's Settings Manager? If so, black borders will appear when the game window doesn't match the enforced ratio. To have a UI canvas account for these, you can attach the "Auto Correct UI Dimensions" component - but you shouldn't have to worry about this otherwise.

  • Thnks you @ChrisIceBox I'ts works fine! I wonder if there will be any way that the Main Camera fade will not affect these Canvas each time there is a transition from one camera to another.

  • Shouldn't be - the fade effect is drawn atop all scene elements, including Unity UI.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.