x


Set Gizmo to object in editor by c# script

I create my own custom null-objects with my menu and I'd like to set Icon to it. It will be great if it possible to use custom images.

alt text

more ▼

asked Oct 16 '11 at 11:35 PM

Azazeo gravatar image

Azazeo
31 7 8 9

I suppose you're talking about specifically setting it in script, because obviously you can press the 'Other...' button to do it by hand.

Oct 16 '11 at 11:41 PM syclamoth

I'd be interested in that aswell: is it possible to set the icon of a number of objects via script (e.g. i want 100 different objects to show those blue labels with their names on it in the scene view).

Feb 02 '12 at 10:32 AM VivienS

It may be possible if we had a list of the names of the default gizmo icons.

Jul 20 '12 at 03:35 PM MSylvia

Was a solution discovered for this without the need to use the OnDrawGizmos function?

Feb 27 at 03:38 PM John108
(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

It is very possible indeed to have custom gizmo images. Import the image you want to use into your project. Then you want to add this function to your monobehaviour.

    void OnDrawGizmos()
    {
        Gizmos.DrawIcon(transform.position, "YourImage.png", true);
    }

Obviously you need to replace the image path with the path to your gizmo image relative to the assets folder. The boolean at the end flags weather or not the gizmo allows scaling (true for scaling in 3d, false for constant size).

hope this helps.

more ▼

answered Sep 07 '12 at 11:24 PM

FatWednesday gravatar image

FatWednesday
462 2 5 12

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x4172
x3340
x1677

asked: Oct 16 '11 at 11:35 PM

Seen: 1357 times

Last Updated: Feb 27 at 03:38 PM