This is my 1st script:
using UnityEngine;
using System.Collections;
using System.Collections.Generic; // List
using UnityEngine.UI;
public class Player : MonoBehaviour
{
public List TrashObject = new List ();
}
my 2nd Script:
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class RangePoint : MonoBehaviour
{
public GameObject myGameObject;
public Transform rangeLocation;
void Start ()
{
RangeToSpawn ();
}
void RangeToSpawn ()
{
TrashEntry trash;
trash = Instantiate (myGameObject, rangeLocation [Random.Range (0, rangeLocation.Length)].position, Quaternion.identity) as TrashEntry;
Player letStoreThis;
letStoreThis = this.GetComponent <Player> ();
letStoreThis.TrashObject.Add (trash);
}
}
// It doesn’t store in a list… and it says that the object that i was trying to instantiate is not set as an instance of object