- Home /
Game preview incorrect!
When I "preview" my game inside Unity, it looks like this:

When I run my game (the actual executable that was generated), it looks like this:

For debugging purposes, I have added 6 giant blocks around my scene, in case my camera is facing the wrong direction. (I would have liked to attach a screenshot but this stupid system seems to only allow to attachments)
The script:
 using UnityEngine;
 using System.Collections;
 
 public class Maze : MonoBehaviour
 {
 
     #region Editor
         public Texture2D plan;
         public Transform wall;
         public Transform floorEmpty;
         public Transform floorWithDot;
         public Transform floorWithPill;
     #endregion
 
         enum LevelElement
         {
             Wall,
             Dot,
             Empty,
             Pill
         }
 
         LevelElement[,] level;
 
         int[] hunterStart;
         int[] pacStart;
 
     void Awake()
     {
         level = new LevelElement[plan.width, plan.height];
         for (int y = 0; y < plan.height; ++y)
             for (int x = 0; x < plan.width; ++x)
             {
                 Transform levelTransform;
                 Color color = plan.GetPixel(x, y);
                 if (color.r > 0.5 && color.g < 0.5 && color.b < 0.5)
                 {
                     level[x, y] = LevelElement.Empty;
                     hunterStart = new int[]{x,y};
                     levelTransform = (Transform)Instantiate(floorEmpty);
                 }
                 else if (color.r < 0.5 && color.g > 0.5 && color.b < 0.5)
                 {
                     level[x, y] = LevelElement.Empty;
                     pacStart = new int[] { x, y };
                     levelTransform = (Transform)Instantiate(floorEmpty);
                 }
                 else if (color.r < 0.5 && color.g < 0.5 && color.b > 0.5)
                 {
                     level[x, y] = LevelElement.Pill;
                     levelTransform = (Transform)Instantiate(floorWithPill);
                 }
                 else if (color.r < 0.5 && color.g < 0.5 && color.b < 0.5)
                 {
                     level[x, y] = LevelElement.Wall;
                     levelTransform = (Transform)Instantiate(wall);
                 }
                 else
                 {
                     level[x, y] = LevelElement.Dot;
                     levelTransform = (Transform)Instantiate(floorWithDot);
                 }
             
                 levelTransform.position = new Vector3 (x, 0, y);
                 levelTransform.parent = transform;
             }
 
         Camera.main.transform.position = new Vector3(plan.width / 2, plan.width / 2, plan.height / 2);
 
         plan = null;
     }
 
     // Use this for initialization
     void Start () {
     }
     
     // Update is called once per frame
     void Update () {
     
     }
 }
So my question:
How do I get my "actual game" to behave/look like the "preview"?
I am using Unity 4.1.5f on Windows 7 Pro 64-bit.
This seems to be a bug. Can you be more detailed as to what you are doing?
Also are you sure you are building the right scene. Often people don't recognize that a build builds all scenes in the build list, not just the current one.
Your answer
 
 
             Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Depth Fade Problem on distance in VR 0 Answers
Why сamera preview does not match what I see on the device 0 Answers
Game Camera not scaling correctly when built. 1 Answer
Unity camera troubles 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                