I use c sharp but I wanted to use the code from [SmokymonkeyS Devlog][1]
I converted java to c# and I don’t understand how get rid of these few errors, can you guy take a look and see what might be causing them?
using UnityEngine; using System.Collections;
[ExecuteInEditMode]
public class rings : MonoBehaviour {
bool emit = true;
float range = 1.0f;
int particleCount = 16;
float particleSize = 1.0f;
float rotationSpeed = 0.5f;
Color particleColor = Color.white;
LayerMask layerMask = -1;
float castMaxDistance = Mathf.Infinity;
private int oldParticleCount; private ParticleEmitter emitter; private Particle[] particles;
private float rot;
private Vector3 center; private Vector3 pos; private RaycastHit hit;
private Transform myTransform;
void Awake (){
emitter = gameObject.GetComponent();
if (!emitter) {
gameObject.AddComponent<EllipsoidParticleEmitter>();
emitter = gameObject.GetComponent();
}
emitter.emit = false;
emitter.ClearParticles();
emitter.useWorldSpace = true;
createParticlesAry();
myTransform = transform;
}
private void createParticlesAry (){
if (particleCount < 0) {particleCount = 0;
}
particles = new Particle[particleCount];
oldParticleCount = particleCount;
}
private void setParticlesCount (){
if (!particles || (oldParticleCount != particleCount)){
createParticlesAry(); } }
void Update (){
setParticlesCount();
emitter.ClearParticles();
if (emit) {
int i;
float radian;
float offsetY;
Vector3 center;
Vector3 pos;
RaycastHit hit;
center = myTransform.position;
rot += Time.deltaTime *rotationSpeed;
offsetY = particleSize /2;
for (i = 0; i < particleCount; i++) {
radian = Mathf.PI *(i /(particleCount *0.5f)) +rot;
pos.x = range *Mathf.Cos(radian) +center.x;
pos.y = center.y;
pos.z = range *Mathf.Sin(radian) +center.z;
if (Physics.Raycast(pos, -myTransform.up, out hit, castMaxDistance, layerMask)) {
pos.y = hit.point.y +offsetY;
}
Debug.DrawRay(pos, myTransform.up *hit.distance, Color.red);
particles*.position = pos;*
particles*.color = particleColor;*
particles*.size = particleSize;*
particles*.energy = 1.0f;*
particles*.velocity = myTransform.up;*
}
emitter.particles = particles;
}
}
}
The errors that im getting are:
> Assets/rings.cs(25,22): error CS0411: The type arguments for method UnityEngine.GameObject.GetComponent<T>()' cannot be inferred from the usage. Try specifying the type arguments explicitly*_</em></em></em> <em><em><em>_*> Assets/rings.cs(28,25): error CS0246: The type or namespace name
EllipsoidParticleEmitter’ could not be found. Are you missing a using directive or an assembly reference?
> Assets/rings.cs(29,22): error CS0411: The type arguments for method UnityEngine.GameObject.GetComponent<T>()' cannot be inferred from the usage. Try specifying the type arguments explicitly*_</em></em></em> <em><em><em>_*> Assets/rings.cs(47,5): error CS1955: The member
rings.particles’ cannot be used as method or delegate
Please help
_*[1]: http://www.smokymonkeys.com/kyrill/*_