Author Topic: Modifying Beautify parameters at runtime  (Read 19 times)

aaron

  • Newbie
  • *
  • Posts: 13
    • View Profile
Modifying Beautify parameters at runtime
« on: September 11, 2019, 07:04:26 PM »
I've made some UI for adjusting some of the Beautify properties at runtime and I've run into a couple of issues.

First I tried making the modifications to the BeatifyProfile asset itself, but I don't see the changes happening. Is there some kind of function I need to call on the Beautify component to apply the changes? Anyway, this is probably not what I want to do because I think I'd rather have the values in the asset stay where they were after leaving play mode.

So then I set it up so that I was modifying the properties on the Beautify component itself which worked properly. The only problem here is that if I disable the Beautify component and then re-enable it later, it seems to reload all its properties from the unmodified Beautify profile and I lose the settings changes I'd made before. Is there a way to avoid this happening or will I need to store my properties in an intermediate C# script?

Thanks!

-A

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: Modifying Beautify parameters at runtime
« Reply #1 on: September 12, 2019, 02:28:24 AM »
Get the new 7.2 beta version which includes a "Sync With Profile" option in the inspector. Disabling this checkbox allows you to change inspector settings and keep those modifications regardless of the profile.

You can change Beautify settings at runtime using:
Code
Beautify.instance.property = value;

where property names usually matches the title of the property in the inspector.

If you want to load the profile at runtime you can do:
Code
Beautify.instance.profile = <new profile>

Or reload the currently assigned profile:
Code
Beautify.instance.profile.Load(Beautify.instance);

aaron

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Modifying Beautify parameters at runtime
« Reply #2 on: September 12, 2019, 09:05:40 AM »
yea i think the better scenario for what i'm doing would be to not modify the profile itself and be able to change properties on the instance, but not have it reload the profile on enable/disable. is that possible?

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: Modifying Beautify parameters at runtime
« Reply #3 on: September 12, 2019, 09:13:07 AM »
Yes (that's exactly what I'm explaining in the previous post):

1. Get the latest version from the beta board (for built-in pipeline).
2. In Beautify inspector, uncheck the "Sync With Profile" box.


aaron

  • Newbie
  • *
  • Posts: 13
    • View Profile
Re: Modifying Beautify parameters at runtime
« Reply #4 on: September 12, 2019, 09:31:31 AM »
Ah I see what you're saying. The beta version is only for use with PPS? There is no standalone version?

Kronnect

  • Administrator
  • Hero Member
  • *****
  • Posts: 4887
    • View Profile
Re: Modifying Beautify parameters at runtime
« Reply #5 on: September 12, 2019, 11:03:44 AM »
Yes, the beta version is for the standalone/built-in pipeline (not PPS).