:shock: :shock: :shock:
can create or import object with c#?
give us code or something, to know what you do wrong…and you try Instantiate function for that?
thanks
public class Test : MonoBehaviour {
public Ship TheShip = new Ship();
// Use this for initialization
void Start () {
TheShip.Index = 5;
//GameObject player = new GameObject ("Teapot");
GameObject TheObject = GameObject.Find("Teapot");
GameObject InstObject = (GameObject) Instantiate (TheObject,TheObject.transform.position,TheObject.transform.rotation);
}
The code as it is there, minus the commented out code, is as you are meant to work in Unity.
The alternative to Find is to use Unitys strong editor focused way of doing it so add
public GameObject myTeapot;
after your ship definition, assign your teapot or whatever there and then instantiate that object
new is something you will never need to use in relation to MonoBehaviours and only very rarely for gameobjects (when you want to create an empty one)