Placing your character preview in the inventory?

Hi guys,
So i am using inventory pro and created an inventory for my game. But i want also to add the character preview to the left side of it. I have no idea where to start, could someone tell me if there is something in inventory pro that allows ous to do that, or what code i need to use?

cumpz,
Vasco

Bump

You could have a new camera “InventoryPreview”, which is a child of the player, and has a culling mask set to only render the layers which the comprises the player (Player layer + weapons layer, etc.), and positioned so that the player is displayed in the correct position on screen. That camera’s depth will be set higher than your main camera so that it renders on top like UI does. Toggle that camera on and off when the inventory opens and closes.

Alternatively, create a new object that will represent the player in the inventory.

Or have the camera render to a render texture that you attach in your inventory UI.

1 Like

Hum i am sorry i’m not so good.
I have set the culling mask to Nothing, because i dont see any option that only shows the player character. The option that is closer to that is the “Default” wich shows normal objects (terrain,grass etc.) How can i set it so it only views the player?

Create a new layer only with the character and other things you want in the character view, and assign those objects to the layer

Yes each GameObject has a Layer defined at the top of the Inspector panel underneath the name. If you click the Layer drop down, there will be an “Add Layer” option, where you can add a “Character” layer. Assign your player objects to that layer, then assign your new camera to only render the Character layer.

But how can i show the camera in a portion of the inventory? I have done that and now camera preview only shows the character. But i still dont know how to place the camera in the inventory :S

I find the simplest solution is to create a render texture that you can put in the UI and have your character camera render to it

To elaborate, every Camera has a “Target Texture” field which accepts a Render Texture. You can create a Render Texture just like any other asset by right clicking in your project files and going to Create → RenderTexture.

Once you’ve assigned your Render Texture to your new Camera, you can add a new UI → Raw Image object, and give the Raw Image component your Render Texture. So now whatever the camera sees will be rendered to that texture, and displayed in your UI.

1 Like

Thank you so much guys, and im sorry if i look so dumb i’m getting started :slight_smile: but thanks for wasting your time with me :smile:

Not a problem. That is actually a fairly advanced technique, and if I didn’t want to help people I wouldn’t log into these forums :wink:

No problem! I had to do this when I was setting up a character view in the character info window.
Another thing I would suggest is to put a 'platform under your character that only shows in the character camera and has no colliders. Something to give players a reference point

In the demo scene of Inventory Pro there is a character window that shows the character. Is that what you want? If so, the prefab for that is in the project and you can also make sure the “ToTextureCamera” object (a camera) which is found under the Third Person Controller is copy/pasted to your own character. When this other camera is positioned correctly (pointed at your character), it will render your character for the Character Window in Inventory Pro (provided you have linked the render output file to the Character Image object in the Character Window.)

If that’s not exactly what you want, I imagine you can tweak it a little till you do get what you want. All the parts are there.

Thanks but i already managed to get what i want :). But still apreciate it