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 /
This question was closed Nov 07, 2013 at 12:58 PM by Dave-Carlile for the following reason:

Duplicate Question: http://answers.unity3d.com/questions/570824/it-will-not-show-correctly-using-custom-shader-whi-1.html

avatar image
0
Question by gyb_bobo · Nov 07, 2013 at 12:57 PM · shaderiosassetbundle

It will not show correctly using custom shader while loading assetbundle built in iPhone

Just like title. this is the code pack the prefab

private static void PackSelect() { string path = Application.streamingAssetsPath + "/bundle.pack";

 BuildPipeline.PushAssetDependencies();
 
 BuildPipeline.BuildAssetBundle(Selection.activeObject, null, path,
                                 BuildAssetBundleOptions.CollectDependencies |
                                 BuildAssetBundleOptions.CompleteAssets
                                 , BuildTarget.iPhone);
 BuildPipeline.PopAssetDependencies();

}

the prefab can be shown on iPhone correctly, but it turned black(may be execute "Fallback" in shader) while loading assetbundle in UNITY_EDITOR and other platforms.

shader code Shader "Mobile/Cutoff2Side" {

     Properties 
     {
         _Color("_Color", Color) = (0.4980392,0.4980392,0.4980392,1)
         _Colorpower("_Colorpower", Float) = 2
         _Diffusemap("_Diffusemap", 2D) = "gray" {}
         _Clipbias("_Clipbias", Range(0,1) ) = 0.466
         _Alphabias("_Alphabias", Range(0,1) ) = 0
     }
     
     SubShader
     {    
         
         LOD 200
 
         Tags
         {
             "Queue" = "Transparent"
             "IgnoreProjector" = "True"
             "RenderType" = "Transparent"
         }
         
 
         Cull Back
         Lighting Off
         ZWrite Off
         AlphaTest Off
         Fog { Mode Off }
         Offset -1, -1
         ColorMask RGB
         Blend One OneMinusSrcAlpha 
         ColorMaterial AmbientAndDiffuse
         
         CGPROGRAM
         #pragma surface surf Lambert
         #pragma target 2.0
         
         float4 _Color;
         float _Colorpower;
         sampler2D _Diffusemap;
         float _Clipbias;
         float _Alphabias;
         
         struct Input
         {
             float2 uv_Diffusemap;
         };
         
         void surf(Input IN, inout SurfaceOutput o)
         {
             float4 color = tex2D(_Diffusemap, IN.uv_Diffusemap);
             o.Emission =  (color * _Colorpower.xxxx * _Color).xyz;
             o.Alpha = (color.a - _Alphabias).x;
             float c = (color.a - _Clipbias).x;
             clip(c);
         }
         ENDCG
     }
     Fallback "Diffuse"
 }
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

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

15 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

Related Questions

It will not show correctly using custom shader while loading assetbundle built in iPhone 2 Answers

Streamed textures appearing as default white only on iOS 0 Answers

Asset bundle shader standard 0 Answers

fixed half float performance on iOS? 1 Answer

See through issue in iOs 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