• 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 Oorlfe · Sep 07, 2015 at 02:15 AM · texture2d

What is Texture2D[][]?

Hi,

What does Texture2D[][]mean? I have searched everywhere I can think to, but can't find a single reference other than my source which is a script I'm trying to dissect. I also can't find any reference to "[][]".

Thanks in advance for any help.

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 maccabbe · Sep 07, 2015 at 02:40 AM 1
Share

It's a jagged array of Texture2Ds

https://msdn.microsoft.com/en-us/library/2s05feca.aspx

http://docs.unity3d.com/ScriptReference/Texture2D.html

avatar image Oorlfe · Sep 07, 2015 at 04:42 AM 0
Share

Great, thanks!

avatar image nu-assets · Sep 07, 2015 at 06:17 AM 1
Share

@maccabbe is right that's a jagged array. There are basically two types of arrays with more than one dimension in c#.

$$anonymous$$ultidimensional Array ($$anonymous$$A)

Basically a matrix. This type has a much nicer syntax compared to the jagged one. But inspecting the produced IL code you will quickly find its disadvatage: The JIT compiler produces method calls and has a more complicated bounding check. Theoretically this array should be faster than the jagged one because of its items are linearly arranged in memory, but in fact it's not.

Usage:

 int[,] matrix= new int[2,2];
 matrix[0, 0] = 12;

Jagged Array (JA)

Just an array of arrays. Has not to be symemmtrical as the $$anonymous$$A, but it could. Due the fact that the compiler outputs pretty optimized code for this kind of array it's slightly faster compared to the $$anonymous$$A.

Usage:

     int[,] jaggedArray= 
    {
     new int[] {1,2,3,4,5},
     new int[] {10,11,12,13},
     new int[] {14}
    };
     jaggedArray[0][0] = 15;

1 Reply

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

Answer by wibble82 · Sep 07, 2015 at 06:00 AM

It's an array of arrays :)

Single texture: Texture2D

Array of textures: Texture2D[]

Array of arrays of textures: Texture2D[][]

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

29 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

Related Questions

How to get mipChain and linear values from existing Texture2D 0 Answers

Getpixels and Getpixels32 doubles and clips RGBA pixel values 0 Answers

Apply Generated Texture to Mesh 1 Answer

Wait for Texture.ReadPixels 1 Answer

Trying to assign a sprite, but getting Type missmatch 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