#Editor extension basics

1 messages · Page 1 of 1 (latest)

honest harness
#

Ah, okay so a bit of history and explanation. IMGUI was also used for doing runtime UI originally, though nowadays people use UGUI (the component and game object based system).
So the manual you are seen tells you how to use it for runtime UI, looking in the game view and you should see it.

tiny perch
#

nothing here

honest harness
#

If you want to add UI to the SceneView then you would want to do something like this

[InitializeOnLoad] // This tells Unity to call the static constructor whenever the domain reloads
public static class SceneViewExtension
{
  static SceneViewExtension()
  {
     SceneView.duringSceneGUI += 
  }
  
  private static void SceneGUI(Scene scene)
  {
    // You can't use the layout system for this so need to position it manually.
    if (GUI.Button(new Rect(0, 21, 100, 21), "Press Me"))
        Debug.Log("pressed");
  }
}
tiny perch
#

ok so there isnt a way to without code, add the ui?

honest harness
#

No

tiny perch
#

well, thats a dead case then

#

dont got time to learn that part of the api

honest harness
#

What is it that you are wanting to do?

tiny perch
#

trying to make a random placement generator for trees for my upcoming game

#

but its something id have to be able to make pretty quick

honest harness
#

Ah

tiny perch
#

thanks anyway

honest harness
#

There are a lot of prefab placement things

#

some on github and some for really cheap on the asset store

tiny perch
#

its not a game im going to invest money into

#

its a school project

#

2 weeks to make the game

#

this is preparation

honest harness
#

Well, there is a couple good free ones if you want

tiny perch
#

for gui creation?

honest harness
#

For placing prefabs

tiny perch
#

randomly?

#

in specific areas?

honest harness
#

Yup

tiny perch
#

could you link me?

honest harness
#

Sure, second.

#

This one I think is the most powerful free one

tiny perch
#

ok, it looks great for when you need to fill a full area
i need mine randomized though

#

thats what im currently working on

honest harness
#

You need what randomized?

tiny perch
#

the placement in the area

honest harness
#

You need to place trees randomly within an area, correct?

tiny perch
#

mhm

honest harness
#

Hmm, I thought it could do that...

tiny perch
#

not from what i saw

honest harness
#

yeah, seems not. My bad

tiny perch
#

no worries

#

already working on my own without ui

#

the inspector will have to suffice as ui

honest harness
#

There is also this, not sure if it suits your needs or not

tiny perch
#

oh shit