Double-tap a key to sprint and to not sprint?
Hello, I am creating a sprinting system and I need help making it so when you double tap the control key, you can sprint automatically without holding it. Then when you press control again once, you...
View Articleif else statement not working???
Everything was working perfectly fine in my project until I changed the condition slightly through the code. Even if i didn't do it right somehow, that's not what it's giving me errors for, but...
View ArticleIt keeps telling me ( error CS1525: Unexpected symbol `else' ) and I can't...
int x=int.Parse(Console.WriteLine("what's the first side? ")); int y=int.Parse(Console.WriteLine("what's the second side?")); int z=int.Parse(Console.WriteLine("what's the third side?")); if (x+y>z...
View ArticleIf else block acts extremely weird
Hello, I've created an if else block. but if condition does not get true, but I'm %100 sure it's true. Is this because encoding of letters? And code enters to if at the first if in foreach loop, I...
View ArticleHow to shift the player to a definite position in the x-axis using key presses?
I am essentially trying to create a subway surfers game for a project. So the plane is divided into three tracks. Left, Middle, Right. If the player is at right, I want to move the player to the middle...
View Articlecheck if my variable is in the same position as the array
Hey guys, I'm developing object inspection script the idea is when I press (E) on the object, the dialog box appears, and take the first string and paste it into the text object in my scene, and if (E)...
View ArticleSo I'm very new at Unity and I tried to improvise the controllers with if...
I tried to use the old Input.GetAxisRaw("Horizontal") and Vertical but it didn't work quite well, my character was teleporting upwards everytime i moved it, so I used this if method and it works, but i...
View ArticleTrigger on collider if another collider is in field of view
I try to trigger a UI on collision with object A, if object B is in sight (of first person player). The collision with object A already works, but I don't know how to implement the combination of...
View ArticleUpdate function doesn't work if conditional statement is present.
Hi, this question is answered many times, but still this is not clear. I am trying to check a condition in update function and subsequently the function will be executed. My code is: using UnityEngine;...
View ArticleControlling the sphere scale depending on CSV file
Hello Everyone, I'm new in Unity and also in C sharp, my task is to control the sphere scale (Or Radius), I have a CSV file of random values like (0~9) I have a hundred rows in the CSV file. I want to...
View ArticleIf/else statement is always else
I was coding more stuff and needed to make an if/else statement. But the statement always evaluates to else. Both variables are set randomly but the contents of redArray are the same every time the...
View ArticleQuestions about the event system in unity.
Good morning all , About the event system in C # and unity: -I currently find it very difficult to assimilate and understand my course on delegates and event systems in C # which is quite complicated...
View Articlewhy is my jump script not working?
So I have this script set up that references another script to sense the character's current power level to check if flying is available instead of jumping, and now I can't jump OR fly. Here it is:...
View ArticleAny way to slim down if/else statements?
Hi! Anyone know a way to slim this code down a bit? Code example below: using System.Collections; using System.Collections.Generic; using UnityEngine; public class AnimationManagement : MonoBehaviour {...
View ArticleI want just animate only one robot when his button is pressed. Problem: that...
using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using Vuforia; public class vb_robotsbuttons : MonoBehaviour, IVirtualButtonEventHandler{ public GameObject...
View ArticleHow ifs work?
Okay, I'm really tired of this damn if statments, 96 out 100 times it wont work -.- . Can please someone explain how if's work? Because here I have an example. In this code the ray of my enemy detects...
View ArticleChange the scale with OnCollisionEnter once
When my player collided with a button"GAMEOBJECT" change the scale to big and the button is actived When i collide again change my player scale to small and the button is disabled. How can i do that?...
View ArticleGameObject return if, else
I am having difficulties creating a GameObject class, basically what I want is for unity to stop throwing errors when the powerUpPrefabs array is empty and ideally print out a debug.log saying that the...
View ArticleWhat's wrong code if-else with tag script ?
Hello I have the right panel and the wrong panel, the panel is used to check whether the object is dragging and dropping in the right slot. but in this code, when I run the wrong panel it always...
View ArticleRaycastHit if/else Problem (bug?)
So, I'm using Raycasts to detect whether something is in front of me. And I have this simple code: if (Physics.Raycast (playerCam.transform.position, playerCam.transform.forward, out hit)) { print...
View Article