Quantcast
Channel: Questions in topic: "loops"
Browsing all 184 articles
Browse latest View live
↧

Change array components through loops with 4.6 gui

I have a level select with 50 levels, each of them have 3 stars (sprites) which can be activated, I have put all of the levels (images) in an array and would like to unlock them and give them their...

View Article


How do I stop sound from looping on button press again

I have a simple button script for a two state button, but I'm having trouble trying to figure out how to make the sound stop looping when I press the button again. Here is what my script looks like....

View Article


Make input code execute once on MouseDown

Hey all, I have a small problem i need to make the following Code execute once only on MouseDown but have no idea how to do it if (Input.GetMouseButtonDown (0)) { TileRay = Camera.main.ScreenPointToRay...

View Article

Color[][] is not storing color. Object reference not set to an instance of an...

Hello, I am trying to reverse an image of a texture2D. I have tried many different attempts at this problem to no avail (including, but not limited to: Reverse() of arraylist, mixing jagged arrays, and...

View Article

Using a for loop to generate and populate an array

My end goal is to create a function that takes an integer value and passes it to an array as its length. I need the array to then generate to that length and populate itself with integer value that...

View Article


Lerping & OnCollisionEnter - how do i lerp without update??

Hey Guys, Thankyou for trying to help me out, I have **"Script A"** that is a component on **enemy gameObjects.** Within the script i have a variable that gives myself access to **"Script B"** public...

View Article

trouble with loops - the impossible is happening

Every now and then I come across some problem like this that is just.. completely intractable. I have no explanation for it. I feel like there can be no explanation for it, like it can't be happening....

View Article

Piece of code including foreach loop not working correctly

Everytime I press play, "Distance" is always 0… What am I doing wrong? if (DataValue == CubeManagerGet.GetComponent ().CurrentCube) { TextGet.text = "Coordinates: {" + transform.position.x + ", " +...

View Article


Problem with arrays and while loops

I've set up a grid of cubes with all random colors and am trying to check through them to ensure there are no cubes next to each other and then runs a function to go through and change them if there...

View Article


Inventory System Help

Hi, I'm making a RPG-like game, and I'd like some help on what's going wrong on my inventory system. Right now, it kind of works. What I mean is sometimes it will work fine, but other times it won't at...

View Article

How can I fix my loop steps to the framerate?

Hi, I'm new to Unity so I apologize if my question is posed poorly. I want to use a loop to execute the following until a condition is met: `transform.Translate (Vector3.right * (Time.deltaTime *...

View Article

From a scale from 1 to 10 how bad are loops inside loops

Title says all...

View Article

Why does this loop throw an error if int questComplete rises above 1?

Now I'm definitely still learning about how loops work so it's a bit of voodoo I have to throw into each code, but I can't for the life of me tease out why this script wouldn't work on two or even...

View Article


How to hold information for the split second between running game and...

I've been writing this sick generic stat system which updates all scripts formed by the stats on every editor update. It's based on arrays and lists and some execute in edit mode tomfoolery (not an...

View Article

while stops script after looping 1 time

Hi guys, it seems that my script get stopped, when the while loop dont loop and instead just runs one time. Here's my code: int count = 0; int repetitions = Random.Range(1,4); while(!(count ==...

View Article


Breaking out of the right loop

im trying to only add a card to my hand if it doesnt already exist, this is the code i use: public List playerHand = new List(); public void LoadCards () { Debug.Log("Loading Cards!"); for (int i=0; i...

View Article

Dialogue Skipping Issues?

Hey guys, I created this dialogue script with a simple Branch Dialogue layout of Name, Text and Button Answers. But I'm having issues where it decides to skip a branch and answer it by itself randomly...

View Article


Infinite loop being caused by instantiating through an if statement

This is a hard one and I am having a tough time just formulating the question. Sorry in advance for the bad looking code and for possible noob mistakes, I am mostly self-taught. I'm building a terrain...

View Article

ThreadPooled loops cause lag

I'm writing an A* algorithm to my game, the problem is that the algorithm loop causes lag or is too slow when used in a coroutine (Takes about 0.3-0.5 seconds without any yields, 15-20 seconds with 2...

View Article

How do I make a loop in a C# script?

I want my player to be moving all the time

View Article
Browsing all 184 articles
Browse latest View live


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