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 Oct 28, 2016 at 02:07 PM by Landern.
avatar image
0
Question by susanto23_ · Oct 28, 2016 at 10:05 AM · unity 5drawline

drawline can't display game? give me a solution

 private const float TILE_SIZE = 1.0f;
 private const float TILE_OFFSET = 0.5f;

 private int selectionX = -1;
 private int selectionY = -1;

 private void Update(){
     PapanCatur ();
     UpdateSelection ();
 }

 private void UpdateSelection ()
 {
     if (!Camera.main)
         return;
     RaycastHit hit;
     if (Physics.Raycast (Camera.main.ScreenPointToRay (Input.mousePosition), out hit, 25.0f, LayerMask.GetMask ("ChekersPlane"))) {
         selectionX = (int)hit.point.x;
         selectionY = (int)hit.point.z;
     } else {
         selectionX = -1;
         selectionY = -1;
     }
 }

 private void PapanCatur(){
     
     Vector3 widthLine = Vector3.right * 8;
     Vector3 heightline = Vector3.forward * 8;
     for(int i = 0; i<=8; i++){
         //debug.drawline cant display in game unity
         Vector3 start = Vector3.forward * i;
         Debug.DrawLine (start, start + widthLine,Color.yellow,0.0f, true);
         for (int j = 0; j <= 8; j++) {
             start = Vector3.right * j;
             Debug.DrawLine (start, start + heightline,Color.yellow,0.0f,true);
         }
     }
     //draw the selection
     if (selectionX >= 0 && selectionY >= 0) {
         Debug.DrawLine (
             Vector3.forward * selectionY + Vector3.right * selectionX,
             Vector3.forward * (selectionY + 1) + Vector3.right * (selectionX + 1));
         
         Debug.DrawLine (
             Vector3.forward * (selectionY + 1 ) +Vector3.right * selectionX,
             Vector3.forward * selectionY + Vector3.right * (selectionX + 1));

     }
 }

}

Comment
Comments Locked · Show 5
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 Namey5 · Oct 28, 2016 at 10:28 AM 0
Share

You haven't asked a question, nor supplied a problem. Please expand.

avatar image susanto23_ · Oct 28, 2016 at 10:40 AM 0
Share

Sorry, in this case. I can't display after i play in the unity. I think have a proble in debug.drawline,

avatar image Namey5 susanto23_ · Oct 28, 2016 at 10:48 AM 0
Share

Have you made sure that Gizmos are enabled in play mode? They aren't by default and are necessary for Debug.DrawLine to work.

avatar image susanto23_ · Oct 28, 2016 at 10:56 AM 0
Share

what is Gizmos? i don't know.. how to enable Gizmos in play mode?

avatar image Namey5 susanto23_ · Oct 28, 2016 at 11:11 AM 1
Share

alt text

Click the button on the far right of the Game View Control Bar.

gameviewcontrolbar.png (9.0 kB)

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

117 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

Related Questions

Draw a line in forward direction of a object 1 Answer

Making Raycast line visible 2 Answers

How to apply an array of transforms to an array of game objects 0 Answers

Flip Rotation of transform when it bounces off a wall 1 Answer

Problem in steering with wheelcolliders 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