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 nicholasfsoares · Aug 17, 2012 at 03:31 PM · guigameobjecttexturebuttonreset

Problem with texture to reset and re-enter the same texture

Well guys my english is not very good to write, read only, so sorry if some error writing this, I'm even using the google translator to make my life easier.

Well my problem is this, in my code I have an object that plan to use viewer textures, then apply to other objects, and I'm using GUI buttons to change the texture, there is a button that I use to reset the changes made texture in this view object to reset the value I set the texture of the object to null, and this is not exactly the problem, the problem occurs after clicking the reset button, when I insert a new texture or the texture that was earlier working, the preview image is all white or the texture appears blurry, I am not able to understand why this is happening, I tried moving the code several times but not able to understand what the problem is, now hear in that forum textures to use instantiate. syntax error does not appear, only this same problem that should be something same semantics.

I'll try to put the code down here so that it is easy to understand.

 // variables
 var tam = 10;
 var Text_Parede : Texture[] = new Texture[tam];
 var Text_Piso : Texture[] = new Texture[tam];
 var Textura : Texture;
 var PreviewText : Texture;   
 /* 
 ...
 other functions and variables that do not have to do with the problem//other functions variables 
 ....
 */ 
 // Screen To Textures Buttons
 scrollPosition = GUILayout.BeginScrollView (scrollPosition,GUILayout.Width(235),GUILayout.Height(140));
 GUILayout.BeginHorizontal();
     for(cont=1;cont<=maior;cont++)
     {
         if(j >= 3)
         { 
             GUILayout.EndHorizontal();
             GUILayout.BeginHorizontal();
             j = 0;
             i++;
         }
         if(Text_Parede[cont-1] && BtnParede)
         {
             if(GUILayout.Button(Text_Parede[cont-1],GUILayout.Width(Btn),GUILayout.Height(Btn)))
             {
                 Textura = new Texture();
                 Textura = Instantiate(Text_Parede[cont-1]);
                 showExampleModel = true;
                 PreviewText = Textura;
                 GameObject.FindWithTag("FollowMouse").renderer.material.mainTexture = Textura;
                 preto = 255;
                 vermelho = 255;
                 azul = 255;
                 verde = 255;
                 tipo = "Parede";
                 // Para Rotacionar a Textura usando Shaders
                 //GameObject.FindWithTag("FollowMouse").renderer.material = NewMaterial(Text_Parede[cont-1]);
             }
         }
         if(Text_Piso[cont-1] && BtnPiso)
         {
             if(GUILayout.Button(Text_Piso[cont-1],GUILayout.Width(Btn),GUILayout.Height(Btn)))
             {
                 Textura = new Texture();
                 Textura = Instantiate(Text_Piso[cont-1]);
                 showExampleModel = true;
                 PreviewText = Textura;
                 GameObject.FindWithTag("FollowMouse").renderer.material.mainTexture = Textura;
                 preto = 255;
                 vermelho = 255;
                 azul = 255;
                 verde = 255;
                 tipo = "Piso";
                 // Para Rotacionar a Textura usando Shaders
                 //GameObject.FindWithTag("FollowMouse").renderer.material = NewMaterial(Text_Parede[cont-1]);
             }
         }
         j++;
     }
 GUILayout.EndHorizontal();
 if(BtnCor)
 {
     CoresPredefinidas();
     GrayScale = false;
 }
 GUILayout.EndScrollView();
 /* 
 ...
 other functions and variables that do not have to do with the problem//other functions variables 
 ....
 */ 
 // Screen To Reset Button
 GUILayout.BeginHorizontal();
     GUILayout.Space(180);
     if(reset)
     {
         GUILayout.Box("Resetando Aguarde...",GUILayout.Width(60));
         /*DeslocarTextura = true;
         EscalarTextura = false;
         ColorirTextura = false;*/
         reset = false;
     }
     else
     {
         if(GUILayout.Button("Resetar",GUILayout.Width(60)))
         {
             //reset = true;
         //Scale_x_text = 1;
         //Scale_y_text = 1;
         Desc_x_text = 0;
         Desc_y_text = 0;
         vermelho = 255;
         verde = 255;
         azul = 255;
         Textura = null;
         PreviewText = null;
         GameObject.FindWithTag("FollowMouse").renderer.material.mainTexture = Textura;
         }
     }
 GUILayout.EndHorizontal();
 
 // the file has 540 lines and not everything has to do with the problem why just put the code where the problem occurred.

Ps.: I am using object with scalar functions, vertical and horizontal scroll, rotate, change color of all textures that appear in the viewer. Do not worry about the variable names in Portuguese.

Thanks for reading, and if you can help will be much appreciated. Sincerely, nicholasfsoares

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 nicholasfsoares · Aug 22, 2012 at 12:28 PM 0
Share

well guys, no longer need, I solved differently, as I use a color control material for some reason to reset the texture he crashed the value of control, leaving blank or black according to the changed code, as on my screen, I had little buttons like a toolbar, color, scale and texture displacement, reseted the initial position of the toolbar to control color, and now everything is normal.

strange as it may seem my text, the important thing that worked here, it was error semantics.

thanks guys

0 Replies

· Add your reply
  • Sort: 

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

8 People are following this question.

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

Related Questions

GUI button doesn't appear on Android 0 Answers

How can I get the Unity 3 texture for 'button on'? 2 Answers

GUILayout.Button scales texture wrong 0 Answers

Specify OnMouseEnter 2 Answers

DrawTexture GUI iPhone 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