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 TifaOng · Jan 24, 2014 at 11:04 AM · c#shadertexture

Better way to assign texture2D & use shader

I have a gameobject with script to store Texture2D[] frames. Now I have Texture2D [] AUS, RUS, and 30 other countries. Each country need to store 48 frames. And I have 5 of this gameobject. Other than drag and drop each of the images into the AUS[47], are there ways to assign using something like this way AUS[0] = "image_name" in the script?

I will reuse the script for gameobjects in different scenes. Drag and drop 48 frames (each country) for 32 countries for a multiple times is really time consuiming.

Another question about shader. How to use a certain shader in script, such as Refractive?

Comment
Add comment · Show 1
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 KellyThomas · Jan 24, 2014 at 11:45 AM 0
Share

How do you populate AUS?

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by poncho · Jan 24, 2014 at 02:04 PM

well, this is just a shorter form of your code

 List<int> tackleFramesList = new List<int>() {3, 7, 11, 15, 19, 23, 27, 31};
 int imageUserCount=0;
 int tacleFramesCount=0;
 for(int i=0;i<element.Count();i++)
 {
    if (i = tackleFramesList[tacleFramesCount])
    {
       tackle_User[0].tackleFrames[tacleFramesCount] = AUS[i];
       tacleFramesCount += 1;
    }
    else
    {
       image_User[0].frames[imageUserCount] = AUS[i];
       imageUserCount += 1;
    }
 }

you could replace tackle_User[0] and image_User[0], for a tackle_User[PlayerNumber], image_User[PlayerNumber] or something similar which will be tracking each of your 3 players, also all of the code in your "AUS" statement could be in a method that receives AUS as a parameter, then assing everything as you had already did, and send an other AUS kind element and a new list of elements to assing to the tackle_User, the same as the number of the User.

Good luck and happy coding

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 TifaOng · Jan 25, 2014 at 02:50 PM 0
Share

thanks for the answer! I edited my question

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

20 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

Related Questions

Texture2D to Texture3D 2 Answers

Distribute terrain in zones 3 Answers

Color specific sections of a texture 1 Answer

Applying decals / textures to uneven surfaces runtime 1 Answer

Texture2D.Resize and Shader 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