The Sealed Power - Ludum Dare 58

This game is a quick fantasy adventure about an explorer who goes into a mysterious, enchanted castle. In this world, most people believe the castle is cursed because anyone who enters never comes back. You play as one of these rare adventurers—someone exploring the castle not for fame, but to learn more about its secrets. During your journey, you find out that the wizard inside isn’t evil, but a protector of a hidden, powerful force.

WebGL version may require several minutes to download the content. Please be patient.
This game require mouse wheel.

Download desktop versions for a better experience

Developed for Ludum Dare 58 (2025) with theme "Collector" by:

Hernán
Bravo

Unity Developer

Martín Heintz
Thomas

Music & SFX
Level Designer

Cristina Fernández Cantizano

Concept Artist
Mini Story

Álvaro Ruz
Gallardo

Game & Level Designer

KNOWN ISSUES

-When you use a card and pick up another one, the selected card doesn’t refresh.

All versions to test in browser

Iterating through child GameObjects is a fundamental skill when working with Unity’s hierarchy system. Whether you’re building procedural systems, managing UI elements, or organizing scene objects, understanding how to traverse and manipulate child objects programmatically is essential for efficient game development.

In this tutorial, we’ll explore various techniques for iterating through GameObject children using C#, including how to access child transforms, modify their properties, and apply components at runtime. The examples demonstrated here are part of the GDT Solutions for Unity project, which can be cloned from my GitHub account for hands-on practice.



Video Tutorial: Iterating Through GameObject Children




Accessing the Project Files

The complete project demonstrated in this tutorial is available in the GDT Solutions for Unity repository on GitHub. By cloning this repository, you’ll have access to the working scene, scripts, and any future solutions that are added to the collection.

To clone the project:

  1. Navigate to the repository on GitHub
  2. Click the “Code” button
  3. Select “Open with GitHub Desktop” (or use your preferred method)
  4. Choose a local folder for the project
  5. Open the project in Unity

This approach ensures you always have access to the latest examples and solutions as they are published.

Project Setup and Scene Structure

The demonstration scene has been prepared with a simple hierarchy structure. An empty GameObject serves as the parent container, holding multiple child objects—standard cube primitives positioned at the same location. Additionally, a separate GameObject contains the script that will be used to iterate through these children.

A UI button has been connected to trigger the iteration function, with console output confirming when the button is pressed. This setup allows for testing and visualization of the iteration process in real-time.

Referencing the Parent GameObject

Before children can be accessed, a reference to the parent GameObject must be established. This is accomplished by defining a public GameObject variable in the script:

Alternatively, a Transform variable can be used, since child objects are accessed through the Transform component. However, using a GameObject reference is equally effective, as every GameObject in Unity has an associated Transform component that can be accessed directly.

Once the variable has been defined, the parent GameObject is assigned through the Inspector by dragging the target object into the exposed field.

Creating the Iteration Function

To keep the code organized, the iteration logic is placed in a separate function called IterateThroughChildren(). This function is then called when the button is pressed, maintaining clean separation of concerns.

For more information on organizing code across multiple scripts and calling functions between them, check out our guide on how to call functions from another script in Unity.

Accessing Child Count

The first step in traversing child objects is determining how many children exist. This is achieved using the Transform component’s childCount property:

This value can be displayed in the Inspector for verification purposes by making it a public variable temporarily. When tested, the variable correctly reflects the number of children (10 in this example).

Implementing the For Loop

With the child count established, a standard for loop is used to iterate through each child:

The GetChild() method retrieves the Transform of the child at the specified index. By storing this reference in a local variable, various operations can be performed on each child object.

When executed, the names of all child objects are printed to the console, confirming that the iteration is working correctly.



Manipulating Child GameObjects

Once the basic iteration structure is in place, numerous modifications can be applied to each child object.

Renaming Children Dynamically

Child objects can be renamed programmatically using the name property, which is both gettable and settable:

Note that i + 1 is used because loop indices start at zero, but human-readable numbering typically starts at one. When executed, all children are renamed sequentially.

Positioning Objects in Space

Children can be repositioned using their Transform component. For example, objects can be aligned in a straight line with consistent spacing:

