简体   繁体   English

unity5-iTween空参考

[英]unity5 - iTween Null Reference

I use iTween a lot and it was OK for most of the time until yesterday, I am getting and error suddenly: iTween使用iTween ,直到昨天大部分时间都是可以的,突然出现错误:

NullReferenceException: Object reference not set to an instance of an object iTween.RetrieveArgs () (at Assets/Plugins/Pixelplacement/iTween/iTween.cs:6811) iTween.Awake () (at Assets/Plugins/Pixelplacement/iTween/iTween.cs:6559) UnityEngine.Object:Instantiate(Object, Vector3, Quaternion)

Initially every time I start the game I get 320 calls of these errors but later it accumulates to 720 and now 999+. 最初,每次我启动游戏时,都会收到320个关于这些错误的调用,但后来累积到720,现在是999+。 I am not sure why it accumulate even though I start the game from scratch all together. 即使我从头开始玩游戏,我也不确定为什么它会累积。 Any suggestion? 有什么建议吗?

UPDATE: 更新:

To an extend, I believe it is due to Sourcetree that I use for version control. 作为扩展,我认为这是由于我使用Sourcetree进行版本控制的Sourcetree I believe it somehow mess up the meta file or make unity have some sort of conflict internally while looking at iTween.cs . 我认为在查看iTween.cs它会以某种方式弄乱元文件或使内部团结产生某种冲突。

I had the exact same error. 我有完全一样的错误。 I found out that by some bug in iTween it had dynamically added multiple iTween script components to one of my prefabs. 我发现由于iTween中的一些错误,它已将多个iTween脚本组件动态添加到我的一个预制件中。 As soon as I removed them, my errors disappeared. 一旦删除它们,我的错误就消失了。

I suggest you go through your prefabs 我建议你遍历预制

The order of script execution in Unity could be the problem. 在Unity中脚本执行的顺序可能是问题所在。 I had this problem days ago and the solution was to go to 几天前我遇到了这个问题,解决方法是

Edit -> Project Settings -> Script Execution Order 编辑 -> 项目设置 -> 脚本执行顺序

then put the script that is been accessed from iTween.cs:6559 to run first. 然后将从iTween.cs:6559访问的脚本放在第一位。 I was getting the same error randomly but they longer appear once I did it. 我随机遇到相同的错误,但是一旦执行,它们就会再出现。 Hopefully that will solve your problem. 希望能解决您的问题。

I am not sure whether I had the same reason for the bug but this is how I solved it. 我不确定我是否有相同的错误原因,但这就是我解决问题的方式。

The objects I was running the itween on, were in the scene. 我正在其上运行其间的对象在场景中。 When I made sure that the references I was using to invoke new instances were from a prefab and not references to objects in the scene - it worked. 当我确定用来调用新实例的引用来自预制件而不是场景中对象的引用时,它就起作用了。

Awake函数中,iTween.Init(应用其间的每个对象),如PixelPlacement所述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM