Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 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 mohanrao164 · Sep 15, 2016 at 05:52 AM · gameobjectcollidercolor change

how to changes color of the 3rd gameobject by colliding and destroying 1st and 2nd gameobjects

Hi All, Here is the scenario I have 6 different objects which are randomly instantiated every 5 seconds.

suppose say if we drag and collide with the gameobject which having same name "one" i am destroying those two gameobjects and instantiate another gameobject with name "two".

My problem is i have power up in the game in which it changes the color of that gameobject. i want that effect to be transfered to the newly instantiate gamobject when the collision is done as explained above.

it should only transfer when we drag and collide the power up given gameobject. can anyone explain how to proceed with this scenario.

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

Answer by FirePlantGames · Sep 16, 2016 at 04:45 AM

Set a new GameObject variable as your created objected :) Like so;

 public GameObject newEffectedGameObject;
 
 GameObject ourNewObject = (GameObject)Instantiate(newEffectedGameObject, transform.position, transform.rotation);
 
 ourNewObject.GetComponent <Renderer>().material.color = Color.green;

You'll have to modify the code to get it to fit your needs, but you mainly want to focus on the Instantiate part.

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 mohanrao164 · Sep 16, 2016 at 06:44 AM 0
Share

@memorymod i don't want the color on every time i Instantiate the gameobject. i need it to be done when the gameobject is effected with power-up and that gameobject is collide with same name gamobject.

here is scenario i will explain i have 4 objects with same name if they collide with each other they are destroyed and Instantiate new object with different name . suppose if we give the power up to gameobject 1 when it is collide with other 3 the new object Instantiate must have same power up effect but if we collide gameobject 2 and 3 it should take color effect of gameobject 1 because it already color effect on it.

i want how to identify that during Instantiate as all the gameobjects posses same script.the newly Instantiate will have different script.

avatar image FirePlantGames · Sep 16, 2016 at 06:55 AM 0
Share

You're seriously giving such a lack of information. What are you struggling with? Since "Write me code" questions aren't allowed in the first place, you're making this even more difficult by not supplying enough information for what you want to achieve.

Explain more clearly and less in a jumbled manner (make a diagram if you have to) What exactly do you want this code to do? What do you want it to detect and how do you want it to react?

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

75 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 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 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 avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Check if trigger collider is touching other trigger collider 2 Answers

Why is transform.Translate not working? 1 Answer

Having trouble playing sound on another gameobject 1 Answer

one shot Sound on collision. Unity 4.0 problem. 2 Answers

Make isKinematic false when touching a Collider? 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