Closed beuzel closed 1 week ago
Hi, thanks for the bug report.
The TestScene in the Tests folder is not meant to be opened manually; it's just a scene that can be reused for TMPEffect's unit tests. For an example scene that gives you an overview of TMPEffects, you can import that through the package manager.
Im still interested in seeing what causes this error, but I didnt manage to reproduce it. If you could clear these things up for me:
Thanks for the fast answer.
I used Scoped OpenUPM to install TMPEffects.
I double clicked on Packages/com.luca3317.tmpeffects/Resources/TMPEffects Required Resources.unitypackage to install the resources. This created the folder Assets/TMPEffects/Resources inside the project.
I send you the whole project. No panic, it is only 1.8 MB: Test_OpenUPM2.zip
Open the TestScene, click game object TMPContainer, in inspector in component TMP Animator open Animations and assign the asset DefaultAnimationDatabase on it. Click on the plus icon to add an animation. The error appears.
In my game project the same error appears more often, but I have plenty of other assets installed.
Click on the plus icon to add an animation.
By that do you mean open up the DefaultAnimationDatabase asset and add an animation to the BasicAnimationDatabase entry?
If so, I did do that and did not get any error 🤔 Im running the project in 2022.3.7f1 for the record, so that could potentially be the issue.
I meant in this component in the reorderable list "Scene Animations" there is in the bottom right a button labeled "+" to add elements. (I thought that this list is a way to apply animations, but after reading the full documentation I think it is a definition of animations to be used. Using tags in text is nice but impractical for me to communicate to translators and to maintain consistency for dozens of languages.)
A test with slightly older Unity 2022.2.21f1 with TMPEffects cloned from this git repo shows no errors. So the error was caused by updates from Unity.
I thought that this list is a way to apply animations, but after reading the full documentation I think it is a definition of animations to be used.
Yeah, SceneAnimations are a special type of animation that derive from MonoBehavior, to allow you to more easily reference scene objects. The list on the TMPAnimator registers them as usable tags.
Using tags in text is nice but impractical for me to communicate to translators and to maintain consistency for dozens of languages.
I see, can you elaborate on what system you were hoping for?
Im planning to implement a field "default animations" to TMPAnimator and its inspector, analogue to the current "default show / hide animations" fields. That'll allow you to set animations that will be applied to the entire text without the need of any tags in the text.
Does that solve the issue youre facing? If not let me know, otherwise Ill close this issue once I implemented the new field (so likely next weekend).
Yes, that would be very helpful. Thanks!
Hey just pushed this to main. You can now set default animations, show animations and hide animations from the inspector. I will probably add support for directly setting TMPAnimation ScriptableObjects alternatively to tag strings.
Describe the bug Error in Unity Editor when accessing/using AnimationDatabases
To Reproduce Steps to reproduce the behavior:
Expected behavior No errors
Screenshots
Desktop
Additional context The TMPWriter works as expected, I think. The preview and runtime works. The TMPAnimator does not work. Preview and runtime have no effect. The error log from the console:
TargetParameterCountException: Number of parameters specified does not match the expected number. System.Reflection.RuntimeMethodInfo.ConvertValues (System.Reflection.Binder binder, System.Object[] args, System.Reflection.ParameterInfo[] pinfo, System.Globalization.CultureInfo culture, System.Reflection.BindingFlags invokeAttr) (at <467a840a914a47078e4ae9b0b1e8779e>:0) System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <467a840a914a47078e4ae9b0b1e8779e>:0) System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at <467a840a914a47078e4ae9b0b1e8779e>:0) TMPEffects.SerializedCollections.Editor.SCEditorUtility.HasDrawerForType (System.Type type) (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/Utility/SCEditorUtility.cs:101) TMPEffects.SerializedCollections.Editor.SerializedDictionaryInstanceDrawer.CreateDisplaySettings (UnityEditor.SerializedProperty property, System.Type type) (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/SerializedDictionaryInstanceDrawer.cs:277) TMPEffects.SerializedCollections.Editor.SerializedDictionaryInstanceDrawer.gInitializeSettings|49_0 (System.Boolean fieldFlag) (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/SerializedDictionaryInstanceDrawer.cs:170)
TMPEffects.SerializedCollections.Editor.SerializedDictionaryInstanceDrawer.InitializeSettingsIfNeeded () (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/SerializedDictionaryInstanceDrawer.cs:179)
TMPEffects.SerializedCollections.Editor.SerializedDictionaryInstanceDrawer.UpdateAfterInput () (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/SerializedDictionaryInstanceDrawer.cs:156)
TMPEffects.SerializedCollections.Editor.SerializedDictionaryInstanceDrawer.OnDrawHeader (UnityEngine.Rect rect) (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/SerializedDictionaryInstanceDrawer.cs:325)
UnityEditorInternal.ReorderableList.DoListHeader (UnityEngine.Rect headerRect) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
UnityEditorInternal.ReorderableList.DoList (UnityEngine.Rect rect, UnityEngine.Rect visibleRect) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
UnityEditorInternal.ReorderableList.DoList (UnityEngine.Rect rect) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
TMPEffects.SerializedCollections.Editor.SerializedDictionaryInstanceDrawer.DoList (UnityEngine.Rect position) (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/SerializedDictionaryInstanceDrawer.cs:121)
TMPEffects.SerializedCollections.Editor.SerializedDictionaryInstanceDrawer.OnGUI (UnityEngine.Rect position, UnityEngine.GUIContent label) (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/SerializedDictionaryInstanceDrawer.cs:103)
TMPEffects.SerializedCollections.Editor.SerializedObservableDictionaryDrawer.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Runtime/SerializedDictionary/Editor/Scripts/SerializedObservableDictionaryDrawer.cs:44)
UnityEditor.PropertyDrawer.OnGUISafe (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.Rect visibleArea) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
UnityEditor.PropertyHandler.OnGUI (UnityEngine.Rect position, UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
UnityEditor.PropertyHandler.OnGUILayout (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUIContent label, System.Boolean includeChildren, UnityEngine.GUILayoutOption[] options) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
UnityEditor.EditorGUILayout.PropertyField (UnityEditor.SerializedProperty property, UnityEngine.GUILayoutOption[] options) (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
TMPEffects.Editor.TMPAnimatorEditor.DrawDatabase () (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Editor/TMPAnimatorEditor.cs:235)
TMPEffects.Editor.TMPAnimatorEditor.DrawAnimationsFoldout () (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Editor/TMPAnimatorEditor.cs:177)
TMPEffects.Editor.TMPAnimatorEditor.RepaintInspector () (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Editor/TMPAnimatorEditor.cs:445)
TMPEffects.Editor.TMPAnimatorEditor.OnInspectorGUI () (at ./Library/PackageCache/com.luca3317.tmpeffects@0.1.2/Editor/TMPAnimatorEditor.cs:477)
UnityEditor.UIElements.InspectorElement+<>c__DisplayClass72_0.b 0 () (at <999670adb4c84ac4bad3ce4f6391c9c9>:0)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)