• 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
Question by Lemon · Apr 20, 2011 at 10:40 PM · texturetexture2ddynamicreadableisreadable

Dynamically create Texture2D that is readable

I want to create a Texture2D dynamically which is readable. There doesn't appear to be any way to set the IsReadable property to true. The docs reference IsReadable, but I can't even find it declared anywhere. I have

Texture2D tex = new Texture2D(width, height, TextureFormat.RGB24, false);

The size of the Texture is runtime dependent, and so I can't create it using a TextureImporter. I also can't clone an existing Texture2D which is readable because I need to change the size.

Thanks

Comment
thienhaflash
siddharth3322

People who like this

2 Show 2
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 xeratol · May 03, 2011 at 11:48 AM 0
Share

I'm having the exact issue. I need to find the "IsReadable" flag because I'm using SetPixels() but I can't find it anywhere. I don't understand :(

avatar image xeratol · May 03, 2011 at 11:53 AM 0
Share

Correction, I'm using GetPixels() which require IsReadable. I checked the "Read/Write Enabled" check box in the Texture Importer but it still causes the same error.

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Eric5h5 · Apr 20, 2011 at 10:44 PM

Your code is fine; you don't need to do anything extra.

Comment
Lemon
Bunny83
Joshua
GurtejKanwar
nyonge
siddharth3322

People who like this

4 Show 0 · 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

Answer by sendel76 · Sep 12, 2011 at 10:40 PM

Having the same issue.

protected static void makeReadable(Texture2D [] textures, bool enabled ) { foreach (Texture2D texture in textures)
{ string path = AssetDatabase.GetAssetPath(texture); TextureImporter textureImporter = AssetImporter.GetAtPath(path) as TextureImporter; textureImporter.isReadable = enabled;
AssetDatabase.ImportAsset(path); } }

this does not help since I created a new Texutre. I want to save this new Texture as PNG - but it says that I cannot save it because read is not enabled.

so... bummer.

Comment

People who like this

0 Show 1 · 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 DaveA · Sep 12, 2011 at 10:40 PM 1
Share

Please format your code with the 101/010 button

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.

Update about the future of Unity Answers

Unity Answers content will be migrated to a new Community platform and we are aiming to launch a public beta later in June. Please note, we are aiming to set Unity Answers to read-only mode on the 31st of May in order to prepare for the final data migration.

For more information, please read our full announcement.

Follow this Question

Answers Answers and Comments

3 People are following this question.

avatar image avatar image avatar image

Related Questions

My Dynamic texture not showing up in the Build??? 0 Answers

When is a referenced texture actually loaded? 0 Answers

Normalizing World Coordinates in Shader & Looking at Reference Texture Returns Incorrect Color 1 Answer

Set image as material 0 Answers

Terrain not unloading texture. 0 Answers


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