By exposing these values as public variables, the positioning can be adjusted through the Inspector without modifying code. This approach provides flexibility when fine-tuning object placement.

Applying Random Colors

Visual properties can also be modified during iteration. To assign random colors to each child, the MeshRenderer component is accessed:

This line accesses the MeshRenderer, retrieves its material, and sets a random HSV color. If multiple materials are assigned to a renderer, alternative properties would need to be used, but for single-material objects, this approach works perfectly.

Each time the iteration function is called, new random colors are generated and applied to the children.



Conditional Position Modifications

More complex logic can be implemented using conditional statements within the loop. For instance, children can be displaced vertically based on whether their index is even or odd:

The modulo operator (%) determines whether a number is even or odd by calculating the remainder when divided by two. Even-indexed children are moved upward, while odd-indexed children are moved downward.

Adding Components at Runtime

Beyond modifying existing properties, components can be added to child objects during iteration. This is particularly useful for creating dynamic behaviors.

Adding Rigidbody Components

A Rigidbody component can be added to each child, enabling physics simulations:

The AddComponent<>() method returns a reference to the newly added component, which can be stored in a variable for further configuration.

Configuring Physics Behavior

With the Rigidbody reference available, its properties can be modified immediately:

In this example, gravity is disabled and linear velocity is applied directly. Even-indexed objects are given downward velocity, while odd-indexed objects move upward, creating an interesting visual effect.



Complete Implementation Example

Here’s a comprehensive example combining multiple techniques:

Key Takeaways

When working with GameObject hierarchies in Unity, several important concepts should be kept in mind:

  • Transform component access is the gateway to working with child objects
  • GetChild() retrieves children by index, making loop-based iteration straightforward
  • Child count can be obtained through the transform.childCount property
  • Component references returned by AddComponent<>() can be captured for immediate configuration
  • Public variables allow Inspector-based tweaking without code modification
  • Modulo operations enable index-based conditional logic for alternating behaviors


Conclusion

Iterating through child GameObjects is a powerful technique that enables dynamic scene manipulation, procedural content generation, and efficient batch operations on multiple objects. By combining basic iteration with Transform manipulation, component access, and runtime component addition, complex behaviors can be created with relatively simple code.

The techniques covered here form the foundation for more advanced systems, including object pooling, procedural level generation, and dynamic UI management. Experimenting with these concepts in the provided project will help solidify understanding and reveal additional creative possibilities.

If you found this tutorial helpful, consider exploring the other solutions in the GDT Solutions for Unity project, and feel free to experiment with the code to create your own variations and effects.



In Unity game development, scripts are essential for adding behavior to game objects. Often, you’ll need to communicate between different scripts—such as calling a function from one script in another. This tutorial walks you through the process step by step, explaining key concepts like references, instances, and visibility. By the end, you’ll understand how to call functions between scripts.

Prerequisites

  • Basic knowledge of C# scripting in Unity (e.g., defining functions and using Debug.Log).
  • A Unity project set up with an empty scene.

In the following video I show an example on how to call a function defined in another script in Unity in C#:




Step 1: Creating the Scripts

Start by creating two new C# scripts in your Unity project:

  1. Right-click in the Assets folder, select Create > C# Script, and name it ScriptA.
  2. Repeat the process to create ScriptB.

Open both scripts in your code editor (e.g., Visual Studio).

ScriptA: Defining the Function

In ScriptA.cs, define a simple function that we’ll call from ScriptB. We’ll also add some logging in the Update method to demonstrate script execution. In the image below we define a function called “FunctionToCall”, which is the function that is going to be called from the other script.

  • Key Point: The function is marked as public to make it accessible from other scripts. Without public, it defaults to private and won’t be visible externally.

ScriptB: Calling the Function

In ScriptB.cs, we’ll declare a reference to ScriptA and call its function.

  • Here, otherScript is a variable of type ScriptA. Using the dot operator (.), we access and call FunctionToCall().

Step 2: Understanding Script Instances and References

Scripts in Unity don’t run on their own—they need to be attached to GameObjects in the scene to create instances. Each instance is independent.

