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 ShaneTheVeryTall · Feb 21, 2012 at 05:56 PM · texturebuildwwwloadresources

Loading textures into an array after build

I am trying to build an application that lets you change add and remove textures (allowing for a variable amount of images) after building the executables for Mac and Windows.

Here is the code, which works fine when adding images to the Resources folder within Unity:

 #pragma strict
 var texture : Texture2D;
 var textures : Object[];
 var i : int = 0;
 
 function Start () {
     textures = Resources.LoadAll("Textures",Texture2D);
     texture = textures[i];
     renderer.material.mainTexture = texture;
 }
 
 function Update () {
     if(Input.GetKeyUp("o")){
         if(i == textures.Length - 1)
             i = 0;
         else
             i ++;
         texture = textures[i];
         renderer.material.mainTexture = texture;
     }
     if(Input.GetKeyUp("i")){
         if(i == 0)
             i = textures.Length - 1;
         else
             i --;
         texture = textures[i];
         renderer.material.mainTexture = texture;
     }
 }

I would like to be able to make this work the same way after the executables have been built. For example, I could use the www class and load something from a folder next to (same path as) the executable. But I don't know how to do the equivalent with the www class. Specifically, loadAll() and then make an array from that.

Any hints?

Thanks!

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

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Berenger · Feb 21, 2012 at 09:56 PM

Maybe it's possible to execute a batch that copy everyhting in the folder you're talking about into the Resources folder ? No idea if that's a good idea, just throwing ideas.

Comment
Add comment · Show 2 · 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 ShaneTheVeryTall · Feb 21, 2012 at 09:59 PM 0
Share

Hmm... interesting idea. Thank you! It's worth mentioning that the idea here is to be able to hand off a unity-built executable with a folder along side of it that the end user (a non unity-user) would be able to throw images into or remove images from (assu$$anonymous$$g they are power of 2 and formatted correctly) without having to do anything else. If your solution would require them somehow running a batch every time, I'd probably try to avoid it. I probably should have clarified my intentions in my original post.

avatar image Berenger · Feb 21, 2012 at 10:05 PM 0
Share

Anyway I'm pretty sure my idea is wrong. I think the Resources folder only matter to tell the build to take everything in it. After the build, I don't think you can use a Resource folder, other than the one compressed in the .unity3d.

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

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

How can I load texture files that are outside of my project folders? 1 Answer

Resource.LoadAll not working in build (works in editor mode) 2 Answers

Free memory after WWW.LoadImageIntoTexture 1 Answer

Images don't load after building. 1 Answer

WWW loading texture problem when built 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