• 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 /
  • Help Room /
avatar image
1
Question by viperbone · Dec 29, 2015 at 02:00 PM · spritesizetutorialboardgame

Rebuild Roguelike with other sprite sheet size

I follow the Roguelike tutorial series. I've trying to rebuild it my own to learn most of it.

However I'm at the "BoardManager" now and instead of a nice board like in the tutorial I get somet$$anonymous$$ng kind of spread tiles.

I see that my sprite sheet is 1024x1024 instead of 256x256 like in the tutorial. How can I tell Unity to expand my sprite so they follow each other?

Board

Here my BoardManager script:

 using UnityEngine;
 using System;
 using System.Collections.Generic;       //Allows us to use Lists.
 using Random = UnityEngine.Random;      //Tells Random to use the Unity Engine random number generator.
 
 public class BoardManager : MonoBehaviour {
 
 
     public int columns = 8;
     public int rows = 20;
     public GameObject[] backgroudTiles;
     public GameObject[] undergroundTiles;
 
     private Transform boardHolder;
     private List<Vector3> gridPositions = new List<Vector3>();
 
     private void InitializeList()
     {
         gridPositions.Clear();
         for (int x = 0; x < columns; x++) {
             for (int y = 0; y < rows; y++) {
                 gridPositions.Add(new Vector3(x,y,0f));
             }
         }
     }
 
     private void BoardSetup()
     {
         boardHolder = new GameObject("Board").transform;
 
         for (int x = 0; x < columns; x++) {
             for (int y = 0; y < rows; y++) {
                 // Background tiles
 
                 // randomly choose a background tile
                 GameObject toInstantiate = backgroudTiles[Random.Range(0, backgroudTiles.Length)];
                 // instantiace it
                 GameObject instance = Instantiate(toInstantiate, new Vector3(x,y,0f), Quaternion.identity) as GameObject; 
                 // parent it to the board holder
                 instance.transform.SetParent(boardHolder);
             }
         }
     }
 
     private Vector3 RandomPosition()
     {
         int randomIndex = Random.Range(0, gridPositions.Count);
         Vector3 randomPosition = gridPositions[randomIndex];
         gridPositions.RemoveAt(randomIndex);
         return randomPosition;
     }
 
     //SetupScene initializes our level and calls the previous functions to lay out the game board
     public void SetupScene (int level)
     {
         BoardSetup();
         InitializeList();
     }
 
         // Use t$$anonymous$$s for initialization
     void Start () {
     
     }
     
     // Update is called once per frame
     void Update () {
     
     }
 }    

roguelike-board.jpg (154.5 kB)
Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by rohn_john · Sep 28, 2016 at 06:01 AM

https://forum.unity3d.com/threads/2d-roguelike-q-a.297180/page-2

please see TizzyTool's reply(#53)

by default 100pixel = 1unit

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

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to set Sprite width and height to match parent-object width and height in-code? 2 Answers

Resizing sprite? 1 Answer

My sprite size changes between animations? 4 Answers

Need help understanding isometry, pixels per unit and camera size 1 Answer

Unity2D animation and sprite layout 0 Answers


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