Forum rules - please read before posting.

GameObject Above MenuItem?

Hi, I've played a little with GUI Depth in the menu manager but it doesn't seem to do the trick...

To signal the player of a new item -> I have a character pick up an item, that item appears where the inventory toggle is, then the item fades out. I have the placement right, but regardless of layer, sorting later, z transform, GUI layer, I can't seem to get the inventory toggle (a bag) to appear below the new gameobject. I was wondering if there's a way to achieve this effect with menus maybe... setting the menu bg as the item picked up and having it fade but wanted to see if there was an easy fix to this layer issue before I go down a new path.

Thanks so much! Loving adventure creator :)

Comments

  • How are your Menus rendered? With AC or Unity UI?

    The GUI depth field affects the drawing depth of AC menus only. These are rendered using Unity's OnGUI function, and so only have an effect on their display relative to anything else rendered with OnGUI. This field is more intended for aiding display when you have other uses of OnGUI from custom scripts or other assets.

    However, as OnGUI elements are always rendered last, they'll always be drawn atop all scene objects - regardless of the depth value.

    To allow for overlap between scene objects and Menu elements, you'll want to look into Unity UI based menus,. These rely on the Unity Canvas component's Render Mode field for rendering - meaning you can set it up to be in World Space, Camera Space etc, to suit your needs.

    I'd recommend relying on Unity UI in general for your interface, as this also offers more options in the way of custom animations and scripting. For example, you could (via script), set a RawImage component's texture to match that of the item, and then (via an Animator component) have it move or fade out.

    Given an Inventory Item's ID number, you can get its texture via scripting with:

    AC.KickStarter.inventoryManager.GetItem (itemID).tex;
    
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.
Do NOT follow this link or you will be banned from the site!