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
1
Question by Lemoln · Jul 11, 2013 at 07:39 PM · randomappearflickerdissapearblink

Making an object blinking for some time, then dissapearing

I have some empty object, just a model. How can I make it be invisible for some random time (15-30 sec.), then appear and dissapear repeatedly, then dissapear again for 15-30 sec?

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 gardian06 · Jul 11, 2013 at 07:48 PM 0
Share

this feels like a "please do this for me" question. please show some level of effort, and edit your question before the down-votes start co$$anonymous$$g.

hint. yield WaitForSeconds(float) will probably get you most of the way there.

avatar image Orr10c · Sep 25, 2016 at 07:30 PM 0
Share

how can i make it blink on trigger? i tried putting the startcoroutine() in the OnTriggerEnter function but the coroutine works only once. can someone help me pls?

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by markedagain · Jul 11, 2013 at 07:50 PM

http://docs.unity3d.com/Documentation/ScriptReference/index.Coroutines_26_Yield.html http://docs.unity3d.com/Documentation/ScriptReference/WaitForSeconds.html

these links should get u started. as for writing the script for you, i dont think nobody will rise to the occasion to just write scripts for someone not trying to learn it themselves, there are other threads for does.

give it a try if , post what u got, if u on the wrong path , we will be more than happy to write u the code and show u the proper path

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 Lemoln · Jul 12, 2013 at 06:50 AM 0
Share

I've got a timer, but I have no idea how to enable/disable the renderer. Could you help please?

avatar image
0

Answer by MicroEyes · Jul 12, 2013 at 07:00 AM

Hope this Helps..

 public GameObject m_playerRendererRef;
 IEnumerator DoIT()
 {
   //Visible initially
    m_playerRendererRef.enabled = false;        //Making invisible
    yield return new WaitForSeconds(2.0f);        //for 2 secs
 
    m_playerRendererRef.enabled = true;  //Making visible
    yield return new WaitForSeconds(1.0f);        //for 1 secs
 
    m_playerRendererRef.enabled = false;        //Making invisible again
    yield return new WaitForSeconds(1.5f);        //for 1.5 secs
 }
Comment
Add comment · Show 3 · 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 gardian06 · Jul 12, 2013 at 03:45 PM 1
Share

there are a few notes that should be made about this script:

1 this script assumes that the model (probably also assumed to be complex) is a child, or an external GameObject to where this script is placed.

2 this script assumes that the reference m_playerRendererRef is setup beforehand probably through the inspector. considering that turning off a GameObject through enabled [deprecated] means that scripts on that object stop being called, but references can still continue (the "m_" portion of the name is an archaic na$$anonymous$$g convention)

a suggestion would be: to change the data type of m_playerRendererRef to Renderer ins$$anonymous$$d of GameObject. this would remove part of the assumption of note 1. if the object is rather complex (more then 1 mesh, or has mesh in children) then leave it the way it is. otherwise you can even place it on the object.

avatar image Lemoln · Jul 12, 2013 at 03:48 PM 0
Share

Thanks! Got the idea, the script worked perfectly!)

avatar image gardian06 · Jul 12, 2013 at 06:42 PM 0
Share

as an addition to the script provided if you would still like the "randomness" then WaitForSeconds takes in a float variable, and can even take in the return value of a Random.Range(float, float):float meaning that by replacing the literals given in the WaitForSeconds arguments you can achieve your:

"make it be invisible for some random time (15-30 sec.), then appear and dissapear repeatedly, then dissapear again for 15-30 sec"

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

19 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

Related Questions

How to make objects appear randomly around a spot 2 Answers

Objects appear randomly in specific length and height 1 Answer

Random object appearance in specific length and height 1 Answer

Materialize an object, then destroy it. 1 Answer

touch appear let go dissapear? 2 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