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 /
avatar image
0
Question by pulkit8.mahajan · Aug 09, 2013 at 06:11 AM · androidnot workingmouseover

Unity shows me a picture of a screen whenever I mouse over the game screen.

Hi, I just recently made my first game and it was working fine with my device. But I wanted to add more so I came home and started working on it. For some reason whenever my mouse moves over the game screen it shows me the titlescene or at least the picture I use for the titlescreen. I published it to my phone and now wherever I touch it shows me the same image and now I can't even move or do anything else in my game. Any suggestions would really help.

Comment
Add comment · Show 13
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 Joyrider · Aug 09, 2013 at 06:20 AM 0
Share

Titlescreen = Splashscreen? $$anonymous$$y guess is, you did something wrong in you code. So it is difficult to tell you much of anything out of the blue.

Have you tried looking where that picture is referenced in your project. And check where that variable holding the image is all being used for. (Should obviously be in your OnGUIs)

avatar image pulkit8.mahajan · Aug 09, 2013 at 09:29 PM 0
Share

the image is never referenced in the scripts. The image is a screen shot of my game. I took the screenshot, imported it into my assets, and pasted it on to a plane with an OnGUI script attached to it. The script has stayed the same but now even when the OnGUI isn't there it still shows up. Is there like a setting that I might have accidentally changed?

avatar image Joyrider · Aug 09, 2013 at 09:33 PM 0
Share

ok.. If you put that image on a plane (in a material), you don't need OnGUI() to display it. OnGUI is only for 2D. So I guess something must be doing something with that plane of yours. Have you checked where that is referenced in your scripts?

avatar image pulkit8.mahajan · Aug 09, 2013 at 11:36 PM 0
Share

I only use OnGui to display the title and the buttons. And the plane is only referenced in that 1 OnGUI script. It's only started to act up now, but the OnGui was working fine earlier.

avatar image meat5000 ♦ · Aug 10, 2013 at 12:12 AM 0
Share

Add a splashscreen (Your Intro image) in Build settings->player settings->splash image. If you wish to make a separate Title screen you should include it as a New Scene and detect a Touch Event on it to begin a call of :

 Application.LoadLevel ("First Level");

The reason it shows up when you touch anywhere is because mouse events and touch events are handled differently. If you do not use a proper Touch Handler a touch to the screen is the same as touching everything in view.

A touch handler looks something like the following and in this case it uses a raycast (shoots a line) from the screen touch position directly into the world and tests to see what the ray touches. Here, "StartGame" is the name of a 3DText object, but for you, you can set your image as a GUITexture for much the same effect. Note that my 3DText object has a Box Collider on it so I can detect the hit of the ray. GUITextures don't require a collider and live in the Camera space rather than the 3DWorld space.

 function Update ()
 {
     if (Input.touchCount > 0) 
     { 
         // If there are touches... 
         var theTouch : Touch = Input.GetTouch (0); 
         // Cache Touch (0) 
         var ray = Camera.main.ScreenPointToRay(theTouch.position); 
         
         
         if(Physics.Raycast(ray,hit,500)) 
         {
             colName = hit.collider.gameObject.name;
             if(Input.touchCount == 1) 
             { 
                 if (theTouch.phase == TouchPhase.Began || theTouch.phase == TouchPhase.$$anonymous$$oved) 
                 { 
                     if(hit.collider.gameObject.name == "StartGame")
                     {
                         Application.LoadLevel ("TC1");
                     }
                 } 
                 //if (theTouch.phase == TouchPhase.$$anonymous$$oved) 
             }
         }
     }
 }

If this doesn't make sense, check out the Penelope iPhone tutorials and check out the Android build of the AngryBots tutorial. The Joystick prefab in the latter contains the Touch Handler and is worth a look.

Edit: OnGUI() is very expensive for most uses. $$anonymous$$ost people (and the stats/profiler) recommend you avoid it like the plague.

avatar image pulkit8.mahajan meat5000 ♦ · Aug 10, 2013 at 12:26 AM 0
Share

I understand what you are saying but my touch handler has been working really well. This problem has only started on my third version of my game, after I exported my project on a flash drive and started working on my home computer. It was working fine for versions one and two, and I'm pretty sure I've engaged some sort of setting, I just don't know what.

avatar image meat5000 ♦ meat5000 ♦ · Aug 10, 2013 at 12:37 AM 0
Share

Did you export the project or copy the whole project folder? I work between my desktop and a netbook and I find that even though I'm using an exact copy of the whole project folder the different Unity installs will require separate setup and will seem to 'remember' different things. It's truly weird like that.

If you copy a folder back and forth, files you have deleted will still be present in the other copy and will essentially be copied back eventually. This can cause major problems if you have rewritten scripts. Check your project folder and see if you have multiply versions of the same files. Say you had a texture in your asset folder. If you modify this texture externally and drop it into the asset folder again, the old texture is not overwritten but renamed texture1. Look in your actual files and not in Unity, and you may find the cause of your problem.

avatar image pulkit8.mahajan meat5000 ♦ · Aug 10, 2013 at 12:59 AM 0
Share

i copied the whole project folder

avatar image meat5000 ♦ pulkit8.mahajan · Aug 10, 2013 at 01:07 AM 0
Share

Careful to add comments, not new answers.

Check in your actual asset files, not in Unity, for assets with numbers after them. Texture, Texture1 Compare them for differences.

Show more comments

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

16 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

Related Questions

Multiple Cars not working 1 Answer

Out of order Please help 1 Answer

How to use the Unity Remote on Android? 0 Answers

Question about ARcamera 0 Answers

Facebook SDK 6.2.2 for Unity doesn't work on my Android Device 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