Avatar fade and TextMesh Pro issue

Posted: 25 Jun 2020 07:10
by Nysalie

Hello all! I'm trying to create a textprinter to reflect my game's design based of off TMProWide's prefab.

I've noticed that the avatar fade effect isn't working properly with TMP elements on the prefab. Switching between TMProWide and Wide you can see that Wide's avatar will fade and TMProWide's will just blip into view as if the fade time where set to 0.

I also tried to clone regular Wide's prefab and replace the text fields with TMP text but simply replacing Dialogue Text's Revealable UI Text script with Revealable TM Pro Text will reproduce this issue. Is there a way to fix this? Could the TMP script be affecting the visibility of the avatar in some unexpected way?

Note: I made sure to check that AuthorImage object has a Canvas Group component for proper opacity manipulation (again, it is set as in the Wide prefab).


Re: Avatar fade and TextMesh Pro issue

Posted: 25 Jun 2020 09:34
by Elringus

Hi, That's actually been recently fixed in v1.11, which is currently in pre-release. You can download the package in Discord's #support channel (via pinned message).


Re: Avatar fade and TextMesh Pro issue

Posted: 25 Jun 2020 11:44
by Nysalie

Oh, sorry to bother then, i don't usually use Discord, I wasn't aware of the fix.

On the subject of TMP, i've also been experiencing some errors, i believe regarding cached materials. Not entirely sure if this requires a new thread but i'll post the error log here just to give you some feedback. Please let me know if I should start a new thread and discuss this further.

The error is not game breaking and there is no noticeable visual bug, it just displays on the console whenever I print text. This happens with either the material that is created when generating the atlas or any material created afterwards and assigned to the object in the editor. (Font materials have the proper RevealableTMProText shader)

Code: Select all

