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 /
This question was closed Nov 06, 2019 at 04:21 PM by Beginner_at_Unity for the following reason:

Solution given by unity development team.

avatar image
0
Question by Beginner_at_Unity · Aug 09, 2019 at 04:03 PM · not workingline

Fruit ninja : Bomb works well but stroke still works only 50% on devices

Update: I found the fault of the bomb and fixed it. However, it appears that the stroke remains unsolved.

The script affecting this is the line script. Does anyone have any ideas how to fix this?

 using System.Collections;
 using UnityEngine;
 
 public class LineCreator : MonoBehaviour
 {
     int vertexCount = 0;
     bool mouseDown = false;
     LineRenderer line;
     public GameObject blast;
 
     void Awake()
     {
         line = GetComponent<LineRenderer>();
     }
 
     void Start()
     {
 
     }
 
     void Update()
     {
 
         if (Application.platform == RuntimePlatform.Android)
         {
 
             if (Input.touchCount > 0)
             {
 
                 if (Input.GetTouch(0).phase == TouchPhase.Moved)
                 {
                     line.SetVertexCount(vertexCount + 1);
                     Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                     line.SetPosition(vertexCount, mousePos);
                     vertexCount++;
 
                     //BoxCollider2D box = gameObject.AddComponent<BoxCollider2D>();
                     //box.transform.position = line.transform.position;
                     //box.size = new Vector2(0.1f, 0.1f);
 
                     EdgeCollider2D eCol = gameObject.AddComponent<EdgeCollider2D>();
                     Vector3[] pos = new Vector3[line.positionCount];
                     line.GetPositions(pos);
                     Vector2[] pos2 = new Vector2[line.positionCount];
                     for (int i = 0; i < line.positionCount; i++)
                     {
                         pos2[i] = new Vector2(pos[i].x, pos[i].y);
 
                     }
                     eCol.points = pos2;
 
 
                 }
 
                 if (Input.GetTouch(0).phase == TouchPhase.Ended)
                 {
                     vertexCount = 0;
                     line.SetVertexCount(0);
 
                     BoxCollider2D[] collidors = GetComponents<BoxCollider2D>();
                     foreach (BoxCollider2D box in collidors)
                     {
 
                         Destroy(box);
 
                     }
 
                 }
 
             }
 
 
             if (Input.GetMouseButtonDown(0))
             {
                 mouseDown = true;
                 vertexCount = 0;
                 line.SetVertexCount(0);
 
             }
 
             EdgeCollider2D[] colliders = GetComponents<EdgeCollider2D>();
 
 
             //edge changed to box
             foreach (EdgeCollider2D box in colliders)
             {
                 Destroy(box);
 
             }
 
 
 
             if (mouseDown)
             {
                 line.SetVertexCount(vertexCount + 1);
                 Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                 line.SetPosition(vertexCount, mousePos);
                 vertexCount++;
 
                 BoxCollider2D box = gameObject.AddComponent<BoxCollider2D>();
                 box.transform.position = line.transform.position;
                 box.size = new Vector2(0.1f, 0.1f);
 
             }
 
             if (Input.GetMouseButtonUp(0))
             {
                 mouseDown = false;
                 vertexCount = 0;
                 line.SetVertexCount(0);
 
 
                 //edge changed to box
                 BoxCollider2D[] collidors = GetComponents<BoxCollider2D>();
                 foreach (BoxCollider2D box in collidors)
                 {
 
                     Destroy(box);
 
                 }
             }
 
         }
 
         // else if (Application.platform == RuntimePlatform.WindowsPlayer)
         else
 
         {
 
             if (Input.GetMouseButtonDown(0))
             {
                 mouseDown = true;
 
             }
 
             if (mouseDown)
             {
                 line.positionCount = vertexCount + 1;
                 Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
                 line.SetPosition(vertexCount, mousePos);
                 vertexCount++;
 
 
                 //BoxCollider2D box = gameObject.AddComponent<BoxCollider2D>();
                 //box.transform.position = line.transform.position;
                 //box.size = new Vector2(0.5f, 0.5f);
 
                 EdgeCollider2D edge = gameObject.AddComponent<EdgeCollider2D>();
                 Vector3[] pos = new Vector3[line.positionCount];
                 line.GetPositions(pos);
                 Vector2[] pos2 = new Vector2[line.positionCount];
                 for (int i = 0; i < line.positionCount; i++)
                 {
                     pos2[i] = new Vector2(pos[i].x, pos[i].y);
                 }
                 edge.points = pos2;
             }
 
             if (Input.GetMouseButtonUp(0))
             {
                 mouseDown = false;
                 vertexCount = 0;
                 line.positionCount = 0;
                 //BoxCollider2D[] colliders = GetComponents<BoxCollider2D>();
                 //foreach (BoxCollider2D box in colliders)
                 //{
                 // Destroy(box);
                 //}
 
                 //edge changed to box
                 EdgeCollider2D[] colliders = GetComponents<EdgeCollider2D>();
                 foreach (EdgeCollider2D box in colliders)
                 {
                     Destroy(box);
                 }
             }
         }
     }
 
 
     void OnCollisionEnter2D(Collision2D collision)
     {
 
         if (collision.gameObject.tag == "bomb")
         {
             GameObject b = Instantiate(blast, collision.transform.position, Quaternion.identity) as GameObject;
 
             Destroy(collision.gameObject);
             blast.SetActive(true);
 
         }
 
 
     }
 
 }
 
fruit-ninja-not-working-new-version.jpg (196.0 kB)
Comment
Add comment · Show 8
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 VitaSkr · Aug 10, 2019 at 08:17 AM 0
Share

Hello @JulianHSC ! Could you attach the project for the further investigation?

Best regards, Vita

avatar image Beginner_at_Unity VitaSkr · Aug 10, 2019 at 11:09 AM 0
Share

Hello Vita, Thank you for co$$anonymous$$g to the rescue again. No password required : https://drive.google.com/file/d/1akE$$anonymous$$R8eqHrJA0_0$$anonymous$$e_B1xwXfvJ$$anonymous$$kuup-/view?usp=sharing.

avatar image VitaSkr Beginner_at_Unity · Aug 10, 2019 at 06:03 PM 0
Share

As far as I know it works on the smartphone, right (recently tested on Huawei Honor 10 it works fine)? Unfortunately, I doesn't have the opportunity to test on the tablet. Could you attach a video of the issue I will check the code if everything works as it supposes to.

Vita

Show more comments
avatar image VitaSkr · Aug 20, 2019 at 07:09 AM 0
Share

Hello,

Accept my apologies for the delay in response and thanks for detailed information! Had a look at your code it seems correct. The issue is also reproducible on my device. Could you fill a bug report for that?

Best regards, Vita

avatar image Beginner_at_Unity VitaSkr · Sep 19, 2019 at 11:25 AM 0
Share

@vitaskruibyte , It's been some time now. Has the bug been found? Which unity version is suitable to fix the error? I would appreciate a reply so I can close this case. $$anonymous$$y bomb also doesn't work properly.

1 Reply

  • Sort: 
avatar image
0

Answer by Beginner_at_Unity · Aug 20, 2019 at 07:27 AM

@vitaskruibyte. OK thank you. I will do that soon. I got another case to post here.

Comment
Add comment · Share
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

Follow this Question

Answers Answers and Comments

151 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 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 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 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 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 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 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 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 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 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 avatar image

Related Questions

Longest distance between straight line and a curve. 1 Answer

How to get a drawn line to snap into a shape? 0 Answers

Textures not showing properly? 0 Answers

Function Update not working 1 Answer

[C#] Enum not working properly 2 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