Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 /
  • Help Room /
avatar image
0
Question by Wineburgen · Mar 03, 2016 at 12:42 PM · c#linerenderer

Linerenderer disappears after second linerenderer appears

I want to draw two separate line renderers in a scene. One line renderer starts as soon as the script starts running, the other line renderer starts after a certain trigger. However, as soon as the second line renderer starts, the line of the first line renderer disappears. A sphere that moves over this line continues moving in the place where the line should be.

This is how I make the different line Renderers:

 LineRenderer StartlineRenderer;
 LineRenderer[] CheckLinerender = new LineRenderer[18];

  void Start()
     {
         StartlineRenderer = gameObject.AddComponent<LineRenderer>();
         StartlineRenderer = GetComponent<LineRenderer>();
         StartlineRenderer.material = StartMat;
         StartlineRenderer.SetWidth(w, w);
         for (int i = 0; i < 18; i++)
         {
             CheckLinerender[i] = new GameObject().AddComponent<LineRenderer>();
             CheckLinerender[i] = GetComponent<LineRenderer>();
             CheckLinerender[i].material = CheckMat[i];
             CheckLinerender[i].SetWidth(w, w);
         }
     }

Afterwards, I go to other scripts to draw the line renderers:

             lineballs0.LINEballs0(StartlineRenderer, StartSphere, StartText3d);
             T1CHECK1.t1Check1(CheckLinerender[0],CheckSphere[0], Check1Text3d[0]);

These scripts look as follows:

 public static void t1Check1(LineRenderer t1c1, Transform Sphere, TextMesh text1)
     {
                 float temp = READER.count;
                 n = 10;
                 float sfy = 50f;
                 t1c1.SetVertexCount(filereader.lastNumberInclusive + 1 + 2 );
                 int k = 0;
                 for (int i = 0; i < filereader.lastNumberInclusive ; i++)
                 {
                     Vector3 vtemp;
                     vtemp.x = -200 - 1 * (float)i + filereader.lastNumberInclusive / 2;
                     vtemp.y = sfy + TEST1.Check1[0, i];
                     vtemp.z = 200;
                     t1c1.SetPosition(k, vtemp);
                     k++;
                 }
                 Vector3 vPos;
                 vPos.x = -200 - 1 * (temp - n) + filereader.lastNumberInclusive / 2;
                 vPos.y = sfy + TEST1.Check1[0, temp - n];
                 vPos.z = 200;
                 Sphere.position = vPos;
                 text1.transform.position = vPos;
                 text1.text = TEST1.Check1[0, temp - n].ToString("0");
         }

AND:

 public static void LINEballs0 (LineRenderer lineRenderer, Transform Sphere, TextMesh text1) 
     {
         float sfy = 3f;
         int temp = READER.count;
         if (temp < 0)            
                      temp = 1;
         lineRenderer.SetVertexCount(filereader.lastNumberInclusive+1+2);
         int k = 0;
         for (int i = 0; i <= filereader.lastNumberInclusive; i++)
         {
             Vector3 vtemp;
         vtemp.x = -200 - 1 * (float)i + filereader.lastNumberInclusive / 2;
         vtemp.y = sfy* filereader.var[0, i];
             vtemp.z = 200;
             lineRenderer.SetPosition(k, vtemp);
             k++;
         }

         int j = filereader.frameCount;
         Vector3 vPos = new Vector3 (-200 - 1*j + filereader.lastNumberInclusive / 2, sfy *                          filereader.var[0, j], 200);
         Sphere.position = vPos;
         text1.transform.position = vPos;
         text1.text = j.ToString() + " " + filereader.var [0, j].ToString("0");
     }

The latter function starts running immediately, the prior starts after a certain timespan. Can anybody tell me why my second line renderer's appearance makes my other line renderer disappear?

Thanks!

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

· 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

3 People are following this question.

avatar image avatar image avatar image

Related Questions

How do I draw a local space line render between parent and child objects ? 1 Answer

Drawing lines folling user input using line renderer. 0 Answers

How to make a surface glow when its hit by a laser. 0 Answers

LineRenderer Raycast Gun Bug 1 Answer

X/Y/Z distance 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