• 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 walkirie · May 01, 2019 at 09:38 AM · script error

Platform Specific Content, Hose Script and Particle System Multiplier startup problems.

Hi, I remember that unfortunately I don't speak English and I have to make do. I'm on Unity now and when it opened it showed errors on these three scripts that I mentioned in the title. I looked around but no valid solution. But why did this happen? Before there were no such mistakes and now I find them. Is there a secure solution to this? Any help is appreciated and I thank you in advance. Place the two scripts to account.

using System; using UnityEngine;

namespace UnityStandardAssets.Effects { public class Hose : MonoBehaviour { public float maxPower = 20; public float minPower = 5; public float changeSpeed = 5; public ParticleSystem[] hoseWaterSystems; public Renderer systemRenderer;

     private float m_Power;


     // Update is called once per frame
     private void Update()
     {
         m_Power = Mathf.Lerp(m_Power, Input.GetMouseButton(0) ? maxPower : minPower, Time.deltaTime*changeSpeed);

         if (Input.GetKeyDown(KeyCode.Alpha1))
         {
             systemRenderer.enabled = !systemRenderer.enabled;
         }

         foreach (var system in hoseWaterSystems)
         {
             system.startSpeed = m_Power;//startSpeed
             system.enableEmission = (m_Power > minPower*1.1f); //system.enableEmission 
         }
     }
 }

}

using System; using UnityEngine;

namespace UnityStandardAssets.Effects { public class ParticleSystemMultiplier : MonoBehaviour { // a simple script to scale the size, speed and lifetime of a particle system

     public float multiplier = 1;//multiplier


     private void Start()
     {
         var systems = GetComponentsInChildren<ParticleSystem>();
         foreach (ParticleSystem system in systems)
         {
             system.startSize *= multiplier;
             system.startSpeed *= multiplier;
             system.startLifetime *= Mathf.Lerp(multiplier, 1, 0.5f);
             system.Clear();
             system.Play();
         }
     }
 }

}

Comment
Add comment · Show 1
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 walkirie · May 01, 2019 at 09:38 AM 0
Share

using System; using UnityEngine; #if UNITY_EDITOR using UnityEditor; #endif

namespace UnityStandardAssets.Utility { #if UNITY_EDITOR

 [ExecuteInEdit$$anonymous$$ode]

endif

public class PlatformSpecificContent : $$anonymous$$onoBehaviour { private enum BuildTargetGroup { Standalone, $$anonymous$$obile }

     [SerializeField] private BuildTargetGroup m_BuildTargetGroup;
     [SerializeField] private GameObject[] m_Content = new GameObject[0];
     [SerializeField] private $$anonymous$$onoBehaviour[] m_$$anonymous$$onoBehaviours = new $$anonymous$$onoBehaviour[0];
     [SerializeField] private bool m_ChildrenOfThisObject;

if !UNITY_EDITOR

void OnEnable() { CheckEnableContent(); } #endif

if UNITY_EDITOR

     private void OnEnable()
     {
         EditorUserBuildSettings.activeBuildTargetChanged += Update;
         EditorApplication.update += Update;
     }


     private void OnDisable()
     {
         EditorUserBuildSettings.activeBuildTargetChanged -= Update;
         EditorApplication.update -= Update;
     }

     private void Update()
     {
         CheckEnableContent();
     }

endif

     private void CheckEnableContent()
     {

if (UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLAC$$anonymous$$BERRY )

    if (m_BuildTargetGroup == BuildTargetGroup.$$anonymous$$obile)
     {
         EnableContent(true);
     } else {
         EnableContent(false);
     }

endif

if !(UNITY_IPHONE || UNITY_ANDROID || UNITY_WP8 || UNITY_BLAC$$anonymous$$BERRY )

        if (m_BuildTargetGroup == BuildTargetGroup.$$anonymous$$obile)
         {
             EnableContent(false);
         }
         else
         {
             EnableContent(true);
         }

endif

    }


     private void EnableContent(bool enabled)
     {
         if (m_Content.Length > 0)
         {
             foreach (var g in m_Content)
             {
                 if (g != null)
                 {
                     g.SetActive(enabled);
                 }
             }
         }
         if (m_ChildrenOfThisObject)
         {
             foreach (Transform t in transform)
             {
                 t.gameObject.SetActive(enabled);
             }
         }
         if (m_$$anonymous$$onoBehaviours.Length > 0)
         {
             foreach (var monoBehaviour in m_$$anonymous$$onoBehaviours)
             {
                 monoBehaviour.enabled = enabled;
             }
         }
     }
 }

}

0 Replies

· Add your reply
  • Sort: 

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

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

104 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 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

all my scripts stopped working after i put a enemy spawner script in 0 Answers

HostListReceived symbol resolve 1 Answer

error CS1525: Unexpected symbol 'rigidbody' 1 Answer

Why I can't add c# script with the correct name ? 1 Answer

Unable to disable the MouseLook script 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