Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help  Can I attach particeattachment in script?
#18
(Yesterday, 09:38 AM)gahyun11 Wrote: what I did was just cleaning particle groups, then appending new particle groups in runtime. then I exited playmode

Modifying particle groups at runtime and having them persist once you get back to edit mode is not a supported use case. Our code is explicitly designed to disallow this, look at ObiActorBlueprint.cs InsertParticleGroup and ClearParticleGroups methods: they do completely different things based on the value of UNITY_EDITOR and Application.isPlaying.

There's two reasons for this: one is that Unity's editor API is of course only available in-editor, so doing this in standalone builds is simply impossible since standalone applications can't modify the asset database (there's no editor asset database!).

The other one is that even if technically possible when entering play mode inside the editor, persisting changes involves writing subasset data to disk which is an *extremely slow* operation. Typically, adding new particle groups at runtime means they will also be used at runtime so any operations involving them must be as fast as possible and must not persist outside of play mode.

Unity follows a similar convention on most of its built-in assets. See:
https://docs.unity3d.com/Manual/Modifyin...pting.html

If you want to persistently modify particle groups and have them written to disk as assets, you must modify them using editor scripts, not at runtime.

(Yesterday, 09:38 AM)gahyun11 Wrote: As you can see, the ui layout of the obi cloth blueprint is messed again.

This is a different error from the one you'd get in Obi 6 due to currentProperty being null due to Unity not correctly initializing public fields in custom editor. The problem here is that particle groups have been added to the a shared blueprint (instead of an instance of it) but have not been persisted to disk. As stated above, this is not supposed to be possible. We'll add an extra check to the editor window in upcoming versions.

Both issues prevent UI rendering from completing successfully, so they manifest in the same way.

kind regards,
Reply


Messages In This Thread
RE: Can I attach particeattachment in script? - by josemendez - Yesterday, 10:20 AM