Why Instances Matter

  • Attach ScriptA to a GameObject (e.g., the Main Camera).
  • Play the scene: You’ll see messages from Update() in the console only if the script is instanced.
  • Attach ScriptA to multiple GameObjects: Each instance runs separately, logging its own GameObject’s name.

Example: If you have two GameObjects with ScriptA attached (e.g., “Main Camera” and “Enemy”), calling FunctionToCall() requires specifying which instance to target. Unity won’t guess—you must provide a reference.

Common Error: Null Reference Exception

If you try calling the function without initializing otherScript, you’ll get a Null Reference Exception. This means the variable is empty (null) and points to nothing.

Step 3: Setting Up the Scene

  1. Create two empty GameObjects in your scene:
    • Name one ScriptA_Object.
    • Name the other ScriptB_Object.
  2. Attach ScriptA to ScriptA_Object.
  3. Attach ScriptB to ScriptB_Object.

Step 4: Initializing the Reference

To fix the null reference:

  1. Make the otherScript field in ScriptB public (already done in the code above).
  2. In the Unity Editor, select ScriptB_Object.
  3. In the Inspector, drag ScriptA_Object into the Other Script field of ScriptB.

This assigns the specific instance of ScriptA to the variable.

Step 5: Testing the Call

  1. Play the scene.
  2. Check the console: You should see repeated messages like “Hello! Function from ScriptA called. That’s amazing! I am: ScriptA_Object”.
  • Why Repeated? The call is in Update(), which runs every frame.
  • Tip: In the Console window, enable Collapse to group identical messages.

Handling Multiple Instances

Duplicate ScriptA_Object and rename it (e.g., “John”).

  • If you drag the original ScriptA_Object to ScriptB’s reference, the logs will show “I am: ScriptA_Object”.
  • Drag “John” instead: Logs change to “I am: John”.

This demonstrates targeting specific instances. In a game, this is crucial—for example, applying damage only to the hit enemy, not all enemies sharing the same script.

Key Concepts Explained

  • References: A reference is like a pointer to a specific script instance. Without it, you can’t access functions or variables.
  • Visibility: Use public for functions/variables you want accessible from other scripts.
  • Multiple Instances: Scripts can be attached to many GameObjects. Always initialize references to target the correct one.
  • Alternative Initialization Methods: Beyond dragging in the Editor, you can use code like FindObjectOfType<ScriptA>() or GetComponent<ScriptA>() for dynamic referencing (not covered here for simplicity).

Potential Challenges

  • Null References: Always check if a reference is null before using it (e.g., if (otherScript != null)).
  • Performance: Calling functions every frame (in Update()) can be inefficient—use events or coroutines for better optimization.
  • Advanced Scenarios: For complex projects, consider ScriptableObjects or singletons for shared logic.

Conclusion

Calling functions between scripts in Unity is straightforward once you grasp instances and references. Start with the code-level setup (defining public functions and variables), then handle the Unity-side initialization. This technique is foundational for building interactive games, like enemy AI or UI interactions.

Experiment in your project, and remember: Practice with multiple instances to solidify the concept. If you found this helpful, explore more Unity tutorials on inter-script communication!

We’ve all been there—you start a new Unity project and hastily name it something like “New Unity Project” or “GameTest1”, only to realize later that the name no longer reflects your vision. Whether it’s for better organization, professionalism, or just personal preference, renaming your project is a common necessity.

However, renaming a Unity project isn’t as simple as changing the folder name. It requires careful steps to avoid broken references, missing assets, or engine errors. In this article, we’ll walk through the correct way to rename your Unity project without losing your work or causing technical issues.

(Tip: Always back up your project before renaming! For example using GitHub)

For a visual breakdown of this subject, you may find my video discussion helpful.




Renaming your Unity project folder will close all scripts currently open in Visual Studio as their paths become invalid. Be sure to:

  • Save all unsaved work first
  • Take note of which scripts were open so you can easily reopen them after renaming

Step 1 – Backup your project

To do this, the simplest way is to navigate to your project in File Explorer (or Finder on Mac), then copy and paste the entire project folder to the desired location.

Step 2 – Remove your project from Unity HUB

