Anyone out there using Unity?

A place for tutorials on how to get the most out of Flash

Anyone out there using Unity?

Postby Thekagekaton » Fri Mar 06, 2015 8:26 am

Hey there everyone!

So, i've been trying to learn various different programming languages, and i've found that trying to build my own engine is...well...unnecessary and WAY too complicated for me to learn right now. So i've jumped over to Unity and LOVE it, though, there are a few things that i've run into that i didn't know, through experimentation and tutorials i've figured most of them out, though, there is one that either no one is talking about, OR is so simple to do that i am over thinking the entire process (completely plausible).

What i'm wanting to do is,

i have different spots that i want the player to be able to click to open the UI, basically like in Breeding Season, when you click the building it opens a UI to interact with the building

I want to limit the amount of memory consumed by reusing one script and one UI and just change different aspects of it to fit the spot (if possible, i figured using some really simple IF statements in the script would work...wait...)

If anyone out there uses Unity and could possibly tell me if my thought process would work...

Using If statements to change the various texts of the buttons and the stuff in the feilds, connect the script to the objects, in the script, have it pull the UI up when the player clicks, then run through the IF statements to pick up what it needs, IF the gameobject is this object, pull this stuff and fill in the UI, change the buttons to do this...would that require different buttons or can i use the script to change that?


I tend to just ramble on so if any of this doesn't make sense please let me know!

Hope someone out there can help!
Thekagekaton
Newly Registered
 
Joined: Thu Nov 13, 2014 4:37 pm

Re: Anyone out there using Unity?

Postby BlueLight » Fri Mar 06, 2015 1:51 pm

i have different spots that i want the player to be able to click to open the UI, basically like in Breeding Season, when you click the building it opens a UI to interact with the building

I want to limit the amount of memory consumed by reusing one script and one UI and just change different aspects of it to fit the spot (if possible, i figured using some really simple IF statements in the script would work...wait...)

If anyone out there uses Unity and could possibly tell me if my thought process would work...


I think i have a concept for you.

So you need to create a script that allows you to click on sprites but doesn't require any special component to be attached to them?

-
You could make a script that on mouse clicks sends out a raycast. check only for Sprite/Gameobject that contain the tag UI.
Once you've clicked on a object with tag UI we need to get it's name. You're going to want to run the name through a conditional test(if else, or switch statement). These test will indicate what logic to run (click on the barn, you go to the barn. Click on a monster, open the monster management menu).
I also suggest you have a end else to warn you about clicking a object that you don't have any logic for but has the UI tag.

This method cuts down on the number of script you have write, or even use to 1. This also allows you to reuse logic. For instances you can place 2 beer mugs in a screen and they'll both do the same exact thing if you click them. This allows you to construct your UI based on the scene editor and avoid the unity GUI API (for this at least). You can also easily change what location your in by loading a new scene; This would allow you to craft each individual building as a separate scene while keeping a single script.
-

I would also suggest not placing all your UI into one script. At the very least break it up into three script. 1 world interaction (the concept we just talked about); 2 HUD This might contain buttons that open up your inventory or just displaying RPG maker like speech; 3 Menu, basically a pop up menu for your inventory, shops, monster management.

I'd like to point out that Unity 4.6 has new UI creation tools so in theory you could create these things like buttons and just switch their graphic out with your sprite.

-
It's 5 AM and i've got homework so i sadly can not provide a prototype of my concept.
User avatar
BlueLight
Gangs n' Whores Developer
 
Joined: Sat Jun 04, 2011 8:23 am

Re: Anyone out there using Unity?

Postby Terrantor!!! » Sun Apr 05, 2015 10:54 pm

I'm getting into it. It's honestly not that difficult. I like Blue's idea. I'd like to help but I'm learning to model, still and don't know any good resources
User avatar
Terrantor!!!
 
Joined: Thu Aug 23, 2012 10:36 am

Re: Anyone out there using Unity?

Postby hat973 » Thu Jun 04, 2015 4:16 am

Me my self I want to want to learn what I can just in case my laptop dies on me I will lose one of my games iv been working on so I would like a alt but I haven't seen a lot of unity games out there that do the Henti platformed like that sonic game for example.
Red light panda

:ugeek: Tumbler: Tumbler
:geek: I have a Blog: Red Light Blog
;) I stream to Give me a Watch over at: Picarto
:mrgreen: Donate: Patreon
:roll: Discord:Discord
User avatar
hat973
 
Joined: Tue Apr 24, 2012 12:44 am


Return to Tutorials



Who is online

Users browsing this forum: No registered users