Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by JasperCiti · Jul 08, 2013 at 04:59 AM · camerabuildbugstartuppreview

Game preview incorrect!

When I "preview" my game inside Unity, it looks like this:

alt text

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

alt text

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.

preview in unity.jpg (201.8 kB)
actualgame.jpg (36.3 kB)
Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Benproductions1 · Jul 08, 2013 at 11:38 AM 0
Share

This seems to be a bug. Can you be more detailed as to what you are doing?

avatar image Benproductions1 · Jul 08, 2013 at 11:40 AM 0
Share

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.

avatar image amphoterik · Jul 08, 2013 at 11:55 AM 0
Share

What is that script attached to?

avatar image tmdchi · Jul 08, 2013 at 12:19 PM 0
Share

Do you have more than one active camera in your scene?

0 Replies

· Add your reply
  • Sort: 

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

19 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

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


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges