Quantcast
Channel: Latest Questions on Unity Answers
Browsing all 171066 articles
Browse latest View live

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 Article


Camera 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 Article


Help 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 Article

FPS 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 Article

2d 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 Article


WorldToScreenPoint 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 Article

Why 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 Article

How 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 Article


Else 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 Article


Unity 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 Article

Raycasting 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 Article

OnTriggerEnter2D 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 Article

Not 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 Article


Respawn 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 Article

Faults 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 Article


Textures 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 Article

C# 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 Article


Detecting 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 Article

Smooth 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 Article

How 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
Browsing all 171066 articles
Browse latest View live


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