D
D
DANICH702021-03-08 17:56:32
Unity
DANICH70, 2021-03-08 17:56:32

Why doesn't it spawn?

Why doesn't it spawn?

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class RandomNumber : MonoBehaviour
{
    private float textimer;
    public float time = 3f;
    public GameObject[] govno;



    // Start is called before the first frame update
    void Start()
    {
        textimer += Time.deltaTime;
        if (textimer >= time)
        {
            Instantiate(govno[0]);
        }



    }

    // Update is called once per frame
    void Update()
    {
        
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
GavriKos, 2021-03-08
@DANICH70

Because Start is called once. And when it is called textimer, well, it certainly won’t work out more than 3

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question