Search Unity

  1. Unity 2020.1 has been released.
    Dismiss Notice
  2. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

Too much blackbox, for example Preset.CanBeAppliedTo

Discussion in 'Documentation' started by Xarbrough, Jul 27, 2020.

  1. Xarbrough

    Xarbrough

    Joined:
    Dec 11, 2014
    Posts:
    751
    Very often, I'm frustrated by the Unity scripting API documentation because it only states the obvious, but not the helpful details I need to know as a programmer. Among others, here is an example:

    Preset.ApplyTo

    Preset.CanBeAppliedTo

    Both calls are black boxes since I cannot see what the C++ code is doing. The docs are vague on what both return values mean. If I check CanBeAppliedTo before using ApplyTo, is it safe to assume that ApplyTo succeeds? If I simply call ApplyTo and receive false, can I assume that the reason for failure is the same as would have been returned by CanBeAppliedTo?
     
unityunity