how to access a specific instance of a script
**hello. i have a script that a button uses to start a function on my gun script that buys ammo. problem is that i have multiple instances of my gunscript on the same camera so when i use sendmessage...
View ArticleHow can I locally play audio over a network without rapid RPC calls?
I'm currently working on a FPS game. I had audio working quite well on single player for my rifle (fires about every .1 second), but then I started using RPC calls for other players to hear the audio...
View ArticleReload clips on Gun-script not applied properly
I'm trying to make my gun script reload similar to that of current FPS in which if a player shoots 1 bullet and the player reloads the gun then it will reload the gun to the full clip amount and take...
View ArticleHow to send a raycast to an object to give me ammo?
Hello, so I have a ammo pack that I has a script which holds a variable. I want to be able to detect the ammo packs from a certain distance, send a message to it telling it to give ammo to my gun. I...
View ArticleHow to prevent my Gravity gun from picking up nothing
My gravity gun code currently has a bug in which if the player right clicks on nothing then it will try to pick it up and allow you to drop it as well, but as soon as you try to pick up something else...
View ArticleAllow picked up object to collide with game level GameObjects
I'm currently producing a gravity gun similar to that in half life in C#. The player right clicks on an object to pick it up and it will make itself a child of an GameObject which will act as the state...
View ArticleBullets aren't firing / Bullet holes not instantiating correctly
I've been trying to make my bullets shoot out of my gun however I've run into a couple of problems. These being when I shoot the bullet it instantiates it but the bullet just stays in 1 position and...
View ArticleHow do I get Single ammo reloading to work?
I'm trying to make my gun script reload similar to that of current FPS in which if a player shoots 1 bullet and the player reloads the gun then it will reload the gun to the full clip amount and take...
View ArticleC# Weapon Manager HELP!
So i have a "gun" script i have made for my guns(C#): using UnityEngine; using System.Collections; using System.Collections.Generic; public class WeaponMan : MonoBehaviour { public GameObject Weapon1;...
View ArticleAnimation conversion failed
Hello,I update to unity 5 and ever since i upgraded i been have animation problems but this one animation is really messing up bad i cant finish my game if i don't fix this my zombie arms are twisting...
View ArticleGun Random Rotation
Hi i'm making a game with Unity (https://www.youtube.com/channel/UCWrC78PXS3Frrp1Sk9TSp7A go here to see the game) and i want to simulate gun inaccuracy by randomly rotating it. The problem is that it...
View ArticleTrying to Make an Animation Work in Unity 5
I want to be able to hold right click to activate an animation (in this case, holding a gun up to the camera), play the last frame of the animation (so the gun stays there), then once right click stops...
View Articleif-statement not executing?
Hello! The follow script is a modified version of another gun I made. The other gun works just perfect, but this gun script just won't let me reload. (NOTE: if-statement in the 'Reload' function!)...
View ArticleError CS0103, The name GetComponet does not exist in the current context.
So, I'm making a script for my animation controller to transition from idle to shooting but it's giving me that error and I am not sure why. using UnityEngine; using System.Collections; public class...
View ArticleRaycast hits player when looking down
Hi, I made a few weapons in my game that use raycasting, blah blah, particles and a bulletshole spawn where the raycast hits. But there's a problem that I can't seem to fix. As you can see in the video...
View ArticleGoing crazy over simple bullets not instantiating in the correct position
I made a simple shooting script which will spawn a bullet prefab in the position and rotation of a bullet emitter which is infront of my gun object and is a child of my gun object. The issue I am...
View ArticleGun recoil?
Hello, for the past 4 days now I've tried to make recoil for my guns, but I just cannot figure out a good way to do it. I've searched the unity forum, unity answers, and YouTube for recoil...
View ArticleDamage Dropoff
How can i make my gun have damage dropoff (it does more damage when close than when at a distance) my game is in 2d and i use c#
View ArticleHaving trouble changing guns through instancing
using UnityEngine; using System.Collections; public class PlayerWeapons : MonoBehaviour { public GameObject[] Weapon; private int nextGun; void Start() { // Select the first weapon SelectWeapon(0); }...
View ArticleFiring a bullet doesn't work properly in the bottom half of the screen
I'm using a raycast to guide a bullet trajectory, and it works really well in the top half of the screen. But anything below that fires straight out for some reason. Here is my code: if...
View Article