Problem with getting colliding objects
Hello, I have a mine which damages in a radius. When I click a button the mine explodes and I have to check what is colliding with the mine radius. I tried making a Primitive.Sphere with the radius of...
View ArticleCamera follow script not following player?
Okay, I have a player prefab ready to go, and I have another script attached to the camera that instantiates that prefab in the Start function at the beginning of the game. Then, once the camera follow...
View ArticleHelp on selecting and unselecting a gameobject?
Hi! I need help. I want my gameobject to be unselected if another gameobject is selected. I have tried doing this with raycast but it isn't working. Any advice? Note: I am new to javascript Here is my...
View ArticleFPS Respawn Script Not Working
Whenever my player dies a respawn button appears however does nothing when pressed CODE: //IMPORTANT NOTE! THIS SCRIPT WAS MADE IN VIDEO NUMBER 21! Check out RespawnMenu to use the old one. #pragma...
View Article2d Movement Messes up when cube is rotatated
Hello unity members, I am in the process of making a 2d game. I have made a small script for movement #pragma strict var speed : float = 20; function Start () { } function Update () {...
View ArticleWorldToScreenPoint conversion inconsistent
I've gotten the camera to follow my player pretty well. When the players position is past the half way height of the screen, the camera locks to the player. Otherwise the camera is locked to the player...
View ArticleWhy doesn't OnTriggerEnter2D get called?
I just started using the 2D tools in Unity but this behavior seems a little odd: I have two sprites with (for testing purposes) each a Box Collider 2D on them, both set to isTrigger. One has a script...
View ArticleHow to refer to run a "void" in one c# script from another to respawn a player
Hello and thank you for reading my question. I have one script called health which refers to the health of the character with the section public void Die (). I have another script called NetworkManager...
View ArticleElse if / to switch
Hello. Can you update this code to switch or smth else. Thanks if(col.tag == "Enemy") { col.gameObject.GetComponent().Hurt(Damage); //Destroy Projectile Destroy(gameObject); } else if(col.tag ==...
View ArticleUnity asset store tools error asset bundles
I created an animation system to publish on the asset store, and submitted it, and then i logged in to the publisher login on the unity website, clicked on pending and saw this. It all seems right, but...
View ArticleRaycasting in a 2D side scrolling shooter
Ive been attempting to make a 2D side scrolling shooter. Howeverm=, i cant seem to get any kind of raycasting to work with 2D colliders. Ive been told to try linecast but i do believe that they cannot...
View ArticleOnTriggerEnter2D not detecting.
I have a player sprite set up that shoots a projectile, I created a new sprite for a enemy which I then wanted to be destroyed upon collision with the projectile... basic stuff. The projectile nor the...
View ArticleNot allowed create MonoBehaviour using new keyword
Right now I have a simple weapon select. In the class WeaponSlot, I have a getSlotNumber method to return the currently selected weapon slot. How can I return this from another script? I want to have...
View ArticleRespawn Wont Work
hello, I am trying to make it so that when my player dies you press the R button and it respawns at the beginning position. I have tried the following code and whenever I die and try and respawn it...
View ArticleFaults with Grid-Based movement...
I have a few uncertainties here. I basically achieved the basics of moving the object by 1 when one of the directional keys are pressed, and it works fine. However, I also wanted the "Q" (left) and "E"...
View ArticleTextures and lights bugging out
Hey guys, I'm having an issue with my project, I recently purchased an asset from the asset store, imported it, etc etc. It gave me an error, which i fixed by re importing Image effects (PRO Only) ,...
View ArticleC# 2D Array of Class : why Class variables can't be changed?
Hy Everyone, I get mad about a problem I have. I've created a public Class called "BlockIDClass" with several variables. using UnityEngine; using System.Collections; [System.Serializable] public class...
View ArticleDetecting multiples of 2
As the Title say's. Is their a way to test a Int variables to see if it is a multiple of 2 or any number? So say i was testing 4, it would return true. Or if it was 89, it would return False.
View ArticleSmooth rotation...
My character rotates 90° to the left when the Q key is pressed, and vice versa when the E key is pressed. However, this happens instantly without smooth movement. I saw lots of questions, but they were...
View ArticleHow to get an object's direction relative to the camera?
I only know how to do it when the camera's Y rotation is set to 0. This's what I did: void GetDirection () { float headingAngle = transform.rotation.eulerAngles.y; if (headingAngle > 315 ||...
View Article