Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Disk Radius Script Not Working
#1
Hello,

I'm trying to modulate the disk radius every frame.  Should be very simple:

public Obi.ObiEmitter haloEmitter;
    public Obi.ObiEmitterShapeDisk disk;
    void Start()
    {
        disk.radius = .1f;
    }

    void Update()
    {
        disk.radius += .06f;
    }



And, indeed, in the inspector the radius increases over time, but the result is not rendered -- it stays at whatever radius is set in the inspector before I enter game mode. In fact, whenever I set the radius in script, the result is not rendered, even if I simply assign it a value in Start().  Any suggestions?
Reply
#2
After setting any property of a emitter shape, you need to recalculate the emission point distribution. This is a relatively expensive operation, and so must be called explicitly. Try:
Code:
disk.GenerateDistribution();
after setting its radius.
Reply
#3
(24-06-2020, 12:05 PM)josemendez Wrote: After setting any property of a emitter shape, you need to recalculate the emission point distribution. This is a relatively expensive operation, and so must be called explicitly. Try:
Code:
disk.GenerateDistribution();
after setting its radius.

thank you so much, it works! in terms of expense, should i keep this out of the update function entirely and only called periodically? or is it just expensive relative to the other parameters and so it won't destroy performance in the update?
Reply