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 xKroniK13x · Apr 04, 2013 at 09:40 PM · texturearrayssaveexportpng

Make an Array of Arrays of Textures

Hi guys and gals, this is a tricky question. My goal is to have a folder that has subfolders filled with PNG images. So, this is how I thought I'd approach it...

Make an array. Inside the array is arrays of textures. So, for example, the first array would be filled with 3 images. These would be exported to the directory "Theme 1" and then move on to the next array, these images would be exported to directory "Theme 2." I have the saving script done, and it changes Texture or Texture2D into .png images and saves them where I want, but I cannot figure out the best way to separate the themes.

I'm using UnityScript. I know you can use System Lists to do this, but then you cannot assign them in the navigator, which makes for lots more coding. Arrays you can simply point and click in the navigator and it assigns them very conveniently, and you can add or remove them with ease.

I've Google'd around and found you can, in normal Javascript, do it simply by having double brackets... so Texture[][] but in Unity, this just results in an error.

I'm stumped here and would love a bit of input. Thanks!

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 Eric5h5 · Apr 04, 2013 at 09:51 PM 0
Share

You can definitely assign Lists in the inspector. So, do that.

avatar image Dracorat · Apr 04, 2013 at 09:56 PM 0
Share

In program$$anonymous$$g terms, what you're looking for is termed a "jagged array". That might aid your Google-fu.

avatar image xKroniK13x · Apr 04, 2013 at 10:03 PM 0
Share

How do you declare it correctly as a list then to be able to use it in the inspector? I can't get it to come up.

I will google jagged array, thanks!

avatar image Eric5h5 · Apr 04, 2013 at 10:21 PM 0
Share
 var foo : List.< Texture2D >;
avatar image xKroniK13x · Apr 04, 2013 at 10:24 PM 0
Share

I did it like this, and now I can assign it in the navigator, but it is no different than the array... for each listing, I wanted another array. If I do

 List.<Texture2D[]>

it disappears from the navigator...

1 Reply

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

Answer by justinl · Apr 04, 2013 at 10:32 PM

I've used this structure before in Unity to give me multi-dimensional arrays in the Unity editor. It works pretty well: Visualizing a Multi Dimensional Array

Comment
Add comment · Show 3 · 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 xKroniK13x · Apr 05, 2013 at 10:49 PM 0
Share

I got this working... do you happen to know how to iterate through all of the variables? Thanks for the help!

avatar image justinl · Apr 05, 2013 at 10:52 PM 0
Share

I'd imagine it would be something like this (untested): foreach($$anonymous$$ultiDimensionalInt the$$anonymous$$ultiArray in the$$anonymous$$ultiDimensionalIntArray){ foreach(int i in the$$anonymous$$ultiArray.intArray){ Debug.Log(i);//here is a value in one of the arrays} }

avatar image xKroniK13x · Apr 05, 2013 at 11:06 PM 0
Share

I'll give it a shot... I posted another question before I got this answer, so maybe someone else can confirm. If you'd like to post this in there as well I can mark it correct if so.

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

13 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

Related Questions

[solved] How to save instance of the texture? 2 Answers

How to save runtime generated texture in Webplayer to hard drive? 1 Answer

Create .png file from script, then import as asset 1 Answer

Blue looks like teal on mobile? 0 Answers

unity png color bleeding 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