If your having a problem with the "NullReferenceException: Object reference not set to an instance of an object" error, roughly around when you make the player shoot for the first time, heres how to fix it. This error means that something outside of the code is not being referenced. Usually, when there is an error with the code it wont allow the game to run. If the game is going, but you only get the error when you shoot, that means the reference hasnt been set OUTSIDE of the code. Simply put, just go to your player(or whatever is making the error) and make sure everything is synced up with your scripts.
Are you planning on making a Video about Enemie Interactions and Health usw? That would be great! Your tutorials are super great btw! Have a good Day, Byeeee!
It'd be pretty easy, instead of checking if you're pressing the mouse button, you could detect tapping on the screen, record the position and register it as a "mouse click". Unity comes with mobile integration, but I probably won't cover it for a bit... eventually tho
How to get the particle system 12:56 (the one that you dragged into the ImpactEffect). Do we need to download from outside source? And do we need to set up anything on it?
at 7:13 I get the following error in my console: NullReferenceException: Object reference not set to an instance of an object PlayerController.ProcessInputs () (at Assets/PlayerController.cs:33) PlayerController.Update () (at Assets/PlayerController.cs:18) line 33 is my weapon.Fire(); code, line 18 is ProcessInputs(); any help?
UPDATE: I fixed it I guess? I clicked on my player, and then dragged my weapon in the weapon slot under Player Controller (Script). Is that how I was suppose to fix it?
@@MitchIcarus This worked. This FUCKING worked. If someone who's reading this is using a private GameObject for Weapon instead of public, just use [SerializeField] above/before the object declaration and it will show up in the Inspector. e.g: [SerializeField] private Weapon weapon;
very nice vid man . can you plz make a tutorial where you combine this mechanic and the 8d movement (in your 8d animation vid) so that we get mechanics just like enter the gungeon. im still new to coding and liked your content easy to understand keep it up .
Help! There was a error that said "Assets\PlayerController.cs(10,12): error CS0246: The type or namespace name 'Weapon' could not be found (are you missing a using directive or an assembly reference?)", it errored at my script " public Weapon weapon;" any help?
Because if you don't, he will shoot to his right (polar angle 0). When you subtract 90 degrees, it is rotating the cube clockwise, which means the top of the cube is the shooting direction. Then it corrects to the mouse position.
it says that the mousePosition doesnt exist even if I did the correct code (mousePosition = sceneCamera.ScreenToWorldPoint(Input.mousePosition);) how can I fix this/ can someone send me a copy, cuz I can't get this to work for the life of me
Love it. That would have taken me so much longer to figure out than 13 minutes
Appreciate it!
If your having a problem with the
"NullReferenceException: Object reference not set to an instance of an object" error,
roughly around when you make the player shoot for the first time, heres how to fix it.
This error means that something outside of the code is not being referenced. Usually, when there is an error with the code it wont allow the game to run. If the game is going, but you only get the error when you shoot, that means the reference hasnt been set OUTSIDE of the code.
Simply put, just go to your player(or whatever is making the error) and make sure everything is synced up with your scripts.
I get this error but what do you mean by synced up with your scripts???
Thank you so much. I needed that.
THANK YOU!!!!!!
Thank you!
I love you and want to marry you. Thank you.
Are you planning on making a Video about Enemie Interactions and Health usw? That would be great! Your tutorials are super great btw!
Have a good Day, Byeeee!
Yup, that's definitely going to get covered soon!
Space shooter tutorials: 1 hour or come in 6 separate videos
When I just could make basic shooter movement in 13 minutes!
This is a really great vid man.
So clear and accessible. So much learnt here. Thankyou
Please do a top-down melee tutorial
that is definitely in my backlog!
The VS code theme you are using is amazing, what is the name?
Nice
Very nice
Could you show me how to use the particles you used?
Nice tutorial! I was wondering how this would work for a mobile game? What are your thoughts on this, can you show us? Thanks again!
It'd be pretty easy, instead of checking if you're pressing the mouse button, you could detect tapping on the screen, record the position and register it as a "mouse click". Unity comes with mobile integration, but I probably won't cover it for a bit... eventually tho
How to get the particle system 12:56 (the one that you dragged into the ImpactEffect). Do we need to download from outside source? And do we need to set up anything on it?
Plz help id doenot rotate properly it rotates half than it auto rotate to its place help
at 7:13 I get the following error in my console:
NullReferenceException: Object reference not set to an instance of an object
PlayerController.ProcessInputs () (at Assets/PlayerController.cs:33)
PlayerController.Update () (at Assets/PlayerController.cs:18)
line 33 is my weapon.Fire(); code, line 18 is ProcessInputs();
any help?
UPDATE: I fixed it I guess? I clicked on my player, and then dragged my weapon in the weapon slot under Player Controller (Script). Is that how I was suppose to fix it?
@@MitchIcarus thank you! had the same problem and this worked
Tysm i sas stuck with this problem for a whole day t’y (:
@@MitchIcarus This worked. This FUCKING worked. If someone who's reading this is using a private GameObject for Weapon instead of public, just use [SerializeField] above/before the object declaration and it will show up in the Inspector.
e.g: [SerializeField] private Weapon weapon;
Is there a way to add delay between each shot so my pistol doesnt shoot a beam of bullets when i hold m1
Could you make a tutorial on Top Down shooting using arrow keys instead of mouse?
Yeeeeees, would love that!!!! C:
wow
very nice vid man . can you plz make a tutorial where you combine this mechanic and the 8d movement (in your 8d animation vid) so that we get mechanics just like enter the gungeon. im still new to coding and liked your content easy to understand keep it up .
How can I have a different gameobject rotate instead of the player and shoot as well
my player didint have collision why ?
seeing the left side of your screen would have been helpful
for some reason my rb.rotation = aimAngle; doesn't work, It says "=" and ";" are used incorrectly, can you please help
How do I make something other than the player rotate and move along with the player (E.g. a blaster of sorts)?
make it a child of the player and it should work
Damn. I'm trying to find a tutorial JUST LIKE THIS for ue4 lol
Hi, any thoughts on making a melee version of this. That would really help!
yeah
brackeys has a viedo about it you can check it out!
My bullet goes up not forwards
WHERE IS PART ONE? Still looking for the first Video part ... XD
Help! There was a error that said "Assets\PlayerController.cs(10,12): error CS0246: The type or namespace name 'Weapon' could not be found (are you missing a using directive or an assembly reference?)", it errored at my script " public Weapon weapon;" any help?
you need to assign the script to it in the editor, as well as making sure your script is named "Weapon"
When I move my mouse why does my character move in like massive circles
is ther anything wrong with this, It says Missing ";"
}
}
void OnTriggerEnter2D(Collider2D other){
if(other.CompareTag("Player")); or if(other.CompareTag("Walls"));
{
DestroyProjectile();
}
}
yup, compare your if statement to the one in the video
@@BMoDev Thanks!
Could You make a vid about the enemy heath scrip??? I am just learning unity and code. If you could that would be great!
so why do you have to do -90 at the aim angle
Because if you don't, he will shoot to his right (polar angle 0). When you subtract 90 degrees, it is rotating the cube clockwise, which means the top of the cube is the shooting direction. Then it corrects to the mouse position.
I don't get it too, I'm confused
my bullet just goes to the right of the gun how do i fix this?
make sure you do -90 at aimAngle
How can i make the camera follow the player
Theres quite a few ways but checkout my Cinemachine tutorial
@@BMoDev alr thank you
it says that the mousePosition doesnt exist even if I did the correct code (mousePosition = sceneCamera.ScreenToWorldPoint(Input.mousePosition);) how can I fix this/ can someone send me a copy, cuz I can't get this to work for the life of me
looks like the semicolon has to be outside of both )), like (mousePosition = sceneCamera.ScreenToWorldPoint(Input.mousePosition));
@@BMoDev I added a second bracket as in "hi, I'm jim (jim jones), nice to meet you."
I try the movement but my cube just move very weird.
Can you help me?
Is your character only rotating toward one spot in the center of your camera?
@@moolayenstudios yes plz help
Is anyone else having issues with the OnTriggerEnter2d not triggering?
Make sure spelling/capitalizations correct.
Make sure IsTrigger is checked in inspector on your Collider2D component
@@BMoDev I'm using visual studio code and simply needed to add the Unity Code Snippets Extension, thank you.
I did all your tutorials but stuck at 6:34
I click the Right button it won't
Help!
Me too.
what should i do when the bullet is not moving
what should i do if the bullet is going up
what should i do if the bullet is falling down
me thinking i was smart making the player the cameras parents so the camera follows me around only to have that fuck up the rotation
Why aren't we funding this?
3:49
6:01
7:36