Forum rules - please read before posting.

Troubles with AC 1.67

Following this thread,

Anyway, Chris, yes, I've re-assigned all the game Managers back to my custom ones.

The sprite issue was only with the default player, not the others, but as I said, I solved that reverting it.

While I still have problems with "NPC Follow" and "Face after Moving" on a hotspot.
Here a video where you can see the behavior (and also how it was working before the update, AFTER/BEFORE):
https://youtu.be/LWHBBIRt8sQ
First 30-40 seconds is with AC 1.67, the rest is with AC 1.66.7 where you can see how is it suppose to work.

I haven't done anything else than "Import All" from 1.67, re-assigned the managers (and reverted the sprite shader).
But in the new version I've those issues...

Couple of screenshots about Hotspot and NPC follow action:
https://ibb.co/cQFqZCw

Comments

  • UPDATE:
    I played around with the AC 2D Demo and my game... I first imported my player into the Park scene and it was having the same problem (not facing a hotspot after walking to a marker). Then I imported Brain 2D into my scene and using it as my default player, it was working good. So I guess there's something wrong with my player prefab?! But why? Considering that the exactly same prefab worked good on AC 1.66.7 (as per video above). I'll try to make some tests, copying the settings from Brain 2D prefab into my Player and see what's causing the bug (p.s. I sent you my player prefab on a PM couple of days ago, so you can try yourself).

    Regarding the NPC Follow, however, I noticed the problem remains even if I've Brain 2D as a player or NPC (I removed the "Player" component and added a "NPC" one to Brain...). I tried playing around with the "Min/Max Distance" and noticed some weird behavior... Maybe the bug is related with that?

    Will dig more soon...

  • UPDATE2
    I discovered the problem is related with "Retro Style Movement". If I uncheck it, my Player is turning to face the marker direction, even if there are some "sliding" problems that I need to fix (maybe because of some other settings). However, if I check "Retro Style Movement" on Brain, it still works good. So there must be something new on AC 1.67 affecting the "Retro Style Movement" that conflicts with something on my Player (that with AC 1.66.7 was working good).

    Still no luck with the NPC Follow... Can't find a way to fix it yet.

  • UPDATE3
    Seems like I fixed the NPC follow also by playing with the movement parameters (like unchecking "Only move when Sprite Changes" and "Retro style movement"). Probably the conflict was between those parameters and my values of Acceleration/Deceleration, etc... Not sure why though, and not sure why they were working with 1.66.7.

  • Thanks for the details, I'll let you know if I need more.

  • Thank you!
    By the way, I've one more question... something not related with version 1.67, but since we are here...
    As you can notice on the video I posted above, at the very beginning, when I click the NPC hotspot, my interaction icons are "sliding" away from the NPC, due to the scrolling (the NPC scrolls, while the interaction menu follows the camera). The interaction menu is set to appear at cursor and freeze, but is there a way to set it to appear at cursor, freeze and scroll with the rest of the scene rather than staying in front of camera? (for positioning reasons I don't want it to appear on hotspot).
    THANKS!

  • edited March 2019

    No, it can't be both.

    What you can do, however, is set it to position "On Hotspot", and then position the Hotspot's "Centre-point override" as necessary.

    Through scripting, you can reposition the centre-point's transform to be over the mouse cursor when a Hotspot is selected, i.e.:

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using AC;
    
    public class RepositionHotspotCentre : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnHotspotSelect += MySelect;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotSelect -= MySelect;
        }
    
        public void MySelect (Hotspot hotspot)
        {
            Vector3 mousePosition = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, 1f);
            if (hotspot.centrePoint) hotspot.centrePoint.position = Camera.main.ScreenToWorldPoint (mousePosition);
        }
    
    }
    
  • edited March 2019

    Thanks again Chris for your awesome support!
    Ok, so, if I understood you correctly, I should go to each hotspot in my game and assign to the "Centre point override" a new game object that has that script attached, right?

    Like in here: https://ibb.co/5M6qVBH

    Now, I've two questions... can this be done "automatically" or should I manually select all my hotspots and do the procedure? (I assigned it to the 2D Hotspot prefab, but I guess this will be effective for all the new hotspots I'll create next, not the ones already in my game).

    Second question:: I've done as I wrote (assigned manually to a couple of hotsposts in my game) and the thing is working partially... Meaning: the interaction icons are never surrounding correctly the cursor, but always a bit far, non centered, a bit randomly...

    See here how they should be and how they are: https://ibb.co/th841qK

    Maybe is it because of the custom script you helped me with that re-assign the icons based on their number? Here a copy-paste of that script:

    http://pasteall.org/1576543

    Not sure I understood everything perfectly, if I'm doing it wrong and what is causing the "out of center".
    Thanks a lot!

  • I should go to each hotspot in my game and assign to the "Centre point override" a new game object that has that script attached, right?

    No - it need only have a single presence in the scene. Each Hotspot requires a "Centre point override", but the script can go on a single empty GameObject.

    The interaction icons are never surrounding correctly the cursor, but always a bit far, non centered

    The UI will be repositioned by centering it's "RectTransform boundary" (as defined in the Menu's properties panel) over the centre-point override. The elements inside it (which should be children of this) are separate - and need to be arranged such that they're visual centre matches the centre of the RectTransform boundary.

    Check that the RectTransform boundary is being set to the correct position or not. If it is, then check if the elements inside it are correctly positioned. The script is an example - you may have to tweak it to suit your own purposes.

  • The thing is... the icons of my interaction are perfectly centered when "Appear At Cursor and Freeze". But using the new script to override the hotspot center, my interaction menu appears at the wrong position, not centered (around) the cursor. The interaction menu is a Unity Ui Prefab custom made with the script I pasted on my previous message and that you helped me with.

    The problem with the hotspot override is that the positions relative to the cursor, change all the time. Is not that everytime is 10 pixel on the left. Sometime it's very far away, sometime near, sometime over it, etc...

    See this collection: of positions https://ibb.co/LQdD6JS
    (on this example the interaction is just one, but when I've 2, 3 or 4, the problem is the same)
    It looks totally random! Not sure why... maybe some kind of conflict with the custom script for arranging the icons?

  • Again, you need to find out if the RectTransform is correctly centered over the centre-point. What we need to know is if it's the centre-point that's being incorrectly placed or not.

    Try this:

    using UnityEngine;
    using System.Collections;
    using System.Collections.Generic;
    using AC;
    
    public class RepositionHotspotCentre : MonoBehaviour
    {
    
        private void OnEnable ()
        {
            EventManager.OnHotspotSelect += MySelect;
        }
    
        private void OnDisable ()
        {
            EventManager.OnHotspotSelect -= MySelect;
        }
    
        public void MySelect (Hotspot hotspot)
        {
            float zDepth = hotspot.transform.position.z - Camera.main.transform.position.z;
            Vector3 mouseScreenPosition = new Vector3 (Input.mousePosition.x, Input.mousePosition.y, zDepth);
            Vector3 mouseWorldPosition = Camera.main.ScreenToWorldPoint (mouseScreenPosition);
    
            if (hotspot.centrePoint) hotspot.centrePoint.position = mouseWorldPosition;
        }
    
    }
    
  • Dear Chris, I tried the new script but the position problem is exactly the same as explained on my previous comment.
    Maybe I'm misunderstanding what do you mean with "you need to find out if the RectTransform is correctly centered over the centre-point". How can I understand that?! Especially considering everything was perfectly centered before the override?
    This is how it looks on my canvas. The icons are then re-arranged through a script you helped me some weeks ago (that I pasted on my previous comment).

    And here some screenshots for my Unity Prefab Interaction Menu.

    Am I missing something?

  • UPDATE: It seems unrelated with the "Arrange Icons" script, because deactivating it the problem remains.

  • edited April 2019

    How can I understand that?!

    Attach an Image component to your RectTransform and give it a transparent colour. That'll tell you if it's centering over the mouse cursor or not.

    Separately, assign your Menu Manager asset file as Default_MenuManager, and set the Interaction's Source to Unity UI Prefab. Does it centre correctly then?

    Test also your own Menu Manager in the 2D Demo.

  • Ok, well, I assigned a transparent color to the RectTransform and it's not centered. (it is when "Appear on Cursor and Freeze" not when "On Hotspot" plus the override centre script).

    I then set the Menu Manager asset to "Default_MenuManager" (and also Demo2D_MenuManger just to test), the Interacion's Source to Unity UI Prefab (the standard one) and the Position type "On Hotspot", and again, it's not centered...

    I then tested my own Menu Manager in the 2D Demo and it's not working... So I set everything to default, everything as in the 2D Demo (Menu, Settings, Scene, Cursor, etc) and tested your script basically on your basic 2D Demo, and again, not working properly (not centered)... Is it working on your side? Maybe I understood wrongly what to do?!

    I've a simple game object with the script you pasted attached to it. Then I assigned this game object (called CentreOverride) to the CentreOverride of the hotspots (for example "Tree" and "Bench" of your demo), then if I play the game and click on the Bench or Tree, the interaction icons appear all the time in a different wrong position relative to the cursor center...

    I don't know, I feel so ignorant :( Sorry...

  • Create a .unitypackage of your Managers, your Menu's prefab/associated graphics, and a sample scene to test with - and PM it to me.

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.