Added: 2 years ago
From: infiniteammoinc
Views: 54,922
Sort by time | Sort by thread (beta)

Link to this comment:

Share to:

All Comments (171)

Sign In or Sign Up now to post a comment!
  • Great video, it really helped me out. Thank you.

  • Very helpful, but I was wondering how am I supposed to learn what and what not is supposed to be capitalized and what to put in brackets etc. ? Or will this just be learnt over a long time after using it for a while?

  • How could someone dislike this? Your tutorials are an amazing help, thank you so much guy

  • hey i was wondering if you could make a tutorial on creating a timer function so that when time runs out the game ends

    Thanks!

  • wow... that's just amazing ... you are like god... created something out of nothing...

  • thank you so much. How can i rescale the fireball's flame so it is not reaching the top of the skybox? I need to reduce it.

  • Hi there, thanks for your video it helps me alot. I just have 1 issue tho, when my main camera 'shoots' capsules, the capsules arent falling down cause of the gravity. They just stay at the place where they were created. I've checked the gravity options in the Project settings, everything looks fine.. Any tips?

  • @contak1212 I just had to add the Rigidbody component from the menu. Got it :)

  • Where do I attach the shoot script? I have my scene and character with fireballs. Do I attach it to the fireball prefab or do I attach it to my character's hand?

  • @talentedguy30 you must have your object (that you want it to shoot) selected (in your case your char's hand) and drag the script on it. As seen at 5:37.

  • @contak1212 I am fed up with this thing now. I always get errors even when i do exactly as you said Could you please create the shoot script for me? for the prefab I put prefabfireball and i have a spawnpoint called Spawn and I placed the fireball prefab with the shoot script. Unity is suppose to be easy on the begiinners.

  • @talentedguy30 Hope it helps

    var prefabBullet:Transform;

    var shootForce:float;

    function Update () { if(Input.GetButtonDown("Jump")­) { var instanceBullet = Instantiate(prefabBullet, transform.position, Quaternion.identity); print(instanceBullet); instanceBullet.rigidbody.AddFo­rce(transform.forward * shootForce); }

    }

  • how do i Duplicate? and snap to create? im pressing alot of buttons and nowt happening lol

  • @RobbieDee2k12 it's pretty easy once you know it !

    to duplicate you have to do : ctrl + D, it will duplicate at the same spot.

    to snap you have to hold the ctrl button while moving your object.

    Hope it helps!

  • I have this error in line 8- UCE0001: ';' expected. Insert a semicolon at the end.

    Can anyone tell me whats wrong?

    var prefabBullet:Transform;

    var shootForce:float;

    function Update ()

    { if(Input.GetButtonDown("Jump")­) { var instanceBullet - Instantiate(perfabBullet, transform.position, Quaternion.identity); instanceBullet.rigidbody.AddFo­rce(transform.forward * shootForce); }

    }

  • Unity 3.5.0 problem:

    The variable prefabBullet of 'Shoot' has not been assigned.

    here is my script:

    var prefabBullet:Transform;

    function Update () { if(Input.GetButtonDown("Jump")­) { var instanceBullet = Instantiate(prefabBullet, transform.position,

    Quaternion.identity); }

    }

  • @11horsepower umight need to make sure your objects name match

  • @robin7ray I fixed it, but thanks though.

  • Thank you, solved my problem...

  • Thank you, solved my problem...

  • Thank you, solved my problem...

  • This is truly amazing tutorial, So grateful of you !

  • i am actually entertained by this game. :D

  • can you do a tutorial as a continuation on this, like a script on how to remove the bullets for the game.

  • Comment removed

  • infiniteammoinc, how can you make it have a weapon for a FPS?

  • please help i put in all the right stuff at 5:37 mins but it keeps saying expected semi-colon at the end ive deleted the script several times and redone but the same thing keeps coming up can anyone help me?

  • sorry im new to this, how do i make it a left click instead of jump?

  • @CALVINATOR97 Fire1 is left click, otherwise make your own input using mouse 0 as the positive

  • @AceOfSeven thanks man :)

  • Comment removed

  • dude !! i'm dreaming..

  • When i go into unity i can only see the floor grid, nothing else, no textures on anything.. :i could someone help me ?

    

  • Excellent tutorials, well paced and good level of detail, thanks a lot. One question though... Doing this in C#,

    GameObject instanceBullet = (GameObject)Instantiate(prefab­Bullet, transform.position, Quaternion.identity);

    instanceBullet.rigidbody.AddFo­rce(transform.forward * shootforce);

    Game compiles fine, however when I shoot I get this error:

    InvalidCastException: Cannot cast from source type to destination type.

    Shoot.Update () (at Assets/Scripts/Shoot.cs:34)

    Anyone please help!!!

  • To everyone who has Bullets that just drop and do not shoot off! Make sure every letter is either Capitalized or Lowercased the way his is! I had "Forward" capitalized and it needed to be "forward". Simple stupid stuff. haha

  • i think i fail. My bullet has rigidbody but wont fall. probably just me being fail but thats what he did so i'm like what. Help anyone?

  • Please help I put in: var prefabBullet:Transform;

    function Update ()

    { if(Input.GetButtonDown("Jump")­) { var instanceBullet - Instantiate(prefabBullet, transform.position, Quaternion.identity); }

    }

    and it comes up with an error saying Assets/Shoot.js(7,35):UCE0001:­';' expected.Insert a semicolon at the end.

    PLEASEE help! PLEASE!

  • @lolcorrupt var prefabBullet:Transform;

    var shootForce:float;

    function Update ()

    { if(Input.GetButtonDown("Fire1"­)) { var instanceBullet = Instantiate(prefabBullet, transform.position, Quaternion.identity); instanceBullet.rigidbody.AddFo­rce(transform.forward * shootForce); }

    }

  • I must say, this is a remarkably helpful video. You explain the scripting terms very nicely, and the things whose meaning I wasn't too sure of in the past (*cough*TORNADOTWINS TUTORIALS*cough*) I now understand.

    Thanks!

  • Whenever I select "Play" all my object just fall. How do I make them stay in place?

  • how could i make the bullet spawn a little in front of my camera, so if i have my camera mounted on an object how could i make the bullet spawn forward enough that it doesn't collide with what my camera is mounted on.

  • Comment removed

  • could you help me make a Nightcrawler style teleporting script like in the X-Men games. that would be cool.

  • how do i shoot with mouse click?

  • @funnycunt83 you have to give it a different button input, instead of "Jump" give it "leftmouse" then make a new input for leftmouse, the positive button is called mouse 0

  • i get this warning: the referenced script on this Behaviour is missing! UnityEngine.object, vector3, Quaternion)

    Game still run but it won't shoot forward just drop it right down

  • how did you make the camera move like that?

  • I don't know what to attach now.. I get this error:

    MissingReferenceException: The variable prefabBullet of 'Shoot' doesn't exist anymore.

  • Awesome tutorials! The best I've seen on Youtube. Thanks a lot!

  • You are AWESOME! my friend, and your sooo smart too, the one thing i am having trouble with is the JavaScript, i am a retard when it comes to that lol, so i was wondering what should i do to learn JavaScripts or any kind of other scripts? should i find books to read for it? because I know nothing about scripting, please help me out I really need some help, thank you :)

  • If only it was as simple as gamemaker...lol thatd be great

  • @Mr0Cellobot making 3d games like this in game maker is a whole lot more complicated than this, imo

  • @uncapitain i know

  • ok im stuck on the bullet script and when ever im ready to play it or says,"Assets/Bullet.js(1,1): BCE0044: expecting EOF, found 'var'." oh and also i dont have the shootforce or any of the tabs you have and i did everything the exact same way you did

  • Hi,thanks for ur tutorial.I'm useing this script to make a side-scrolling game,

    .

    the script is like this:

    var prefebmoney:Transform;

    var power: float;

    function Update () {

    if (Input.GetKeyDown (KeyCode.Z))

    var instancemoney = Instantiate(prefebmoney,transf­orm.position,transform.rotatio­n); instancemoney.rigidbody.veloci­ty =transform.right*power;

    }

    I'd like to change the shooter's direction as my character's,how can i rewrite this script?thanks

  • Hey I'm using Unity 3.4 and after using the same shoot script, I get an error stating " MissingMethodException: Method not found: 'UnityEngine.Rigidbody.Addforc­e'. " Any suggestions on how to fix it ?

  • @CRonaldo7soccer the "f" in "force" needs to be capitalized, i.e.: rigidbody.AddForce

  • @infiniteammoinc Hey thanks for the quick response, I really appreciate it :D And ya the capital F did the trick, I can finally shoot ! lol Thanks again :D

  • Hey I'm using Unity 3.4 and after using the same shoot script, there is an error stating " MissingMethodException: Method not found: 'UnityEngine.Rigidbody.Addforc­e'. " Any suggestions on how to fix it ? 

  • Great tutorials!!! this is the first Unity tutorial i watched, and i've seen that it is great also for beginners! when i first got unity i watched this tutorial and understand unity very well, thanks Alex!!!!!!!!!!!!!!!! :)

  • really enjoy ur vidioes

  • Anybody know how to make the bullet travel in any direction you want it to because when i shoot it from my gun it goes to the left.

  • @BTIXist Its very simple just send me your script and i will fix it for you. :)

  • var prefabBullet:Transform;

    var shootForce:float;

    function Update()

    { if(Input.GetButtonDown("Jump")­) { var instanceBullet - Instantiate(prefabBullet, transform.position, Quaternion.identity) ; instanceBullet.rigidbody.AddFo­rce(transform.forward * shootForce); }

    }

    where is the problem here???

  • @iliri6600 aha! the "var instanceBullet - Instantiate..."! it should be "var instanceBullet = Insta.....". you forgot the '=' sign.

  • @iliri6600

    If you Havent already done it :)

    var prefabBullet:Transform;

    var shootforce:float;

    function Update ()

    { if(Input.GetButtonDown("Fire1"­)) {  var instanceBullet = Instantiate( prefabBullet, transform.position, Quaternion.identity); instanceBullet.rigidbody.AddFo­rce(transform.forward * shootforce); }

    }

  • Comment removed

  • @iliri6600 to me it says :Assets/shoot.js(9,31): unexpected char: 0xFFD.

    what should i do! im terifieed XD

  • alright so i have a wierd problem whenever i use a rigid body for anything it immediately disappears

  • hey, where do you get the shadow and the lights? i didn't have it even if i change the direction of the point light. please tell me how ASAP

  • Comment removed

  • I am making a game where you are a ball and you roll around, similar to the morph ball in Metroid Prime. I have made quite a few games before just simple goofy ones because I have only been using Unity for about 7 months and I have been scripting for just over a year. I am having trouble trying to get the ball to actually roll as it is moving. All it can do right now is move, turn, and boost. Could you give me some ideas on how to make it roll?

  • Thanks a lot. Very helpful tutorials.

  • thank you so much!

    I know maya pretty well, but now i wanted to do a game... for example for a FPS game, can I make characters in maya, rig them, texture, and do animation, to then use Unity to program it all? like to make the character move forward, and use a walk cycle animation, when i hit W....?

    I'm new to programming, and this is how i presume it works xD any tips would be appreciated.

  • How do you drag the objects to make them bigger? I'll sub if you answer.

  • @Halo4Follower derp.

  • @Viannima lol I figured out like 5 minutes after I asked it, lawl.

  • @Halo4Follower lol, press r on your keyboard and drag in the middle of the thingy (axes) which appares...

  • It seems like my bullets are cloning but they are invisible. Is there anyway to change the look of the bullet?

  • When I drag the prefab Bullet to the Shoot script, it doesn't do anything and there is no arrow for a drop down menu like you did it, instead there is a target icon, that when click, will open a window that shows everything in my scene.

  • thanks dude

    

  • thank inormasinya ye broooo...!!!!

    GooD luck

  • @smaschannel you have to first give your enemy life points and when they equal 0 for it to be destroyed.

    then you have to tag your bullets, Then tell your enemy when your bullet collides with it to it subtracts a life point.

  • just a quick question:

    when i shoot, i can only shoot in a few directions, but i want to be able to shoot 360 degrees around me. How would one do that?

    btw great tutorial!

  • a shooting function with collision and regular physics all in one line? You sir blew my mind.

  • For some reason, everytime I code that program, i'm sure it's exact and when I run it does work, it shoots out object but theres an error at the bottom of the screen saying "NullReferenceException: Object reference not set to an instance of an object." I don't quite understand that. help?

  • spawning boxes: the variable prefab bullet of shoot has not been assigned

  • Howdy,

     I just picked up Unity about a month ago and purchased a Book/DVD combo to help me understand the software and get going on creating a game. I have to say that, without a doubt, your tutorials put the publication (which I won't name) I purchased to shame. I appreciate the fact that you would take the time to help people whom you may never even meet understand how all of this works. Very big of you.

    -Rich from Texas

  • How do you apply physics to the blocks to make them fall, mine arent falling D:

  • @AwesomeStep select your cubes, then go to: Component > physics> then it says, "rigidbody". Click on that and they will fall (insta physics, insaaaaaane).

  • @MrLolman666 Thanks dude :)

  • Thx you

    But I have some problem

    I can move and shoot the box,

    but, the box (bullet) went through everything which suppose to be reflected.

    Need help T T

  • Comment removed

  • so I have a script attached to a prefab, and I want to access some variable on the script, how do I do that ?

  • can you make a Tutorial on how to make it delete the objeceds after 5 seconds or so

    for Shooting :)

  • Thank you for this!

    I'm subscribing. ;D

  • how i can make taht blocks move by those squares?

  • thank you

  • @tehham well i have it sorted now and have done for a long time....... but the "varshootForce:float;" allows me to alter the shoot force within unity and it was set to 1000 at first...... but allis good now ^_^

  • Space, space, space

    Wohooooooo

    Nice tut! Will help me :D

  • For 2D art is it possible to use a sketch you have scanned onto your computer?

  • OK that was a really good tutorial it almost completely works...... the only problem is that my prefab just drops and does not propel forward here is the script as copy/pasted from my game

    var prefabBullet:Transform;

    var shootForce:float;

    function Update()

    { if(Input.GetButtonDown("Jump")­) { var instanceBullet - Instantiate(prefabBullet, transform.position, Quaternion.identity); instanceBullet.rigidbody.AddFo­rce(transform.forward * shootForce); }

    }

  • @ashiron2 I'm no expert, but it seems you haven't defined shootForce. So (I'm guessing) unity initialises it as 0 by default. Set it to something like 10 or 50 and see how it works.

  • Thank you for your tutorial It really helped my understanding more of the coding thats involved

  • Really good guide, was very helpful. Many thanks

  • @lithiumproject sorry I acedently clicked vote down :(

  • whenever i do this i dont get the area to put my prefab in, as you explain in 6:21

  • I have a character with an animation (waving a wand) is there a way to stall the bullet so it will shoot a second later after spacebar is pressed?

  • I made the bullet a physical object, but it won't fall. What might I have done wrong?

  • this is extremely helpful I was lost until i watched these videos

  • Very useful man, i was looking for this kind of fast approach to start coding a game, and the original documentation is like reading a dictionary ; )

    Thanks from Montevideo, Uruguay

  • Okay, so I'm making this FPS game but you don't start out with any guns. Instead you walk up to a turret and shoot all the zombies. But I have no idea what to say in the script for the character to walk up to the turret and 'enter' it! I would like the player to push the space bar to enter it, and to exit it. PLEASE HELP!!!! thank you

  • why is this not in HD?

  • Great tutorial, I looked around for awhile and couldnt find anything that would get me started till now, Thanks!

  • hi i have a problem with the scripting.... i checked it about 10 times and it's all the same but an error is popping out everytime i press run and it tells me to put a semicolon at the end of line - 7 . but i already have a semi colon at the end of that line exactly liek the tutorial. why is the error still popping out? thanks

  • how do I do instead of jump to squeeze the left mouse button?

  • @skenerz if(Input.GetMouseButton(0) or something like that

  • really nice! do you know anything about work with 3d max an unity or it is simply merge the stuff from 3d max to unity? thanks for the tutorial!

  • Can I ask how to make script that reacts on mouse click? like GetButtonDown but for click of mouse.

  • this is the worst demonstration ever

  • what is the esiest way to make a sniper type game

  • As I understood the Jump word in the script is the button space, but i have another movement script that i need space button for, what should i type for left click like in a normal fps game?

  • my cubes dont colide with things

  • @JackAida youll need to add a rigid body component. select your bullet prefab in the hierarchy and click component-->rigid body. now click apply in the inspector to apply this change to the entire prefab.

  • good scripting tutorial for unity

  • @infiniteammoinc yes, several different things. First I tried what you did, then I tried the bullet object itself, nothing wants to work...

  • When I run the shootscript, it tells me "The prefab you want to instantiate is null". I've double checked it and double checked it again, I'm sure it's exactly what you have.

  • @DarkFlame7755 Have you plugged anything into the prefab variable in the inspector yet?

  • @DarkFlame7755 null means that nothing has been selected

  • @DarkFlame7755 i get the same problem

  • nice =)

  • Thanks a lot for making these. I really appreciate the way you explain your way through scripting, that is really helpful for a complete scripting novice such as myself. Up until this point I have just copied other scripts to get close enough to the results I wanted, but now I can begin to edit these without a barrage of error messages. So once again, thanks alot.

  • k. can this engine be used to make 2d games?

  • @fireman59000 yes, instead of using the perspective view use the orthographic view instead.

  • i wish i could hire this guy!!!!

  • I'm used to working in c++, but I have to work in unity for school. It's really scary how easy this is. And still powerfull as well. Most easy to use engines are really slow.

  • @hedanit0 Yeah, Unity's the first "package engine" that I've actually liked - because it doesn't get in your way while providing really powerful tools that are easy to use. (at least, most of the time)

  • Yeah What xxxsory19xxx said!!!!!!!

  • dude ur freakin crazy at this stuff can you help me with some stuff just started were should i start?? i would like to make characters like wolfs and such you knw how??

  • @XxXSorry19XxX If you've never made a game before, I'd suggest playing around with primitives (cubes, spheres, etc) b4 trying to make a game with full 3D models or even 2D art. Get the hang of the basics first, then work your way up.

    Most things with full 2D art are going to require Photoshop/Painter knowledge, 3D models require an experienced modeller using Blender or 3DS Max or Maya etc...

    Best to start small, with something you can finish. Try cloning Pong, Pac Man or Tetris for example. :)

  • @XxXSorry19XxX if you are still planning on making a game inbox me. im a (somewhat) experieced modeler and skinner/texturer.

  • i have a problem with your shooting script where when i shoot after rotating about 180 degrees it wont shoot past it. so i only have like a 180 degree view for shooting instead of full rotation.

    any help much appreciated.

  • srry bout the message but i found the error but dont know how to fix the erroe is there is no rigidbody attached to Bullet(Clone) but i put it in my script

  • @mylespol You have to attach a rigidbody to the bullet prefab in the editor. (Component -> Physics-> Rigidbody) Make sure it's on the prefab, otherwise it won't get replicated to the bullets that you spawn. :)

  • Nice man 5 out of 1000. I was messing around in the unity site tut and man there complex and boring. You made it a lot easier. I can totally see Mac making a console soon (they just gata) I made the switch from pc to mac and I'm never looking back. Games are just so much essayer to make on a mac because of the work flow from C4D to Unity is a snap (for animation) Keep on rock man good stuff

  • Hey i am new to Unity, How do you import C4D models into Unity

  • @kieranblacker i dont know i started unity 1 year ago!!

  • @kieranblacker i dont know

  • i took the code

    if(Input.GetButtonDown("Jump")

    and change Jump to Sites. how do u make it when i press z the objec the script is in moves?

  • Nice work!

  • Great tutorial.

  • oh my gosh thank you for this tutorial!! your games are freakin awesome by the way.

  • THANK YOU! 5*, Subscribed.

  • Hey your the only understandable person doing these tutorials, keep it up!

  • @MGuniverse yeah Agree... :)

  • yea .very informative, and on a good level too.

    i saw other tutorials doing more or less the same, with at least twice the amount of code. which is really hard to get into , especially for a non-programmer for me, trying to understand it.

    but i gotta learn it. i need it for work soon :D

  • dude you are "the man"

  • Great tutorial. I hope more like this.

  • great tutorial you should do a tutorial for javascript

  • @TheInventorL oh yah! That would be nice! @.@

  • really good... gave me a good insight.. look forward to more tutorials

  • In Another Brothel: 3D

    Hehe, I kid, these tutorials are awesome. Looking forward to more...

  • I like how the 3D controls are similar to Maya's. It makes me think i have a chance of getting a game going from my sotckpile of models and characters. :)

  • Cool tutorials, i would like to know how do you make it so bullets for example start disapearing afther 10 are created.

    I just did the Lerpz Scape tutorial, so there is this prefab where you spawn enemyes, and i dont know how to make it so it only spawns the amount i want and not allways that it gets in the spawn range.

    Hope i make myself clear XP

  • You could add a script to your bullet that keeps track of time and after a second or so deletes the prefab it is a component of.

  • just add in the script for the bullet Destroy(gameObject, 10); and it will destroy the gameObject that the script is on after 10 seconds. Easier to do it after time. if you have no script on your bullets, just add the script "Times ObjectDestructor" which comes default unity, and pick the time it takes for it to be deleted. Hope this helps :)

  • Great job! I have been very useful to start with software.

    Thanks.

  • I really enjoyed this.

    Nicely setup with the little video window haha.

    Great tutorial! I hope you continue it as a series. :)

  • Great job! When I finish with my as3 stuff I'm going strait to Unity.

Loading...