Forum rules - please read before posting.

Version 1.32 - Unity 2D mode, Local Variables and Crafting

edited May 2014 in Official news
This time on "Adventure Creator"..

Unity 2D mode
Available as an alternative (and now the default) to the Top Down / World Space etc modes for 2D, this allows for a workflow more in line with what you expect a 2D adventure engine to be like in Unity.  The 2D system has always kind of zig-zagged in terms of "best workflow", but this way makes sense enough to justify another go-over.  Previous modes are still supported, but the 2D demo has been updated to this mode, which works with 2D physics/raycasting, and a new "Polygon Collider" pathfinding method, in which you define the NavMesh by manipulating a Polygon Collider 2D directly in the scene view.  Much easier than laying down Segments!

Local Variables
Listed in the Variables Manager underneath the Globals, these Variables only exist in the scene they're declared in, making them more suitable for logic that has no effect on the rest of the game (a door being opened, for example).  Should make it much easier to manage larger games, this way.

Crafting system
A little simplistic to begin with, but the basics are there: you define a "Recipe" in the Inventory Manager, which takes a bunch of Inventory ingredients to make a new one.  You need to make use of the new Crafting menu element, which is demonstrated in the Demo_MenuManager's Crafting Menu.  Just copy it to your own Menu Manager and turn it on when appropriate.  Recipes can also be set to require a specific "pattern" to work, Minecraft-style.

And a whole much more besides:

Upgrade notes:
  • The RuntimeVariables script has been renamed to GlobalVariables
  • Added: Local Variables - use Variables Manager to define scene-based Variables, compatible with Variable Actions
  • Added: True "Unity 2D" mode for 2D games - use to work entirely in the Unity 2D view; 2D Demo updated to show workflow
  • Added: Hotspot2D, Trigger2D, CollisionCube2D, NavMesh2D prefabs for Unity 2D-based games
  • Added: Polygon Collider pathfinding for "Unity 2D" games - construct a navigation "mesh" directly in the Editor
  • Added: Crafting system - combine multiple inventory items together make new ones
  • Added: Crafting to Inventory Manager - use to declare complex inventory combinations
  • Added: Crafting menu element - either use to place down ingredients, or display the output
  • Added: Inventory: Crafting Action - use to clear crafting ingredients or create the appropriate item
  • Added: Blue borders now appear in Menus when previewing Elements with multiple slots
  • Added: Ability to set initial quantity of Items that appear in Inventory on start
  • Added: Static functions for setting/getting variables
  • Added: "Turn before walking" option to Characters - found in Character Inspector's Movement settings
  • Added: Characters no longer need Rigidbodys or Colliders if collision, gravity or Triggers aren't involved - useful for mobile
  • Added: Keyboard pop-up when using Input boxes on iOS and Android devices
  • Added: Variable: Check Action now supports comparison between Variables
  • Added: Setting a string with the Variable: Set Action now supports replacement tokens
  • Added: Ability to link Enter key presses on an Input element to a Button element on the same Menu
  • Added: On and Off textures to Toggle menu elements
  • Fixed: Active Inventory item sometimes being incorrectly being de-selected
  • Fixed: Conversations ending prematurely if an unrelated ActionList ends as well
  • Fixed: Menus sometimes "flickering" before appearing for the first time
  • Fixed: Save game and scene-switching issues with Player-less games
  • Fixed: Changes in Menu states being reset after changing scene
  • Fixed: Hotspot labels not appearing over Container items
  • Fixed: Menus sometimes resizing inappropriately when adding new Elements
  • Fixed: 2D GameCameras not working with Orthographic perspective
  • Fixed: Character: Animate action's "Add directional suffix?" not working for Mecanim
  • Fixed: Issues with building to Windows Phone 8
  • Fixed: Active cursor effects playing if hovering an Inventory item of a Hotspot with a valid but disabled Interaction
  • Fixed: Display issues with Input box Menu elements
  • Fixed: Sound effects continuing to play after a saved game in the same scene was loaded
  • Fixed: Player being able to "double-click to run" even when "Always Walk" was set in Player: Constrain Action
  • Fixed: ActionList resetting if Actions were pasted into it and no further changes were made
  • Fixed: Text appearing beneath Button background textures
  • Fixed: Speech being skipped if the mouse button was held down continuously from activating the ActionList
  • Fixed: Player not always re-appearing after game was restarted
