#Dialogue system debug

1 messages · Page 1 of 1 (latest)

karmic compass
#

The prefabs is actif in default and the parent is actived before I place it as childen during runtime.

I load a prefabs characterFrame (gameobject) that contain Image and animator from the addressable
then I load a sprite and a clip from the addressable before applying it on the characterFrame that I loaded previously
but the clip can't be played on a inactif gameobject.
The code used during the dialogue (not all but where the problem may come)
https://paste.mod.gg/zccqriqytrfb/3

Thanks for the help

spark briar
#

What's the actual problem, not being able to play clips on an inactive object?

karmic compass
#

I logged all the process and everything seem fine

spark briar
#

have you used a debugger yet to check what happens?

karmic compass
#

I know unity debug + vs

spark briar
#

like the one in your ide?

karmic compass
#

this one ?

karmic compass
#

yeah the debug

#

with break point

#

but I still can't figure out why it doesn't work or where

spark briar
#

then you didnt do it properly 😐

#

The point is to check and see if it does you want or expect

#

If it does not then you check specifically WHY

#

what should actually happen in this class because HandleTags() appears to essentially break down strings that hold this data (bad design) and then assign bits to some object elsewhere that requires these strings to be in the correct order (also bad design)

#

bascially you invented a shit way to store data

#

use a scriptable object instead or parse json/xml/yaml or anything else

karmic compass
#

oh i see

#

i followed a tuto so well

#

I will change it later

spark briar
#

pretty bad tutorial good god

#

If you want to use something like this you should at least parse it ahead of time so you have objects grouping stuff together

karmic compass
#

oh

#

effectively, it is easier to use than reading only tag

spark briar
#

much nicer to loop over a collection of objects with the data already usable

#

yea this system is bizzarre and overly complex for no good reason

#

scriptable objects make the most sense here as you can use AssetReference to assign addressable assets easily
Or use some json with the addresses:

{
  "id": "foobar",
  "icon": "Icons[foobar]"
}
karmic compass
#

but i read tag in ink file , can I still use it ?

spark briar
#

Oh right, then perhaps you should have the tags refer to better stored data as soon as possible
e.g. uses a id used to look up rest of data elsewhere
uses id of "emotion" to look up sprite elsewhere

#

instead of putting raw addresses in the tags

karmic compass
#

tag ?

spark briar
#

your tag rn has an address in the string right?

karmic compass
#

yeah

spark briar
#

You could specify a character and some state in the ink files e.g. joe:angry. You can then use this to look up joes data and the correct sprite.

#

You system currently seems to need a certain tag to show up first to even load something which seems bad

case ADDRESSABLE_TAG:
    currentObj = await _dialogueSceneObjectHandler.LoadCharacter(tagValue);
    break;
karmic compass
#

Yeah i just see it

#

oh

#

I can do like you said joe:angry then split it and use joe to find if it is loaded then get the sprite angry and apply it. so event if I don't have addresse tag, I can still change the character expression

#

i was so idiot

spark briar
#

yea you are free to then change what "angry" is for all dialog later with greater ease

#

id avoid having addresses in the ink files so then its easier to modify that data elsewhere

karmic compass
#

and it make overall less tag to be managed

spark briar
#

but see how this goes

karmic compass
#

or just the adress

#

this ?

spark briar
#

if you have a scriptable object that holds the data you solve that issue:

[System.Serializable]
public class CharacterSprite
{
  public string name;
  public AssetReferenceSprite sprite;
}

[CreateAssetMenu]
public class CharacterData : ScriptableObject
{
  public string id;
  public string name;
  public List<CharacterSprite> sprites;
}
#

Do remember btw you can change the address of anything to be simpler instead of being a long ass file path

karmic compass
#

Like moving the file

spark briar
#

well if you have lots of ink files using that long address yea you screwed yourself

#

no if it has a custom address then its location in project doesnt matter

karmic compass
#

oh

#

i will get a lot of CharacterData eh, I like it

#

it make so easier the like of GD

spark briar
#

if you prefer you can change CharacterSprite to hold a Sprite reference directly

karmic compass
#

thx, i was thinking about this

#

then let me do the change and see if it help to resolve the problem

spark briar
#

Ideally it simplifies how this is set up so in the ink files its easier to configure it all

karmic compass