Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Worldbox Wiki
Search
Search
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Modding Code Examples
(section)
Page
Discussion
English
Read
Edit
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
View history
General
What links here
Related changes
Upload file
Special pages
Page information
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Adding a Custom Window == To add a custom window, you can create a custom class inspired by `WindowFavorites.cs`. Once you have your class ready, you can create a new window like so by copying the Favorites window and removing the attached WindowFavorites component, replacing it with your own. Let's say we want to add a new window for religions : <syntaxhighlight lang="csharp" line="1"> var canvasWindows = GameObject.Find("/Canvas/CanvasWindows"); var favWindow = GameObject.Find("/Canvas/CanvasWindows/WindowFavorites"); // clone the favorite window var religionWindow = Instantiate(favWindow); religionWindow.gameObject.name = "WindowReligion"; // remove the WindowFavorites class/component from your new window Destroy(religionWindow.gameObject.GetComponent<WindowFavorites>()); // attach your own WindowReligion class/component here religionWindow.gameObject.AddComponent<WindowReligion>(); // set the screen_id of the window, so you can open it from a button religionWindow.gameObject.GetComponent<ScrollWindow>().screen_id = "religion"; // add the window to the canvas windows group religionWindow.gameObject.transform.parent = canvasWindows.transform; // add the window id to the scrollwindows group, so you can open it from a button ScrollWindow.allWindows.Add("religion", religionWindow.GetComponent<ScrollWindow>()); // change the window title var religionTitle = GameObject.Find("/Canvas/CanvasWindows/WindowReligion/Background/Title"); Destroy(religionTitle.gameObject.GetComponent<LocalizedText>()); religionTitle.gameObject.GetComponent<Text>().text = "Religion"; </syntaxhighlight> Now you should be able to open this window from anywhere with <code>ScrollWindow.allWindows['religion'].clickShow();</code>
Summary:
Please note that all contributions to Worldbox Wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Worldbox Wiki:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Toggle limited content width