Setting Up The Scene
Last updated
Last updated
First, create a new folder in your Unity project and name it. For this example, we'll name it '2D City Builder Tutorial Demo'.
Next, create a new scene inside this folder. To do this, right-click in the folder, select Create > Scene, and name the scene. Here, we'll name it '2D City Builder Tutorial Demo Scene'.
Now, locate the Grid Managers and EGB Pro 2 Grid XY prefabs in the SoulGames > Easy Grid Builder Pro 2 > Prefabs directory, and drag them into your scene.
Next, navigate to SoulGames > Easy Grid Builder Pro 2 > Prefabs > Built In UI, find the EGB Pro 2 UI Prefab, and drag it into the scene as well.
After adding these prefabs to your scene, select all three in the Hierarchy, then right-click, go to Prefab, and select Unpack Completely.
Make sure to unpack the prefabs to prevent any potential issues that could arise in the future.
Ensure the 'Grid Managers' component's Transform values (Position, Rotation, and Scale) remain at their default settings: 0, 0, 0. Do not modify these values or make any of these objects a child of another object.
Now, select the EGB Pro 2 Grid XY object from your hierarchy. This will serve as our grid system. While you can use multiple grid systems if needed, this tutorial will focus on a single grid system.
As you’ll notice, this object has two components attached. Use the provided links to explore these components and their use cases in greater detail.
Next, open the Core Grid Properties section in your Easy Grid Builder Pro XY component. Click the refresh icon next to the Grid Unique ID property to generate a new unique ID for your grid. This ID is essential for Saving and Loading functionality.
At this point, you may notice that the grid is not visually represented in the scene. This is because the grid system is currently set to work only in Play Mode. To enable the grid visuals in the Editor, toggle the Update Grid In Editor property in the Core Grid Properties section. This will generate the grid visualization directly in your scene.
If you still don’t see the grid visual after enabling the Update Grid In Editor property, follow these steps to troubleshoot:
Navigate to SoulGames > Easy Grid Builder Pro 2 > Prefabs > Grid Visuals. Locate the Object Grid (Object Prefab). Double-click the prefab to open it, then close it. This will refresh the prefab and may resolve the issue.
If the issue persists, go to SoulGames > Easy Grid Builder Pro 2 > Misc Assets > Materials. Locate the Grid Plane Shader Graph Material, right-click on it, and select Refresh. This will refresh the material and should resolve the problem.
Let’s set up the Camera to fit our 2D game.
Start by selecting the Main Camera object from your Hierarchy and switching to the Game view.
In the Camera component, change the Projection to Orthographic. Then, in the Projection section, set the Size to 10.
Next, configure the background in the Environment section. Set the Background Type to Solid Color and choose a dark gray color or any color that matches your preference.
Finally, adjust the Transform component by setting the Position to 0, 0, -10.
This setup will ensure your camera is properly configured for a 2D game environment.