Search Feedback

28
votes

UnityEvent set (persistent) target from code

GUI

-

-

Please expose the functionality to set the referenced target object of UnityEvents from code in the editor.

I can imagine simply exposing a method like SetPersistentTarget(GameObject go) on the event or adding a static helper method to UnityEventTools.

This is useful in situations where I want to forward the event setup through a different editor interface, like when setting a UnityEvent on a GameObject in the scene from a custom playable. The custom playable itself cannot store a reference to the event, but I could store an ExposedReference to a GameObject and get available methods myself if I could set the UnityEvent target in my script.

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

(10889)

2D

(287)

Ads

(57)

AI & Navigation

(81)

Analytics

(130)

Animation

(406)

Asset Store

(364)

Asset Store Publisher

(19)

Assets

(551)

Audio

(185)

Cloud Build

(148)

Collaborate

(68)

Docs & Tutorials

(247)

Editor

(2545)

Everyplay

(17)

Game Performance Reporting

(21)

General

(987)

Graphics

(894)

GUI

(442)

Input

(173)

Licensing

(93)

Networking

(190)

Physics

(387)

Platforms

(445)

Profiling & Optimization

(84)

Runtime

(185)

Scripting

(1141)

Terrain

(174)

WebGL

(142)