error CS0116: A namespace can only contain types and namespace declarations
I'm new to this coding stuff...can someone help me get this right? At first, line 41 was written this way: var col = m_colliderEvents[i].collider; but it kept giving the mistake that I have to change it to collider Component. I did that, but it kept giving me mistakes. So then I change it to this: var col = OnParticleCollision.collider; but now i'm getting a lot of mistakes, everywhere. Also can you tell me how to convert c# files into other files because i couldn't open it to post here?
(NEW CODE I CHANGE) var col = OnParticleCollision.collider;
(OLD CODE) var col = m_colliderComponent[i].collider;
WaterHouse Particles.cs(42,37): error CS0116: A namespace can only contain types and namespace declarations........ `var attachedRigidbody = gameObject.GetComponent<Rigidbody>();`
WaterHouse Particles.cs(41,37): error CS0116: A namespace can only contain types and namespace declarations.......... `var col = OnParticleCollision.collider;`
WaterHouse Particles.cs(34,17): error CS1518: Expected class, delegate, enum, interface, or struct...... ` while (i < numCollisionEvents)`
Water-Hose-Particles.cs(28,41): error CS0178: Invalid rank specifier: expected ,' or ]....... `m_CollisionEvents = new ParticleCollisionEvent[safeLength];`
Your post is a terrible mess. Copy-paste the whole file, add comments to the pasted code to indicate where does the error occur please.
Try something like var col = m_colliderComponent[i].GetComponent<Collider>();
lol ok, this is what I meant....
At first, line 41 was written this way: var col = m_colliderEvents[i].collider;
but it kept giving the mistake that I have to change it to collider Component. I did that, but it kept giving me mistakes. So then I change it to this: var col = OnParticleCollision.collider;
but now i'm getting a lot of mistakes, everywhere. Also can you tell me how to convert c# files into other files because i couldn't open it to post it here?
(OLD CODE) var col = m_colliderComponent[i].collider;
(NEW CODE I CHANGE) var col = OnParticleCollision.collider;
THIS ARE THE ERROR CODES I'$$anonymous$$ GETTING:
WaterHouse Particles.cs(42,37): error CS0116: A namespace can only contain types and namespace declarations........ `var attachedRigidbody = gameObject.GetComponent<Rigidbody>();`
WaterHouse Particles.cs(41,37): error CS0116: A namespace can only contain types and namespace declarations.......... `var col = OnParticleCollision.collider;`
WaterHouse Particles.cs(34,17): error CS1518: Expected class, delegate, enum, interface, or struct...... `while (i < numCollisionEvents)`
Water-Hose-Particles.cs(28,41): error CS0178: Invalid rank specifier: expected ,' or ]....... `m_CollisionEvents = new ParticleCollisionEvent[safeLength];`
Your answer
Follow this Question
Related Questions
What is the difference between Update() , LateUpdate() , FixedUpdate(), and when i should use them 3 Answers
Make FixedUpdate camera be static like in Update? 0 Answers
What is the most accurate way to call a function based on time? 0 Answers