- Home /
Pickup and read a piece of paper
Hey guys I have been working on a game for Uni and I have been researching how to make a player pick up and read a piece of paper lying on the ground, I would like it if I could pick it up on mouse click, I saw a couple of decent already answered questions like this for example,
http://answers.unity3d.com/questions/294448/how-to-make-player-have-the-ability-to-pickup-and.html
although that doesn't seem to be working for me, any advice?
Thanks
Do you get any erros?..Also did you create the OnTouch and Untouch function? Oh and did you assign the tag to the paper?
There is no way to make a player read something :-)
Point is, thinking about reading and paper is making it too specific. Look up how to select with mouse clicks. Common topic. Selecting "paper" is the same as clicking on treasure chests.
Then look up best way to make text (pre-made texture, GUIText, 3DText + imported font.) Then look at how to either make something pop onto the screen, or how to slide an object up to the camera (like it's being brought to your face.)
Answer by ricardo_arango · May 25, 2013 at 11:59 AM
Try using the MonoBehaviour.OnMouseUp callback. Make sure to assign a collider to the "paper" GameObject, and that it uses a layer different from "Ignore Raycast".
http://docs.unity3d.com/Documentation/ScriptReference/MonoBehaviour.OnMouseUp.html using UnityEngine; using System.Collections;
public class Example: MonoBehaviour {
void OnMouseUp() {
Debug.Log("Clicked on the object this script is attached to");
}
}
Your answer
Follow this Question
Related Questions
Cant pickup papers with script 2 Answers
How to make a "Pick Up" script? 2 Answers
Picking up/Holding objects? 4 Answers
Help with adding power ups to game 1 Answer
Ammo Pickup 0 Answers