'm trying to instantiate an object that I imported from blender (and a prefab the same file), but, I'm getting the error
The object you want to instantiate is NULL.
I can set the game object via GUI but I'd like to know how to set it via C#. The gameobject I created in blender is called Sphere.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Create_Planet : MonoBehaviour {
public GameObject planet;
// Use this for initialization
void Start () {
planet = Resources.Load("Sphere") as GameObject;
}
// Update is called once per frame
void Update () {
if (Input.GetKeyDown(KeyCode.Space)) {
Instantiate(planet, new Vector3(0, 0, 0), Quaternion.identity);
Debug.Log("spcae");
}
}
}