Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 Gaming-Dudester · Jun 25, 2015 at 04:11 PM · unity5timertilestep

Timer triggered by tile?

How do I make a tile that triggers a timer when stepped on.

Comment
Add comment · 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 kmgr · Jun 25, 2015 at 04:12 PM 0
Share

Can you provide any code you got, for example the Tile class?

avatar image Gaming-Dudester · Jun 25, 2015 at 05:33 PM 0
Share

Sure here

avatar image Gaming-Dudester · Jun 25, 2015 at 05:54 PM 0
Share

public class teleport : $$anonymous$$onoBehavior { Public GameObject target; Transform target,$$anonymous$$ySpace;

Void Awake() { $$anonymous$$ySpace = transform; } Public void OnTriggerEnter(Collider other) { Switch (other name) { Case "teleporter": //this is my teleporter object on the scene gameObject.transform.position = Target_1.transform.position //Target_1 is a blue square on the scene// // if I step on the teleporter (the red square) it makes me go to the Target_1.position // } }

avatar image Gaming-Dudester · Jun 25, 2015 at 05:55 PM 0
Share

Remember that this script does what it needs to do fine.

avatar image Gaming-Dudester · Jun 25, 2015 at 05:59 PM 0
Share

But see where it teleports me? The GA$$anonymous$$EOBJECT.TRANSFOR$$anonymous$$.POSITION = TARGET_1.TRANSFOR$$anonymous$$.POSITION place? Right before that I want a timer that makes it not be teleport until 2 seconds passed. WHAT I DONT WANT IS the trigger to take 2 seconds to respond. I wanna step on it and EVEN if I walk of it the timer to the teleportation to still be ticking.

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by brunopava · Jun 25, 2015 at 06:05 PM

You can use this method:

http://docs.unity3d.com/ScriptReference/Collider.OnTriggerEnter.html

To create a simple timer you can use:

 float time = 0;
 private void Update()
 {
     time += Time.deltaTime;
     Debug.Log(time);
 }


ps: For the trigger to work properly you need to attach both collider and rigidbody to the object that is entering the trigger. As for the trigger itself you just need a collider with trigger enabled.

Comment
Add comment · Show 1 · 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 Gaming-Dudester · Jun 25, 2015 at 06:08 PM 0
Share

How do u start the timer

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

23 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

Related Questions

My high time score isn't working 1 Answer

Tilemaps making feature 1 Answer

How to Double Jump??? Whats Wrong? 0 Answers

Can't activate my timer for shooting script? 2 Answers

How to stop a countdown from counting down 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