0 votes

I am trying to randomize some Particles2D instances.

Instancing the Particles2D Nodes and randomizing the object members (like amount, explosiveness and such) works fine. But when assigning a ParticlesMaterial to the process_material member I can't instance a new ParticlesMaterial. This leads to the effect that when randomizing the ParticlesMaterial members (like initial_velocity, color and such) all Particles2D Nodes receiving the change. I would like to have seperate materials for each Particles2D Node.

# I want to get rid of this by creating a new ParticlesMaterial in code:
onready var particles_material = preload("res://particlesmaterial.tres")

var particles_reference = Particles2D.new()
particles_reference.process_material = particles_material   # <--

Is this somehow possible?

Thanks in advance.

in Engine by (1,032 points)

1 Answer

0 votes
Best answer

It is easy as that:

var particles = Particles2D.new()
particles.process_material = ParticlesMaterial.new()
by (1,032 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.