@ -243,6 +243,8 @@ namespace Fungus
// try to find the character param first, since we need to get its portrait
// try to find the character param first, since we need to get its portrait
int characterIndex = - 1 ;
int characterIndex = - 1 ;
int characterParamIndexPartial = characterIndex ;
Character partialCharacter = null ;
if ( characters = = null )
if ( characters = = null )
{
{
PopulateCharacterCache ( ) ;
PopulateCharacterCache ( ) ;
@ -252,15 +254,30 @@ namespace Fungus
{
{
for ( int j = 0 ; j < characters . Length ; j + + )
for ( int j = 0 ; j < characters . Length ; j + + )
{
{
if ( characters [ j ] . NameStartsWit h ( sayParams [ i ] ) )
if ( characters [ j ] . NameMatc h ( sayParams [ i ] ) )
{
{
characterIndex = i ;
characterIndex = i ;
item . Character = characters [ j ] ;
item . Character = characters [ j ] ;
break ;
break ;
}
}
else if ( characters [ j ] . NameStartsWith ( sayParams [ i ] ) )
{
characterParamIndexPartial = i ;
partialCharacter = characters [ j ] ;
}
}
}
}
}
//if still no charcter was found but we found a partial we use it for backcompat but warn user
if ( item . Character = = null & & partialCharacter ! = null )
{
Debug . LogWarning ( "Conversation Manager Character Partial Match; found '" + sayParams [ characterParamIndexPartial ] +
"' and will use " + partialCharacter . NameText + "\n Recommend modifying conversation and characters so they match exactly." ) ;
characterIndex = characterParamIndexPartial ;
item . Character = partialCharacter ;
}
// Assume last used character if none is specified now
// Assume last used character if none is specified now
if ( item . Character = = null )
if ( item . Character = = null )
{
{