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 Feb 07, 2015 at 04:21 PM by meat5000 for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by ntaproduction · Feb 07, 2015 at 11:15 AM · movementmobilecharactermousemouseposition

How do I stop an object from cloning when moving?

I'm creating a mobile game that the user has to tap the screen to move the object/character. Right now I'm using mouse input to test the game play and haven't gotten far in development, just getting the input down but I can't seem to figure it out. When I press play then click on the screen, the object moves to the clicked position but leaves a trail of self clones and it continues to do it every time I click. Help is greatly appreciated.

 public class PlayerInput : MonoBehaviour 
 {
     private Vector3 target;
     public float speed = 1.5f;
 
         // Use this for initialization
     void Start () 
     {
         target = transform.position;
     
     }
     
     // Update is called once per frame
     void Update () 
     {
         if (Input.GetMouseButtonDown(0))
         {
 
             target = Camera.main.ScreenToWorldPoint(Input.mousePosition);
             target.z = transform.position.z;
 
             //Debug.Log("TAP!!!");
         }
 
         gameObject.transform.position = Vector3.MoveTowards(transform.position, target, speed * Time.deltaTime);
 
     }
 }
 
unity-screenshot.jpg (103.6 kB)
Comment
Add comment · Show 2
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 ntaproduction · Feb 07, 2015 at 07:44 AM 0
Share

Never$$anonymous$$d. It's gotta be a graphics issue.

avatar image AngryBurritoCoder · Feb 07, 2015 at 01:20 PM 0
Share

HEY, take a screenshot of you camera object selected, check your flag settings of the camera, just like yemachu said, i doubt its a graphics issue

1 Reply

  • Sort: 
avatar image
1
Best Answer

Answer by Mr. Mud · Feb 07, 2015 at 11:27 AM

From what I can make out of the image, the Clearflags of your camera are either set to "Depth only" or "Don't Clear".

Changing it to "Solid Color" or "Skybox" should solve this issue. Or have another camera render a background first... not all that efficient.

Comment
Add comment · Show 2 · 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
avatar image ntaproduction · Feb 07, 2015 at 04:14 PM 0
Share

Yea the clear flags where set to depth only. Sorry about that. Thanks for the help.

avatar image Mr. Mud · Feb 07, 2015 at 04:39 PM 0
Share

This forum is supposed to help you out with some (slight) issues you might run into, so there is no need to apologize. In any case, I am glad that I could help you solve this issue.

Follow this Question

Answers Answers and Comments

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Unity3d 4,script nGUI btn drag convert to move where i mouse click 1 Answer

Get general direction of mouse/tap location relative to player on mouse click? 0 Answers

Smooth Camera Movement script with problem. 0 Answers

Getting object to follow mouse position along X axis only 4 Answers

c# scripting navigation problems 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