By the way, somebody asked a question below the article ‘Warning: Unity Standard Assets Depreciated’. In my reply, I linked this asset:
right so i wanted to move closer to my terrain and see how thing goes as if i were the player, but whenever i use WASD to move closer, my terrain just slowly fades away
help
Also, there are some trees that only appear on my terrain if i look into it at a certain angle
Some red mushroom:
And if i look into it at another angle… it’s gone?
Before we head to the next problem, please let me know if the linked character controllers asset worked for you. Or wasn’t that a problem?
Regarding the new problem, that’s the expected behaviour in Unity to increase the performance. Depending on the distance, the renderer does not render certain objects.
To solve the problem in the game window, you could change the clip plane values of the camera. This might have a noticeable negative impact on the performance of your game because the more objects Unity has to render, the slower the game will become.
To solve the problem in the Scene window, do the same for the scene view camera, which can be found in the Gizmos menu:
Bear in mind that this, too, could significantly slow your game and Unity down.
Advanced techniques to have lots of visible objects in the scene and a high(er) performance are LOD, billboards and textures. These topics are way beyond the scope of this course, though, so I cannot help you with this. However, you can find lots of tutorial videos on Youtube, and you could also ask our helpful community of students for advice over on our Discord chat server.
The Asset pack u sent me is the controller for fps and tps, not the trees assets and ships assets that i need for Argon Assault tho, anyway can u be more specific on how to modify the clipping panes to fix the issues that im having with the camera? i have tried modified it but it is not working, the terrain still fades away right when i zoom in
Still like this, help?
Increase the ‘Far’ value significantly. At the moment, it is set to 10000 in your screenshot. Also select the terrain and press F
on your keyboard to set the focus on that game object.
Regarding the spaceship asset, I’ve just checked the course, and the Star Sparrow asset is linked in the resources of video ‘Import Player Ship Asset’.
Regarding the trees, you could download Rick’s project from GitLab. Then copy and paste the relevant assets (e. g. the Standard Assets folder) into your own project.
Alternatively, you could look for free trees in the Unity Asset Store. According to the description in the Unity Asset Store, these free trees are compatible with the URP, so you could test them:
When looking for assets, make sure they are compatible with your current render pipeline.
many thanks for the tree assets pack, i have put trees in my game now.
And now im wondering, is there a big difference between these 2 ways of caching a variables.
this is how Rick code in the video,
So what if i just cache them all first then just use them after? Is there any difference of anyway? maybe better performance or maybe doing so might create bugs of some kind…
Which one is better?
Awesome. Did you manage to implement them without any problems?
You may use local variables if the values don’t take up much space in memory. As a rule of thumb, int
and float
values are considered ‘small’, so your solution is fine. I would remove the superfluous instance variables, though, as they are not used in the code you showed here.
See also:
- Forum User Guides : How to apply code formatting within your post
i have edited my solution, so should i do it that way (set a variables up top first then use it later on), or should i just code like Rick(instance variables right in code?)
We are dealing with value types here. This means that we get new objects in Fly() anyway, and we do not save any relevant space in memory by assigning those values to an instance variable instead of a local variable.
Back in the 80s, the difference would have been relevant because each bit mattered. However, on our modern computers, we don’t care about a few bits, so we usually don’t waste any time with insignificant micro-micro-micro-optimisation.
You could analyse your code with the Profiler in Unity to see if you are even able to notice any difference.
When deciding whether we need an instance variable, we always ask ourselves how much resources we would need to get an object again. A calculation might be resource-intensive, so we want to keep the value. A simple calculation might be ‘nothing’, so it could make sense to recalculate the value when needed.
For everything else, this answer might be interesting:
With this knowledge, decide yourself what might be best in your project because there is rarely an universal answer to questions like these. As always, ‘best’ depends on the specific problems you want to solve with your solution.
idk what i did but now i cant move my ship during the timeline anymore, must be something with the timeline tho, i changed things a bit and then now i can only move the ship when the timeline is finished
EDIT: if the timeline is running, i cant move anything, if it’s stopped, i can moved my ship again
Check if the timeline animates the child (= Player Ship). If it does, you found the problem: The animation overrides all values that you apply via code. The result looks as if you cannot move the spaceship anymore, or as if the code does not work anymore.
Only the root game object (= the Player Ship) may be animated.
so in Rotate Ship With Position & Throw in Argon Assault section of the course.
I noticed that Rick’s ship rotates (pitch yaw and roll) smoothly, I mean slowly to the rotated value, and not jump right to it like mine, mine just feels rigid and not smooth at all. Well I mean my code is pretty the same as Rick, but the ship just rotates straight away and it feels a bit jumpy…
First of all, please let me know if the other problems are solved. Otherwise, they will continue to live in my mind, and I’ll eventually get confused.
Secondly, if the code is fine but the rotation not smooth, try to decrease the rotation value in the Inspector. Rick’s solution works with very small values close to 0 only.
right i fixed it by delete the ship animation key in timeline, only using the player rig animation key, so that left the ship rotation-free many thanks
can u be more specific, my rotation still feels so rigid and not smooth at all, and which rotation value btw? sorry, i just wanna make sure im taking ur solution right
Since each game is unique, Rick’s and Gary’s values might not always be perfect for your game. For this reason, it is expected that you have to tweak the values in your own game until you get a pleasant result. Don’t worry if you need different values than Rick’s.
In his PlayerControls class, he implemented the following lines:
[Header("Screen position based tuning")]
[SerializeField] float positionPitchFactor = -2f;
[SerializeField] float positionYawFactor = 2f;
[Header("Player input based tuning")]
[SerializeField] float controlPitchFactor = -10f;
[SerializeField] float controlRollFactor = -20f;
Admittedly, the description in his code sounds a bit cryptic but since you know what your goal is, you just have to jump to the relevant code, which is is very likely in the ProcessRotation() method. In the code block of that method, you’ll see that he uses those factor variables to finetune the rotation, which is controlled by the player input. Rick’s description starts to make sense.
Since the variables are exposed in the Inspector, you have to finetune the values in the PlayerControls component in the Inspector in the Unity Editor. Make sure to select the spaceship in your Hierarchy. Since there are no universal values that make everything look good, you will have to test your game. It might be that you have to tweak the values a few times, and test your game a few times, until your game feels right.
If the problem persists, you could try to multiply by Time.deltaTime
. In that case, you’ll need higher factor values.
not working for me I’ve been cranking and testing many times…still feels chunky and jumpy. Not smooth as Rick tho, well it’s just a small adjustment to the game anw so maybe it’s not that important… right?
You are testing your game in the Game window, aren’t you? If so, bear in mind that the Game window is just a preview. A laggy preview. We cannot solve any editor related problems because we don’t have access to the source code of Unity.
To figure out if the problem is limited to the editor, build your game and test your build. It might well be that your actual game (= the build) is as smooth as Rick’s.
many thanks, definitely will try it out in the future
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.