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 /
This question was closed Nov 14, 2014 at 04:17 PM by unimechanic for the following reason:

Too subjective and argumentative

avatar image
0
Question by awplays49 · Nov 11, 2014 at 06:43 AM · sizelevelgaps

Unit sized gaps between my blocks?

I used the script below and this tutorial to follow along: https://www.youtube.com/watch?v=nrSUYMnySR4

using UnityEngine; using System.Collections;

public class Levels : MonoBehaviour {

 private int levelWidth;
 private int levelHeight;

 public Transform NcolWoodOneTile;
 public Transform NcolGrassOneTile;
 private Color[] tileColors;

 public Color NcolWoodOneColor;
 public Color NcolGrassOneColor;

 public Texture2D levelTexture;![alt text][1]

 // Use this for initialization
 void Start () {
     levelWidth = levelTexture.width;
     levelHeight = levelTexture.height;
     loadLevel ();
 }
 
 // Update is called once per frame
 void Update () {
 
 }

 void loadLevel () {
     tileColors = new Color[levelWidth * levelHeight];
     tileColors = levelTexture.GetPixels ();

     for(int y = 0; y < levelHeight; y++)
     {
         for(int x = 0; x < levelWidth; x++)
         {
             if(tileColors[x+y*levelWidth] == NcolWoodOneColor)
             {
                 Instantiate(NcolWoodOneTile, new Vector3(x, y), Quaternion.identity);
             }
             if(tileColors[x+y*levelWidth] == NcolGrassOneColor)
             {
                 Instantiate(NcolGrassOneTile, new Vector3(x, y), Quaternion.identity);
             }
         }
     }
 }

}

[1]: /storage/temp/34992-screenshot+(70).png

screenshot (70).png (154.3 kB)
Comment
Add comment · Show 5
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 richyrich · Nov 11, 2014 at 07:32 AM 0
Share

You do not seem to have completed the tutorial. Your code does not match that at 15:34

avatar image awplays49 · Nov 11, 2014 at 12:32 PM 0
Share

richyrich the thing he added there was optional. Did you see when he tested it before adding that and it worked?

avatar image awplays49 · Nov 11, 2014 at 01:13 PM 0
Share

I added it and it still doesn't work :(

avatar image awplays49 · Nov 11, 2014 at 03:35 PM 0
Share

richyrich the thing he added there was optional. Did you see when he tested it before adding that and it worked?

avatar image richyrich · Nov 11, 2014 at 09:39 PM 0
Share

@awplays49 Fair play mate, I only wrote "not 'seem' to have completed tutorial". Admittedly that could have been expressed more clearly. I have updated the comment. $$anonymous$$y apologies

1 Reply

  • Sort: 
avatar image
0

Answer by bubzy · Nov 11, 2014 at 06:55 AM

you need to ask a question

Comment
Add comment · Share
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

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity large level size in build 0 Answers

End level when all enemies eliminated 2 Answers

How to save achievments in game 2 Answers

Is there any way to destroy script at certain level ? 1 Answer

leaving level 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