Hi, I am currently doing the “Complete C# Unity Game Developer 3D” course on Udemy and I need some help with “Project Boost”. My ‘rocket’ doesn’t work properly until I click on it in the hierarchy, does anyone have any ideas as to why or how to fix this? Any help is much appreciated. A link to an unlisted YouTube video showcasing the problem can be seen here: https://youtu.be/v4tZVtVqc24
This. is. strange.
I can see that there is movement albeit very slightly. It’s like something is interfering with the input until the game view no longer has the focus.
Can you share your game somewhere so I can have a look? I suspect there will be a lot of back-and-forth here if we try to solve it over the posts
You’re disabling the thrust as soon as you’ve processed it, so you have to kinda pump the spacebar to get some thrust. I guess that’s what you wanted.
I don’t get the behaviour you do, though. I get one relatively decent thrust and when I click the rocket in the hierarchy everything stops - as I would expect it to.
Do you have a controller connected?
Yes i have a controller connected and i use Unity’s new input system and invoke unity events on the “Player Input” component on the ‘rocket’ rather than using “Input.GetKey(KeyCode.Space)” for example, so that i can use keyboard and controller. This is different to how its done in the course where the other method i just mentioned is used, so i had to do things a little differently which is why i assume i have this problem, although i’m not sure why what i’ve done doesn’t work. Also i don’t know if its worth mentioning but doing it this way i’ve had to use significantly more “main thurst” and “Rotation thrust” - the instructors values are 100 and 1 respectively, whereas mine is 20000 and 100.
The Unity version i’m using is 2022.3.1f1
Update: I found something to fix it, i’m sure it’s not the best way but it works.
i moved where i set the thrustActivated bool to false, to to its own function. Then in the ProcessThrust() function where the force is applied to the rocket, i invoke that new function that sets the bool to false with a 0.1f delay and it works fine. After doing this i also need significantly less force, my mainThrust variable now works nicely on only 2500 as opposed to the 20000 it was on previously.
Thanks for the help your “you’re disabling the thrust as soon as you’ve processed it” line helped me think of that solution.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.