To remove a project from Unity Hub without deleting its files:

  1. Locate the project in your Unity Hub Projects tab.
  2. Click the three dots icon (⋮) next to the project name (see Figure 1).
  3. Select “Remove Project from List”.
Figure 1: Remove project from Unity HUB.

Important: This action only removes the project from Unity Hub’s interface—your project files remain untouched on disk. To fully delete the project, you’ll need to manually remove its folder from your computer.



Step 3 – Rename your project’s folder

To rename your Unity project, simply right-click the project folder in File Explorer (Windows) or Finder (Mac), select Rename, and enter the new name.

Figure 2: Renaming Unity project.

Step 4 – Add the renamed project to Unity HUB

To add your renamed project back to Unity Hub, click the Add button (see Figure 3), select Add project from disk, and navigate to the renamed project folder in File Explorer/Finder.

Figure 3: Option to add project to Unity HUB from disk

Once added to Unity Hub, your renamed project will appear with its new name—simply open it to continue working with all your assets and scripts intact.



In many games, you might need an enemy, follower, or NPC to chase the player or a target object. Unity provides several ways to achieve this, and in this article, we’ll focus on one simple yet effective method: the Vector3.MoveTowards() function.

This approach allows you to smoothly move one GameObject toward another at a controlled speed, making it ideal for basic AI movement, following mechanics, or even simple pathfinding. We’ll break down how it works, how to implement it in a script, and how to customize its behavior.

For a visual breakdown of this subject, you may find my video discussion helpful.




To begin, create a new C# script in Unity by right-clicking in the Project Window and selecting Create > C# Script (See Figure 1). Name it (e.g., ChaseTarget), then double-click to edit it in your code editor.

Figure 1: Creating a new script in Unity

Figure 2: Script assigned to an empty GameObject in the scene.

Next, drag the script from the Project Window onto an empty GameObject in your scene’s Hierarchy. This assigns the script as a component, allowing you to define movement logic (like MoveTowards) that will execute during gameplay.



