Im using lastest iPhone version...works in regular Unity.
I cut and pasted this script from the wiki. http://www.unifycommunity.com/wiki/index.php?title=Particle_Spiral_Effect
It give me the error CS1002: Expecting ';'
It happens of every line that uses a generic, like ParticleAnimator animator = emitter.transform.GetComponent();
Can anyone explain what is different here or what the problem is when using the iPhone version of Unity? Looks like it may be a limitation of ParticleEmitter and ParticleAnimator types in iPhone or something.
Adding to what Mike said, here are some generic methods I compiled together for the iPhone.
I couldn't extend the component or gameObject classes with these so you simply have to add the object as a passed value, and the class is GM instead of gameObject or Component. Performance wise, I haven't done any benchmark tests. I don't believe they are any faster than 1.1 casting methods because that is how they work. If anything, they might be a little slower, but any of these functions wouldn't be called very often so it doesn't make much difference.
IPhone does support generics, but it hasn't got some of the helper functions as generic yet. GetComponent for example hasn't been updated to allow generics.
I assume this is probably because it's still possible to compile against the older version of .NET, so generics in the API would stop it from compiling
The only solution would be to provide your own generics wrapper for GetComponent, or just use the non generic function
answered Jun 05 '10 at 08:25 PM