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.

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

(10244)

2D

(266)

Ads

(51)

AI & Navigation

(78)

Analytics

(121)

Animation

(379)

Asset Store

(295)

Asset Store Publisher

(7)

Assets

(524)

Audio

(173)

Cloud Build

(135)

Collaborate

(48)

Docs & Tutorials

(233)

Editor

(2374)

Everyplay

(13)

Game Performance Reporting

(16)

General

(919)

Graphics

(847)

GUI

(413)

Input

(160)

Licensing

(86)

Networking

(181)

Physics

(372)

Platforms

(434)

Profiling & Optimization

(78)

Runtime

(176)

Scripting

(1131)

Terrain

(167)

WebGL

(140)