ArgumentNullException: Value cannot be null.
Parameter name: source
UnityEngine.Material..ctor (UnityEngine.Material source) (at <480508088aee40cab70818ff164a29d5>:0)
TMPro.TMP_Text.CreateMaterialInstance (UnityEngine.Material source) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_Text.cs:1481)
TMPro.TextMeshProUGUI.GetMaterial (UnityEngine.Material mat) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:757)
TMPro.TMP_Text.get_fontMaterial () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_Text.cs:185)
TMPro.TextMeshProUGUI.GetMaterials (UnityEngine.Material[] mats) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:788)
TMPro.TMP_Text.get_fontMaterials () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_Text.cs:211)
Naninovel.UI.RevealableTMProText.SetMaterialProperties (UnityEngine.Vector4 lineClipRect, UnityEngine.Vector4 charClipRect, System.Single charFadeWidth, System.Single charSlantAngle) (at Assets/_ThirdParty/Naninovel/Runtime/UI/TextPrinter/RevealableTMProText.cs:180)
Naninovel.UI.RevealableTMProText.Update () (at Assets/_ThirdParty/Naninovel/Runtime/UI/TextPrinter/RevealableTMProText.cs:116)
Naninovel.UI.RevealableTMProText.OnRectTransformDimensionsChange () (at Assets/_ThirdParty/Naninovel/Runtime/UI/TextPrinter/RevealableTMProText.cs:95)
UnityEngine.Object:Instantiate(GameObject)
Naninovel.Engine:Instantiate(GameObject, String, Nullable`1) (at Assets/_ThirdParty/Naninovel/Runtime/Engine/Engine.cs:270)
Naninovel.<InstantiatePrefabAsync>d__29:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/UI/UIManager.cs:122)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder`1:Start(<InstantiatePrefabAsync>d__29&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:279)
Naninovel.UIManager:InstantiatePrefabAsync(GameObject)
Naninovel.<InitializeAsync>d__34:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/Actor/TextPrinter/UITextPrinter.cs:56)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder:Start(<InitializeAsync>d__34&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:131)
Naninovel.UITextPrinter:InitializeAsync()
Naninovel.<ConstructActorAsync>d__29:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/Actor/ActorManager.cs:217)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder`1:Start(<ConstructActorAsync>d__29&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:279)
Naninovel.ActorManager`4:ConstructActorAsync(String)
Naninovel.OrthoActorManager`4:<>n__0(String)
Naninovel.<ConstructActorAsync>d__12:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/Actor/OrthoActorManager.cs:49)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder`1:Start(<ConstructActorAsync>d__12&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:279)
Naninovel.OrthoActorManager`4:ConstructActorAsync(String)
Naninovel.<AddActorAsync>d__17:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/Actor/ActorManager.cs:130)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder`1:Start(<AddActorAsync>d__17&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:279)
Naninovel.ActorManager`4:AddActorAsync(String)
Naninovel.<GetOrAddActorAsync>d__1`4:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/Actor/ActorManagerExtensions.cs:29)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder`1:Start(<GetOrAddActorAsync>d__1`4&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:279)
Naninovel.ActorManagerExtensions:GetOrAddActorAsync(IActorManager`4, String)
Naninovel.Commands.<GetOrAddPrinterAsync>d__13:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/Command/Printer/PrinterCommand.cs:39)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder`1:Start(<GetOrAddPrinterAsync>d__13&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:279)
Naninovel.Commands.PrinterCommand:GetOrAddPrinterAsync()
Naninovel.Commands.<HoldResourcesAsync>d__11:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/Command/Printer/PrinterCommand.cs:20)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder:Start(<HoldResourcesAsync>d__11&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:131)
Naninovel.Commands.PrinterCommand:HoldResourcesAsync()
Naninovel.<>c:<HoldResourcesAsync>b__4_0(IPreloadable) (at Assets/_ThirdParty/Naninovel/Runtime/ScriptPlayer/ScriptPlaylist.cs:61)
System.Linq.SelectEnumerableIterator`2:MoveNext()
UniRx.Async.Internal.ArrayPoolUtil:Materialize(IEnumerable`1) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/Internal/ArrayPoolUtil.cs:67)
UniRx.Async.<WhenAll>d__54:MoveNext() (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/UniTask.WhenAll.cs:41)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder:Start(<WhenAll>d__54&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:131)
UniRx.Async.UniTask:WhenAll(IEnumerable`1)
Naninovel.<HoldResourcesAsync>d__4:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/ScriptPlayer/ScriptPlaylist.cs:61)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder:Start(<HoldResourcesAsync>d__4&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:131)
Naninovel.ScriptPlaylist:HoldResourcesAsync(Int32, Int32)
Naninovel.<PreloadAndPlayAsync>d__99:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/ScriptPlayer/ScriptPlayer.cs:320)
UniRx.Async.CompilerServices.AsyncUniTaskMethodBuilder:Start(<PreloadAndPlayAsync>d__99&) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/AsyncUniTaskMethodBuilder.cs:131)
Naninovel.ScriptPlayer:PreloadAndPlayAsync(String, Int32, Int32, String)
Naninovel.UI.TitleNewGameButton:<StartNewGameAsync>b__7_0() (at Assets/_ThirdParty/Naninovel/Runtime/UI/TitleUI/TitleNewGameButton.cs:47)
Naninovel.<ResetStateAsync>d__71:MoveNext() (at Assets/_ThirdParty/Naninovel/Runtime/State/StateManager.cs:204)
UniRx.Async.CompilerServices.MoveNextRunner`1:Run() (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/CompilerServices/MoveNextRunner.cs:18)
UniRx.Async.Internal.FuncExtensions:Invoke(Action, AsyncOperation) (at Assets/_ThirdParty/Naninovel/ThirdParty/UniTask/UniRx.Async/Internal/Hack.cs:18)
UnityEngine.AsyncOperation:InvokeCompletionEvent()

Lastly, since this is my introductory thread on the forum let me congratulate you on the framework, it is a monumental work and I hope that lot more users will use it in the future.


Re: Avatar fade and TextMesh Pro issue

Posted: 25 Jun 2020 12:18
by Elringus

The cached material thing is actually a TMPro issue. It's usually solved by deleting game object, that is automatically created under the game object with TMPro text component and re-saving the prefab. Deleting Library folder under project directory could also help.

I'm glad you like Naninovel! Feel free to get in touch (here or on Discord), in case you'll have other questions or suggestions.


Re: Avatar fade and TextMesh Pro issue

Posted: 25 Jun 2020 13:59
by Nysalie

Wonderful, thank you once again for the help. I'll try your solutions. This is not a disruptive error, just a minor nuisance but it gets a bit annoying seeing the red messages.