Quantcast
Channel: Questions in topic: "invokerepeating"
Browsing all 220 articles
Browse latest View live
↧

destroy a trail made by invoke repeat ?

i made a trail that spawns when an object is shot , but i cant seem to make it "destroy" , basically like angry birds , when u shoot the first chicken it draws a trail , you shoot the second one , it...

View Article


How can I call InvokeRepeating wich can be found in the start function, after...

At he moment Im making a starship game, and I making a boss battle, and when the boss comes I have to stop the InvokeRepeating wich counts the travelled distance. My problem is, when I Cancel the...

View Article


Stop inherited class's function through return;

Hi, thanks in advance. I have a base class with a function similar to public virtual void Function() { if (boolean) { return; } } I have a separate class with the function: public override void...

View Article

2D Limit player speed

Hello I am working on a endless runner.I am using **InvokeRepeating** for **adding speed** to my player but I have problem with it.**I want to limit my max player speed to 20f**. How can I do this?

View Article

How to get function to run every x seconds and then every y seconds?

I have a coroutine that I want to run every 10 seconds, and then every 15 seconds. So that would look like coroutine runs for the first time, 10 seconds later it runs for the second time, 15 seconds...

View Article


How can I call a new class function with InvokeRepeating ?

public class CheckInRange{ public IEnumerator loopCheckInRange(){ timer += 1; Debug.Log (timer); yield return new WaitForSeconds (0.2f); } }...

View Article

(SOLVED) Destroy(gameObject) doesn't destroy the gameObject, only disables...

Hello friends. I'm in the midst of prototyping a game, and I've run into a problem that makes zero sense to me, even after a few hours of working on it. Calling Destroy(gameObject) on the object seems...

View Article

How can I repeat an action after set number of seconds,

To simplify, my player has a flashlight and after a set amount of time the battery percentage should lower by 1%. Since it starts at 100%, after some time -> 99% then 98% and so on. So far, I've...

View Article


Best practise time-based, repeating function calls: InvokeRepeating vs...

I recently started work on a strategy game, which is very similar to games like ANNO, CIVILIZATION and SETTLERS. ---------- For this I had to write a lot of functions which repeat each X seconds, e.g....

View Article


What other ways can i invoke my Function outside of update and start?

I'm creating a script that manages the players stats, and so far i've created a function that works, but if i call it in update it invokes multiple times, i cant put it in start either because it needs...

View Article

InvokeRepeating work only once

Hi everyone, i read some posts here and in other forums but i don't understand how to use InvokeRepeating. public class LightMovements : MonoBehaviour { public Light myLight; private float maxRange =...

View Article

CancelInvoke cant cancell,Updating InvokeRepeating

I don't understand what I am doing wrong, and why, but when I do CancelInvoke inside Update, its still executing, i can still hear the audio, and transformations. using UnityEngine; using Random =...

View Article

Slow down invoke repeating/rigidbody.transform.position?

So I've been working on this movement script for a really long time, remaking it in several different ways, and I have the following code: using System.Collections; using System.Collections.Generic;...

View Article


Need Help with changing skyboxes

I am trying to make an endless runner and I have made 20 Skyboxes. I want them to change every few minutes but for testing's sake, I'm keeping it 5 seconds. I want skyboxes to change in a random...

View Article

Why does Debug.Log continue to execute from Start() and why does...

While trying to figure out why InvokeRepeating() doesn't execute I noticed the line: Debug.Log("Initial moveSpeed: " + moveSpeed); continuously executes. using System.Collections; using...

View Article


Why isn't it switching the fireOn state to true

I want this script to make two objects switch which one is active. The only thing that happens is that it says true in the debug thing. They are both in the same position in game just that `fireOn`...

View Article

Making a spawner adjust its spawnrate over time

I'm trying to make a spawner spawn enemies faster over time. However, I'm having a little difficulty figuring out a repeating method that would speed up at a controlled rate. This was one of my...

View Article


Add force.impulse for objects created using objectpooling,adding impulse...

i am trying to make random objects appear at random places and jump up and fall. when I use the following code , the "added force" is being printed everytime but objects are getting to smaller and...

View Article

I'm having trouble with InvokeRepeating in my 2D game.

When I start the game the variable gets 1+ but that's it. I want it to repeat. Here's the code: using System.Collections; using System.Collections.Generic; using UnityEngine; public class Population :...

View Article

Time intervals of methods not working - 2D Game

Hey, I created a Water/Hunger/Poison and HappinessBar in my 2D top down game. The bars itself work, but I want to update them (not the poison and healthbar, as they are effected bey enemies) and...

View Article
Browsing all 220 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>