Author Topic: NGUI affacting the 3D model texture  (Read 2239 times)

sherocku

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 1
    • View Profile
NGUI affacting the 3D model texture
« on: October 23, 2014, 11:48:37 PM »
Hi, I am using NGUI3.6.5.
I found that whenever I use the following code to enable a button that made by a NGUI sprite, the texture of the 3D model in another camera will be affected.


  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class testNGUI : MonoBehaviour {
  5.         public GameObject       testingSprite_GO;
  6.         public UISprite         testingSprite_S;
  7.         private bool spriteEnabled = true;
  8.         private bool gameObjectEnabled = false;
  9.  
  10.         void OnGUI(){
  11.                 if(GUI.Button(new Rect(100, 350, 100, 50), "Sprite On")){
  12.                         testingSprite_S.enabled = !spriteEnabled;
  13.                         spriteEnabled = !spriteEnabled;
  14.                 }
  15.  
  16.                 if(GUI.Button(new Rect(100, 400, 100, 50), "GameObject On")){
  17.                         testingSprite_GO.SetActive(!gameObjectEnabled);
  18.                         gameObjectEnabled = !gameObjectEnabled;
  19.                 }
  20.         }
  21. }

After enabling the button the material/ texture of the 3D model is broken, sometimes will be transparent),
The attachment can see the correct model and bugged model.


And this problem will be happen on iphone :'(
When I build on Android or play on unity editor, the model will not have any problems.

It was troubled. :'(:'(:'(
How can I use NGUI sprite but not affect the 3D model texture? Thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: NGUI affacting the 3D model texture
« Reply #1 on: October 25, 2014, 02:18:20 PM »
First, you shouldn't mix OnGUI and NGUI. They are completely different systems and are not meant to be used together.

Second -- NGUI doesn't affect 3D models at all. NGUI simply creates geometry that's drawn by Unity, nothing else. I suggest looking at the material and/or shader used by your 3D model.