Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Strange Lines in Android Version

Discussion in 'Scripting' started by mirzahat, Aug 24, 2015.

  1. mirzahat

    mirzahat

    Joined:
    Dec 21, 2014
    Posts:
    53
    Hello,

    I exported my app for android and here is a strange result:

    https://www.dropbox.com/s/1fcc9zu4acmhyin/droid.jpg?dl=0

    There is a clip in the billiard game that is is pointing toward the touch point.

    But why is this clip colored pink?

    Is it because I use a raycast?

    Do I need to post my code?

    irza
     
  2. pixpusher2

    pixpusher2

    Joined:
    Oct 30, 2013
    Posts:
    121
    I can only guess that it's either missing a texture or the shader used is not supported on your mobile
     
  3. mirzahat

    mirzahat

    Joined:
    Dec 21, 2014
    Posts:
    53
    Hello,

    actually its a lineRenderer...here is the code:

    Code (csharp):
    1.  
    2. lineRenderer.SetPosition(0, startPos);
    3. Vector3 forward = transform.TransformDirection(direction) * 100;
    4. lineRenderer.SetPosition(1, forward);
    5.  
    On desktop, it works ok...the renderer is set up programmatically:

    Code (csharp):
    1.  
    2. lineGO = new GameObject("Line");
    3.         lineGO.AddComponent<LineRenderer>();
    4.         lineRenderer = lineGO.GetComponent<LineRenderer>();
    5.         lineRenderer.material = new Material(Shader.Find("Mobile/Particles/Additive"));
    6.         lineRenderer.SetColors(c1, c2);
    7.         lineRenderer.SetWidth(0.01F, 0.01F);
    8.         lineRenderer.SetVertexCount(2);
    9.  
    On android, it gives me those odd results...

    Any ideas?

    Mirza
     
  4. BrendanKZN

    BrendanKZN

    Joined:
    Jun 22, 2011
    Posts:
    157
    Apparently Shader.Find only looks in a Resources folder as per the docs. "When building a player, a shader will only be included if it is assigned to a material that is used in any scene or if the shader is placed in a "Resources" folder"
     
  5. mirzahat

    mirzahat

    Joined:
    Dec 21, 2014
    Posts:
    53
    I dont get it somehow...

    Do you mean I need to check what shaders are there for all?

    Mirza
     
  6. pixpusher2

    pixpusher2

    Joined:
    Oct 30, 2013
    Posts:
    121
    Referring to BrendanKZN's post, are you using the Mobile/Particles/Additive shader on any other materials in game?
    If not, you'll have to place that .shader file inside your Assets/Resources folder for it to be packaged with the project.