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 Fred_Vicentin · Jan 15, 2014 at 06:55 PM · texturearray

Link image sequence to an array

Hey guys, I tried to do a video with transparency but I got some problems, now I'm using an image sequence to do an animated texture by my self, I done the code, and its all working but I have 70 png's sequences to link one per one.

I'm using public Texture[] texture

Can I link a folder and get the images inside or any other solution to don't drag pngs one per one ?

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

2 Replies

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

Answer by robertbu · Jan 15, 2014 at 07:09 PM

If you take a look at the Unity Interface, you will see a tiny lock icon at the top right of the Inspector opposite the 'Inspector' tab. To load all of your images at once:

  • Select the game object with the above script

  • Click on the 'lock' icon to lock the veiw

  • Go to your textures and select the ones you want

  • Drag and drop the whole list to the 'texture' variable

  • Click on the 'lock' icon again to unlock the view

Comment
Add comment · Show 4 · 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 Fred_Vicentin · Jan 15, 2014 at 08:31 PM 0
Share

Thank you :), worked

avatar image Fred_Vicentin · Jan 15, 2014 at 08:58 PM 0
Share

I found a problem, Unity is not displacing them in order, for example, the images are named 01,02,03,04 and unity put 02,01,04,06

avatar image robertbu · Jan 15, 2014 at 09:12 PM 1
Share

You are absolutely right. I've never used this feature for exactly this purpose. It seems like a bug to be for it to function this way. The only thing I can think of to work around the problem is Resources.Load() or Resources.LoadAll(). Put all of your images in a folder in the Assets/Resources folder. Then you can do:

 void Start() {
     texture = Resources.LoadAll<Texture>("theTextures");
 }

...where 'theTextures' is the name of the folder inside of 'Resources' where you placed your images.

avatar image Fred_Vicentin · Jan 16, 2014 at 12:09 PM 0
Share

Solved ! Thank you !

avatar image
0

Answer by Fred_Vicentin · Jan 16, 2014 at 12:28 PM

I'm posting there to help everyone that have the same problem. I done some modifications on my code, this is a code that pass texture per texture like a MovieTexture, you can use it when you need a transparency on your video.

Code:

 using UnityEngine;
 using System.Collections;
 
 
 public class gifAnimate : MonoBehaviour
 {
     //Can't be Texture, you need create an Object and later convert in Texture
     public Object[] botao;
     
     //Change this for speed
     public float framesPerSecond = 10;
     
     void Start()
     {
            //Change "MaoEsquerda" for the Folder name (thanks robertbu)
        botao = Resources.LoadAll("MaoEsquerda");
     }
 
     void Update()
     {
        int index = (int) (Time.time * framesPerSecond) % botao.Length;
 
         //Now you convert the Object to texture
         renderer.material.mainTexture = botao[index] as Texture;       
     }
 }

Remember that you need to create a folder called Resources and put a folder with the name that you want, on my case, "MaoEsquerda". Enjoy =)

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

18 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

Related Questions

Cycling Texture Array 1 Answer

How to access multiple components of a component at once? 2 Answers

How can i show the texture in the array? 2 Answers

Textures from array variabels? 1 Answer

Assigning UV Map to model at runtime 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