Skip to content
TheChatArchiveThe Chat Archive
gpt-4.1-mini-2025-04-14· OpenAIAi2 WildChat-4.8M (AI2)

I have duplicated my scene and deleted trees from my terrain. Now both scenes show the…

  1. User

    I have duplicated my scene and deleted trees from my terrain. Now both scenes show the same trees (or no trees) and textures. How to fix it?

  2. Assistant

    This situation usually happens because Unity terrains share the same Terrain Data asset by default when you duplicate a scene or terrain. The trees, details, textures, and overall terrain shape information are stored inside the Terrain Data asset, which is a separate asset file referenced by your Terrain component.

    Why this happens:

    • When you duplicate a scene or a terrain GameObject, Unity does not duplicate the Terrain Data asset. Both terrains still reference the same Terrain Data asset.
    • Therefore, any change (like removing trees, changing textures) in one terrain will affect the other since they share the same underlying data.

    How to fix it:

    You need to create a separate Terrain Data asset for the terrain in the duplicated scene, so you can edit it independently.

    Steps:

    1. Select Your Terrain GameObject in the duplicated scene.

    2. In the Inspector, find the Terrain component.

    3. The Terrain component references a Terrain Data asset (shown as a small asset field, e.g., TerrainData).

    4. Duplicate (or create a new) Terrain Data asset:

      • Click on the Terrain Data asset in the Inspector.
      • In the Project window, right-click the Terrain Data and select Duplicate (or press Ctrl + D / Cmd + D).
      • Rename the duplicated Terrain Data as needed (e.g., TerrainData_Duplicate).
    5. Assign the duplicated Terrain Data asset to the Terrain component:

      • Drag and drop the duplicated Terrain Data asset into the Terrain component's Terrain Data slot in the Inspector.
    6. Now you can freely modify the trees, textures, and details on the duplicated terrain without affecting the original terrain.


    Additional tips:

    • If you have many terrains or complex setups, consider writing an Editor script to automate duplication of Terrain Data assets.
    • Keep in mind that the heightmap, details, trees, and textures are all part of Terrain Data, so any changes require a unique Terrain Data asset per terrain if you want them independent.

    If you want, I can guide you with a script or more detailed steps for your Unity version!

  3. User

    I have a weird back that my shadows of object are visible in the scene editor and when I move around it looks like its burnt into the monitor. How to fix it?

  4. Assistant

    What you're describing sounds like shadow artifacts or "shadow acne" combined with possible framebuffer persistence or monitor/graphics card issues, but most often it's a common problem known as shadow acne or shadowmap artifacts in Unity's Scene view.

    Here are some steps and explanations to help you fix this:


    1. Identify the Problem: Shadow Acne / Burnt-in Shadows

    • Shadow Acne: This is a common shadow artifact where shadows appear on surfaces incorrectly, making it look like shadows are "stuck".
    • Burnt-in effect in Scene View: If shadows appear "etched" or "burnt-in" and don’t update or refresh properly as you move the scene view camera, it’s usually a rendering or editor viewport glitch.
    • This can happen because the Scene view uses slightly different rendering settings than the Game view.

    2. Common Solutions in Unity

    a) Adjust Shadow Bias Settings on the Light

    • Select the Directional Light or the light casting shadows.
    • In the Inspector, look for:
      • Bias
      • Normal Bias

    Increasing these slightly reduces shadow acne but setting them too high can cause shadows to "detach" from objects (Peter Panning).

    Try these steps:

    • Increase Bias slightly (e.g., from 0.05 to 0.1).
    • Increase Normal Bias slightly.
    • Play with these until the shadows no longer look burnt-in but still look natural.

    b) Shadow Distance and Quality Settings

    • Go to Edit > Project Settings > Quality.
    • Check the Shadow Distance — if it’s very high, shadows can behave poorly.
    • Lower the shadow distance for better shadow quality closer to the camera.

    c) Clear the Scene View or Refresh It

    • Sometimes Scene view can get stuck or not refresh shadows correctly.
    • Switch between different Scene view rendering modes:
      • From the Scene view toolbar, toggle between Shaded, Wireframe, and Shaded Wireframe mode to force a redraw.
    • Focus out and back into Unity or switch between Scene/Game view.
    • Restart Unity if needed to clear any viewport glitches.

    d) Check Graphics Drivers and Monitor Settings

    • Rarely, actual display issues or driver problems cause ghosting or burnt-in effects.
    • Make sure your graphics drivers are updated.
    • Try using a different monitor or check your monitor’s "response time" settings if applicable.

    e) Use Linear Lighting Mode and Rebuild Lighting

    • Go to Edit > Project Settings > Player, set color space to Linear instead of Gamma.
    • Then rebake your lighting if using baked or mixed shadows.

    3. Additional Tips

    • If using Real-time shadows, try tuning the shadow resolution or cascade count in Lighting > Quality settings.
    • If shadows remain problematic in Scene view only, but are fine in Game view, this is likely just how Unity’s Scene view renders shadows and no real problem in your build/game.
    • You can temporarily disable shadows in Scene view to avoid confusion (from View Modes dropdown in Scene view).

    Summary

    • Increase Light’s Bias and Normal Bias.
    • Adjust Shadow settings in Quality and Lighting.
    • Refresh Scene view or restart Unity.
    • Update graphics drivers.
    • Check if the issue only appears in Scene view or also in Game view.

    If you want, I can help you step-by-step or provide screenshots for these solutions!

  5. User

    the terrain issue persits. I copied the terrain data assat and renamed it, than assigned the new in the new terrain and noticed wheneer I change something it changes the other terrain as well

  6. Assistant

    Thanks for the follow-up! Since you have duplicated the TerrainData asset, assigned the duplicate to the new terrain, but both terrains still change simultaneously, it means that some shared data remains or some changes are happening to a shared asset not duplicated.


    Key points and what might be going on:

    1. TerrainData is a complex asset containing:

      • Heightmap
      • Trees
      • Details (grass, bushes)
      • Splat textures
    2. When you duplicate the TerrainData asset file in the Project window, it creates a new asset referencing the same internal data arrays, not necessarily independent copies internally.

    3. Simply assigning a duplicated TerrainData that references the same underlying data arrays will cause changes in one terrain to affect the other.


    How to fully duplicate TerrainData correctly:

    Unity does not provide a direct "deep copy" method to duplicate TerrainData in the Editor by default.

    You need to create a new TerrainData object and copy the data from the old one explicitly (heightmap, splat textures, trees, details, etc.). Here's how to do it via script.


    Example C# Editor Script to Duplicate TerrainData Fully

    using UnityEngine;
    using UnityEditor;
    
    public class TerrainDataDuplicator : MonoBehaviour
    {
        [MenuItem("Tools/Duplicate Terrain Data")]
        static void DuplicateSelectedTerrains()
        {
            foreach (GameObject go in Selection.gameObjects)
            {
                Terrain terrain = go.GetComponent<Terrain>();
                if (terrain == null)
                {
                    Debug.LogWarning(go.name + " does not have a Terrain component.");
                    continue;
                }
    
                TerrainData originalData = terrain.terrainData;
    
                // Create new TerrainData
                TerrainData newData = new TerrainData();
    
                // Copy heightmap
                int hmWidth = originalData.heightmapResolution;
                int hmHeight = originalData.heightmapResolution;
                newData.heightmapResolution = hmWidth;
                newData.size = originalData.size;
                float[,] heights = originalData.GetHeights(0, 0, hmWidth, hmHeight);
                newData.SetHeights(0, 0, heights);
    
                // Copy splat prototypes (textures)
                SplatPrototype[] splats = originalData.splatPrototypes;
                newData.splatPrototypes = splats;
    
                // Copy tree prototypes
                TreePrototype[] trees = originalData.treePrototypes;
                newData.treePrototypes = trees;
    
                // Copy detail prototypes
                DetailPrototype[] details = originalData.detailPrototypes;
                newData.detailPrototypes = details;
    
                // Copy tree instances
                TreeInstance[] treeInstances = originalData.treeInstances;
                newData.treeInstances = treeInstances;
    
                // Copy details (grass/other)
                int res = originalData.detailResolution;
                newData.SetDetailResolution(res, originalData.detailResolutionPerPatch);
                for (int i = 0; i < originalData.detailPrototypes.Length; i++)
                {
                    int[,] detailLayer = originalData.GetDetailLayer(0, 0, res, res, i);
                    newData.SetDetailLayer(0, 0, i, detailLayer);
                }
    
                // Save the new TerrainData asset
                string path = AssetDatabase.GetAssetPath(originalData);
                string newPath = path.Replace(".asset", "_Copy.asset");
                AssetDatabase.CreateAsset(newData, newPath);
                AssetDatabase.SaveAssets();
    
                // Assign new terrain data
                terrain.terrainData = newData;
    
                Debug.Log("Duplicated TerrainData and assigned it to " + go.name);
            }
        }
    }
    

    How to use this script

    1. Create a new script called TerrainDataDuplicator.cs inside an Editor folder (you may need to create the folder).
    2. Paste the code above.
    3. In the Unity Editor, select the GameObject(s) with the terrain(s) you want to duplicate.
    4. From the menu at the top, go to Tools > Duplicate Terrain Data.
    5. The script will create a deep copy of the TerrainData asset and assign it to the selected terrains.

    What this script does:

    • Creates a brand new TerrainData object
    • Copies heightmaps, textures, trees, and details
    • Saves this as a new asset file (with _Copy suffix) in your project
    • Assigns the new TerrainData to the selected terrain

    Why do you need this?

    Duplicating the .asset file itself (right-click > Duplicate) does not make a full independent copy internally, so changes to one asset might reflect in another if they share references.

    This script guarantees a deep, independent copy so you can safely modify terrains independently.


    If you want I can also help you customize this or do it step-by-step!

  7. User

    how to create a new terrain asset?

  8. Assistant

    Creating a new TerrainData asset in Unity (a brand-new, empty terrain data file) can be done either via the Unity Editor UI or via script.


    Method 1: Creating a New Terrain (and its TerrainData) via Editor UI

    1. In the Unity Editor:

      • Go to menu: GameObject > 3D Object > Terrain
      • This will create:
        • A new Terrain GameObject in your scene
        • Along with a new TerrainData asset automatically created and assigned to it
    2. Locate the TerrainData asset:

      • Select the new Terrain GameObject
      • Look in the Inspector at the Terrain component
      • You'll see a Terrain Data field showing the TerrainData asset it uses
      • You can click the small target icon next to it to locate the asset in your Project window (usually in the root Assets folder or inside Assets/Scenes)
    3. Save the TerrainData asset

      • (Optional) Select the TerrainData asset in the Project window, and move it to your desired folder for better organization

    Method 2: Creating a TerrainData Asset from Scratch in Project Window

    1. In your Project window, right-click in a folder where you want to create the terrain data asset.
    2. Choose Create > Terrain Data.
    3. This creates a new TerrainData asset you can rename as you like.

    Note:
    This asset is empty but fully functional. You can select it and customize properties like heightmap resolution, detail resolution, etc. It's not tied to any Terrain GameObject yet — to use it you must assign it to a Terrain.


    Method 3: Create TerrainData via Script (for Automation)

    If you want to programmatically create a TerrainData asset:

    using UnityEngine;
    using UnityEditor;
    
    public class TerrainDataCreator
    {
        [MenuItem("Tools/Create TerrainData Asset")]
        public static void CreateTerrainDataAsset()
        {
            TerrainData terrainData = new TerrainData();
            terrainData.heightmapResolution = 513;    // Common resolution
            terrainData.size = new Vector3(500, 100, 500);
    
            string assetPath = "Assets/NewTerrainData.asset";
            AssetDatabase.CreateAsset(terrainData, assetPath);
            AssetDatabase.SaveAssets();
    
            Debug.Log("Created new TerrainData asset at: " + assetPath);
        }
    }
    
    • Save this script in an Editor folder.
    • Run the menu item Tools > Create TerrainData Asset.
    • It makes a new TerrainData asset you can assign to a Terrain GameObject.

    You still need to create a Terrain GameObject in the scene and assign this new TerrainData to it.


    Summary to use a new TerrainData asset:

    • Create TerrainData asset (via Project Create menu or script)
    • Create a Terrain GameObject (GameObject > 3D Object > Terrain)
    • Assign your new TerrainData asset to the Terrain's Terrain Data slot in the Inspector
    • Modify terrain as needed (height, trees, textures)

    If you want me to help you create a brand-new Terrain GameObject with a custom TerrainData asset assigned or duplicated from existing, just let me know!