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 18: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

(10797)

2D

(282)

Ads

(56)

AI & Navigation

(84)

Analytics

(133)

Animation

(396)

Asset Store

(356)

Asset Store Publisher

(17)

Assets

(544)

Audio

(185)

Cloud Build

(145)

Collaborate

(65)

Docs & Tutorials

(240)

Editor

(2513)

Everyplay

(19)

Game Performance Reporting

(22)

General

(981)

Graphics

(870)

GUI

(432)

Input

(173)

Licensing

(92)

Networking

(189)

Physics

(384)

Platforms

(442)

Profiling & Optimization

(85)

Runtime

(182)

Scripting

(1169)

Terrain

(172)

WebGL

(143)