Forum rules - please read before posting.

Speech + Conversation

Hi, how are you?
I am trying to generate a behavior in a scene of my game and I would like to ask how to achieve it.

In the room there is a TV which has an NPC component and after a USAR interaction it turns on.

When turned on, it starts playing a background actionlist that does the following:

I wait 2 seconds, random between 3 and Play Speech, then repeat.

This works well, the problem is that a little more to the right there is an NPC with which I want to start a conversation and for some reason if the TV is running I receive the following error:

transform.localPosition assign attempt for 'Panel' is not valid. Input localPosition is {NaN, NaN, NaN}.
Menu.cs
line 1171
rectTransform.localPosition = localTargetPositionUI;

If the TV is turned off, the conversation works correctly

Comments

  • It sounds like you have a Menu that relies on Unity UI, yet does not have a "RectTransform boundary" assigned.

    You can find out which Menu it is by entering in the following just above the offending line in Menu.cs:

    if (rectTransform == null) Debug.Log ("No rectTransform found for " + title + ", RuntimeCanvas: " + RuntimeCanvas, RuntimeCanvas);
    
  • edited June 2020

    Hi chris!
    Thanks for your help
    However the Debug line is not firing up... but i found the problem..

    The tv objects has a NPC Behaviour, i use it to positioning the Speech Text over the tv and giving it a red color.

    if i remove the NPC Script from the tv, all is working ok.

    if i turn on the npc script:

    transform.localPosition assign attempt for 'Panel' is not valid. Input localPosition is { NaN, NaN, NaN }.
    UnityEngine.Transform:set_localPosition(Vector3)
    AC.Menu:SetCentre(Vector2, Boolean) (at Assets/AdventureCreator/Scripts/Menu/Menu classes/Menu.cs:1172)
    AC.PlayerMenus:UpdateMenuPosition(Menu, Vector2, Boolean) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:772)
    AC.PlayerMenus:UpdateMenu(Menu, Int32, Boolean, Boolean) (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:989)
    AC.PlayerMenus:UpdateAllMenusAgain() (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:2117)
    AC.PlayerMenus:UpdateAllMenus() (at Assets/AdventureCreator/Scripts/Controls/PlayerMenus.cs:2105)
    AC.StateHandler:Update() (at Assets/AdventureCreator/Scripts/Game engine/StateHandler.cs:232)

    the tv has a animation on it (sprite change) I noticed too that if i have a NPC script on the tv the animation works in the unity editor but if i complile it to android the animation does not play.

    There is any method to positioning the speech dialog above the tv without the npc script?

    Is the problem that i mention before relevant to you and your engine? i can continue testing with you if you like. if not, i can go for a walkaround.

    ** edit ***

    the bug always happen with:

    NPC SCRIPT on and while the tv is playing speechs i try to start a conversation with another.

    Thanks you very much!

  • The new error message is still related to the old - it's to do with your Menu having position issues, most likely your Subtitles menu.

    Specifically, it's an issue with the Unity UI-side of things. If you switch the Source property of your Subtitles menu (or whichever menu is being used to display the TV's speech) back to "Adventure Creator", does the error stop?

    Assuming so, what change have you made to this Menu and its Unity UI prefab from their default values? Is this "TV" NPC displaying speech via his own dedicated menu, or is it the same used by all? Let's see some screens of both the Menu's properties, and the root Canvas object of the UI prefab.

  • Switching the Source property back to "Adventure Creator" does not solve the problem :(

    Maybe it's a problem with the Conversation Menu? because the problem starts when i start a conversation..... if the tv is running and i do a "look at object "that plays a player speech all works fine..

    I'm using the 9-verbs ui dialog prefab, and i did a duplicate of that one for the tv subtitle.

    i did not make any changes to the prefabs.

    here are the screenshots:

    http://www.gauchogames.com/support/subtitle.png
    http://www.gauchogames.com/support/subtitletv.png

    Thanks!!!

  • edited June 2020

    Did you switch the Source option of both menus? The error message doesn't say exactly which menu has the issue.

    It may be the Conversation menu - try changing the Source of that, too.

    Once the error's stopped, revert the Source values one-by-one back to Unity UI Prefab, so that we can isolate which menu specifically is causing the issue. If it's the Conversation menu, did you make any changes to it from the default Nine-verbs template?

  • Ok good news! the problem is solved, it was the conversation menu.

    i changed the position type to manual and transition type to none.

    maybe i changed that options by mistake before.. i don't remember their default values.

    But anyway, thanks for guide me to the solution!

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.