Forum rules - please read before posting.

Change AC Inventory for Unity UI Inventory

edited February 2017 in Technical Q&A
Hello everyone!
I want to replace the AC default inventory bar with another one I created for my game (see attached images).


Problems I found:
a) When I run game appears this error:

NullReferenceException: Object reference not set to an instance of an object
AC.MenuPreview.Update () (at Assets/AdventureCreator/Scripts/Menu/MenuPreview.cs:58)

b) I can collect objects correctly into inventory but I can't drag them out from inventory to another object to use it (custom AC Inventory does allow It).

c) Don't appear the Checkmare Image Toggle Button and when I click on don't close the panel. I understand that I need an Actionscript for it?

EDIT: I remove the Toggle button an add a Button with Actionscript to Turn Off the menu when I clicked on it, but doesn't work.



d) Can I make this panel draggable on the screen?

Many thanks!




Comments

  • a) What version of AC are you using?  The code the message is referencing shouldn't be running while the game runs - it is appearing every frame that the game runs?

    b) Update to the latest AC version.  Drag-and-drop inventory was added for Unity UI some time ago.  The Demo_MenuManager's Inventory Menu, when switched to Unity UI Prefab, can be used with drag-and-drop - you can use that to test with if necessary.

    c) Your Menu's Appear type is set to Mouse Over - meaning that even if the Menu is turned off, the "rule" for which it should be open still applies and it will turn back on immediately afterwards.  You can either change the Appear type setting, or use the Menu: Change state Action to lock the Menu instead.  When a Menu is locked, it will not turn on even if the "rule" for it to do so applies.

    d) That will be down to the Unity UI prefab, not AC.  AC won't control the Canvas's position - so that you have full control over it yourself.  There's likely a script or example for this on the Unity forums.
  • edited February 2017
    Hello Chris,

    a) I'm using a version 1.55c. I reset options data to revert a original setup, create a New Game Wizard with new managers and no error appears now.

    b) I think that the problem has been when I created a new Managers (other than Demo Managers). It's possible?

    c)  I created a new button into InGame UI with an actionscript that Turn On or Off (with a previous check state if is visible or not) and works properly. :) 
    Now I only have to do is make functional the close button I have at the panel.

    d) I follow this tutorial and it works correctly until I incorporate this Menu into AC Menu Manager. I will do it again to verify.


    EDIT: Reviewing this AC tutorial, I think that the error is that I have no include the new scripts in the available actions folder. It's possible? 


    I put into my script this lines but a list of errors appears in the console.



  • a/b) It depends on when the Managers were created.  There was an issue regarding the Menu Manager creating "null" Menus, but that was fixed some time ago.  New Managers won't have this problem, but one way to fix a broken Menu Manager is to duplicate each of the Menus in turn, and delete the originals.

    d) The Console messages suggest that there are issues with the script itself, not the location of it.  You will have to go through the messages and solve the script errors they refer to.  You can post the script at http://paste.ofcode.org/ if you wish, but bear in mind that this is not a coding forum - and you should refer to Unity's own coding tutorials if you need help learning that aspect of development.
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.