• 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 something 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 this 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

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Two computer with the Same project, same graph file, same settings, but different graph resolutions (half of the original) 0 Answers

How to resize an image, without affecting the size of the button? 0 Answers

Unity Increase sprite size on build 0 Answers

Resizing sprite? 1 Answer

How to set Sprite width and height to match parent-object width and height in-code? 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges