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 /
  • Help Room /
avatar image
0
Question by Visciukas · Aug 18, 2016 at 09:55 PM · layer mask

FireBaseScript from asset. Something is wrong.

Hello, I'm having one error in asset which is called "Fire and Spell Effects" which is free. Script name FireBaseScript.cs. I have error on line 79-81. I have no idea how to fix this... On console it shows me this error:

 layer numbers must be between 0 and 31
 UnityEngine.Physics:IgnoreLayerCollision(Int32, Int32)
 DigitalRuby.PyroParticles.FireBaseScript:Awake() (at Assets/PyroParticles/Prefab/Script/FireBaseScript.cs:81)
 DigitalRuby.PyroParticles.FireConstantBaseScript:Awake() (at Assets/PyroParticles/Prefab/Script/FireConstantBaseScript.cs:79)


//CODE

 using UnityEngine;
 using System.Collections;
 
 namespace DigitalRuby.PyroParticles
 {
     [System.Serializable]
     public struct RangeOfIntegers
     {
         public int Minimum;
         public int Maximum;
     }
 
     [System.Serializable]
     public struct RangeOfFloats
     {
         public float Minimum;
         public float Maximum;
     }
 
     public class FireBaseScript : MonoBehaviour
     {
         [Tooltip("Optional audio source to play once when the script starts.")]
         public AudioSource AudioSource;
 
         [Tooltip("How long the script takes to fully start. This is used to fade in animations and sounds, etc.")]
         public float StartTime = 1.0f;
 
         [Tooltip("How long the script takes to fully stop. This is used to fade out animations and sounds, etc.")]
         public float StopTime = 3.0f;
 
         [Tooltip("How long the effect lasts. Once the duration ends, the script lives for StopTime and then the object is destroyed.")]
         public float Duration = 2.0f;
 
         [Tooltip("How much force to create at the center (explosion), 0 for none.")]
         public float ForceAmount;
 
         [Tooltip("The radius of the force, 0 for none.")]
         public float ForceRadius;
 
         [Tooltip("A hint to users of the script that your object is a projectile and is meant to be shot out from a person or trap, etc.")]
         public bool IsProjectile;
 
         [Tooltip("Particle systems that must be manually started and will not be played on start.")]
         public ParticleSystem[] ManualParticleSystems;
 
         private float startTimeMultiplier;
         private float startTimeIncrement;
 
         private float stopTimeMultiplier;
         private float stopTimeIncrement;
 
         private IEnumerator CleanupEverythingCoRoutine()
         {
             // 2 extra seconds just to make sure animation and graphics have finished ending
             yield return new WaitForSeconds(StopTime + 2.0f);
 
             GameObject.Destroy(gameObject);
         }
 
         private void StartParticleSystems()
         {
             foreach (ParticleSystem p in gameObject.GetComponentsInChildren<ParticleSystem>())
             {
                 if (ManualParticleSystems == null || ManualParticleSystems.Length == 0 ||
                     System.Array.IndexOf(ManualParticleSystems, p) < 0)
                 {
                     if (p.startDelay == 0.0f)
                     {
                         // wait until next frame because the transform may change
                         p.startDelay = 0.01f;
                     }
                     p.Play();
                 }
             }
         }
 
         protected virtual void Awake()
         {
 /*79*/      Starting = true;
 /*80*/      int fireLayer = UnityEngine.LayerMask.NameToLayer("FireLayer");
 /*81*/      UnityEngine.Physics.IgnoreLayerCollision(fireLayer, fireLayer);
         }
 
         protected virtual void Start()
         {
             if (AudioSource != null)
             {
                 AudioSource.Play();
             }
 
             // precalculate so we can multiply instead of divide every frame
             stopTimeMultiplier = 1.0f / StopTime;
             startTimeMultiplier = 1.0f / StartTime;
 
             // if this effect has an explosion force, apply that now
             CreateExplosion(gameObject.transform.position, ForceRadius, ForceAmount);
 
             // start any particle system that is not in the list of manual start particle systems
             StartParticleSystems();
 
             // If we implement the ICollisionHandler interface, see if any of the children are forwarding
             // collision events. If they are, hook into them.
             ICollisionHandler handler = (this as ICollisionHandler);
             if (handler != null)
             {
                 FireCollisionForwardScript collisionForwarder = GetComponentInChildren<FireCollisionForwardScript>();
                 if (collisionForwarder != null)
                 {
                     collisionForwarder.CollisionHandler = handler;
                 }
             }
         }
 
         protected virtual void Update()
         {
             // reduce the duration
             Duration -= Time.deltaTime;
             if (Stopping)
             {
                 // increase the stop time
                 stopTimeIncrement += Time.deltaTime;
                 if (stopTimeIncrement < StopTime)
                 {
                     StopPercent = stopTimeIncrement * stopTimeMultiplier;
                 }
             }
             else if (Starting)
             {
                 // increase the start time
                 startTimeIncrement += Time.deltaTime;
                 if (startTimeIncrement < StartTime)
                 {
                     StartPercent = startTimeIncrement * startTimeMultiplier;
                 }
                 else
                 {
                     Starting = false;
                 }
             }
             else if (Duration <= 0.0f)
             {
                 // time to stop, no duration left
                 Stop();
             }
         }
 
         public static void CreateExplosion(Vector3 pos, float radius, float force)
         {
             if (force <= 0.0f || radius <= 0.0f)
             {
                 return;
             }
 
             // find all colliders and add explosive force
             Collider[] objects = UnityEngine.Physics.OverlapSphere(pos, radius);
             foreach (Collider h in objects)
             {
                 Rigidbody r = h.GetComponent<Rigidbody>();
                 if (r != null)
                 {
                     r.AddExplosionForce(force, pos, radius);
                 }
             }
         }
 
         public virtual void Stop()
         {
             if (Stopping)
             {
                 return;
             }
             Stopping = true;
 
             // cleanup particle systems
             foreach (ParticleSystem p in gameObject.GetComponentsInChildren<ParticleSystem>())
             {
                 p.Stop();
             }
 
             StartCoroutine(CleanupEverythingCoRoutine());
         }
 
         public bool Starting
         {
             get;
             private set;
         }
 
         public float StartPercent
         {
             get;
             private set;
         }
 
         public bool Stopping
         {
             get;
             private set;
         }
 
         public float StopPercent
         {
             get;
             private set;
         }
     }
 }

