I want to make a particle class that moves every second.
However, I don’t know how to exchange data within a class between components.
Is this a bad type specification?
List<Particle> particles = new List<Particle>();
for(int i=0; i<_pTotal; i++)
{
var tmp = new Particle();
Vector3d v = new Vector3d(1,1,1);
tmp.setup(v);
particles.Add(tmp);
}
A = particles;
Thanks your time and reply.
I didn’t understand about reflection in C#.
Your sample files are very helpful.
Thank you very much for your valuable response !
the reason why you cannot pass classes from one script component to another is due to the fact that it does not know the exact type because it’s missing the right ‘using’ reference…
Any script component has a name with a unique ID. Something like (…)ScriptComponent325346346346(…)MyClass… i believe
Now you can try to find that. It’s in the memory and accessible. Maybe I’ll can try to give an example later, or you are using Tuples and Func<>/Action<> delegates to be passed over. Last but not least you can use Reflection, which is in use by both examples… This is terrible for performance critical use-cases like ‘Particles’. There is also a couple of boxing and unboxing going on if you work with ‘object’.
However, something to note: Generally seen it is about making a bad hack in any case. Write a custom plugin or a library instead, and access your object directly from there…