iTween NullReferenceException from GameObject Instantiation
The error: NullReferenceException: Object reference not set to an instance of an object iTween.RetrieveArgs () (at Assets/Plugins/Pixelplacement/iTween/iTween.cs:6502) iTween.Awake () (at Assets/Plugins/Pixelplacement/iTween/iTween.cs:6250) UnityEngine.Object:Instantiate(GameObject, Transform)
My code:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Tilemaps;
public class TilesetDropShadow : MonoBehaviour
{
public Vector2 shadowOffset = new Vector2(-0.2f, -0.2f);
private GameObject[] Tilesets;
private void Start()
{
Tilesets = new GameObject[transform.childCount];
for(int i = 0; i < transform.childCount; i++)
{
Tilesets[i] = transform.GetChild(i).gameObject;
}
for(int i = 0; i < Tilesets.Length; i++)
{
GameObject shadow = Instantiate(Tilesets[i], Tilesets[i].transform);
shadow.name = "dropShadow";
shadow.transform.Translate(shadowOffset);
shadow.GetComponent<TilemapRenderer>().material = Resources.Load<Material>("DropShadow");
shadow.GetComponent<TilemapRenderer>().sortingOrder = -16;
Destroy(shadow.GetComponent<TilemapCollider2D>());
}
}
}
The error (from what I can tell), is being caused because there's an iTween component on the instantiated GameObject with empty values. What's weird is that I haven't called an iTween upon the object I'm referencing to instantiate. Even in the inspector, it doesn't look to have an iTween on the parent GameObject or the instantiated one. I've tried using iTween.Init and iTween.Stop on the GameObject this script is attached to fix the issue, but it persists. Any help would be appreciated. Thanks!