Comment
Add comment · Show 2
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 DavidV95 · Jan 29, 2017 at 07:36 PM 0
Share

Hello, I'm having the same exact problem .. I see there are no replies here, but have you been able to fix the problem, because I can't really find a solution anywhere?

avatar image Visciukas DavidV95 · Feb 01, 2017 at 06:26 PM 0
Share

@$$anonymous$$V95 Hello, I tried to fix this specific problem but unfortunately I was not able to do it. I just ignore it and still everything works pretty well. :) This warning message does not prevent Unity to Build the game.

2 Replies

· Add your reply
  • Sort: 
avatar image
1

Answer by canacarirose · Aug 31, 2017 at 09:20 PM

The fix is adding an if check in the Awake method in the FireBaseScript:

 protected virtual void Awake()
 {
     Starting = true;
     int fireLayer = UnityEngine.LayerMask.NameToLayer("FireLayer");
 
     // Need to make sure we have layers
     if(fireLayer >= 0 && fireLayer < 32)
         UnityEngine.Physics.IgnoreLayerCollision(fireLayer, fireLayer);
 }
 
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
avatar image
0

Answer by julien-conan · Jan 23, 2019 at 01:45 PM

Same error solved in Pyro Particles package, thanks.

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.

Follow this Question

Answers Answers and Comments

67 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

Related Questions

Assigning multiple layers to a Layer Mask through code? 2 Answers

raycast gets wrong layer 2 Answers

UI with layer always displaying 1 Answer

change enemy NavMesh Walkable at runtime 1 Answer

Not working condition: gameObject.layer==LayerMask.GetMask... 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