Search Feedback

0
votes

ScriptableObject.OnValidate()

Scripting

-

-

Monobehaviour.OnValidate() messages are a great way of sanitising data changed in the inspector.

Given the push for developers to use ScriptableObject for more of their game data ( which I'm a huge fan of ) it would be beneficial to have this same functionality of Monobehaviours.OnValidate() in ScriptableObjects.

use cases:
Preventing designers from inputting values that exceed a range calculated based on other values within the scriptable object.

Precalculate a tree or lookup table after seed/input values are changed.

Alternatives:
I'm away that the ISerializationCallbackReciever can be used for similar results, however those methods are called in other scenarios so using them naively can have unintended consequences.

Comments (1)

  1. Cd25d50bdbe458274c17b2c1ebc20fd9?d=mm

    idbrii

    Nov 13, 2018 17:50

Your opinion counts

Help us make things better. Share your great idea for improving Unity or vote for other people’s.

Log in to post a new idea

Categories

All

(11034)

2D

(291)

Ads

(63)

AI & Navigation

(83)

Analytics

(130)

Animation

(413)

Asset Store

(371)

Asset Store Publisher

(21)

Assets

(557)

Audio

(185)

Cloud Build

(154)

Collaborate

(70)

Docs & Tutorials

(251)

Editor

(2579)

Everyplay

(17)

Game Performance Reporting

(22)

General

(1003)

Graphics

(903)

GUI

(447)

Input

(173)

Licensing

(93)

Networking

(193)

Physics

(392)

Platforms

(448)

Profiling & Optimization

(84)

Runtime

(188)

Scripting

(1154)

Terrain

(178)

WebGL

(145)