Search Feedback

44
votes

Transform callback events

Scripting

-

-

Having events for when the position/rotation/scale changes (and potentially other components as well such as colliders and rigidbodies) would be invaluable. It would be much more performant than manually checking transform.hasChanged every frame (which, for example, is a major source of performance issues in NGUI), it would reduce code coupling, and it would still work when we do not have access to the code that modifies the transform (such as with closed-source 3rd-party libraries, or even Unity's animation system)

See discussion here
https://forum.unity.com/threads/more-transform-callbacks.263448/

Comments (3)

  1. 6eff31212b700d9259e4f5386c968983?d=mm

    YakDevBrandon

    Jan 23, 2019 19:52

    I agree. I think RectTransform would benefit from this as well. As far as I know there is no easy way to find out when a particular RectTransform's layout has been rebuilt. But there are many scenarios when you need to know a RectTransform's dimensions as soon as it's been laid out.

  2. De538f6303bc4c5fbed82b7dcefab0a9?d=mm

    SweatyChair

    Jan 09, 2019 03:22

    Same here, I have a number of components in many partial classes, attached at character controller. In some point it moved unexpectedly and it's really hard to find which script exactly do it...

  3. B525f1d791b2e619bc4ae399b0bcb5e6?d=mm

    Jinja

    Jan 03, 2019 21:36

    I'd like this for debug purposes, that is, what systems/scripts are changing the position of my gameObject? Put a breakpoint or log in a transform changed event and find out. If the overhead of checking for callbacks is too costly, I would be happy if this was an editor only capability.

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)