How to make waiting in unity js?
How to do actions for some other object, for excample I click start buttong, and camera goes left on x for 50.
How to hide objects.
Give me few excamples of simple js scripts for android touch inputs, like I touch game object and print "object is clicked", and script for sliding page down.
How to simply save files, like numbers and make them automicaly loaded next time android game is started, I want to same what answers were corect and some statistic things
I would rly like you give me script and description and try to avoid giving me links. Sorry for asking all this stuff, but I rly couldnt find answers, and link on unity for inputs was so confusing. Pls help.
And yes excample of js array script, like script [1], sript [2], and print then
Replies
http://walkerboystudio.com/html/unity_training___free__.html
They are free and should cover most of your questions, one way or another. They have helped me a great deal in the past.
- You can use: yield WaitForSeconds(3); this will wait 3 seconds before running the lines after it.
- If you want to use a button to make something happen use OnGUI to place a button. Then use the update function to always make the camera go to a certain location, that you set in the GUI button.
- you can hide things by turning off their renderer. Something like:
Transform.render.setActive = false.
- I save a really good video about touch input on mobile a while ago. I'll try to find it again and get back with some of the examples they show in there.
- The most simple way to save things in Unity is Playerprefs.
If you explain a bit more what you want to achieve exactly I might be adable to show some examples of how you could code it.
About touch input can you give me simple excample like: object is clicked, print message object is touched. With no possibiliti of more than one touch, i want this enter options os start or statistics. Also can u give me excample for scrolling page down, like not every lvl can get on one scren so u have to scroll down to see the rest
Just browse the unity documentation on their website. All the information about touch events et cetera are in there. Just like PlayerPrefs, SetActive(), as is everything else you're asking for.
Simple Google searches would've given you all these answers.
Can u answes few next questions, I would be really thankful.
If condition for OnMouseDown, like if clicked object is someObject do etc. And how to make this multi conditional, like if clicked object is someObject1 or clicked object is someObject2 etc do actions. Sorry for asking so basic questions but my browser is weak and I cannot go so much in browsing, and here u rly help me.
For the touch input you can do something like this:
This will cast a ray from the camera to the place that you've touched the screen. It will then look to see if what you've hit has a certain tag. If it does it logs a message in the console.
I've haven't tested it, so I'm not sure it works exactly like that but it should point you in the right direction.
Okay, I have never used raycast before, so it registers click over colision? because I use collision on models? I know I maybe sound like retard right now, but I guess I am for this.
EDIT, also does it hits only first object, or and objects behind it. because I will have some objects behind.
thx for answering