Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 TitanSurvivalStudios · Jan 26, 2018 at 09:16 PM · 2d spritesmaprandomizationmap-generation2dtexture

how do you make a huge 2d texture map made of random picked textures?

hey guys how would i make one huge texture 2d map just 1 texture made of like randomly picked textures, so i got something like it but its not one texture this right here i will show is like 3,000+ so here is the image, if you guys know how to make this 3,000+ become one texture please tell me: alt text

each one of those textures are 16x16 pixels. the map ingame is a 10x, 10y the textures are like 0.16x, 0.16y, 0.16z. if you guys need to know anything else just say so, well i would not be giving you the code for spawning those 3000+ textures beacuse they are not the same script as the one that i am trying to make a generation thing like it just that they will all be one texture, and i don't mean like take a picture i mean like it generates as one texture instead of 3000+

whatiwantmaplike.png (161.4 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

2 Replies

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

Answer by TitanSurvivalStudios · Jan 28, 2018 at 05:51 AM

i fixed it myself guys, so this is not even close to be done but here should be a tile based generation like thing that is one texture that puts 16x16 textures on it: public Texture2D[] texturelist; public Texture2D sourceTex; public int width = 160, height = 160; void Start() { StartCoroutine(WorldGeneration()); } IEnumerator WorldGeneration() { Texture2D destTex = new Texture2D(width, height); for (int j = 0; j < width; j += 16) { for (int z = 0; z < height; z += 16) { int b = Random.Range(0, texturelist.Length); sourceTex = texturelist[b]; for (int x = 0; x < 16; x++) { for (int y = 0; y < 16; y++) { Color pix = sourceTex.GetPixel(x, y); destTex.SetPixel(j + x, z + y, pix); destTex.Apply(); Sprite destsprite = Sprite.Create(destTex, new Rect(0, 0, 160, 160), new Vector3(0f, 0f, 0f)); GetComponent<SpriteRenderer>().sprite = destsprite; if (x == 16) { y = 0; x = 0; break; } } } yield return new WaitForSeconds(0.01f); } } }

So the waitForSeconds can be changed guys if you want ok!!

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
avatar image
0

Answer by JonPQ · Jan 26, 2018 at 11:14 PM

Use a render camera. in a new scene... create a camera, set it to ortho mode. Hopefully your object is a whole unit size and square... If its not, fix it so it is. Next make the camera Orthos size, match your object. e.g. if your square is 10 unity units... then set your camera ortho size to 5 (radius) put your object in front of the camera so its facing the camera, (local position 0,0,10) and it should fill the screen exactly from left to right edge of the camera view (if you run the scene, or just click on th camera in scene view) next, create a render texture somewhere in a project folder, and set the camera's render target to be that texture.... (drag the render texture onto the slot on the camera component for target) the camera will now start rendering its view to that texture... as 1 single texture...

If you need this at run-time. you can have the camera off, then just turn it on for 1 frame, or temporarily, and call Camera.Render() from a script.

If you need to save this out, then you'll need to make an editor script on Ui Drop down, it should look for scene camera, do a render, look at the render target, grab that texture, and save the texture out as a file.

You can save out the texture like this...

 Using System.IO;
 
  File.WriteAllBytes(Application.persistentDataPath + "/" + texFileName, texReference.EncodePNG());

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 TitanSurvivalStudios · Jan 26, 2018 at 11:28 PM -1
Share

thats not even what i asked i want them to generate as 1 texture ins$$anonymous$$d of 3,000 i don't want to take a picture

avatar image TitanSurvivalStudios · Jan 26, 2018 at 11:29 PM 0
Share

but thanks for trying

avatar image TitanSurvivalStudios · Jan 26, 2018 at 11:49 PM 0
Share

sorry if i was rude

avatar image TitanSurvivalStudios · Jan 27, 2018 at 12:23 AM 0
Share

then again i may be able to use this somewhat

avatar image TitanSurvivalStudios · Jan 28, 2018 at 05:50 AM 0
Share

ok i finely got it working

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

78 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 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 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 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 avatar image avatar image

Related Questions

How to curve country meshes based upon a flat projection, into a sphere? 2 Answers

How do I make an interactive map on Unity? 0 Answers

,Identifying direction of GameObject in Range 0 Answers

Easy way to build a 3d map based on real world? 2 Answers

How do I create a random map out of existing patterns? 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