Change property of ParticlesMaterial with code

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By BryanGieger

I wanted to know if you can change the Velocity variable of AngularVelocity with code:
enter image description here
I’m new to Godot and C # but I think it’s done with the code:

var particles = (Particles2D)GetNode("Particles2D");
particles.   ...ETC.

If I am wrong correct me and please can you teach me how to do it?

:bust_in_silhouette: Reply From: rojekabc

If you go a mouse pointer over your property, you’ll see a name of property. For angular velocity property name is angular_velocity. So, to set the value, for example, 2.5 of it, in your sample, you should do something like this:

particles.material.set("angular_velocity", 2.5)

I tried the following code:

var particles = (Particles2D)GetNode("Particles2D");
if (Input.IsActionPressed("ui_right))
{
  particles.Material.Set("angular_velocity", 2);
}

But I get this error:
0:00:05:0402 - System.NullReferenceException: Object reference not set to an instance of an object.

Type:Error
Description: System.NullReferenceException: Object reference not set to an instance of an object.
Time: 0:00:05:0402
C Error: Unhandled exception
C Source: /home/bryangieger/GodotProjects/SpaceShooter/Player.cs:32
C Function: void Player._Process(Single )

UPDATE: The following code has worked.

particles.ProcessMaterial.Set("angular_velocity", 2);

BryanGieger | 2019-01-07 18:19

:bust_in_silhouette: Reply From: GrayDwarf

v3.4.2 gdscript example:

$MyParticles2D.process_material.set("emission_sphere_radius", 5)