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 /
This question was closed Mar 20, 2016 at 04:13 AM by Bunny83 for the following reason:

Problem is not reproducible or outdated

avatar image
0
Question by nanovasco · Mar 18, 2016 at 12:50 PM · buttonstartsetactive

My SetActive(false) doesn´t work

I want to activate my particle system with a button, but it seems like my Start function just execute the first line.

using UnityEngine; using System.Collections.Generic;

public class ScriptMago : MonoBehaviour {

 private GameObject Espiral;
 // Use this for initialization
 void Start() {

     GetComponent<Animation> ().CrossFade ("Idle1");
     Espiral = transform.FindChild("Cyclone").gameObject;
     Espiral.SetActive (false);
 }



 public Texture2D icon;
 
 void OnGUI () {

     if (GUI.Button (new Rect (10, 10, 100, 50), icon)) {  
         GetComponent<Animation> ().CrossFade ("Magic Attack3");
         Espiral.SetActive(true);
     }
     
     
 }

}

Comment
Add comment · Show 7
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 Ali-hatem · Mar 19, 2016 at 03:02 PM 0
Share

see the doc

avatar image Bunny83 Ali-hatem · Mar 19, 2016 at 06:36 PM 0
Share

Transform.FindChild is just a wrapper for Transform.Find. So it should work exactly the same.

 // UnityEngine.Transform
 public Transform FindChild(string name)
 {
     return this.Find(name);
 }

avatar image SkandYxyz · Mar 19, 2016 at 03:08 PM 1
Share

Is Espiral != null?

avatar image Bunny83 SkandYxyz · Mar 19, 2016 at 06:37 PM 0
Share

Right, or in other words: Do you get a null reference exception in line 7 ? ^^

avatar image nanovasco Bunny83 · Mar 19, 2016 at 09:58 PM 0
Share

I get this:

NullReferenceException: Object reference not set to an instance of an object

Show more comments
avatar image Bunny83 · Mar 20, 2016 at 04:13 AM 0
Share

@nanovasco:

Ok, so i guess this problem is now outdated based on your comment. So i close it.

0 Replies

  • Sort: 

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

OnSelect and OnPointerEnter work in one script but not another on the same object 2 Answers

Unable to reactive the game object 1 Answer

shop/button opening problems due to the starting(?) 1 Answer

Script Two Button Functions At Once 1 Answer

SetActive Button from another scene isn't working in build 0 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