And with that, it's Friday, I'm tired and boy do I need to slzzzzzzzzzzzzz *head hits desk*

Comments

  • edited May 2014
    I buy the plugin. See there's no 'True' 2D mode. And see you've just upgraded this so we can have it.
    Man, that's what I call a really great start :)>-

    Oh by the way, a few tips about french translations corrections for the menu (being a french myself, as you might guess with my english mistakes ^^) :

    Les Options -> Options
    Reculer -> Retour
    Restaurer -> Charger
    sauver -> sauvegarder
    recommencer (that means restart !) ->  reprendre
    sauver le jeu -> Sauvegarder la partie / sauvegarder la progression
    new save -> nouvelle sauvegarde
    Volume de la voix --> Volume Voix
    Volume de la musique -> Volume Musique
    Le Volume du son -> Volume Sonore

    And, well, bravo for that new version :)
  • Excellent update as usual Chris, thanks for all the hard work!
  • Looks like there is a big issue with variables in this update! I'm getting several errors when trying to start any scene:

    The class defined in script file named 'RuntimeVariables' does not match the file name!
    UnityEngine.Resources:Load(String)
    KickStarter:Awake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:129)

    The class defined in script file named 'RuntimeVariables' does not match the file name!
    UnityEngine.Object:Instantiate(Object)
    KickStarter:Awake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:129)

    PersistentEngine has no GlobalVariables component attached.
    UnityEngine.Debug:LogError(Object)
    KickStarter:Awake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:153)

    NullReferenceException: Object reference not set to an instance of an object
    ActionVarCheck.End (System.Collections.Generic.List`1 actions) (at Assets/AdventureCreator/Scripts/Actions/ActionVarCheck.cs:91)
    AC.ActionList+<RunAction>c__Iterator1.MoveNext () (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:159)
    UnityEngine.MonoBehaviour:StartCoroutine(String, Object)
    AC.ActionList:ProcessAction(Int32) (at Assets/AdventureCreator/Scripts/ActionList/ActionList.cs:127)


    Looks like there might be a minor naming error in one of the variable scripts? Is anyone else having these problems?
  • I got this error when drag and drop my asset file on "Settings manager"
    now when i click on Settings manager this error show up and faid Game edittor
    this is bad for 1.32
    you can fix it?

    XmlException: Text node cannot appear in this state.  Line 1, position 1.
    Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace)
    Mono.Xml2.XmlTextReader.ReadContent ()
    Mono.Xml2.XmlTextReader.Read ()
    System.Xml.XmlTextReader.Read ()
    System.Xml.XmlReader.MoveToContent ()
    System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot ()
    System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader)

  • Welp, it looks like changing the name of the "RuntimeVariables.cs" file to "GlobalVariables.cs" fixed all my problems! Simple enough!
  • edited May 2014
    Small remarks in the readme file :
    Everypage where there are hyperlinks to sections 2.8 and 2.9, they are not working properly ;)
    p.31 ,you've written "Diagonal sprites? checkbox."
    • Added: "Turn before walking" option to Characters - found in Character Inspector's Movement settings
    • Added: Keyboard pop-up when using Input boxes on iOS and Android devices


    Thats great Chris. Thanks alot!

  • Nice thanks guys
  • Cool update! Very happy to hear about the polygonal navmesh editing :) I'll have to try that out soon. Is it 'easy' to switch from Topdown2D into Unity2D? I'd try it in a project that's not that far in development yet so setting up the scene again wouldn't be a disaster, but just wondering.

    p.s. this update break Pixelcrusher's Dialogue System AC integration (because of the globalvariables change). I posted how to fix it manually here and emailed Tony to inform him.
  • Im getting the above same reported errors:

    XmlException: Text node cannot appear in this state.  Line 1, position 1.
    Mono.Xml2.XmlTextReader.ReadText (Boolean notWhitespace)
    Mono.Xml2.XmlTextReader.ReadContent ()
    Mono.Xml2.XmlTextReader.Read ()
    System.Xml.XmlTextReader.Read ()
    System.Xml.XmlReader.MoveToContent ()
    System.Xml.Serialization.XmlSerializationReaderInterpreter.ReadRoot ()
    System.Xml.Serialization.XmlSerializer.Deserialize (System.Xml.Serialization.XmlSerializationReader reader)

    NullReferenceException: Object reference not set to an instance of an object
    GlobalVariables.UpdateSelf () (at Assets/AdventureCreator/Scripts/Variables/GlobalVariables.cs:44)
    GlobalVariables.Awake () (at Assets/AdventureCreator/Scripts/Variables/GlobalVariables.cs:26)
    UnityEngine.Object:Instantiate(Object)
    KickStarter:Awake() (at Assets/AdventureCreator/Scripts/Game engine/KickStarter.cs:129)

    NullReferenceException: Object reference not set to an instance of an object
    AC.MenuSlider.RecalculateSize () (at Assets/AdventureCreator/Scripts/Menu/Menu classes/MenuSlider.cs:194)
    AC.Menu.PositionElements () (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:610)
    AC.Menu.Recalculate () (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:529)
    AC.Menu.Copy (AC.Menu _menu) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:244)
    PlayerMenus.Awake () (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:69)

    Overall the update looks really good for 2D work but on iOS with the above errors it is unusable. These errors don't really occur in Desktop platform mode.

    Hope for an update soon!
  • edited May 2014
    Apologies for the teething problems - it's not always easy to fix one thing without breaking another.  I will have an update with fixes out shortly.

    I was also not aware that Unity wouldn't automatically rename RuntimeVariables to GlobalVariables!  Very frustrating.
  • I'm running into problems with the GameCamera2D since the 1.32 update. I've noticed they now default to orthographic instead of perspective, but when I try to use the offset field to determine the constraints of my horizontal movement, it doesn't seem to affect the orthographic camera. I tried switching it to perspective, since that's what I was using before the update, and I've noticed that the perspective camera now behaves differently, squishing my scene so everything looks fat in-game but fine in scene mode...?
  • The GameCamera2D will only set itself as Orthographic when created in "Unity 2D" mode, which is what it ought to be.  What Top Down setting have you got set?  The offset parameter works differently when used with Orthographic camera: it'll affect the physical position of the camera, not the perspective matrix, so you'll only see an effect while the game is running.  Don't know what you mean by the squishing comment - the offset code for perspective cameras hasn't changed.
  • I'm not sure how else to explain the squishing effect, but it seems to be a minor issue anyway and possibly a bug with unity, because it corrects itself when I actually hit play. The orthographic camera boundaries still aren't working for me though - I used the offset during gameplay to determine the min/max constraints, but when I then input those values, they turn out to be wrong because the camera pans too far over. Is this because the ortho camera uses worldspace values rather than however the offset works?
  • The values will be different, yes, but the Constrain limits will still work with the Offset.  They'll be referring to distance (in world units) from the camera's original position.

    Could you describe how exactly to re-create the squishing effect for me?  It may well be a Unity bug, but if it was working before I can likely fix it.
  • edited September 2015
    Hi Chris,

    Is there a solution to save the Local Variables? My problem is when the player want to save the game, i should save the Local Variables. I`m using Adventor Creator 1.48

    Best regards,
    Gabor
  • edited September 2015
    @Gabor: Local Variables are saved automatically.  Could you provide steps to recreate your problem?  What platform are you working on / building to?
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 Unity's Adventure Creator.