• 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 OldSchoolGamer · Apr 08, 2011 at 02:49 PM · multipleinvisiblesoundslerpzjetpack

Make lerpz invisible to enemies by hitting fire 2? A cloak?

Hello All,

I just recently got into unity (and really dig it), but scripting is definitely my weakest point right now. There are three gameplay mechanics I'd like to add in and have no clue how to. Help on ANY of these would be stellar... thanks in advance!

1.) What I would like to do is when the player presses and holds the "fire 2" button a quick particle effect plays as a one shot, a sound effect plays as a one shot, the player model disappears so all you can see is the shadow blob, and lastly enemies ignore the player. When the player releases the fire 2 button an additional sound plays, the same particle effect plays, the player model pops back into view, and enemies can now "see" the player.

2.) I'd like to start the player off with no jumping ability... which I know is just making canjump false at first. Additionally, when the player hits the space bar a sound plays and a short spark particle emits from the jetpack to further signify it isn't working yet. When the player picks up a specific fuel cell... I want the jetpack to work as it normally does.

3.) Lastly, how would I play more than one sound for the jetpack so that an intro sound plays as a oneshot over the first part of the loop when the player presses space and an outro sound plays as the player releases space and the loop stops. I've added in audio variables to the jet pack script but can't figure out how to call them.

So, any ideas? I've been searching for any leads and have had no luck. Thanks in advance!

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
2

Answer by Jesse Anders · Apr 08, 2011 at 03:24 PM

You'll probably have better luck with each of these posted as its own question :)

Anyway, once you've learned the basics of instantiating and destroying or activating/deactivating objects, enabling/disabling components, and so on, it should become fairly clear how the things you describe can be done.

The first problem, for example, breaks down into a few different parts:

  • Detecting when the button has been pressed (see the Input class and the input manager)
  • Detecting when the button has been released (same)
  • Instantiating or activating/enabling a particle effect (see Instantiate and look into prefabs)
  • Playing a sound (see AudioSource, AudioClip, PlayOneShot(), PlayClipAtPoint(), etc.)
  • Hiding and showing the player model (look into the 'enabled' property of the Renderer component; for a gradual effect, look into alpha blending)
  • Having NPCs ignore the player when the player is invisible (multiple solutions, but search for 'accessing other game objects' in the scripting reference for some hints)

As you can see, there are multiple sub-problems that have to be solved here. Multiply that by your three questions, and there are about 20 different questions that need to be answered :) (Which is why one question per post might be better.)

I'm not sure which of the steps described above you need help with, but if you run into specific problems with any of them, post here or on the forums and someone will likely be able to help.

Comment
Add comment · 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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

No one has followed this question yet.

Related Questions

Moving Platform with multiple targets 0 Answers

Accessing multiple audio devices 1 Answer

Mesh displaying on one computer but not another? 1 Answer

Radio, multiple sound clips script not working 1 Answer

Lerpz Jet-pack Weak 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