ddionisio / MateAnimator

Adding more features to the open sourced Animator from Unity.
113 stars 29 forks source link

Error on EventTrack when method is null #18

Closed igrir closed 7 years ago

igrir commented 8 years ago

Hi @ddionisio! It's been a long time :octocat: Just today I realized if I put nothing on GameObject parameter in Event track it would return error. Here's the error I've got

NullReferenceException: Object reference not set to an instance of an object MateAnimator.AMActionMethodCall.Apply (Single t, Boolean backwards) (at Assets/Plugins/MateAnimator/Scripts/Classes/AMActionTween.cs:471) MateAnimator.AMActionTween.DoUpdate (Single p_totElapsed) (at Assets/Plugins/MateAnimator/Scripts/Classes/AMActionTween.cs:92) Holoville.HOTween.Plugins.Core.ABSTweenPlugin.Update (Single p_totElapsed) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Plugins/Core/ABSTweenPlugin.cs:469) Holoville.HOTween.Tweener.Update (Single p_shortElapsed, Boolean p_forceUpdate, Boolean p_isStartupIteration, Boolean p_ignoreCallbacks, Boolean p_ignoreDelay) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:844) Holoville.HOTween.Tweener.GoTo (Single p_time, Boolean p_play, Boolean p_forceUpdate, Boolean p_ignoreCallbacks) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Tweener.cs:951) Holoville.HOTween.Core.ABSTweenComponent.GoTo (Single p_time, Boolean p_forceUpdate) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Core/ABSTweenComponent.cs:659) Holoville.HOTween.Sequence.Update (Single p_shortElapsed, Boolean p_forceUpdate, Boolean p_isStartupIteration, Boolean p_ignoreCallbacks) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Sequence.cs:749) Holoville.HOTween.Core.ABSTweenComponent.Update (Single p_elapsed) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/Core/ABSTweenComponent.cs:954) Holoville.HOTween.HOTween.DoUpdate (UpdateType p_updateType, Single p_elapsed) (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/HOTween.cs:2252) Holoville.HOTween.HOTween.Update () (at D:/DG/_Develop/__UNITY3_CLASSES/_Holoville/__HOTween.Assembly/HOTweenV1/HOTween.cs:734)

ddionisio commented 8 years ago

I'll take a look at it when I get around sometime tonight.

ddionisio commented 8 years ago

I wasn't able to repro with that exact error, but there was another exception if I have a GameObject as null for parameter. I've made it so that it references the actual object of UnityEngine.Object to alleviate that. I've put a null check for method and target object as well, if for some reason its reference is disappearing.

Let me know if that works for you. If it doesn't error out, but you expect an object to be valid, double check if that object during runtime is getting deleted somehow.

tomaszzackiewicz commented 7 years ago

Hello,

I have installed DOTween and MateAnimator, however I get many errors:

Finished compile Library/ScriptAssemblies/Assembly-CSharp.dll
Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs(134,48): error CS0246: The type or namespace name `Vector4Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs Line: 134)

Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs(134,41): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs Line: 134)

Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs(147,48): error CS0246: The type or namespace name `ColorPlugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs Line: 147)

Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs(147,41): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs Line: 147)

Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs(160,48): error CS0246: The type or namespace name `Vector2Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs Line: 160)

Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs(160,41): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs Line: 160)

Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs(173,48): error CS0246: The type or namespace name `Vector2Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs Line: 173)

Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs(173,41): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMMaterialKey.cs Line: 173)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(217,56): error CS0246: The type or namespace name `Vector2Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 217)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(217,49): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 217)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(219,56): error CS0246: The type or namespace name `Vector3Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 219)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(219,49): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 219)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(221,56): error CS0246: The type or namespace name `ColorPlugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 221)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(221,49): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 221)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(225,56): error CS0246: The type or namespace name `Vector4Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 225)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(225,49): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 225)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(243,60): error CS0246: The type or namespace name `Vector2Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 243)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(243,53): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 243)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(245,60): error CS0246: The type or namespace name `Vector3Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 245)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(245,53): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 245)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(247,60): error CS0246: The type or namespace name `ColorPlugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 247)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(247,53): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 247)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(251,60): error CS0246: The type or namespace name `Vector4Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 251)

Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs(251,53): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMPropertyKey.cs Line: 251)

Assets/MateAnimator-master/Scripts/Classes/AMRotationEulerKey.cs(87,48): error CS0246: The type or namespace name `Vector3Plugin' could not be found. Are you missing an assembly reference?

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMRotationEulerKey.cs Line: 87)

Assets/MateAnimator-master/Scripts/Classes/AMRotationEulerKey.cs(87,41): error CS0411: The type arguments for method `DG.Tweening.DOTween.To<T1,T2,TPlugOptions>(DG.Tweening.Plugins.Core.ABSTweenPlugin<T1,T2,TPlugOptions>, DG.Tweening.Core.DOGetter<T1>, DG.Tweening.Core.DOSetter<T1>, T2, float)' cannot be inferred from the usage. Try specifying the type arguments explicitly

