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 Nick_lzn · Feb 14, 2014 at 04:44 AM · no errorobject follow path

Instantiating Texture2D Object get non-readable error about AssetBundle

hi guys! I got an error when i Instantiate the mainAsset of the AssetBundle, which it is like: Instantiating a non-readable '001' texture is not allowed!Please mark the texutre readable in the inspector or don't instantiate it.

the code:

 Texture2D tex = Instantiate(www.assetBundle.mainAsset) as Texture2D;
 //some assign
 www.assetBundle.Unload(false);

I change the Texture-Type to Advance,and enable the read/write-Enable;then Build AssetBundle. But it's not working.Still get same error.

the Build code:

 BuildPipeline.BuildAssetBundle(object, null, path, BuildAssetBundleOptions.ColletDependencies | BuildAssetBundleOptions.CompleteAssets);

Thanks in Advance!

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

3 Replies

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

Answer by MOlmstead · Feb 20, 2014 at 03:44 PM

I'm having this same problem and I've come to the conclusion that it is not possible. I have a bundle with a texture that I want to save to disk (the reason why is irrelevant). When I call EncodeToPNG() I get the same error as Nick_Izn.

The problem is the fact that "Read/Write Enabled" is stored in the texture's metafile but BuildAssetBundle doesn't pack meta files and I see no way to make it do so, short of making the entire bundle a scene.

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 Nick_lzn · Feb 21, 2014 at 02:13 AM 0
Share

Your conclusion sounds reasonable. Finally, I change my solution with IO.FILE operation by my self ins$$anonymous$$d. Hope Unity3D-Team would be inproved this problem.

avatar image
1

Answer by ereneld · Sep 24, 2014 at 10:20 PM

I had the same issue. The solution is changing Texture import settings on asset bundle creation using OnPreprocessTexture function. You can use the example class to change texture import setting on asset bundle creation.

 using UnityEngine;
 using UnityEditor;
 
 class TextureImporterExample : AssetPostprocessor {
     void OnPreprocessTexture () {
         TextureImporter textureImporter = assetImporter as TextureImporter;
         //textureImporter.compressionQuality = (int)TextureCompressionQuality.Best;
         //textureImporter.textureFormat = TextureImporterFormat.RGB24;
         textureImporter.isReadable = true;
     }
 }



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 Nick_lzn · Oct 24, 2014 at 02:32 AM 0
Share

THAN$$anonymous$$ YOU VERY $$anonymous$$UCH! It is very useful code!

avatar image aryaman1994 · Jun 15, 2016 at 07:55 AM 0
Share

Thank you so much. Just what I needed and an extremely elegant solution!

avatar image Weedliam · Aug 12, 2016 at 09:27 PM 0
Share

please tell me how to use that function, I added the class to "Editor" folder, but the error continues

avatar image
0

Answer by Robotron18 · Apr 22, 2015 at 12:05 PM

And you can to use BuildAssetBundleOptions.DeterministicAssetBundle parameter in BuildPipeline.BuildAssetBundle() method. In this case bundle will create with texture project settings.

http://docs.unity3d.com/ScriptReference/BuildAssetBundleOptions.DeterministicAssetBundle.html

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.

Follow this Question

Answers Answers and Comments

23 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

Related Questions

Codes unavailable in C# 0 Answers

Get Asset Preview (3.5) 1 Answer

How to partially reveal texture of a plane or object 1 Answer

How can i reset unity to default? 0 Answers

Get ClosestPointOnBounds when inside bounds? 2 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