Forum rules - please read before posting.

Game object Inputfield to update global variables?

Is there a way to connect Game object inputfields to global (or local) variables?

Something like, letting the player enter their names but through game objects inputfield rather than menu input fields.

Thanks. 

Comments

  • edited January 2015
    Another question related to this.

    I got a local variable (integer) i want to show in the scene. But when i use Labels (menu) , it only checks global variables.

    So, is there a way to connect Localvariables ([localvar:x]) to gameobject text fields (in scene)?  (In this new UI TEXT video they are attaching script. This is what im after for this particular question)
  • I'm assuming by Gameobject Input field, you mean the UI component.

    If you link it to AC's Menu system, you can use the Variable: Set Action to set a Global string to the value of the input box.  But to do it through script (so that you can also affect Local variables), check section 12.6 of the manual - that gives a list of script functions you can use to read/write variables through code.
  • Alright. I guess there is no easy way to do this.

    I'll start learning c# little by little :) thanks.
  • Can i atleast request Menu Labels to also have Localvariables?  In some rare cases like mine, there could be scene related menus which will only appear in one scene and labels in that scene can show Local variables.


  • Hold the presses. Never mind , ive managed :)
  • edited January 2015
    Is there a easier way to call Actionlists in to UnityUi Buttons than writing scripts?
    What i mean, with the current Ui interface we can add game objects on to "on click" list and there are some options which might be useful for firing the action list.
  • edited January 2015
    Im receving this error
    error CS0117: `AC.AdvGame' does not contain a definition for `RunActionList'

    when im trying to call for
    AC.AdvGame.RunActionList (ActionListAsset actionListAsset);

    ----------------------------

         [SerializeField]
        private Button MyButton = null; // assign in the editor
       
        void Start()
        {
            MyButton.onClick.AddListener(() => { PlayerMenus.SimulateClick (main_menu, button_red, 2); });
        }


    Gives this error

    error CS0103: The name `PlayerMenus' does not exist in the current context

    Also, what does slot stand for?
  • Last but not least, how do we call the result of popup variables? I cant seem to call them with strings like " AC.GlobalVariables.GetStringValue (xx); "


  • The PlayerMenus error just needs to be changed to AC.PlayerMenus - you're missing a namespace.

    A popup's value can be found with:
    AC.GlobalVariables.GetVariable (xx).GetValue ();

    Just so you're aware, you can easily link a UI button to an ActionList by declaring it in the Menu manager.
  • edited January 2015
    Ok , than thanks for the info.

    I'm aware but i got curious and tried my hands on Unity Ui for a change. I did manage to achieve what i want though so it was fruitfull.

    As for AC.PlayerMenus : I just copy pasted  from the manual (page 121), and it seems to miss  AC. before playermenus   (My manual version is v1.41)

    Also  about the previous error which was

    error CS0117: `AC.AdvGame' does not contain a definition for `RunActionList'

    This also is fixed using "RunActionListAsset". For some reason, RunActionList didnt (may be it would if i was calling for inscene actionlists instead of actionlistasset) work for me (though again, i just copy pasted from manual).

    I should check a bit more before asking again.

    Thanks a lot Chris.
  • Those are good spots - I'll fix the function names in the manual for 1.42.
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.