How to Move an Object to a Target Position in Unity (Using C# Scripting)

In your script, define two public GameObject variables to reference the moving object and its target (See Figure 3) and a float variable for the speed of the chasing object:

public GameObject sphereObject;  // The object that will move (e.g., a sphere)
public GameObject targetPosition; // The target to chase
public float speed = 1f; //The speed of the chasing object
Figure 3: Defining GameObject variables to drag in the inspector

After saving the script, return to Unity’s Editor (See Figure 4 for visual reference):

  1. Select the GameObject with your script attached.
  2. In the Inspector, you’ll see the two empty fields for sphereObject and targetPosition.
  3. Drag and drop the respective GameObjects from your scene or Hierarchy into these slots.

Now your script can access these objects at runtime! (Tip: Mark variables as [SerializeField] if you prefer private fields to appear in the Inspector.)

Figure 4: Objects assigned in the variables in the inspector and speed



Movement instructions and safety checks

To move the sphereObject toward the targetPosition, use Vector3.MoveTowards() inside an update method (e.g., Update()FixedUpdate(), or LateUpdate()). Add the speed variable to control movement and multiply it by Time.deltaTime for frame-rate independence:

void Update()
{
if (targetPosition != null)
{
sphereObject.transform.position = Vector3.MoveTowards(
sphereObject.transform.position,
targetPosition.transform.position,
speed * Time.deltaTime
);
}
}

About the Update functions

  • Update Methods:
    • Update(): Standard for most movement (runs every frame).
    • FixedUpdate(): Preferred for physics-based movement (syncs with physics steps).
    • LateUpdate(): Useful if movement should follow other calculations (e.g., camera tracking).
  • Safety Check: Always validate targetPosition exists to avoid NullReferenceException.



Introduction

Video playback is a powerful tool in game development, used for cutscenes, tutorials, background visuals, and immersive storytelling. In Unity, playing videos can enhance narrative depth, provide in-game instructions, or create dynamic environments—but it requires the right setup. Whether you’re using Unity’s built-in VideoPlayer component or integrating external assets, this guide will walk you through the essentials of seamless video integration in your game.

For a visual breakdown of this subject, you may find my video discussion helpful.




First Step – Add Video Player component

The Video Player component in Unity allows you to play video files directly in your scene, whether for cutscenes, backgrounds, or interactive elements. To set it up:

  1. Create an Empty GameObject
    • Right-click in the Hierarchy panel.
    • Select Create Empty and name it (e.g., VideoPlayerObject).
  2. Add the Video Player Component (See Figure 1)
    • With the GameObject selected, click Add Component in the Inspector.
    • Search for and add the Video Player component.
Figure 1: Add Video Player component to a GameObject.



Second Step – Configure Your Video

Supported Video Formats in Unity

The Video Player component supports several common video file formats, including:

  • MP4 (.mp4) – Recommended for broad compatibility
  • MOV (.mov) – Common for macOS exports
  • WebM (.webm) – Efficient for web-based projects
  • AVI (.avi) – Less optimized but widely used

(Refer to Unity’s documentation for platform-specific details.)

How to add a video clip in Unity’s video player component

  • Assign a video clip in the Video Clip field.
  • Adjust settings like Play On AwakeLoop, and Render Mode as needed.
Figure 2: Add Video clip to the Video Player component.



Third Step – Using “Render Texture” Mode in Unity’s Video Player

To render a video onto a dynamic surface (e.g., in-game screens or custom materials), set the Video Player’s Render Mode to Render Texture:

  1. Create a Render Texture
    • Go to Assets > Create > Render Texture.
    • Adjust resolution (e.g., 1920×1080) in the Inspector.
  2. Assign to Video Player (See Figure 3)
    • Select your Video Player component.
    • Set Render Mode to Render Texture.
    • Drag the Render Texture into the Target Texture slot.
Figure 3: Change the Render Mode to Render Texture

Why Use This Mode?

  • Dynamic Surfaces: Project videos onto 3D objects.
  • Reusability: One video can drive multiple textures/materials.
  • Performance: Avoids direct UI/raw image overhead.



Fourth Step – Apply render texture to object to play video clip in Unity

  1. Create a UI Raw Image (See Figure 4)
    • Right-click the Canvas in the Hierarchy.
    • Go to UI > Raw Image.
    • Resize and position it as needed.
  2. Assign the Render Texture
    • Select the Raw Image and drag the Render Texture into its Texture field.
Figure 4: Create a Raw Image component to play video clips on a Canvas in Unity

Now, the video will play directly on the UI!



In this tutorial, we’ll explore the straightforward methods to change TextMeshPro text colors in Unity via scripting. Whether you’re looking to highlight important information, indicate status changes, or simply add visual flair to your game’s UI, these techniques will help you implement color changes efficiently in your Unity project.

For a visual breakdown of this subject, you may find my video discussion helpful.




Initial Setup

Text Mesh PRO Text Component

When using TextMeshPro, you’ll likely work with one of the two component types shown in the images below: either a TextMeshPro – Text (UI) component that displays on your user interface (which must be placed inside a Canvas), or a TextMeshPro component that renders in world space like a 3D model. Fortunately, the color-changing method we’ll cover works effectively for both component types.

Creating a new TextMeshPro – Text (User Interface) component through the Unity hierarchy menu.
Creating a new TextMeshPro – Text (World Space) component through the Unity hierarchy menu.



Second step – Choose one of your scripts or create a script and assign it to a GameObject from the scene

For changing color text in Unity at runtime, create a script that executes when your game runs. Add ‘using TMPro;’ at the top to import the TextMeshPro namespace, then declare a TMP_Text variable before your Start function—for example, ‘public TMP_Text myText;’ (though you can choose any variable name). This steps are shown below.

After attaching your script to a GameObject, you’ll notice your variable appears in the Inspector but shows ‘None’ in the field. To proceed with changing color text in Unity, you need to initialize this variable. Simply drag the TextMeshPro component you want to modify into the field in the Inspector, as demonstrated in the images below.

With your variable initialized, you can now change text color in Unity through your script by accessing the color parameter with the dot operator. Add ‘myText.color = Color.yourChosenColor;’ in the Start method, and when you press Play, you’ll see the text immediately display in your new color, as illustrated in the images below.



For more flexibility, define a public Color variable in your script, which will allow you to select your preferred text color directly through the Unity Inspector, as demonstrated in the images below.

Astervoid is a little space exploration game that offers tight, focused space exploration in a compact but detailed asteroid sector. Navigate your mining vessel through physics-based flight mechanics to extract resources from uniquely composed space rocks.

CLICK TO LOAD THIS GAME

GAME JAM: Ludum Dare 57

Download desktop versions for a better experience

KNOWN ISSUES

-Artifitial gravity inside the ship has bugs, we had to force the ship stops when you don’t drive it. When an asteroid hits the ship the player doesn’t stick to the floor of the ship and it could make you bunny hop.

What makes a space exploration game interesting

One thing that can make space exploration games interesting is the environmental storytelling, scattered artifacts, abandoned stations, or unusual geological formations can tell stories without massive questlines. What happened in this sector? Why was it abandoned?
AsterVoid is jam game, therefore we didn’t have much time to dedicate to storytelling, but beneath the gameplay lies a little narrative: you navigate a sector littered with space rocks that once formed a thriving planet—one that was fractured from within when its inhabitants’ obsessive mining for the precious mineral voidolite triggered a catastrophic collapse. Now, these floating remnants serve as both warning and opportunity as you follow in their ambitious footsteps.

Developed for Ludum Dare 57 (2025) with theme "Depths" by:

Hernán Bravo

UNITY DEVELOPER
PROGRAMMER
SOFTWARE ENGINEER

Dennis Schlüter

GAME DESIGNER
CONCEPT
3D MODELS & TEXTURES

All versions to test in browser

Introduction to Texturing in Blender

Texturing a 3D model is a crucial step that brings your design to life. It involves adding colors and intricate details that enhance the visual appeal of your work. In this guide, we will explore how to texture a 3D model in Blender using images as a primary resource for colors and textures.

This is how you apply textures to 3D models in Blender explained in video:




Preparing Your Model for Texturing

Before diving into the texturing process, it’s essential to make sure your 3D model is properly prepared. This includes ensuring that your model’s UV mapping is correctly set up.

UV mapping is a process that translates the 3D surface of your model into a 2D surface, allowing you to apply textures accurately.

You can access the UV Editing workspace in Blender to adjust and optimize the UV layout.

Creating a UV Map for texturing your 3D model – Step-by-step

To quickly create a UV Map for your 3D model you can follow this steps:

  • Select your object.
  • Go into edit mode
  • Select all the vertices by pressing A a couple times
  • Press U to bring the UV Mapping contextual menu
  • Choose the option “Smart UV Project“, that function usually have nice results and at this point you are ready to apply textures to your 3D model.
UV Mapping contextual menu. Smart UV Project function

Applying Textures and Colors

With your UV map in place, you can start applying textures. Blender allows you to use image textures that can be imported into your project. To do this, navigate to the Shader Editor and create a new material. Add an Image Texture node and load the image you wish to apply. Connecting this node to the Base Color of your material will display the image on your model. Adjust the mapping settings in the Image Texture node to fit your model correctly.

As you work on how to texture a 3D model in Blender, remember to tweak various settings such as scaling, rotation, and placement to get the desired look. Utilizing additional nodes for bumps and specularity can also enhance the realism of your textures.

You have reach the end of the article, if it was useful consider subscribing to the channel!

Introduction to Proportional Editing in Blender

Bending 3D models in Blender can transform your designs into dynamic, organic shapes. One of the most effective tools for achieving this is the Proportional Editing feature. This tool allows you to manipulate vertices, edges, and faces while maintaining a smooth transition across nearby elements. It’s essential for achieving that natural look in your models.

Activating Proportional Editing

To start bending your model, you first need to activate Proportional Editing. You can do this easily by selecting your object, entering Edit Mode (press Tab), and then clicking the circle icon in the toolbar or simply pressing the ‘O’ key. A highlighted circle will appear around your selected vertex, indicating the area of influence you can manipulate. This circle can be adjusted using your mouse wheel, increasing or decreasing the size of the affected area.

For a visual breakdown of this subject, you may find my video discussion helpful.




How to Bend Your Model

With Proportional Editing activated, it’s time to bend your model. Select the vertex you want to move and drag it to your desired location. As you move the vertex, you’ll notice that surrounding vertices will also adjust based on the influence of the Proportional Editing tool, you can use the mousewheel while moving the element to modify the influence of the proportional editing tool. This tool is not limited to one vertex, you can select multiple vertices, edges or faces and the bending will be calculated using all those elements.

This technique is ideal for creating curves or bending areas of your model without compromising the overall shape.

If you need to achieve more complex curves, consider experimenting with the different falloff settings available (such as Smooth, Sphere, or Root). Each will provide a unique effect on how the surrounding geometry interacts as you make your adjustments. This versatility is key in getting the precise look you want.

Conclusion

In conclusion, mastering the Proportional Editing tool in Blender offers you incredible flexibility in bending 3D models. With practice, you can create intricate and engaging designs that elevate your projects. Start experimenting with this powerful tool today, and watch your creative possibilities expand.

You have reach the end of the article, if it was useful consider subscribing to the channel!

Image 1. Game window with the Unity console attached at the bottom. Screenshot take from the survival game I’m developing in Unity

Understanding Unity Console Basics

In Unity, the Console window is an essential tool for developers. It allows you to view logs, warnings, and error messages generated by your code. Writing messages to the console can be incredibly helpful for debugging and tracking the flow of your application.

Most useful console instruction – Debug.Log

One of the simplest ways to write something in the console is by using the Debug.Log method. This method enables you to display messages in the console. To use it, simply call Debug.Log("Your message here"); inside any function in your script. For example:

void Start() {

Debug.Log(“Game has started!”);

}



How to WRITE messages in the CONSOLE in Unity

Writing the Debug.Log instruction by itselft it won’t write your message in console, you need to ensure that the function where you send the console message is executed, for this to happen, certain conditions must be met:

  • The script with the function in which you send the console message must be attached to a GameObject in the scene.
  • The GameObject that has the script assigned must be active at some point of the lifetime of your application.
  • Console logs must be enabled, look for the icons at the top right of the Console window.

Logging Different Message Types

In addition to Debug.Log, Unity offers other logging methods such as Debug.LogWarning and Debug.LogError. These methods are useful for indicating potential issues or errors in your code:

Debug.LogWarning("This is a warning!");
Debug.LogError("This is an error!");

By using these different logging methods, you can categorize messages effectively, making it easier to identify issues within your project.

In summary, writing output to the console in Unity is straightforward with the use of the Debug.Log methods. Whether you’re logging regular messages, warnings, or errors, these tools provide vital insights into your game’s running state.

You have reach the end of the article, if it was useful consider subscribing to the channel!



In this artcile we see how to show the current system time in Unity in a text from the user interface.

This could be useful for example to have a VR smartwatch and display the system time in a world space Canvas attached to that smartwatch.

This solution is in the “GDT Solutions for Unity” GitHub repository

For a visual breakdown of this subject, you may find my video discussion helpful.




Procedure to create a Script that controls a digital clock

This article is about how we can read the system time in Unity and showing it on a text in the Canvas

First of all let’s create a new script and also create an empty GameObject to assign the script, as shown in the following images

Image 1. We create a new script
Image 2. We create a new empty GameObject
Image 3. We assign the script to the empty GameObject

Inside the script declare the TMPro namespace and define a TMP_Text variable, call it for example “text_currentTime“, as shown in the lines 3 and 8 of the following image.

Image 4

In the hierarchy, inside your Canvas, create a new Text Mesh Pro object. If you don’t have a Canvas Unity will create one for you.

Image 5
Image 6

In case you need it, here is a video on how to work with Text Mesh PRO, you may want to check it, if it’s the first time using it.

Select the GameObject object that has the script, take the Text Mesh Pro object and drop it in the field in the inspector that corresponds to the TMP_Text variable we defined. By doing this, now we have the reference of the text object in our script and we can modify it by code.

Image 7: Text Mesh PRO text component was assigned to the TMP_Text variable field in the inspector.


Inside our script, let’s add the “System” namespace and define a “DateTime” type variable, call it for example “currentTime“.

Inside Update we are gonna assign to that variable, the following instruction (pay attention to uppercase characters):

currentTime = DateTime.Now;

We can use this currentTime variable to get information about the current time, for example which hour it is, the current minute and the current second. So let’s define a couple local int variables to temporarily assign those values.

int hour = currentTime.Hour;
int minute = currentTime.Minute;
int second = currentTime.Second;

Now that we have all the information we need, we can show the system time in our Unity game in the user interface using the TMP_Text variable we defined, and we can do so in the following way:

text_currentTime.text = hour.ToString(“00″)+”:”+minute.ToString(“00”)+”:”+second.ToString(“00”);

Image 8. Update method in Unity to display system time on a Canvas text.

Hit play and you should be seeing that it is working.

Adapt this solution to create a VR smartwatch in Unity

This solutions works exactly the same if you want to display the current time on a VR smartwatch, the difference is that you probably will need to configure the Canvas as World Space, assign your VR camera in the canvas field in the inspector and attach the Canvas object as a child of the Hand anchor of your VR controller.

You have reach the end of the article, if it was useful consider subscribing to the channel!

In this article we see how to draw the outline on the edges of 3D models in Blender, using the Freestyle tool within the Render Properties.

You can configure the thickness of the outline and apply modifiers to it, you can also choose the color of the outline or use a modifier, for example a random noise generetor that allows you to randomly choose between different colors.

There is a video tutorial on this topic:




Let’s start with a basic 3D model with a camera that is pointing towards it, if we press F12 we will get a render of the scene from the prespective of our camera, as we can see in the following two images.

Starting point with a basic 3D model and a camera
Image result after pressing F12

Now, we can easily add an outline to our 3D model going to the render Properties by activating the freestyle checkbox.

Access to the render properties.
Freestyle checkbox inside render properties that enables the Outline.

If we make a render again we will see that the outline is being generated on the edges of our 3D model.

Render with the freestyle checkbox checked. An outline is drawed on the edges of the 3D model.

You can quickly modify the thickness of the outline using the thickness variable inside the Freestyle section:

And in the View Layer tab you will find several options to apply to the outline, for example you can where to draw the outline along with other parameters like color and effects.

For detailed information check the video above.

You have reach the end of the article, if it was useful consider subscribing to the channel!

In this article, we’ll explore how to import a custom font into Unity and generate a Text Mesh Pro (TMP) Font Asset using the Font Asset Creator. By following these steps, you can easily customize the font style of your TMP text, enhancing the visual appeal of your Unity projects.

For a visual breakdown of this subject, you may find my video discussion helpful.




Which Font format to use in Unity

Fully supported formats for custom fonts and Text Mesh PRO are:

TrueType Fonts (.ttf)

OpenType Fonts (.otf)

Other Formats: While Text Mesh Pro does not directly support other formats like Web Open Font Format (.woff / .woff2), you can convert these into .ttf or .otf if needed before importing them into Unity.

Procedure to use custom fonts with Text Mesh PRO in Unity

First of all you will need to import the font files in your Unity project, you can do that by taking the font files and dragging to a folder inside Assets.

To use custom fonts with Text Mesh Pro you need to generate a font atlas, which is done through the Font Asset Creator in Unity.

This process involves creating a texture atlas with the characters from the font file, which is then used by Text Mesh Pro for rendering text smoothly at various sizes.

To generate the font atlas in Unity go to the Window tab, then to TextMesh Pro and then Font Asset Creator, as you can see in the following image.

In the Font Asset Creator window you have a field called “Source Font” where you can drag your font file.

Once you drag the font you click on “Generate Font Atlas”.

The process will take a momento, when it’s done you save the file in your project folder.

The resulting Asset is a file that you can drag and drop it in to the font field from any TextMesh PRO component in the inspector. That will apply the custom font to your text

Where to find Fonts to download

You can get Font files from different websites like DaFont or 1001Fonts.

You have reach the end of the article, if it was useful consider subscribing to the channel!

Exit mobile version
Secured By miniOrange