Understanding OnCollision methods in Unity

In this post, we’ll talk about Unity methods related to collisions. So fasten your seatbelt as we are heading into collision! ?

Currently, in Unity, there are two separate physics engines. One for 3D physics, and another one for 2D. Both work in the very same manner, but they are using different components.

So for example, if we want to turn an object into a physical object in 3D space, we would use Rigidbody. Analogous we would use Rigidbody2D if we want to turn it into a 2D physical object.

Continue reading “Understanding OnCollision methods in Unity”

Creating Replace Tool in Unity for Level Designers

Do you wish you could make a level with simple cubes and later replace them all with some other object with one click? This is what we are going to create today!

A long time ago, I created posts about the basics of creating extensions for the editor. I’m not going to cover that topic here, so go ahead and check the post about creating custom editor windows. ?

This post will cover creating tool window, gathering of selected objects on the scene, and using Unity’s Undo class. ?‍?

Continue reading “Creating Replace Tool in Unity for Level Designers”

Understanding Component Destruction in Unity

We did a post about what happens when an object is created and initialized. we also did one on different update methods. Now it’s time to see what happens at the end of the object life-cycle with OnDisable() and OnDestroy().

This time, we don’t have so many methods to cover as there are only two of them, but the question remains the same. When they are called, and what should you use them for? ?‍♂️

Continue reading “Understanding Component Destruction in Unity”

Procedural Terrain Generation – Texture – Part 4

In previous posts, we generated a plane, added noise and noise layers to it. Now, it’s time to add texture to our terrain finally! ?

If you haven’t seen previous posts, I would recommend doing so, as the content of this post is based on them.

Do you remember that we added UV to our terrain mesh? We did it in the first post on plane generation. Thanks to that, we don’t need to worry about it now. But to remind ourself which part is responsible for assigning UV to our mesh, let’s put it here.

Continue reading “Procedural Terrain Generation – Texture – Part 4”