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
2
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
Add comment · 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
4
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
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 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
Add comment · 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.

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

How to get player's face onto character mesh 1 Answer

Update Texture type to GUI during runtime 0 Answers

Loading a www texture makes my game freeze for a second 1 Answer

Why is NativeArray always shorter than the number of pixels in the texture? 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