Forum rules - please read before posting.

Displaying a global variable.

edited May 2016 in Technical Q&A
Perhaps I'm missing something but I've been doing this for hours now.

I followed your tutorial on how to display a global variable, setting up the variables and using the text 'Score/Money etc = [Var1] etc'. That worked a treat and I can see it in-game. No worries there.

However, I'm trying to add this display label to another menu, as I like to keep my Inventory, Score, Quit and Options all in one menu.

I can't for the life of me get this variable displayed in another other menu. Does it have to be it's own menu? I've followed the exact steps and even copy and pasted the label, removing or hiding other menu elements that may be getting in it's way.



(On a side note, my the appropriate text of my inventory items when I
hover over them in my Inventory menu seem to be behind the items
instead of in front. Perhaps this is related)

Comments

  • Umm... are yo mixing AC and uGUI menus? For the items issue, remember that AC menus are set to display first, always. uGUI menus are always gonna show behind if both an AC menu and a uGUI menu are active at the same time. About the label not displaying the text, I find it weird, if you are using the correct tokens ( [var:0] ) it should work. You could also try tying the label directly to the Gvar value (if I remember correctly you can do this by choosing from the "label type" drop down), once you've selected the right Gvar, the label will always display the current value.

    (this image is from the tutorials, there you can also see the drop down for the label type. The option in it that you want should read something like "global variable".

    image
  • Hey Alverik, thanks for your help. No I'm not using unity's in engine UIs of any kind.

    I still have the problem with text appearing behind everything (regardless of this specific label I'm trying to make) but I'll check out your suggestion.
  • edited May 2016
    So the same label text works in one element but not another?  That shouldn't be the case.  Please post screenshots to explain what you've done.

    If your Menus rely on Adventure Creator for their drawing (i.e. not Unity UI), then they're order in the Menu Manager's list will determine the order in which they're drawn.  Menus are processed top-down, so the bottom-most Menu in the list will be displayed above all others.
  • No, that was exaxtly it. I assumed the text was there, just behind and placed the menus in order top to bottom, however like you said it's the other way around. Now I can see it, was there all along.

    My apologies for topic drifting, but since I have you. I also followed your video tutorial on cameras. I can see my new Navcam one in the scene view following my player left and right etc when I run the game. I can see that. Yet even though it's my Default camera in AC, the main camera (unity's default camera you shouldn't delete) is remaining static.
  • Next time, please post unrelated questions in new threads - I don't mind how many threads there are, but it helps to keep track of issues.

    Does the MainCamera have the MainCamera component on it, and are you getting any error messages in the Console?  Your MainCamera should display it's Attached camera at the bottom of the Inspector.  Is it showing your NavCam there?
  • Ah, I see. I've been posting in the wrong subject matter. Very sorry.
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.