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
0
Question by HSW2201 · Jan 06, 2014 at 11:47 AM · gameobjectassign

assign n gameobject and change value?

alt text alt text

okay, those screenshots may help you to understand what I mean. say, I have four gameobject(particly system) which shows my spaceship thruster. I want to assign them into one script as element0, ~ , element3. when I press forward key, then change the start size to 0.7, like I used booster or sth. I'm pretty newb to unity and don't know what I need to do.

  1. assign number of gameobjects into one script(they are all particle system).

  2. when I press forward(<-I know how to do this) then the script changes the start size to [numberIwant].

these are what I want to achieve. I don't know: how to assign gameobject as var(am I correct?) and change its var. please help me :)

1.png (10.7 kB)
2.png (10.1 kB)
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
0
Best Answer

Answer by UnbreakableOne · Jan 06, 2014 at 01:19 PM

To reply with your questions:

Write a script and public a field to your particle system type, then drag and drop the particle to that field in editor. Then in your "press key", use that field to change variable to what you want. Let me write a pseudo code for you:

 public ParticleSystem ParticleSystem_Reference_1;
 
 void Update()
 {
   if(Input.GetButtonDown("[F]"))
   {
     ParticleSystem_Reference_1.StartSize = 0.9 //whatever you want
    }
 }

I'm new to Unity as well, so this might just get you started.

Comment
Add comment · Show 2 · 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 HSW2201 · Jan 06, 2014 at 01:32 PM 0
Share

aaaaah thanks! that simple lines are what I needed! thank you very much sir!

avatar image UnbreakableOne · Jan 06, 2014 at 01:51 PM 0
Share

Glad I could be of any help!

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

Beginner: assigning texture to part of GameObject 1 Answer

Assigning variables in inspector 1 Answer

Disable/Enable Script or Add/Remove? 1 Answer

static var for one object. 2 Answers

How to change variables on a new gameobject's script 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