using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Triangle : MonoBehaviour {
private int places = 0;
// Use this for initialization
void Start () {
// Instantiating places
createPlaces(3);
}
// Update is called once per frame
void Update () {
}
void createPlaces(int places) {
this.places = places;
for (int i = 0; i <= places; i++) {
Instantiate (this);
}
}
So, I’m not sure whats wrong. My intention was to create 3 triangles on the screen. But the game runs on an infinite loop creating the gameObject. Also, I notice many people do not instantiate things by referencing (this). Is there anything wrong with that? Or should I do: Instantiate(gameObject).
Thanks for the help. ![]()