Forum rules - please read before posting.

Adding images to journal entries

I've read this process:
https://adventure-creator.fandom.com/wiki/Adding_images_to_documents_and_journals

Before I start down that road, I thought I would check to see if this was still the best/only way to add an image to a journal entry.

Thanks in advance.

Unity version: 2021.3.21f1
AC version: 1.77.3

«1

Comments

  • It is - though feedback is welcome.

  • @ChrisIceBox Just wondering if this is still true! When adding journal pages on the fly through action lists, is it possible to add textures / images now natively in AC?

    Or would this still be the approach?

  • @ChrisIceBox Just following up sorry -- I suppose I'm curious to know if it's possible to either have
    A) Text & Images alongside each other
    or
    B) Make each journal page a different image

    I guess I'm curious to know if it's possible to do something like this:
    https://adventurecreator.org/forum/discussion/8058/creating-a-diary-system-like-the-ones-in-uncharted-nitw

  • Journals and Documents can now both have Textures associated with their pages, yes - but adding Journal pages at runtime (with the Menu: Change state Action) is limited to text-only.

    What you could do is have your Journal contain all of the pages by default, and then limit how many of them you can see - by hiding the "Shift Right" button through script until you wish for more to be revealed.

    The maximum number of accessible pages could be dictated by a Global Integer variable, something like:

    using UnityEngine;
    using AC;
    
    public class AutoShowJournalButton : MonoBehaviour
    {
    
        MenuJournal journal;
        MenuButton shiftRightButton;
    
        void Update ()
        {
            if (journal == null) journal = PlayerMenus.GetElementWithName ("MyJournal", "Journal") as MenuJournal;
            if (shiftRightButton == null) shiftRightButton = PlayerMenus.GetElementWithName ("MyJournal", "ShiftRight") as MenuButton;
    
            int maxPage = GlobalVariables.GetVariable ("MaxJournalPage").IntegerValue;
            shiftRightButton.IsVisible = journal.showPage < maxPage;
        }
    
    }
    
  • edited June 2024

    @ChrisIceBox
    Ah thank you! Will try this out!

    However, I think I'm running into another issue before -- it looks like when I place a texture in the corresponding journal page elements, nothing seems to show up strangely?

    Tried looking at the manual and at this thread: https://adventurecreator.org/forum/discussion/11281/document-and-journal-design

    Does this mean that each journal page cannot be set to a different texture?

    Here's a reference video. The menu is enabled on start and it pauses the game: https://drive.google.com/file/d/1Ji3GU-lWPPm2Ne7hVKvwKNu2UfxAuzz9/view?usp=drive_link

  • edited June 2024

    I also tried adding a background texture to the journal element itself -- that seems to be fine -- and it displays in runtime (so it looks like the menu is turning on correctly) -- wanted to let you know to eliminate it as a source for this problem!

    However, the individual textures I'm assigning to each page (like in the video above) do not show up.

    Also if you wanted to try it out directly, please feel free to pull the _latest from my repository (the one PM'd!) _

  • Pages from a Journal are displayed within a Graphic element, whose "Graphic type" property has been set to "Page Texture".

  • Hi Chris, I have the same problem. The graphic element with type "Page texture" does not show the assigned image of the journal page, but only the fallback texture.
    AC 1.79.3
    Unity 2022.3.18

  • You need to link the Graphic element to the Page you wish to display the graphic for - set the Journal element name field to Document.

  • Ah, Got it. Of course it works if you do it right. Thanks a lot.

  • Hello,
    I am trying to do something very similar and I cant make it work.
    Basically Set an inventory item of type Documents. I have a bunch of graphic pages that provides the text. Then in the AC Menu tab tried to do as mentioned above. The graphic wont display. I can only make it work if I load it in the fallback graphic slot but then I am stuck with only one graphic.
    https://ibb.co/bgBxrvGK
    https://ibb.co/PvZ2vVbX

  • Nvm I ve made it work. I ve set the journal element name to PageText and it picked the textures. Not sure whats going on there to be honest!

  • The Graphic element (named Texture in your Menu) does not store information about which Document is displayed. It instead relies on a separate Journal element, which does, and uses that to determine which texture to show.

    The Journal element name field refers to which Journal element (named PageText in your Menu) to look for. When you entered PageText in as the value, it was able to find the element and know which Document is being viewed.

  • I see! It all makes sense now thank you!

    This leads me to my next question though.

    I had a fairly big resolution texture so I used the Size setting in the Graphic properties.I set it to Absolute pixels and got it where I needed it to be.

    Now if I create a different Inventory Document item with a completely different texture this will no longer work as the second document will also pick this same global resolution.

    For now the way around it is to have the resolution of the graphics at exactly the size I need it to be so I can set the global size setting to Automatic.
    Is there a way around that?

    Also, how difficult would it be to implement a scroll function while examining documents?

    Another thing as I delve a bit deeper into menus.

    Say I create my own menu. How do I gain access on lets say a graphic element? Is the only way by copying the graphic element from the template? That goes for a lot of elements. Even though the graphic element is of element type Button, if I go about creating a new button I don't have acess to the same properties.

    Thank you!

  • For dynamic content, including scrollbars, you're best off switching to Unity UI instead of AC for your Menu rendering.

    For each of the default Menus, this can be done just by setting the Source property to Unity Ui Prefab. These already have a linked UI Canvas prefab that will be used when this option is set.

    In this mode, each Menu is rendered using a UI Canvas. Each of the elements are linked to an associated UI component. Button elements link to Button components, and Graphic elements can link to either Image or Raw Image components.

    A tutorial on converting a new Menu to use Unity UI can be found here.

    Once you have your Document textures showing in an Image, you can then have a simple script attached to it that updates its size based on the texture being shown:

    using UnityEngine;
    using UnityEngine.UI;
    
    public class SetImageSize : MonoBehaviour
    {
        public Image image;
    
        void LateUpdate()
        {
            if (image != null)
            {
                image.SetNativeSize();
            }
        }
    }
    

    You can also make use of Unity's Scrollbar component to have the content be scrollable.

    Say I create my own menu. How do I gain access on lets say a graphic element? Is the only way by copying the graphic element from the template? That goes for a lot of elements. Even though the graphic element is of element type Button, if I go about creating a new button I don't have acess to the same properties.

    To clarify: the Element type label doesn't refer to the currently-selected Element, but the type of Element that will be created if you then click Add new beside it.

  • Thank you!
    Yeah I think its time to actually go through the Menu section of the documentation.
    Thank you for the script but.. where exactly would I attach this too?

  • Place the script in a C# file named SetImageSize. Then, once you have a UI prefab that's linked to the Menu, attach it to the same GameObject that has the Image component linked to the Graphic element. Assign the Image component in its Inspector, and it will force the Image to resize based on the set texture.

  • There seems to be a strange bug where if I switch to UnityUI for the documents when I shift a page it jumps from page 2 to page 4.
    I have set a document with 5 pages. Everything works correctly when the source is in Adventure Creator.
    I switched to Unity UI in order to have a bit more control over the document's size and also implement a scroll function.
    When I shift the pages it will always omit page 3. Goes from 2 to 4. It will ocassionaly flash wrong pages when going back from 5 to 1.
    I've even tested out creating a fresh set of a 5 page document where the page graphic stays completely the same and only the page numbering changes and it does the same

  • What are your AC/Unity versions, and are you using Input System or Input Manager, for input handling? Are you shifting with mouse-clicks, or with keyboard presses?

    Any screenshots you can share of the issue will help clarify the situation. In particular, the input settings and the properties of the Shift button.

  • Unity :6000.1.3f1
    Adventure Creator 1.84

    Input Handling is set to Input System Manager (New), I've also tried setting to Both but its the same
    I am shifting with mouse clicks
    Here is a screenshot of the documents meny and shiftnext elements.
    https://ibb.co/n8Z6fFm8
    Same settings work just fine if I set the Source to Adventure creator

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.