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 kompound · Jan 10, 2013 at 10:11 AM · 2diphoneleveltile

2D game level building best practice

Hey

I'm building a 2D game with multiple levels. Each level will be setup in a grid say 10x10. When I design the level each tile will be in the correct place, at runtime I will jumble them up. The objective is to click the tiles, they rotate back to their original position.

My question is... Do I need to create one level per scene and 'place' each tile visually when building the level or should I do it pragmatically once per scene. or just have one scene called 'Game' and load in sprite locations..

Just a bit lost, any help will be much appreciated.

Comment
Add comment · Show 3
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 cdrandin · Jan 10, 2013 at 10:29 AM 0
Share

You can do it anyway you like. I prefer 1 level per scene as it makes organization a lot better and simpler for everyone.

avatar image kompound · Jan 10, 2013 at 12:26 PM 0
Share

Would this not add massive overhead to the final compiled exe / app?

avatar image Seth-Bergman · Jan 10, 2013 at 01:57 PM 0
Share

yes, NOT GOOD ADVICE, especially for mobile, where the scene load time will be more noticeable. How having 100 scenes is simpler than 1, I will never know!

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by Seth-Bergman · Jan 10, 2013 at 11:17 AM

Well, I am recently discovering that using just one single scene can be advantageous (as indicated here), as this requires no load time..

EDIT::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

deleted other stuff cuz it was not relevant

the link (or rather, the game from the link, since your link didn't quite work) shows a memory-type game. When the card is clicked on, it is "flipped" to show what is on the other side. In this case, they are simply swapping the texture on that object for a different texture.

something like:

 var backOfCard : Texture;
 var frontOfCard : Texture;

 objectInQuestion.renderer.material.mainTexture = frontOfCard;

(just a simple example)

For your main purpose however (rotating the image), it may be easier just to rotate the image itself... But you will not be able to use GUI Textures in this case.. You would probably need to create planes to attach the image to, and rotate those instead.

This is pretty simple to set up, and should work fine for your needs. Getting back to your actual question, you can create a set of planes on first load, and from that point on, you are simply re-using the same planes each new "level" without ever needing to change scenes. Just swap out the new texture (this part would be similar to the swap code above), and set the new position, and you'd be good to go! If you have extra planes, you can simply set them aside (outside of the camera view) until you need them.

(the same method would apply to GUI Textures as well, but you would need to save out 4 versions of each image, since GUI Textures don't rotate)

Hope this helps

Comment
Add comment · Show 5 · 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
avatar image kompound · Jan 10, 2013 at 12:19 PM 0
Share

Hi Seth - no the tiles will not change they will stay where they are but each tile can be rotated by 90 degrees each click

avatar image kompound · Jan 10, 2013 at 12:23 PM 0
Share

Actually it will be same idea as this video robot repair but the sprites would rotate 90 degrees ins$$anonymous$$d of flip over. However, for each level i need the tiles in specific places. http://m.youtube.com/watch?v=6kt1j9hUs3g

avatar image Seth-Bergman · Jan 10, 2013 at 12:59 PM 0
Share

O$$anonymous$$, well that's simple enough. Give me a bit, I'll change my answer to make it relevant

O$$anonymous$$, Answer Updated

avatar image kompound · Jan 10, 2013 at 02:01 PM 0
Share

Thanks for this Seth - I'm actually trying to make a clone of the game piperoll. You rotate pipes so that they connect together. Lets say my level grew to maybe 100 planes (i.e. pipes) would this cause a massive performance hit, should I be using cubes at this point? I read many planes = bad somewhere and to use quad with 3 triangle but I have no idea how to do that :-D

avatar image Seth-Bergman · Jan 10, 2013 at 05:02 PM 0
Share

as for "quad with three tris", I guess you are referring to this issue:

http://answers.unity3d.com/questions/8699/planes-with-less-tris.html

I don't know how much difference it would make, but the idea I guess is just to create a lower-poly plane in your modelling software (such as Blender).

not sure if cubes would be much better..

3D modelling software is complicated, but creating a simple plane should be relatively do-able, if you decide to try (still tricky though) but if you can find someone who knows anything about it, they can bust you out one in about 5 seconds..

again, not sure how much difference it would make ..

(p.s. if my answer solves your question, be sure to accept it by clicking the check mark.. Thanks!)

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

10 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

Related Questions

2D Platformer: Using Tiled? 1 Answer

How to set tile from ScriptedTile script? 1 Answer

Level Chunk for infinte 2D runner 0 Answers

Level builder for iphone 3 Answers

Native iPhone Bluetooth Multiplayer? 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