I need help. Here’s my code.
ublic class Rotation02 : MonoBehaviour {public Transform target; public Transform target2;
// Update is called once per frame
void Update () {
if (Input.GetKeyUp(KeyCode.R))
iTween.RotateTo(gameObject,iTween.Hash("rotation",target.position,iTween.EaseType.easeInOutSine,"time",1.3f));
if (Input.GetKeyDown(KeyCode.R))
iTween.RotateTo(gameObject,iTween.Hash("rotation",target2.position,"easetype",iTween.EaseType.easeInOutSine,"time",.9f));
}
}
I can play the scene but when I press R I get an error that says:
NullReferenceException: Object reference not set to an instance of an object
iTween.CleanArgs (System.Collections.Hashtable args) (at Assets/Standard Assets/Scripts/iTween/Plugins/iTween.cs:6745)
iTween.RotateTo (UnityEngine.GameObject target, System.Collections.Hashtable args) (at Assets/Standard Assets/Scripts/iTween/Plugins/iTween.cs:2287)
Rotation02.Update () (at Assets/Standard Assets/Scripts/General Scripts/Rotation02.cs:11)
I get another error that says:
Tween Error: Hash requires an even number of arguments!
UnityEngine.Debug:LogError(Object)
iTween:Hash(Object) (at Assets/Standard Assets/Scripts/iTween/Plugins/iTween.cs:6530)
Rotation02:Update() (at Assets/Standard Assets/Scripts/General Scripts/Rotation02.cs:11)
The game object that has the script just rotates to the side when I press R.
Any input is appreciated.