(Filename: Assets/MateAnimator-master/Scripts/Classes/AMRotationEulerKey.cs Line: 87)
ddionisio commented 7 years ago

Looks like it has something to do with the compatibility mode (hyper compatible version). Basically instead of Vector3Plugin, it's Vector3WrapperPlugin.

Let me go through and add a compile flag around those places.

So once I'm done, there should be a new define symbol you'll need to add in the player settings DOTWEEN_HYPER_COMPATIBLE

I'll reply here once I check it in.

tomaszzackiewicz commented 7 years ago

Ok, thank you.

ddionisio commented 7 years ago

If you get the latest, you should be able to fix the issue now.

Basically add DOTWEEN_HYPER_COMPATIBLE to Scripting Define Symbols in Edit->Project Settings->Player

tomaszzackiewicz commented 7 years ago

Sorry for late answer, but it doesn't work. It changed nothing. Still the errors.

ddionisio commented 7 years ago

I am assuming you are using DOTween's hyper compatible version.

You have to add the define symbol DOTWEEN_HYPER_COMPATIBLE in the projects settings.

1) In Unity editor, go to the menu Edit->Project Settings->Player 2) In the inspector, go to Other Settings 3) Look for Scripting Define Symbols 4) In Scripting Define Symbols, type in: DOTWEEN_HYPER_COMPATIBLE 5) Once that setting is applied, Unity should recompile and errors should go away.

tomaszzackiewicz commented 7 years ago

Yes, I use DOTween's hyper compatible version. I have done exactly what you said. The same. I would send you a screenshot of my Unity but here it is probably imposible.

ddionisio commented 7 years ago

Check the settings to the platform target you are currently using, ie. Standalone, Android, etc.

Make sure DOTWEEN_HYPER_COMPATIBLE is in the one you have as the active platform target. So if you go to File->Build Settings... Look in the Platform window and the active target is the one with the Unity icon. Check the Player Settings for that.

tomaszzackiewicz commented 7 years ago

Sorry, but all is OK. I use the Standalone in the Build Settings and clicking the Player Settings I will see DOTWEEN_HYPER_COMPATIBLE under Scripting Define Symbols.

Please install the recent Unity and add your code. I would like to know whether you get errors or not.

ddionisio commented 7 years ago

I tried it on 5.5.0f3

Prior to the fix, I was getting the exacts error you were getting. So the latest from the repo should have taken care of it.

Can you create an empty project with the plugins MateAnimator and DOTween in it (the ones you were using in the project with the issue)? I will assume that will give the same errors. Then attach it in your message.

tomaszzackiewicz commented 7 years ago

I have done all from the beginning; DOTween, MateEditor and DOTWEEN_HYPER_COMPATIBLE. The same. Strange thing - when i click Play with the errors, the DOTWEEN_HYPER_COMPATIBLE disappears under Scripting Define Symbols. I have pasted the DOTWEEN_HYPER_COMPATIBLE again and now OK.

image

Do you want my project?

tomaszzackiewicz commented 7 years ago

My fresh project with the errors:

TestTimeline.zip

ddionisio commented 7 years ago

Are you doing anything custom with the code project settings? (Monodevelop or Visual .NET)

Sometimes the code project gets desynced with the project, it should be safe to delete those files (solution files). Just make sure to back up.

Looks like it has something to do with the define symbol not getting added somehow.

If all else fails, add this line at the top of AMPluginFactory.cs:

#define DOTWEEN_HYPER_COMPATIBLE

tomaszzackiewicz commented 7 years ago

Are you doing anything custom with the code project settings? (Monodevelop or Visual .NET).

Not yet. I wish in the future, but the project is clean with default settings.

If all else fails, add this line at the top of AMPluginFactory.cs:

define DOTWEEN_HYPER_COMPATIBLE

Maybe I'm blind but I don't have AMPluginFactory.cs in the project! Have I overlooked something?

ddionisio commented 7 years ago

Ah, I see what's going on now.

You need to get the latest of MateAnimator, you'll know it's the latest if you get the AMPluginFactory.cs

tomaszzackiewicz commented 7 years ago

Ah, I see what's going on now.

You need to get the latest of MateAnimator, you'll know it's the latest if you get the AMPluginFactory.cs

I thought this version is the latest. Where can I get the latest version?

ddionisio commented 7 years ago

Should be in the master branch. If you want to just download it, it should be available in the repo's page via Clone or download

tomaszzackiewicz commented 7 years ago

I downloaded the zip. i have no idea why it is not recent. I will try again tomorrow.

tomaszzackiewicz commented 7 years ago

I have downloaded the zip master again and .. IT WORKS! Thank you. I can add that earlier I downloaded the zip master too and it didn't work.

ddionisio commented 7 years ago

No problem! Glad that worked out.