tag:blogger.com,1999:blog-11853265408213868002024-03-05T05:58:11.840+00:00Diabolical: The ShooterGame development blog<br>
Diabolical is a 3D first person shooter which will be available for the Xbox 360John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.comBlogger138125tag:blogger.com,1999:blog-1185326540821386800.post-55249554059350032152017-04-22T15:36:00.002+01:002017-04-22T16:24:31.091+01:00Installing Blender on Windows 10I've been having trouble installing and using Blender on Windows 10. I've had various issues with 2.78a, 2.78b and 2.78c. The issues might have happened on earlier versions but I hadn't updated for a long while.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOaNevPqLEB7tWwLTiD-pRCUxuosRBlC6izhmbHZmQ4ilrGvnoWZveiudFu4M1CfXzWicKr3ild5btuvrfohayP2c54tqcnQFDGR2b_iwgEOtc5O5KLMWzDbdbgx4AI6AdP_JdlRmwjm8/s1600/BlenderBlackScreen.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="169" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhOaNevPqLEB7tWwLTiD-pRCUxuosRBlC6izhmbHZmQ4ilrGvnoWZveiudFu4M1CfXzWicKr3ild5btuvrfohayP2c54tqcnQFDGR2b_iwgEOtc5O5KLMWzDbdbgx4AI6AdP_JdlRmwjm8/s320/BlenderBlackScreen.png" width="320" /></a></div>
<br />
Just to be clear. Once Blender is working, it's working well.<br />
<div>
It appears to install but when I try to run it for the first time I just get the black console screen.<br />
<br />
With 2.78a and 2.78b I got an error message, not a very enlightening message but the Internet search pointed me in the direction of graphics drivers and updating them fixed the problem.</div>
<br />
I installed version 2.78c in April 2017. Lots of Windows updated had happened since the last installs. This time I just got a black screen with no error messages. It did not even appear to to try to load or to create the user preferences.<br />
<br />
This time, the first thing I tried was to turn on Developer mode.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3p9RUw-_D9kDyKLyLTiHqq8C4WGctNNTisIKldhCOp5TclM2gzYjfChaBJmmFT-6jEzDUPrqTz7r6StVTBW_6qv4dSWSArD4GI_R6O0-hkligtUINMwYQHEGqEKvGDLXTpyUjfc6RAIw/s1600/SettingsFromTheWindowsButton01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh3p9RUw-_D9kDyKLyLTiHqq8C4WGctNNTisIKldhCOp5TclM2gzYjfChaBJmmFT-6jEzDUPrqTz7r6StVTBW_6qv4dSWSArD4GI_R6O0-hkligtUINMwYQHEGqEKvGDLXTpyUjfc6RAIw/s1600/SettingsFromTheWindowsButton01.png" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWDepuZpfrfFBwLY1CYvsBtEThmjnwzq3BXj-jrIoGD6nzvfiuXf6ciYly0bvKvtQYUZmNcII009GbLGsB4AKRe2YhfdeWYQmX_mUX6B8kjjDn6rzi9T_oUw9EBWa20bkMkrRB9yRz2cM/s1600/UpdateAndSecurity01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="273" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWDepuZpfrfFBwLY1CYvsBtEThmjnwzq3BXj-jrIoGD6nzvfiuXf6ciYly0bvKvtQYUZmNcII009GbLGsB4AKRe2YhfdeWYQmX_mUX6B8kjjDn6rzi9T_oUw9EBWa20bkMkrRB9yRz2cM/s320/UpdateAndSecurity01.png" width="320" /></a></div>
<br />
I'd had issues with other installs where, despite it's name, Developer Mode needed to be enabled for the app to be able to setup its preferences correctly, or at all.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEHJLEV5jhmvjV6P0vh-13nFlgZrs3W1ft-x8lvFWHBqmMZbLrpEVY92mSAlsjgtgurPhBg-qliVoYuLGBSC_RMvy2UzRgOLZTzQT5XP7w7h1pmJrUqJC_oUQn0g6HSKN8qe85vu0Cn3k/s1600/DeveloperSetting01.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiEHJLEV5jhmvjV6P0vh-13nFlgZrs3W1ft-x8lvFWHBqmMZbLrpEVY92mSAlsjgtgurPhBg-qliVoYuLGBSC_RMvy2UzRgOLZTzQT5XP7w7h1pmJrUqJC_oUQn0g6HSKN8qe85vu0Cn3k/s320/DeveloperSetting01.png" width="320" /></a></div>
<br />
After selecting Developer Mode, it is necessary to reboot the machine, or at least it was in my case.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikPyRyaG9lQ_PjS180TvDwHVfhyphenhyphenoDYVRtgPTUDUQP_T_s3GmO3jtN29viHDWWNC_DK-NwRL1a5s1pybE3FQvhdSD1a_2tt7z85xQC0ya55AiDB5PMFfGl68mDkAYvp17PTgxneZBUphOQ/s1600/Blender278cWorkingWin10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="196" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEikPyRyaG9lQ_PjS180TvDwHVfhyphenhyphenoDYVRtgPTUDUQP_T_s3GmO3jtN29viHDWWNC_DK-NwRL1a5s1pybE3FQvhdSD1a_2tt7z85xQC0ya55AiDB5PMFfGl68mDkAYvp17PTgxneZBUphOQ/s320/Blender278cWorkingWin10.png" width="320" /></a></div>
<br />
After that Blender ran as it should.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-62717713580359403302016-03-18T14:52:00.004+00:002016-03-19T11:44:30.319+00:00Uneven Curved CornersI was surprised how well a simple technique worked to get a curved corner that had a different radius in two directions.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1CM6cS7erG6M1IUrqgQJW3wwIv3wVs45eHKufOhlp7ux3NAYaG47rJEUHsExadwqi08w6DPhgbn7E9XjjAZ0Iu0fIVoxznHGw8Mo0Xbk42r8LUr54xMEKOy59ytrljilxSGot1xvdrPk/s1600/Uneven+curved+corner.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1CM6cS7erG6M1IUrqgQJW3wwIv3wVs45eHKufOhlp7ux3NAYaG47rJEUHsExadwqi08w6DPhgbn7E9XjjAZ0Iu0fIVoxznHGw8Mo0Xbk42r8LUr54xMEKOy59ytrljilxSGot1xvdrPk/s400/Uneven+curved+corner.png" width="383" /></a></div>
<br />
To get the first curve I subdivided a plane and moved the vertices to line up with a circle in each of the directions I wanted the corner.<br />
<br />
To get the curve round the corner to be a larger curve than the others I added a circle and simply <b>scaled</b> each row of vertices in just one direction until the edge vertex lined up with the view of the edge of the circle.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicHKCUfN6UCSjHT3fjNrMxKEfA8vG3_v0hnlQfqUuiu9Qli2TBEMpIvpemQ2yCktY1vMAF2OetmoqMYchgJTGRM6WsDCJyvy8UKwVf7rOunOHR6WSJuVeCgGUF7ZNp-Uroux9bwXqEudM/s1600/ScaleYRoundCircle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="291" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEicHKCUfN6UCSjHT3fjNrMxKEfA8vG3_v0hnlQfqUuiu9Qli2TBEMpIvpemQ2yCktY1vMAF2OetmoqMYchgJTGRM6WsDCJyvy8UKwVf7rOunOHR6WSJuVeCgGUF7ZNp-Uroux9bwXqEudM/s400/ScaleYRoundCircle.png" width="400" /></a></div>
<br />
The other vertices scaled neatly to keep a smooth complex curve. In the above example I scaled [S] and restricted it to the Y axis [Y] which is the direction of the green arrow in the above image.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaT7lAOmpxZEqXM0Mn_5f2KARVhKG1CJDHVXQfx9g1QXTHUhMtx8aSKbACgYB6P915Dk30uD5ZdKsIBPu-JmEBndxfpcIx0ZukB70MPuUTuFhv8-IUqFARtC1QPyjCaC8xMazFBAyFVKE/s1600/CurveFollowingCircle.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaT7lAOmpxZEqXM0Mn_5f2KARVhKG1CJDHVXQfx9g1QXTHUhMtx8aSKbACgYB6P915Dk30uD5ZdKsIBPu-JmEBndxfpcIx0ZukB70MPuUTuFhv8-IUqFARtC1QPyjCaC8xMazFBAyFVKE/s400/CurveFollowingCircle.png" width="400" /></a></div>
<br />
It was the fact of scaling rather than moving that kept the curve in the other direction looking smooth.<br />
I started from the top and always scaled to the centre line of the guide circle. I just selected the upper most vertex as the last selection and scaled towards that.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGYNwt3da0760kZYCHlqbsvO9hGDgJqedlBp91WOJ2q6M0G69lOHzQ01a36EIq-Bbdy_2B90yuGVZVWIuimROgnrM-KXov7ApkCsmZoARSoLYbJJV5ajuZzvs5PTDH4mHJFg1ok2eeE5U/s1600/FinishedComplexCurve.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="311" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGYNwt3da0760kZYCHlqbsvO9hGDgJqedlBp91WOJ2q6M0G69lOHzQ01a36EIq-Bbdy_2B90yuGVZVWIuimROgnrM-KXov7ApkCsmZoARSoLYbJJV5ajuZzvs5PTDH4mHJFg1ok2eeE5U/s400/FinishedComplexCurve.png" width="400" /></a></div>
<br />
It's much harder to describe than it was to do.<br />
<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-36430347958817654122016-03-10T12:47:00.000+00:002016-04-02T15:47:33.005+01:00Modelling with quadsI've been working on some static models of cars. This hopefully this will improve my 3D modelling skills.<br />
<br />
I am trying to stick to the pretty much universally recommended way of doing this and that is to use <b>only quads</b>. Not triangles.<br />
<br />
There are several articles online about why quads work better. Here's a <a href="http://blendernewbies.blogspot.co.uk/2008/11/3d-mesh-topology-tip-quads-vs-triangles.html" target="_blank">link to just one explanation</a> but a quick search on Google will find you lots of others. In short, quads can be smoothed, quads maintain edge loops and can be subdivided for improved quality results.<br />
<br />
Most balance articles also mention that there are cases for using triangles in some parts of the model but they should be hidden out of sight. I now know why I found it so difficult to get smooth faces on some of my earlier models. I'd used triangles in the wrong places.<br />
<br />
From a games perspective, most, if not all rendering is done as triangles but we are talking about the best way to create the model. Quads, apparently also animate better because the folds will be more predictable.<br />
<br />
Anyway. The point of this post is to remind myself of how I have made some shapes with quads, avoiding triangles.<br />
<br />
At the moment there is just one tip but I'll add more as I work them out.<br />
<br />
<br />
<ul>
<li><b>Reduce the number of edges subdividing rectangles</b> </li>
</ul>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhOWZO8kfClbO9n4HoSyzJSxZN4pdCi79PniuPAcAwdw22VF1qVIzype0c9hoP39HhQ7lJCbghYWOTFLC8EZU-jzQ1K-BHeANEvxP83BKggGppjzpvbkEQEXCEHpPm2Q2ZOji0GX0XzLw/s1600/Reducing+quads.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="232" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhhOWZO8kfClbO9n4HoSyzJSxZN4pdCi79PniuPAcAwdw22VF1qVIzype0c9hoP39HhQ7lJCbghYWOTFLC8EZU-jzQ1K-BHeANEvxP83BKggGppjzpvbkEQEXCEHpPm2Q2ZOji0GX0XzLw/s400/Reducing+quads.png" width="400" /></a></div>
<br />
This transitions from a row of three quads down to a row made with just a single quad. A complex shape at the bottom of the face and simplified at the top.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSwOreYg6kKEQQfpuTVnB8PjXsD7hA0J5j7Tfmc-S-qSPosAP6uW_hJj8yPZEErgSSJy3eyrPTsvjVp1NgwQspHBP1LeMUjdY8_IyDA1xG_rE665Ax-xMOo_SNEFBuub08ZKb6Jum7Efk/s1600/Complex+curves.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="252" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSwOreYg6kKEQQfpuTVnB8PjXsD7hA0J5j7Tfmc-S-qSPosAP6uW_hJj8yPZEErgSSJy3eyrPTsvjVp1NgwQspHBP1LeMUjdY8_IyDA1xG_rE665Ax-xMOo_SNEFBuub08ZKb6Jum7Efk/s400/Complex+curves.png" width="400" /></a></div>
<br />
I often end up with this situation when creating curves within otherwise flat faces.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4WvTKSDI_8svii2zot1jp1JC-A6zgQCdahKXMMavfuC0l21v8yzhhku-BofZ5AWom9C8nQ_D4sdhQ5HOnq8JJs29FZAhaFgkZa8xSwibSD_1MRLrSDDtgQ_7sp19dM7DPGpKs9M7o7bY/s1600/ReducedQuads2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh4WvTKSDI_8svii2zot1jp1JC-A6zgQCdahKXMMavfuC0l21v8yzhhku-BofZ5AWom9C8nQ_D4sdhQ5HOnq8JJs29FZAhaFgkZa8xSwibSD_1MRLrSDDtgQ_7sp19dM7DPGpKs9M7o7bY/s400/ReducedQuads2.png" width="200" /></a></div>
<br />
Another example, 10 quads down to just two.<br />
<br />
<br />
<b><span style="font-size: large;">Other useful articles and tips:</span></b><br />
<a href="http://blender.stackexchange.com/questions/12106/long-rectangular-quads-or-neat-squarish-quads-with-tris" target="_blank">What shape should the quads be?</a> Evenly sizes or any shape.<br />
Also look for<a href="http://blender.stackexchange.com/questions/14514/how-to-make-an-edge-loop-that-is-parallel-to-one-of-the-sides-of-the-face-loop" target="_blank"> edge-parallel mode</a>. After pressing Ctrl-R for a loop cut, press E to align to an edge and F to toggle between which edge to align to.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-18085540711200842302015-06-29T09:29:00.000+01:002015-06-29T13:27:02.480+01:00My Blender PreferencesEvery time I come back to Blender I forget how I had it setup the last time I used it.<br />
<br />
Obviously settings are to each persons' taste but I have never quite got on with all the Blender defaults. I assume when using a new programme that the authors know better than me what are the best settings for their application. Eventually I give up and use my own choice.<br />
<br />
<h3>
Rotation</h3>
<br />
The default rotation type of Turntable is fine but it pivots round a hard to understand global point. It almost feels arbitrary to me.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
I prefer it to pivot round the centre of the selected items. It's still not ideal every time but at least I can understand what it is doing.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinu-Oec-lPezBRVHbsXkSpa0byZ3fU7Z4OHpEfGlzmm9Ycye3Onevpb-yubIh2hgftMNG3K2OmWdRPdMBfHXrx_rMDxQxAFFboFLBLn-1tzpZbpIZ9j6xKtElDEgqngoDUiq99_HlNL8E/s1600/JCBManipulationSettings002.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="183" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinu-Oec-lPezBRVHbsXkSpa0byZ3fU7Z4OHpEfGlzmm9Ycye3Onevpb-yubIh2hgftMNG3K2OmWdRPdMBfHXrx_rMDxQxAFFboFLBLn-1tzpZbpIZ9j6xKtElDEgqngoDUiq99_HlNL8E/s400/JCBManipulationSettings002.png" width="400" /></a></div>
<br />
<h3>
Zoom</h3>
<br />
This is just my preference. By default Blender zooms to the centre of the current view. Sometimes that is OK but I find it quicker to zoom to where my mouse is pointing.<br />
<br />
<h3>
Metric</h3>
<br />
I like to work with actual sizes and I like those to be metric.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvBZYMXgg7Ao3sDQ_wwmzBTkioFlnjxVtt3SgQnyJIigk2gqhhpvT2eQZzzOXKcYkZCiygzsPRS636YNtCSQmWznbOjQ0addcQHxLRjTM45kKMjxtIYYy2Mvsh7dUAK5lQ9Pkwp8I9AII/s1600/JCBmmEntry001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvBZYMXgg7Ao3sDQ_wwmzBTkioFlnjxVtt3SgQnyJIigk2gqhhpvT2eQZzzOXKcYkZCiygzsPRS636YNtCSQmWznbOjQ0addcQHxLRjTM45kKMjxtIYYy2Mvsh7dUAK5lQ9Pkwp8I9AII/s1600/JCBmmEntry001.png" /></a></div>
<br />
Ideally millimeters (mm) but although Blender allows entering numbers as mm, it displays the results in centimeters (cm).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkowfZw-zev9g5ZUJzsJBCMQ2a553uv9tSHgKZ2HqIs-8GdEMU6gAl6kZG7cBkvM1d1Btq1JMDO4ay-MezD6_wc9qhs57kA1FRh3EvGq_HY3jo6DbuNj-93UPRiJqO1KWf1Q_XE5p7dLk/s1600/JCBMetricSettings001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="308" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkowfZw-zev9g5ZUJzsJBCMQ2a553uv9tSHgKZ2HqIs-8GdEMU6gAl6kZG7cBkvM1d1Btq1JMDO4ay-MezD6_wc9qhs57kA1FRh3EvGq_HY3jo6DbuNj-93UPRiJqO1KWf1Q_XE5p7dLk/s400/JCBMetricSettings001.png" width="400" /></a></div>
<br />
I use the scale option to get the result to be mm. One unit size equals 1mm.<br />
<br />
I am sure that most readers will assume that my preference for metric is because I have grown up in England. This is not entirely the case. I am old enough that I can work in both imperial and metric and I do still measure in inches when working on less precise jobs, like fences for the fields. When I'm 3D modelling, I typically need some accuracy and millimeters is just so much easier at all scales.<br />
<br />
I can't complain because I still prefer working in degrees and not radians but clearly Blender's interface is designed for the units most commonly used in Europe and not for people like me and most of the building trade in the UK that work in the scientific standard size of millimeters. I am happy there is a choice and centimeters are much better for my needs than inches.<br />
<br />
<h3>
Display</h3>
<div>
<br /></div>
<div>
The information I display while working changes. It is handy to hide bits so they do not get in the way.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMhukjB4bHR-NbnDfsCUtF0hn0uLPXa8TvHUcma5bdpFvUW4oCcigGpwibSFoeEZAlcnsj2CRDRuextGzX9_KTR1srQsgFUaCKSa7hjBzbBDlZqzqKl2NzM4G5SNoscY83yOMqv6hUrEU/s1600/JCBShowEdgeLength001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiMhukjB4bHR-NbnDfsCUtF0hn0uLPXa8TvHUcma5bdpFvUW4oCcigGpwibSFoeEZAlcnsj2CRDRuextGzX9_KTR1srQsgFUaCKSa7hjBzbBDlZqzqKl2NzM4G5SNoscY83yOMqv6hUrEU/s320/JCBShowEdgeLength001.png" width="259" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiqhOgd2b2xmAQtNL8tepPv-stdvG6zGEaVGUq8ljJbVqqfM9FfkjJDd6DrpyZbW5zNOed-TAHXsCB8AhhMM0f4Zz6_yiPSdrFwRcHos6j6sHGu_zqlX022oq_3BaWoXQXN3fsDdjegYM/s1600/JCBDisplaySettings001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiiqhOgd2b2xmAQtNL8tepPv-stdvG6zGEaVGUq8ljJbVqqfM9FfkjJDd6DrpyZbW5zNOed-TAHXsCB8AhhMM0f4Zz6_yiPSdrFwRcHos6j6sHGu_zqlX022oq_3BaWoXQXN3fsDdjegYM/s400/JCBDisplaySettings001.png" width="213" /></a></div>
<div>
<br /></div>
<div>
The things I find useful are the lengths of selected edges to get accurate sized objects and the normals to show the outside face of a surface.</div>
<div>
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD9hTQ6SrmI5khF7MZH5KtLYP61_Azt1MnsvAUp_r4U2btahBagywAw8eEYJBd8zDniHH2umllig5nNGtvwdbZdMb1D7-4mQY9pM8HM9uen162uK-hdTNwwcGDVjQqA2WmRNFpcPQbTxQ/s1600/JCBBackfaceCulling001.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="228" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjD9hTQ6SrmI5khF7MZH5KtLYP61_Azt1MnsvAUp_r4U2btahBagywAw8eEYJBd8zDniHH2umllig5nNGtvwdbZdMb1D7-4mQY9pM8HM9uen162uK-hdTNwwcGDVjQqA2WmRNFpcPQbTxQ/s400/JCBBackfaceCulling001.png" width="400" /></a></div>
<div>
<br /></div>
<div>
I also turn on back face culling to help with keeping track of the outside and inside of objects.</div>
<div>
<br /></div>
<div>
As I find other preferences, I'll update this page.</div>
<div>
<br /></div>
John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-43796026124171507802015-06-03T13:04:00.000+01:002016-03-03T15:58:17.468+00:00Blender Quick ReferenceI have used <a href="https://www.blender.org/" target="_blank">Blender</a> a lot for 3D models for games but my use has long periods away doing coding or other projects.<br />
<br />
That means whenever I return to 3D modelling I have to remember how to use <a href="https://www.blender.org/" target="_blank">Blender</a> again. Typically <a href="https://www.blender.org/" target="_blank">Blender</a> has progressed a version or two as it is very actively being developed. It always takes me a while to get back up to speed.<br />
<br />
I hunted round for <a href="https://www.google.co.uk/search?q=blender+quick+reference&espv=2&biw=1636&bih=860&source=lnms&tbm=isch&sa=X&ei=279uVfr1KKq17gbf1IKgCg&ved=0CAcQ_AUoAg#imgrc=_" target="_blank">quick start guides</a> and <a href="https://www.google.co.uk/search?q=blender+quick+reference&espv=2&biw=1636&bih=860&source=lnms&tbm=isch&sa=X&ei=279uVfr1KKq17gbf1IKgCg&ved=0CAcQ_AUoAg#tbm=isch&q=blender+keyboard+shortcuts" target="_blank">keyboard shortcuts</a> but none quite had what I needed.<br />
<br />
What I wanted was the common features used to make most models to get me up to speed as quickly as possible. I don't need every feature because I can look up the rarely used ones as needed. Therefore, in my usual way, I have created a desktop quick reference guide that has the features I need to remember each time.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2We6U3OJ572tYG_iltDzKKylkM7FVN9G981a2VVi6VJ0VoqO9UZuEDwmfWeTpvRRK6uDZSUkrq2kB88VywA-R2j-k4Hz0LDM7jSmtyjFfF7qhj_vOcsListiI1x9PFlFy8OFavBviR3g/s1600/Blender27QuickReference019page1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="276" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh2We6U3OJ572tYG_iltDzKKylkM7FVN9G981a2VVi6VJ0VoqO9UZuEDwmfWeTpvRRK6uDZSUkrq2kB88VywA-R2j-k4Hz0LDM7jSmtyjFfF7qhj_vOcsListiI1x9PFlFy8OFavBviR3g/s400/Blender27QuickReference019page1.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgIo3QhYCS9k2UETSzPqAp6BrSe_IMu6sOoaufZ8J6kXVOy319zNteZFSCce34I8hiRrfv69e8Pg1E8g2AbGQEKcIAm65adkDU22WR3EhkNYH_13kCuO4q6MkV1FYkV7u4LaUhrGmw8Hk/s1600/Blender27QuickReference019page2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="276" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjgIo3QhYCS9k2UETSzPqAp6BrSe_IMu6sOoaufZ8J6kXVOy319zNteZFSCce34I8hiRrfv69e8Pg1E8g2AbGQEKcIAm65adkDU22WR3EhkNYH_13kCuO4q6MkV1FYkV7u4LaUhrGmw8Hk/s400/Blender27QuickReference019page2.png" width="400" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
This will continue to be a work in progress. I will add more reminders as and when I know what I need to use.<br />
<br />
<span style="font-size: large;">Downloads</span><br />
<br />
I've made a couple of versions available for download:<br />
<br />
<a href="https://drive.google.com/file/d/0B6KA9qkK3ar5Zk04YmxBRTRiTE0/view?usp=sharing" target="_blank">PDF to print or view</a><br />
<a href="https://drive.google.com/file/d/0B6KA9qkK3ar5ZUE4US1wckhlcU0/view?usp=sharing" target="_blank">Source PowerPoint to edit to make your own changes</a><br />
<div>
<br />
<b>3D Printing</b><br />
<br />
If you are <a href="http://blog.discoverthat.co.uk/search/label/3D%20Printing" target="_blank">interested in 3D printing see my other blog</a>.<br />
<br />
==<br />
<br />
<b>Last Updated - </b>3 March 2016<br />
<br />
<a href="http://blog.discoverthat.co.uk/2015/06/3d-modelling-using-blender.html" target="_blank">Cross post on my other blog</a></div>
<div>
<br /></div>
John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-17057465503878900832015-06-03T12:40:00.000+01:002015-06-03T12:40:00.309+01:00Blender Set Origin ScriptI have not done much work on my game recently but to do so I need to get round to creating the levels and I'm back to using Blender again. <br />
<br />
When I started to tidy up one of my models I came across an odd feature in Blender. You can only set the origin on the active object.<br />
<br />
My main reason for setting an origin is to get all of the origins of all of the objects in a scene at the zero point. I find it easier to import in to other programmes and line them up if they all have the same centre.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0S5OtuBvab4cZyLwKPKNYqdE5qFkCOVm47CeMm3yXEHSLLc5RuUPCSyW9erRsjv0-J9A6ANSW3Ratsx2xRRcFNgYECAz5czbebGHv0Hc32CBC1bCtZo9aJy6p9-EGerw6utLZDRn3j6U/s1600/SetOriginButton1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi0S5OtuBvab4cZyLwKPKNYqdE5qFkCOVm47CeMm3yXEHSLLc5RuUPCSyW9erRsjv0-J9A6ANSW3Ratsx2xRRcFNgYECAz5czbebGHv0Hc32CBC1bCtZo9aJy6p9-EGerw6utLZDRn3j6U/s1600/SetOriginButton1.png" /></a></div>
<br />
Using the built in button, it is frustrating having to select one object at a time to set all the origins. I decided to create a script to do this for me.<br />
<br />
Not as easy as I expected because even in code the set origin only works on the active object.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIpZfNF3S4Am_aWH-o5YiVKv_eHGN79uA9C4L9GjFv75VvcPNWRUWGWV3evGia7U3sUiBObbwvZzwPQY2rLpPyp5PE0DeOVoFJBiT61yUUl-3RwLRRTOnsgPnQx90OVyqUaMQPbzuCMcA/s1600/PythonConsole1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="158" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIpZfNF3S4Am_aWH-o5YiVKv_eHGN79uA9C4L9GjFv75VvcPNWRUWGWV3evGia7U3sUiBObbwvZzwPQY2rLpPyp5PE0DeOVoFJBiT61yUUl-3RwLRRTOnsgPnQx90OVyqUaMQPbzuCMcA/s320/PythonConsole1.png" width="320" /></a></div>
<br />
I just typed the lines in to the console to run it. After the last line press return one extra time to run it.<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqkQwYJgUqJgohcL5pNhc3fReu4J-0Y3SaH4d3QTIWnJoKE6N6LqrMVIm7LgVVohmT2LF1dgjN-IcKAvq7oO1MRYgAsm3qu85pmYH3ZYWjIOgGxWVrE5Fok4T2nritV8jS0WzaS35ffsAI/s320/codebg.gif") rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="-ms-word-wrap: normal; color: black;">
for item in bpy.context.scene.objects:
if item.type == 'MESH':
item.select = True
bpy.context.scene.objects.active = item
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
item.select = False
</code></pre>
<br />
The above worked in version 2.74 of Blender. It goes through ALL objects in the scene which is what I wanted.<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqkQwYJgUqJgohcL5pNhc3fReu4J-0Y3SaH4d3QTIWnJoKE6N6LqrMVIm7LgVVohmT2LF1dgjN-IcKAvq7oO1MRYgAsm3qu85pmYH3ZYWjIOgGxWVrE5Fok4T2nritV8jS0WzaS35ffsAI/s320/codebg.gif") rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="-ms-word-wrap: normal; color: black;">
for item in bpy.context.selected_objects:
if item.type == 'MESH':
bpy.context.scene.objects.active = item
bpy.ops.object.origin_set(type='ORIGIN_CURSOR')
</code></pre>
<br />
<br />
In theory the above should work for the currently selected objects but I have not tested that script.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDqBTvGYbRfoapKIlC_MdlmCBztro87SmtwoSXCKtguOgKBzKtiP71rRarJnBQF_IGX72oUt7dsU4MHcBUEsoVDZ1dkEOfgB8fmvJbmRP8z0cD14sxiVIbddZUx8HKMLbT39oZDW3KXGI/s1600/ConsoleCopy1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhDqBTvGYbRfoapKIlC_MdlmCBztro87SmtwoSXCKtguOgKBzKtiP71rRarJnBQF_IGX72oUt7dsU4MHcBUEsoVDZ1dkEOfgB8fmvJbmRP8z0cD14sxiVIbddZUx8HKMLbT39oZDW3KXGI/s1600/ConsoleCopy1.png" /></a></div>
<br />
I came across another oversight when trying to copy that code to save it. To get the Windows Ctrl-C (copy) and Ctrl-V (paste) to work in the console window you first have to click on the console menu item at least once. After that Ctrl-C and Ctrl-V work as expected.
John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com2tag:blogger.com,1999:blog-1185326540821386800.post-27625127274468628232014-12-12T10:22:00.001+00:002014-12-23T14:01:09.909+00:00Ultimate FPS and Photon Unity NetworkingI received an e-mail today that got me interesting in my game again.<br />
<br />
Too much of my time was spent tinkering with animations and controls to try to get things just right. I've looked at some pre-built assets before but none quite hit the mark. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVHsz-mWZsNpikthAiHOhiHyHCzeswr4iQZHAPeiHgMAGGZ4OVLvuBi7mMqPlmnGj6ToooY7uSlK_C-49BZmLHv3OkITMsKcB6frvRg-DrOL9M35lb2YeTvF94baUF0quTdPxPVMcVutM/s1600/UFPSPhotonUN1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhVHsz-mWZsNpikthAiHOhiHyHCzeswr4iQZHAPeiHgMAGGZ4OVLvuBi7mMqPlmnGj6ToooY7uSlK_C-49BZmLHv3OkITMsKcB6frvRg-DrOL9M35lb2YeTvF94baUF0quTdPxPVMcVutM/s1600/UFPSPhotonUN1.jpg" height="216" width="320" /></a></div>
<br />
<a href="https://www.assetstore.unity3d.com/en/#!/content/2943" target="_blank">Ultimate FPS (UFPS) </a>have added a third person view and are now adding multi-player. Both those features are exactly what I have been waiting for. They have teamed up with <a href="https://www.exitgames.com/en/PUN" target="_blank">Photon Unity Networking (PUN)</a> which is my multi-player platform of choice so I am already familiar with that.<br />
<br />
<a href="http://forum.unity3d.com/threads/ufps-ultimate-fps-50-off-sale.126886/" target="_blank">http://forum.unity3d.com/threads/ufps-ultimate-fps-50-off-sale.126886/</a><br />
<a href="https://www.assetstore.unity3d.com/en/#!/content/2943" target="_blank">https://www.assetstore.unity3d.com/en/#!/content/2943</a><br />
<a href="https://www.exitgames.com/en/PUN" target="_blank">https://www.exitgames.com/en/PUN</a><br />
<br />
It's a closed Beta at the moment but this looks to be exactly what I need to speed up my development:<br />
<a href="http://www.visionpunk.com/content/assets/ufpsmp/landing.html" target="_blank">http://www.visionpunk.com/content/assets/ufpsmp/landing.html</a><br />
<br />
1000's of hours have gone in to UFPS which I would never have time to replicate and so I am very hopeful that all I need to do is add in my gamepad support and some AI and the rest will be level design and assets to complete the game. Sounds easy but I know there is still a lot of work left to do.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVSEcg-K5FN5pbSX3fcNvme8cJv1OsVBNy_7BEUexUJVqBsGHl_lulI5pDSj3hv0LgcCsfW60phyphenhyphen2zSSfSm-QzIlE4w-jGOWvVJrjBtUYh3oPBFz24kvCqNxhhuTVKqAf4Ty2voUyhRxI/s1600/ControlsLayout2014-02-07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVSEcg-K5FN5pbSX3fcNvme8cJv1OsVBNy_7BEUexUJVqBsGHl_lulI5pDSj3hv0LgcCsfW60phyphenhyphen2zSSfSm-QzIlE4w-jGOWvVJrjBtUYh3oPBFz24kvCqNxhhuTVKqAf4Ty2voUyhRxI/s1600/ControlsLayout2014-02-07.jpg" height="149" width="320" /></a></div>
<br />
Coming up to the Christmas break I might even have some time to work on it.<br />
<br />
Fingers crossed that they let me in on the Beta.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-17659310809451236552014-11-14T08:45:00.000+00:002014-12-23T13:46:56.950+00:00PauseFollowing on from my last post about source control, lots of additional things have conspired to halt development.<br />
<br />
The aforementioned <a href="http://blog.diabolicalgame.co.uk/2014/08/clone-repository-in-sourcetree.html" target="_blank">source control issues</a>, <a href="http://blog.discoverthat.co.uk/search/label/car" target="_blank">Land Rovers</a>, laptop problems, excessive work at my day job and then playing <a href="http://www.destinythegame.com/" target="_blank">Destiny</a> on my <a href="http://support.xbox.com/en-GB/xbox-live-status" target="_blank">Xbox One</a> have all been parties to what I expect to be a long pause.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuABXzBHrjP9FJFvBJHUjuvhkzKrS0nLMndIm7jUVOs3npB6J_9HifKf0yAhrckkWogTwDWogvRtfOrgZa_ibcvLOLb5Vzza6QrcrFgKuvhRnFjTOVoggRtRJIrMVZzIpu_BNlclU6LCQ/s1600/WarlockDestiny2014-11a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuABXzBHrjP9FJFvBJHUjuvhkzKrS0nLMndIm7jUVOs3npB6J_9HifKf0yAhrckkWogTwDWogvRtfOrgZa_ibcvLOLb5Vzza6QrcrFgKuvhRnFjTOVoggRtRJIrMVZzIpu_BNlclU6LCQ/s1600/WarlockDestiny2014-11a.png" height="286" width="320" /></a></div>
<br />
Destiny is so <a href="http://www.bungie.net/" target="_blank">close to the game I would have liked to have developed</a> that I am spending my spare time playing that.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqudQB9qI6yuv7N-ApBglH9911h9BIxhmiao-xuLY6o2VLte8CJri2jDySRIgtWmlggJyX7JRcER0xLPuiMQSIquamFrXXe9qaX68FgyqHSBrPXbFkx9AM1TPsrBFrarRrdrfJq_04XjU/s1600/HunterDestiny2014-11b.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqudQB9qI6yuv7N-ApBglH9911h9BIxhmiao-xuLY6o2VLte8CJri2jDySRIgtWmlggJyX7JRcER0xLPuiMQSIquamFrXXe9qaX68FgyqHSBrPXbFkx9AM1TPsrBFrarRrdrfJq_04XjU/s1600/HunterDestiny2014-11b.png" height="296" width="320" /></a></div>
<br />
I expect to return to my own game development at some point but for the time being any updates will be few and far between.<br />
<br />
==<br />
<br />
Update:<br />
<br />
Although Destiny kept me more interested than any other game this year, I have still lost interest in it. No matter how good quality the graphics are and how stable the game play is, playing the same thing over and over is only fun for a while.<br />
<br />
It has made me re-think my game design. In particular I now want each play through of any level to be different every time. The characters both players and enemies should start at different locations and cover different areas of the same map.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-65459972443019116102014-08-27T18:30:00.000+01:002014-12-12T14:22:43.764+00:00Clone a Repository in SourceTreeI have not done much development for the last month. This is because, in addition to being busy with other things, the repository for Diabolical on my main laptop became corrupt! I have not had enough time to think about fixing it. It's holiday time and despite the weather I have had some outside jobs to do including some <a href="http://blog.discoverthat.co.uk/" target="_blank">work on my Land Rover</a>.<br />
<br />
I looked at the problem with <a href="https://www.atlassian.com/software/sourcetree/overview" target="_blank">SourceTree</a> a couple of weeks ago and decided that the only way to fix the busted repository was to take a copy of my most recent changes that have not yet been pushed up, delete the old local copy of the repository and start again with a fresh download of the source.<br />
<br />
The trouble is it's now over a Gig download so it's not a quick fix. I also can't remember all the repository settings. I use a <a href="http://blog.diabolicalgame.co.uk/2014/08/security-workround-for-sourcetree.html" target="">quick work round for security issues</a> and there are some very basic <a href="http://www.sourcetreeapp.com/faq/" target="_blank">Getting Started answers</a> on the support site but I decided to do some reminder screenshots to add to this article.<br />
<br />
As long as the repository already exists on the server the process in SourceTree is easy.<br />
<br />
Clone/New from the toolbar<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RKefWDdAjuqlaZhDRoHyFSWMOX5vYQ9ALv8Hh69KeBP4QGJV3zjWR4xcbUpyLNloMhdCaqg7dfM_6u6DIIa_Fy5PT5UpphBZjP01oAshbdo32T5LwmSWdIUj47Y2_QcyJ_HpTfdQu28/s1600/clone1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1RKefWDdAjuqlaZhDRoHyFSWMOX5vYQ9ALv8Hh69KeBP4QGJV3zjWR4xcbUpyLNloMhdCaqg7dfM_6u6DIIa_Fy5PT5UpphBZjP01oAshbdo32T5LwmSWdIUj47Y2_QcyJ_HpTfdQu28/s1600/clone1.png" /></a></div>
<br />
<br />
<br />
Enter or select the source path<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3Ca7ybDpxYM2E61ElOwwKxXgmt3TVrkiEZnGJIoe1U34RTCRcl0cv0C6d5ssM01VwOKCq5armPbKamcCwh5qLtNCvMCeaTwZLX2vrYWwaqA90GJ3r3VFtO3eVGPgU5SIt0K-AffVSokI/s1600/clonedialog1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj3Ca7ybDpxYM2E61ElOwwKxXgmt3TVrkiEZnGJIoe1U34RTCRcl0cv0C6d5ssM01VwOKCq5armPbKamcCwh5qLtNCvMCeaTwZLX2vrYWwaqA90GJ3r3VFtO3eVGPgU5SIt0K-AffVSokI/s1600/clonedialog1.png" height="52" width="320" /></a></div>
<br />
<br />
Select from the list on the server or select another server<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGLb7upaIn7fTEoRC1ZKeBzVKtZLdXzC3M01MTDPpLxl-ppnqyNkrLuuWgnbHvOLbr2ax_9TvoyL1T-WJFluupoPQecVRCJ_nhuPUsTEg-sKgM-mQEuoumryyhs1YASyfCAk1y75fKJL4/s1600/SelectSource1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiGLb7upaIn7fTEoRC1ZKeBzVKtZLdXzC3M01MTDPpLxl-ppnqyNkrLuuWgnbHvOLbr2ax_9TvoyL1T-WJFluupoPQecVRCJ_nhuPUsTEg-sKgM-mQEuoumryyhs1YASyfCAk1y75fKJL4/s1600/SelectSource1.png" /></a></div>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsX8av_CrLSuT-42zY_zsJXrpwRqMBTEwnByg458AKfC6djWGNt_bjO5xIZoM4-XODB7D8Q5ZSq6birVzg6_eEtfO6Eg1C2oAtYblj1eAuzL2rMk6i0cq7oJ9J3cnSC_dtSu6lZcApikU/s1600/SelectFromList1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsX8av_CrLSuT-42zY_zsJXrpwRqMBTEwnByg458AKfC6djWGNt_bjO5xIZoM4-XODB7D8Q5ZSq6birVzg6_eEtfO6Eg1C2oAtYblj1eAuzL2rMk6i0cq7oJ9J3cnSC_dtSu6lZcApikU/s1600/SelectFromList1.png" height="48" width="400" /></a></div>
<br />
<br />
Enter the local path to the folder to store the repository<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqz_253vzHPyafOaoM_amNsmmhIxqtR-Yt7i-QuJGQYVywnqPpAiesWTRxtJB5JzIG3a6iaU2WLwT2AjHZXmR7414ymLylmnQMXM9uE2cOARXvLVhBMxqsPnjr9i2YWQq1-ZpvG0ID2sY/s1600/CompletedCloneScreen2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgqz_253vzHPyafOaoM_amNsmmhIxqtR-Yt7i-QuJGQYVywnqPpAiesWTRxtJB5JzIG3a6iaU2WLwT2AjHZXmR7414ymLylmnQMXM9uE2cOARXvLVhBMxqsPnjr9i2YWQq1-ZpvG0ID2sY/s1600/CompletedCloneScreen2.png" height="192" width="400" /></a></div>
<br />
<br />
You can select an existing empty local folder or manually add a new folder name which will be created<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOJmAcjqfqlk0Xj48OAwH1W-bg5811X5eGMqqXkz2N0AE6kbSKQn0fubHZfwSXqsaqGcb8Br4QmqzMIBSYC2g-ZxCCDlefM-qJ7efwufwEtJYDSyIqp9hnTbyaAP9tHbt-2CP3L9y_mKU/s1600/CloneButton2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgOJmAcjqfqlk0Xj48OAwH1W-bg5811X5eGMqqXkz2N0AE6kbSKQn0fubHZfwSXqsaqGcb8Br4QmqzMIBSYC2g-ZxCCDlefM-qJ7efwufwEtJYDSyIqp9hnTbyaAP9tHbt-2CP3L9y_mKU/s1600/CloneButton2.png" /></a></div>
<br />
Press the clone button to download all the files from the repository<br />
<br />
It may take a few minutes depending on the size of the repository and your download speed but then you will be ready to start working on your project.<br />
<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-44768798788479151402014-08-26T08:30:00.000+01:002014-12-15T09:28:11.717+00:00Security Workround for SourceTree<a href="http://www.sourcetreeapp.com/" target="_blank">SourceTree is easy to download</a> and <a href="http://www.sourcetreeapp.com/faq/" target="_blank">easy to install</a> but getting the security working can be a bit tricky to start with. This is made worse, if like me, you are pressed for time and sometimes behind an SSL aware man-in-the-middle firewall.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiDXNFu2EAMCeTI_I8VlH00MWWV8LCbQHAoyXDlOUBizFZBLf_WBKsuZWQ1gtlirgcyux1bMmhyFJG2D-hlYwEyRhpXnRWBUZPnPeNGPJeN1AA3Ff26ngfyjijVrWXlXTEItaMB2l6Qlg/s1600/SSHError1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhiDXNFu2EAMCeTI_I8VlH00MWWV8LCbQHAoyXDlOUBizFZBLf_WBKsuZWQ1gtlirgcyux1bMmhyFJG2D-hlYwEyRhpXnRWBUZPnPeNGPJeN1AA3Ff26ngfyjijVrWXlXTEItaMB2l6Qlg/s1600/SSHError1.png" height="135" width="320" /></a></div>
<br />
<br />
I kept getting an SSL certificate error when trying to clone a repository. I am fairly sure this is due to not adding the SSH public key to the repository on the web site but at the time I was in too much of a hurry.<br />
<br />
As I was having trouble I did a quick bit of searching and found an option to 'Disable SSL certificate validation...'<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit8p19Zsn0IVfAUumRabxv0rrz_BOS1SHYBQ1Q6r_nOjfZ3kTf93cb9FjoKEcEqbIVsFCNhb-nHPQMvvo0CMIM-GTdyHjOk6x5W9TmJuyt-p_zZmBXJyIh0YufSc-FigSb6ySwwNcA5v0/s1600/DisableSSLCertCheck2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEit8p19Zsn0IVfAUumRabxv0rrz_BOS1SHYBQ1Q6r_nOjfZ3kTf93cb9FjoKEcEqbIVsFCNhb-nHPQMvvo0CMIM-GTdyHjOk6x5W9TmJuyt-p_zZmBXJyIh0YufSc-FigSb6ySwwNcA5v0/s1600/DisableSSLCertCheck2.png" height="192" width="320" /></a></div>
<br />
<br />
That got rid of my errors and allowed me to get on and download my repository.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinMuB88XtlHGLspA6oac_HqpEsJ8udVDO6isRp1MU0eFnFCYVOJloAfMf7nRM9a6i4ntXCImpHjK8MkMYBBcLfsKBGU7QXzNQ6vGJd4qHjklgutP-25QoVdqs3N0tzzOocFCa1f0INpIQ/s1600/ThisIsAGitRepo1.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEinMuB88XtlHGLspA6oac_HqpEsJ8udVDO6isRp1MU0eFnFCYVOJloAfMf7nRM9a6i4ntXCImpHjK8MkMYBBcLfsKBGU7QXzNQ6vGJd4qHjklgutP-25QoVdqs3N0tzzOocFCa1f0INpIQ/s1600/ThisIsAGitRepo1.png" height="49" width="320" /></a></div>
<br />
For my open source and experimental projects the security is not critical but for more important projects I would suggest taking the time to configure SSH correctly.<br />
<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-9480300417922465922014-07-14T14:17:00.001+01:002014-07-14T14:17:47.796+01:00The Importance of NothingJust a quick tip for this article.<br />
<br />
I have a lot of layers in my <a href="http://unity3d.com/unity/animation" target="_blank">Unity Mecanim</a> Controller which I turn on and off as needed by setting the weight to one and then usually fade that back out to zero when no longer needed. The layers are typically for upper body only movements like reloading or throwing.<br />
<br />
I had struggled with unexpected jerky starts when the layer was enabled.<br />
<br />
I eventually realised that there is a mandatory default animation on each layer. In the layers where it was useful to transition from Any State, the behaviour of the controller is to immediately start the default state, which causes the jump and then start the transition from that incorrect state to the desired state.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZVmmfsIZrpj1zfb_IWcwN9VXamUz1pWn1UrB_Yw_CjpPqJWNmO1IlS_rFUKd_cjAMG-miCqzKkAMRHocPmTg33C1h6xM4ef0v2pbalVBthibYzv8mmRBYvhEpp23SZ_Kn_P-HW1IXhic/s1600/NullStateDefault2014-07-09a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgZVmmfsIZrpj1zfb_IWcwN9VXamUz1pWn1UrB_Yw_CjpPqJWNmO1IlS_rFUKd_cjAMG-miCqzKkAMRHocPmTg33C1h6xM4ef0v2pbalVBthibYzv8mmRBYvhEpp23SZ_Kn_P-HW1IXhic/s1600/NullStateDefault2014-07-09a.png" height="146" width="400" /></a></div>
<br />
<br />
Armed with that information I simply added a default state that does not have an animation. It does nothing and has no transitions but that fixed it.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-83390033201505427072014-06-25T19:00:00.000+01:002014-06-25T19:00:02.367+01:00Mecanim AnimationsI have been working on moving about the game and getting the animations in place for the actions I will need.<br />
<br />
The advantage of Unity is there are lots of pre-produced kits to use. Some free but most have a small amount to pay. I have been working on the in-game movement. I have tried lots of the free packages, used most of the <a href="https://www.assetstore.unity3d.com/en/#!/content/7673" target="_blank">tutorials</a> and purchased a lot of animations at modest prices.<br />
<br />
I have found that the <a href="http://unity3d.com/unity/animation" target="_blank">Unity Mecanim system</a> is very powerful. It has some great advantages, like being able to re-task animations from one model to another. Like any complex system, getting the best out of Mecanim is still time consuming.<br />
<br />
None of the assets I tried or purchased had a <a href="https://www.assetstore.unity3d.com/en/#!/content/10299" target="_blank">control system or set of animations</a> that completely suited how I wanted Diabolical to behave. I have therefore created the input controller and the Mecanim controller almost from scratch.<br />
<br />
I created myself a test environment using bits and pieces from the <a href="https://www.assetstore.unity3d.com/en/#!/content/10299" target="_blank">assets I purchased</a> and some of the tutorials. This made it easy to test changes.<br />
<br />
Some of the best <a href="https://www.assetstore.unity3d.com/en/#!/content/15098" target="_blank">animations I purchased </a>were designed for root motion as are most of the latest <a href="https://www.assetstore.unity3d.com/en/#!/category/97/page/1/sortby/popularity" target="_blank">Unity tech demos</a>. Root motion is where the animation moves the character within the world. This leads to a much better looking result. The trouble I found was that I could not get it to feel like a first person game. It felt like watching a third person. For example, instead of the animation moving as quickly as the player input round a corner, there was a nice looking smooth curve but not quite what the player controls were doing.<br />
<br />
Diabolical is an over the shoulder game, so although the view is third person the controls should feel like a first person game.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhurQzmdy4oFGNj8HgCSCNpTussKHVliYDDSMCGWlYt1vV_GGJwpfk9AKmppY_C6Oma8RgUY3yQOf5lv0aA7YD7r9f5A9Ap1P2G62eWtbYEGsEpX7RtSO2mtgt7j9-qeIjj1lzxaaCAhjU/s1600/ShoulderView2014-06b.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhurQzmdy4oFGNj8HgCSCNpTussKHVliYDDSMCGWlYt1vV_GGJwpfk9AKmppY_C6Oma8RgUY3yQOf5lv0aA7YD7r9f5A9Ap1P2G62eWtbYEGsEpX7RtSO2mtgt7j9-qeIjj1lzxaaCAhjU/s1600/ShoulderView2014-06b.jpg" height="246" width="400" /></a></div>
<br />
If I had more time or lots of people to work on it, I am sure root motion can be used to produce a good feeling and good looking first person solution, unfortunately I have neither the time nor the people, it's just me. I have opted for the more traditional route of the input directly moving the player entity and the animations doing a best approximation of the movement to get there.<br />
<br />
You end up with feet sliding and perhaps the odd lag in the animation but to me the movement feels better from a players perspective.<br />
<br />
It's taken a few weeks and I've had a few frustrating days in that time but I am now happy with the result.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgl0u6g7c7sAFr9XobmuZiRu8eKcRs9Gh-oJGOvNaabwaz5Baop_ybEmjQPyYD7KXok-rFWdbS9IJB_P-4fvGvYUa4H65iyvhXPSHjCVfIsQ_PHipjr2chOvpLw_fEt3V4fY4ln7cW2GY/s1600/MecanimTree2014-06c.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhgl0u6g7c7sAFr9XobmuZiRu8eKcRs9Gh-oJGOvNaabwaz5Baop_ybEmjQPyYD7KXok-rFWdbS9IJB_P-4fvGvYUa4H65iyvhXPSHjCVfIsQ_PHipjr2chOvpLw_fEt3V4fY4ln7cW2GY/s1600/MecanimTree2014-06c.jpg" height="260" width="400" /></a></div>
<br />
I have more and better animations than I had in the XNA version. In Unity I already have rifle and pistol aiming up and down, walking, running, jumping, shooting and reloading. I just need to add throwing grenades and I am done with this bit.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-12172827177672591342014-05-12T12:36:00.002+01:002014-05-14T07:43:58.993+01:00Blender to Mixamo to Blender to UnityAs with all 3D modelling one of the biggest problems is transferring models between applications and still retain all the details.<br />
<br />
The following is what works for me to get a mesh modeled in <a href="http://www.blender.org/" target="_blank">Blender </a>2.70a in to <a href="https://www.mixamo.com/" target="_blank">Mixamo </a>to create the rig and then back in to Blender and on in to <a href="http://unity3d.com/" target="_blank">Unity </a>4.3 still in a state to animate.<br />
<br />
You may not need to get your model back in to Blender but I need to add some simple animations not available from Mixamo yet.<br />
<br />
<b>Blender to Mixamo</b><br />
<br />
Export from Blender using the FBX exporter that ships with Blender 2.70a.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr0dL4wOJX_a7XzacMNcvNoGrsV2AjhwacyR_l93n_6nA8l0KYTia9YReNtFT9-uo0sypwH0UDgU2XMvfa2BL-UeZ2PJVb-bUw7CC8eQlswGspwEf0f9OQH-HK68UCXvHsJB8g7g19XME/s1600/ExportFBXToMixamo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjr0dL4wOJX_a7XzacMNcvNoGrsV2AjhwacyR_l93n_6nA8l0KYTia9YReNtFT9-uo0sypwH0UDgU2XMvfa2BL-UeZ2PJVb-bUw7CC8eQlswGspwEf0f9OQH-HK68UCXvHsJB8g7g19XME/s1600/ExportFBXToMixamo.jpg" height="400" width="181" /></a></div>
<br />
<br />
You only need the mesh but the settings matter little. Mixamo appears to sort out most things. I used the defaults of -Z Forward and +Y Up. I do change the Path Mode to 'Strip Path' so the FBX expects the texture file in the same folder as the FBX file.<br />
<br />
Compress the FBX file and the texture file in to a zip file and upload just that Zip file in to the Rig upload of Mixamo.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaS5ZLmwMQ7e8CLKR60O1iyusLnH_SZ6V-atR_haxGNW8_fmfFKv2HZpYyp3wQE7AuffC6iExK3wH682t25FXQu9cOyOicmyuAPwnErYlpaFxSsJifKwLLgQGwsfjJ-yrb0RCmWcxaFkI/s1600/UploadZipToMixamo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiaS5ZLmwMQ7e8CLKR60O1iyusLnH_SZ6V-atR_haxGNW8_fmfFKv2HZpYyp3wQE7AuffC6iExK3wH682t25FXQu9cOyOicmyuAPwnErYlpaFxSsJifKwLLgQGwsfjJ-yrb0RCmWcxaFkI/s1600/UploadZipToMixamo.jpg" height="35" width="400" /></a></div>
<br />
It took me several variations of file types before I worked out the above that worked. Even the zip file was a problem. For some reason a zip file created with 7zip did not work but a zip created with WinRar did.<br />
<br />
Once in Mixamo the Auto-Rigging worked very well. <b>Mixamo does a much better job of weight painting</b> than I can manage.<br />
<br />
The next trouble was exporting in a format that I could read back in to Blender.<br />
<br />
<b>Mixamo To Blender</b><br />
<br />
I found the standard Collada worked with Blender 2.70a, not the version for use with the older version of Blender.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVOUmdVfUgEK66SQyKvBuXiI-IgnJOr6Xc7kxykL8_oQcGSQb7P9CKd4J-MiLO_HAzXCIR20wWD0sdLM03i0XnKlKIu5NkpWApdGcS30nnRxswHFDqI8Q6SIZNhvvqVF6DJZDDWb6VSEM/s1600/ColladaDownloadMixamo.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVOUmdVfUgEK66SQyKvBuXiI-IgnJOr6Xc7kxykL8_oQcGSQb7P9CKd4J-MiLO_HAzXCIR20wWD0sdLM03i0XnKlKIu5NkpWApdGcS30nnRxswHFDqI8Q6SIZNhvvqVF6DJZDDWb6VSEM/s1600/ColladaDownloadMixamo.jpg" height="283" width="320" /></a></div>
<br />
<br />
I added the T-pose animation and downloaded it as a zipped Collada file.<br />
<br />
I then imported that in to Blender using the Collada (Default) importer shipped with version 2.70a of Blender.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhld33D-ssc-yfLKOW_cyDSSa9cqiDzyrsbjwKnpyFbj4yPD6ZBZrPye7QjP8NyypLoItJbe6xXSycUYXQ2_DBBA-tymrGZfpDDVE0NDOMEzHocTxHnJID2DREQFl1b5MbAKZK9psUYdyE/s1600/ColladaImport270a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhld33D-ssc-yfLKOW_cyDSSa9cqiDzyrsbjwKnpyFbj4yPD6ZBZrPye7QjP8NyypLoItJbe6xXSycUYXQ2_DBBA-tymrGZfpDDVE0NDOMEzHocTxHnJID2DREQFl1b5MbAKZK9psUYdyE/s1600/ColladaImport270a.png" height="180" width="400" /></a></div>
<br />
<br />
I never understand why most importers change the scale to 0.01. <br />
<br />
I simply change the scale for all three axes back to 1.0 and the model and the armature are as I expect.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtXrKgCkLTbo6wlZVBS_8rNSBmZ2d1G4PpFDMJtsLbz0C1fFM9h-bMwiR-G8b3swBQuVli63M6EVUO17dn78qVzoUOcL65jrn7bDwiOUNDtodbn7N-dRoC5F95BlRSeeg6yDylf3sNASE/s1600/InBlender.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgtXrKgCkLTbo6wlZVBS_8rNSBmZ2d1G4PpFDMJtsLbz0C1fFM9h-bMwiR-G8b3swBQuVli63M6EVUO17dn78qVzoUOcL65jrn7bDwiOUNDtodbn7N-dRoC5F95BlRSeeg6yDylf3sNASE/s1600/InBlender.jpg" height="190" width="400" /></a></div>
<br />
I downloaded a version with an Idle animation and that worked as well.<br />
<br />
<b>Blender to Unity</b><br />
<br />
Blender to Unity poses few problems. Export to FBX and drag in to Unity.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgas96kz4x6cTR1GgHvw9F03RmBKFUxrkhYF_TWikg_3BcbgZ6s9SJSfjXPU-i5CcE9uPb0SxZ_EqBJJZp_n0FV20UjNeihj1jZnk6hPiEaqhMmzFrHzK4JYUIvXWcBvE6sABAMR5GVJrM/s1600/ExportFBX_Yup.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgas96kz4x6cTR1GgHvw9F03RmBKFUxrkhYF_TWikg_3BcbgZ6s9SJSfjXPU-i5CcE9uPb0SxZ_EqBJJZp_n0FV20UjNeihj1jZnk6hPiEaqhMmzFrHzK4JYUIvXWcBvE6sABAMR5GVJrM/s1600/ExportFBX_Yup.jpg" height="400" width="180" /></a></div>
<br />
<br />
Again I use the standard settings in Blender, I only include the Armature and Mesh and change the Path Mode to 'Strip Path'.<br />
<br />
In Unity, drag the FBX file exported from Blender in to a folder in Unity.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSPqXMnELNfw0i1VwBEY62ENVVpnT0m8kg01kOMjE-7-RBS1qQ92hlShgNUhU2Xa3xGBB_qthroicQjr83BTilsgTS6j9HifilLy3yimNBvVqxU0MkRvgy63cQFq2iDfe_YfJ9xbNk-sU/s1600/UnityImportedFolder.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSPqXMnELNfw0i1VwBEY62ENVVpnT0m8kg01kOMjE-7-RBS1qQ92hlShgNUhU2Xa3xGBB_qthroicQjr83BTilsgTS6j9HifilLy3yimNBvVqxU0MkRvgy63cQFq2iDfe_YfJ9xbNk-sU/s1600/UnityImportedFolder.jpg" height="135" width="400" /></a></div>
<br />
The model imports face down but the armature and animation will make the model face the correct way up without having to rotate the imported mesh.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirehO7wVa-OSqKCREva6S2GIqPLgN7SDCy3EE9hMSm0TTcDhWOg97Pl2hVnYY4crTxGj6dnN6OlWMqY1WCzLO50tUt0mAuduXlJJiEMWPITHWsHYYMHvhhQbxXYwlLeh4YPQP9iYlD94o/s1600/FaceDown.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirehO7wVa-OSqKCREva6S2GIqPLgN7SDCy3EE9hMSm0TTcDhWOg97Pl2hVnYY4crTxGj6dnN6OlWMqY1WCzLO50tUt0mAuduXlJJiEMWPITHWsHYYMHvhhQbxXYwlLeh4YPQP9iYlD94o/s1600/FaceDown.jpg" height="330" width="400" /></a></div>
<br />
<br />
Like other importers Unity also imports at a scale of 0.01 so it needs to be changed to a scale of 1.0.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglvE0HtsBEACj36MwBLkhr5xXymnxAmcQGs8egIHBf6V6JG0Etk0z_FwmVvb2nDP80fBBusjIqI_a_6Gus5DLEbg2jetV7tkpTLNgT0mQEucd6LaEnMOZ3YkqAOY_MInPaO2xdoVrE9bk/s1600/ScaleModel1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglvE0HtsBEACj36MwBLkhr5xXymnxAmcQGs8egIHBf6V6JG0Etk0z_FwmVvb2nDP80fBBusjIqI_a_6Gus5DLEbg2jetV7tkpTLNgT0mQEucd6LaEnMOZ3YkqAOY_MInPaO2xdoVrE9bk/s1600/ScaleModel1.jpg" height="400" width="350" /></a></div>
<br />
<br />
If necessary drag the texture in and create a material using that then drag the material in to the mesh renderer for the model.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4PI-6keBA7Be7RRfFpT3Tsd7KZSXMl_lgJjPp8L_s2v5yz92TUjH4oHGfye7TTzhQsnneXl3PIBKz1wDdxXUpcD7BGHxWIzN3NKGllaxQDQwxRPzx0DlUHkfwef0PV9DIdDQWJIPKdHU/s1600/MeshRenderer.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4PI-6keBA7Be7RRfFpT3Tsd7KZSXMl_lgJjPp8L_s2v5yz92TUjH4oHGfye7TTzhQsnneXl3PIBKz1wDdxXUpcD7BGHxWIzN3NKGllaxQDQwxRPzx0DlUHkfwef0PV9DIdDQWJIPKdHU/s1600/MeshRenderer.jpg" height="320" width="400" /></a></div>
<br />
<b>Prepare to Animate</b><br />
<br />
To use any of the animations it will be necessary to configure the Avatar Rig in Unity.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAra4MQmwTp4zzi91Gtm9ggaYIeZYzxb5YLg5MWrxXJxWH2v3LQyONLu8QGCdlsPUUpidxdEzvE7xpY3Z7avUQzflnarrwKnjSSQk-4AlBS-aTRKSFpAs6iGXxbRcMBXizq5sbPU4VAW8/s1600/HumaniodRig.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjAra4MQmwTp4zzi91Gtm9ggaYIeZYzxb5YLg5MWrxXJxWH2v3LQyONLu8QGCdlsPUUpidxdEzvE7xpY3Z7avUQzflnarrwKnjSSQk-4AlBS-aTRKSFpAs6iGXxbRcMBXizq5sbPU4VAW8/s1600/HumaniodRig.jpg" height="170" width="400" /></a></div>
<br />
<br />
Select the model and press the Rig button.<br />
<br />
Change the animation type to Humanoid and press Apply.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhho_owJer-kgHW2ii8cmK8X_zV29ySYQOssBAx7hqHwscBc1K8-Cy9bq0Vfu9R7QNce9FyFGVBnxI80eHpk6WLCBCF-Ji2Mmidb3vGF8lAW5hjCB7UCpXnUdxfgRm02tRa95LHURb1kAY/s1600/AvatarHuman.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhho_owJer-kgHW2ii8cmK8X_zV29ySYQOssBAx7hqHwscBc1K8-Cy9bq0Vfu9R7QNce9FyFGVBnxI80eHpk6WLCBCF-Ji2Mmidb3vGF8lAW5hjCB7UCpXnUdxfgRm02tRa95LHURb1kAY/s1600/AvatarHuman.jpg" height="312" width="320" /></a></div>
<br />
<br />
The chances are it will work it all out itself but if necessary you can press the configure button.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnZ5FQLpuTaHviir-gQo9SV3vF5he3ZyQCJH67KZDhMnOXg2gQeMU1C0CA81AdwKj0betrO-OICYT_KNqxXnF6JMMR3xo0OZyzw3Znk7irWgYlg1h9vGtabbQS-q6qdbbERta7Nhu2RgY/s1600/InUnity.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnZ5FQLpuTaHviir-gQo9SV3vF5he3ZyQCJH67KZDhMnOXg2gQeMU1C0CA81AdwKj0betrO-OICYT_KNqxXnF6JMMR3xo0OZyzw3Znk7irWgYlg1h9vGtabbQS-q6qdbbERta7Nhu2RgY/s1600/InUnity.png" height="320" width="296" /></a></div>
<br />
<br />
At this point you should be able to use <a href="http://unity3d.com/unity/animation" target="_blank">Mecanim </a>animations on the imported model. Job done.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-16600577530559998312014-05-09T14:25:00.002+01:002014-05-14T07:51:54.602+01:00Head Texture UV UnwrapI've been working on the controller and animations and this has led me back to character creation.<br />
<br />
I have tried creating my own animations and although acceptable they are not as good as those I can purchase for a modest fee for use with the <a href="http://unity3d.com/unity/animation" target="_blank">Unity3D Mecanim </a>system.<br />
<br />
In the process of trying out the purchased and a few free bundled animations with my own models I have found some shortcomings with my skinning. To fix that I have tried <a href="https://www.mixamo.com/" target="_blank">Mixamo</a>. It did a fantastic job of adding a rig and skinning my character.<br />
<br />
The test animations also showed where my mesh needed improvement. Before I create a final skinned mesh using <a href="https://www.mixamo.com/" target="_blank">Mixamo</a> I decided I should fix the mesh and that led me eventually to recreating the UV map for the characters head.<br />
<br />
<b>Texturing a Head</b><br />
<br />
I have never textured a human head before so to remind me of the technique I used I decided to put it down in this blog.<br />
<br />
There are loads of tutorials out there for UV mapping and texturing but the two I found most useful are:<br />
For UV unwrapping: <a href="http://bgdm.katorlegaz.com/lscm_tute/lscm_tute.htm" target="_blank">http://bgdm.katorlegaz.com/lscm_tute/lscm_tute.htm</a><br />
For creating the texture for the head: <a href="http://www.3dm3.com/tutorials/maya/texturing/" target="_blank">http://www.3dm3.com/tutorials/maya/texturing/</a><br />
This one also has a fully body tutorial but was also helpful: <a href="http://cgi.tutsplus.com/articles/game-character-creation-series-kila-chapter-3-uv-mapping--cg-26754" target="_blank">http://cgi.tutsplus.com/articles/game-character-creation-series-kila-chapter-3-uv-mapping--cg-26754</a><br />
<br />
I am not going to go in to detail because those tutorials do that. I am just going to mention the bits I wanted answers to. The only thing to mention about the tutorials above is that the version of Blender mentioned is an older version. For me the standard Unwrap method created the head UV in one go without any adjustment needed.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFnzpTVH2Rlxpl-wUm8tK3wivpCC2DRh12bilWfC5MiJw97INf-PlJTwKFA5qm7_l5yqvi-H8CDZOYe06v3wVYeamzdWWwMHlqA_LeV1ktfnMtN-BDx9afh4UuuJB1XN-mZ1k4a0ZyJxU/s1600/UVHeadMap2014-05-10b.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFnzpTVH2Rlxpl-wUm8tK3wivpCC2DRh12bilWfC5MiJw97INf-PlJTwKFA5qm7_l5yqvi-H8CDZOYe06v3wVYeamzdWWwMHlqA_LeV1ktfnMtN-BDx9afh4UuuJB1XN-mZ1k4a0ZyJxU/s1600/UVHeadMap2014-05-10b.jpg" height="265" width="400" /></a></div>
<br />
<br />
<b>Where to create seams?</b><br />
I decided:<br />
- From just above the hairline back over the head to the back of the neck.<br />
- From under the chin down the centre of the neck at the front<br />
- Across the mouth<br />
- The eyes should be separate and therefore already a hollow cutout<br />
<br />
I tried a horizontal cut on the forehead but I found this made it difficult to add hair without a visible line.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigyO1hklsQLmWr7UWiZt86tg3DwOZCWK_Pw2SNg7j6Wd3VYqdJmlL60zmUHNrhGWvpCs6sznCQQGHX-7gAAI3VQwtNDnsk0eiqhJg84PWxQS20rpbuirdIWiP9aB_RtY5EJ-H7ROBBlW0/s1600/HeadCuts2014-05-10a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEigyO1hklsQLmWr7UWiZt86tg3DwOZCWK_Pw2SNg7j6Wd3VYqdJmlL60zmUHNrhGWvpCs6sznCQQGHX-7gAAI3VQwtNDnsk0eiqhJg84PWxQS20rpbuirdIWiP9aB_RtY5EJ-H7ROBBlW0/s1600/HeadCuts2014-05-10a.jpg" height="400" width="340" /></a></div>
<br />
<br />
<b>Do I separate the ears?</b><br />
I had seen some examples with the ears being removed and dealt with separately. I tried that and found the joint was visible. For me it works best if I keep the ears attached.<br />
<br />
<b>Can I use a downloaded head texture created for another model?</b><br />
No. I tried adjusting the UV to fit a texture and it did not work. It was stretched and all wrong in places. What worked for me was to create the texture to fit the UV map as generated by Blender. The generated UV has done the maths to minimise stretching.<br />
<br />
<b>Basic Technique</b><br />
<br />
Start by exporting the UV map from Blender. You won't get very far unless you know what you are trying to line the texture up with. The exported UV image gives you a semi-transparent texture with lines on to use as a layer in your photo editor.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_pjW8k4zFEq_cqdLZD8mPuczVQowGjgfoOfSwaMgZ-UuLt5ow46LH4yAz72SbHYiIaT52rcXxfQt5DkBdkYUqt9SsABXlj_Vrpf_xNK8coT_wv6E0I89fhedzbUb5G1awOE4Gas4ObbI/s1600/UVMapBlank2014-05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_pjW8k4zFEq_cqdLZD8mPuczVQowGjgfoOfSwaMgZ-UuLt5ow46LH4yAz72SbHYiIaT52rcXxfQt5DkBdkYUqt9SsABXlj_Vrpf_xNK8coT_wv6E0I89fhedzbUb5G1awOE4Gas4ObbI/s1600/UVMapBlank2014-05.jpg" height="385" width="400" /></a></div>
<br />
<br />
Creating the finished texture is also all about <b>layers</b>.<br />
<br />
I started with a background of skin colour. This was created using photo of a face. Using the clone tool in Gimp I extended the flesh in all directions until I had a rectangle of flesh. The important bit is that it retained tonal variation, so it still looked like skin.<br />
<br />
The result was still very rough with duplicated wrinkles and blemishes. I used various blurs and finished with a giant size smudge brush with an opacity of about 60% to end up with an even result.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXLQf7c4r-xdz6u4SHpQHgXpipiNeCCMfeXOrke_Ww0KcSRgM_AyTPIEaeFMTOlnXTDWc-ZoAUD60t-QWS7Vfz__NuDBa8P74lZ9C-tIN4_OScSIX7TPN5bqgzJD67IoGEAA0bBwN4sao/s1600/SkinToneGimp2014-05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgXLQf7c4r-xdz6u4SHpQHgXpipiNeCCMfeXOrke_Ww0KcSRgM_AyTPIEaeFMTOlnXTDWc-ZoAUD60t-QWS7Vfz__NuDBa8P74lZ9C-tIN4_OScSIX7TPN5bqgzJD67IoGEAA0bBwN4sao/s1600/SkinToneGimp2014-05.jpg" height="298" width="400" /></a></div>
<br />
That skin is the base layer over which everything else is added.<br />
<br />
The next layer I created was for the eyes and nose taken from a different photo of a face. I feathered the edge by using a large erase tool with a faded edge. It was deliberately a freehand rough cutout so the blend was more natural. I kept the eye brows as well.<br />
<br />
I repeatedly scaled the layer until the eyes lined up with the UV map. I then scaled vertically to get the nose the right length.<br />
<br />
I used small clone and smudge brushes with blurred edges to make the area round the eyes redder and remove any overlap of the eye in the photo with the UV map. I then filled in the eyes with the same colour and smoothed the result using the smudge brush.<br />
<br />
I smudged out the nostrils from the texture because my model has geometry to form those and it looks odd if the texture does not align with the geometry of the nostrils.<br />
<br />
I added a layer for the mouth and adjusted the scale to fit the UV map.<br />
<br />
The same with the layer for the ears.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-UEYZb64DdHRPqBUCWOpiHGyaN6en4DyYraoeWQmX1qo5q214JJYF8Ppc095zt1djvvwJ9-EWDvpSP7DZv-bfxeFT2CJNuAkOn8s-9A8xDiGJCC-ZihLXFD6i5piFEBdmhwzehNegIks/s1600/EyesNoseEarsLayerOnly2014-05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-UEYZb64DdHRPqBUCWOpiHGyaN6en4DyYraoeWQmX1qo5q214JJYF8Ppc095zt1djvvwJ9-EWDvpSP7DZv-bfxeFT2CJNuAkOn8s-9A8xDiGJCC-ZihLXFD6i5piFEBdmhwzehNegIks/s1600/EyesNoseEarsLayerOnly2014-05.jpg" height="272" width="400" /></a></div>
<br />
<br />
For all the added layers above the skin I set the opacity to 50% so they all blended nicely.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCYk-9L66XTzjJkGirLvv3FxzHKy1lSfYSsSB-WqIdKLjhu2aVrxeDwRs_uvx7mkoQV1Yn1jR-uFbTj1lneaVBw-XLtc6qLzICcw1YR7Be3-k-PP_DJr0DVh0RxQD6fPGb5xUrmhNZhLU/s1600/EyesNoseEars2014-05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjCYk-9L66XTzjJkGirLvv3FxzHKy1lSfYSsSB-WqIdKLjhu2aVrxeDwRs_uvx7mkoQV1Yn1jR-uFbTj1lneaVBw-XLtc6qLzICcw1YR7Be3-k-PP_DJr0DVh0RxQD6fPGb5xUrmhNZhLU/s1600/EyesNoseEars2014-05.jpg" height="257" width="400" /></a></div>
<br />
<br />
At this point I decided to try it on the model and I am pleased with the results.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1kCWYeaIeuzDytVMmHimQpLtSfYVGdkglAfDUgLa2jKroGJDeTdVAG0wGfEFO-vsx_vU8P1zesuAO6rlbTAt2VziMioFjdFjgEIR-LFgYb5k8u5O2dgfWpUriFgegW0E4-BNx00wGsFY/s1600/SkinnedHead2014-05,jpg.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh1kCWYeaIeuzDytVMmHimQpLtSfYVGdkglAfDUgLa2jKroGJDeTdVAG0wGfEFO-vsx_vU8P1zesuAO6rlbTAt2VziMioFjdFjgEIR-LFgYb5k8u5O2dgfWpUriFgegW0E4-BNx00wGsFY/s1600/SkinnedHead2014-05,jpg.JPG" height="395" width="400" /></a></div>
<br />
<br />
I added blemishes and the hair the same way using additional layers.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitleUNuDRvgDTELp-VvilUz3Bxh-kFQGPmHvY1lYHKtQjuWK4uO6PnVOCUrJ694cKyTV_geuyZ7oTa5tqbVFT10wAzfRT8j-YbY2kEHeQMUSP80dmemOvp8V_ayx6Lt1FRoTa-uxIOq28/s1600/WithHair2014-05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEitleUNuDRvgDTELp-VvilUz3Bxh-kFQGPmHvY1lYHKtQjuWK4uO6PnVOCUrJ694cKyTV_geuyZ7oTa5tqbVFT10wAzfRT8j-YbY2kEHeQMUSP80dmemOvp8V_ayx6Lt1FRoTa-uxIOq28/s1600/WithHair2014-05.jpg" height="311" width="400" /></a></div>
<br />
<br />
In my opinion hair looks best as a separate mesh made of strips so the hair in this texture is just a placeholder.<br />
<br />
Now that is done I can add the rig and skinning information using Mixamo.<br />
<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-18881839095196567642014-04-27T17:51:00.000+01:002014-04-27T18:28:40.925+01:00Avoid Photon OnDestroy WarningsI like my code to compile and run without errors. The <a href="https://www.exitgames.com/en/PUN" target="_blank">Photon Unity Networking (PUN)</a> code did not.<br />
<br />
When exiting scenes I would get the following errors for each instantiated object in the level:<br />
<code>
<br />
OnDestroy for PhotonView View (0)1001 on CharacterPlaceholder(Clone) but GO is still in instantiatedObjects. instantiationId: 1001. Use PhotonNetwork.Destroy().<br />
<br />
Failed to 'network-remove' GameObject because it's null.<br />
<br />
</code>
<br />
I searched the Internet and <a href="http://forum.exitgames.com/" target="_blank">Exit Games forums</a> but found little help that actually solved the problem. I found plenty of other people reporting the same issue.
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirQvEkgJ7mYbp08QA9HioqKF_1LJmdHZJE7mqvsC6QrI79tRfA9bLQyKOPFS4VcXd-Ldan2UNK8ftznQMt19UpF2R_ENjdIcsf3LZbpIRq8cMpKFsChsRUeJOBZKLdITLuwzbhv34bY2k/s1600/PhotonErrorMessages2014-04.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirQvEkgJ7mYbp08QA9HioqKF_1LJmdHZJE7mqvsC6QrI79tRfA9bLQyKOPFS4VcXd-Ldan2UNK8ftznQMt19UpF2R_ENjdIcsf3LZbpIRq8cMpKFsChsRUeJOBZKLdITLuwzbhv34bY2k/s1600/PhotonErrorMessages2014-04.jpg" height="246" width="400" /></a></div>
<br />
<br />
I tried reading the PUN documentation but that was unhelpful as were any of the samples that I tried so I experimented.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaYaO81FGoQ52gIGpoeVVzR4t5UE4QSswNt3KigkXiOmbk8czy79q0Lyz4uTq2o7Lmvy3JClLSUrG4vXG8fRowUIouNtTOlA20ABs5-t_bNi4WKUgm6ZsMSc1x3QeyPIYK0R5nrcXAcDU/s1600/MultiplayerExample2014-04b.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgaYaO81FGoQ52gIGpoeVVzR4t5UE4QSswNt3KigkXiOmbk8czy79q0Lyz4uTq2o7Lmvy3JClLSUrG4vXG8fRowUIouNtTOlA20ABs5-t_bNi4WKUgm6ZsMSc1x3QeyPIYK0R5nrcXAcDU/s1600/MultiplayerExample2014-04b.jpg" height="215" width="400" /></a></div>
<br />
<br />
I now have a work round which avoids the warnings and errors.<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqkQwYJgUqJgohcL5pNhc3fReu4J-0Y3SaH4d3QTIWnJoKE6N6LqrMVIm7LgVVohmT2LF1dgjN-IcKAvq7oO1MRYgAsm3qu85pmYH3ZYWjIOgGxWVrE5Fok4T2nritV8jS0WzaS35ffsAI/s320/codebg.gif") rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="-ms-word-wrap: normal; color: black;">
/// Tidies up before exit from the scene.
/// Attempts to destroy network objects correctly.
/// Pauses the messages while the scene changes.
private static void TidyUpBeforeExit()
{
// Destroy any photonView game objects.
PhotonView[] views =
GameObject.FindObjectsOfType<photonview>();
// Whichever client exits first cannot
// destroy the objects owned by
// another client.
foreach (PhotonView view in views)
{
GameObject obj = view.gameObject;
if (view.isMine)
{
// Clients can destroy their
// own instantiated objects
PhotonNetwork.Destroy (obj);
}
else
{
// Clients cannot destroy objects
// instantiated by other clients.
// This avoids the error by
// removing the instantiated
// object before the network view
// is destroyed
if (PhotonNetwork.
networkingPeer.
instantiatedObjects.
ContainsKey(view.instantiationId))
{
PhotonNetwork.
networkingPeer.
instantiatedObjects.
Remove (view.instantiationId);
}
}
}
// By pausing and starting the
// messages manually I can start
// any client or server in any
// order and all spawn messages
// are retained.
PhotonNetwork.SetSendingEnabled(0, false);
PhotonNetwork.isMessageQueueRunning = false;
}
</code></pre>
<br />
<br />
I simply include that method before any scene change.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com1tag:blogger.com,1999:blog-1185326540821386800.post-79175616179610488592014-04-24T13:50:00.000+01:002014-04-24T13:52:23.832+01:00Manual vs AutomationI spent several hours trying to use what I was expecting to be better methods to control spawning character when the level changes in a network game. I'm using the <a href="https://www.exitgames.com/en/PUN" target="_blank">Photon Unity Networks</a> (PUN) methods.<br />
<br />
According to the following forum post the automated methods should handle pausing messages when the scene changes.<br />
<a href="http://forum.exitgames.com/viewtopic.php?f=17&t=2575" target="_blank">http://forum.exitgames.com/viewtopic.php?f=17&t=2575</a><br />
<code>
<br />
PhotonNetwork.automaticallySyncScene = true<br />
PhotonNetwork.LoadLevel(...)<br />
<br />
</code>
<br />
As far as I can tell, they work but the trouble with automation is that it is only useful if the person designing the automation was thinking the same way as you are. In this case, <a href="https://www.exitgames.com/en/PUN" target="_blank">Exit Games</a> were not.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnKhsLXU1pjXc8q4EBrnMPGupH5v_i8I6Cg3Ub2HPOJvTeYVOzpHfGMWpjFPSdFi6YCFXdZvmZtvH5s1ZTdjIWzlhOYhhar6dSVLGg6uM967y34CnAo5t8nxnnZQi4yhKqfqNkYUsZCTo/s1600/LevelSelection2014-04.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjnKhsLXU1pjXc8q4EBrnMPGupH5v_i8I6Cg3Ub2HPOJvTeYVOzpHfGMWpjFPSdFi6YCFXdZvmZtvH5s1ZTdjIWzlhOYhhar6dSVLGg6uM967y34CnAo5t8nxnnZQi4yhKqfqNkYUsZCTo/s1600/LevelSelection2014-04.png" height="168" width="320" /></a></div>
<br />
I have a scene selection popup and a lobby scene before the level loads. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjiQTk20LRPESPXJKB4PWig39oPn0IqwQX5BV_58UlRXmJDlffcLJdvht66XPnvX-tA6hput_J7ObNJvw0jEES0NHnTyRyxCGLIwuN64RcK5uJByV6GRc3RmAiLalIrUgH5tFeUtgBARQ/s1600/LobbyScene2014-04.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjiQTk20LRPESPXJKB4PWig39oPn0IqwQX5BV_58UlRXmJDlffcLJdvht66XPnvX-tA6hput_J7ObNJvw0jEES0NHnTyRyxCGLIwuN64RcK5uJByV6GRc3RmAiLalIrUgH5tFeUtgBARQ/s1600/LobbyScene2014-04.png" height="191" width="400" /></a></div>
<br />
The server and the client can sit at that lobby and join the game when they are ready.<br />
<br />
By manually controlling the network message flow I can allow the server and the client to join in any order. If I use the automated methods the server must be in the game scene before any of the clients!<br />
<code>
<br />
PhotonNetwork.SetSendingEnabled(0, false);<br />
PhotonNetwork.isMessageQueueRunning = false;<br />
<br />
</code>
Obviously I prefer my method. I simple disable the messages before loading a level and start them again only when the scene has started and before the spawn message is sent.<br />
<br />
The only reason I tried to change to the automated methods was because I was trying to get rid of some annoying PhotonNetworks warning and error log messages whenever I exit a scene. <br />
<code>
<br />
OnDestroy for PhotonView View (0)1001 on CharacterPlaceholder(Clone) but GO is still in instantiatedObjects. instantiationId: 1001. Use PhotonNetwork.Destroy().<br />
<br />
Failed to 'network-remove' GameObject because it's null.<br />
<br />
</code>
<br />
The automated methods did not fix those either!<br />
<br />
Back to finding a fix for the errors!<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-36787588413507616382014-04-18T14:12:00.002+01:002014-04-27T18:14:58.976+01:00Unity GizmosI've been using Unity 3D for months now and I somehow missed Gizmos as a concept. I had seen the camera and speaker icons in the editor view but I think I had just assumed they were built in symbols used for built in objects and I had a blind spot towards them.<br />
<br />
I now know better. You can easily create your own icons which can be included in the scene. I started using them when I wanted to make spawn points visible in the scene. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqqiku6aiYHEFr8ta5d-qPR5ucdb8ahSxPrW0J_8HG6JAPz2EPbts7F8vQPLbwfC87nnxltcKQXf88J2nFfWXXaOmy2jwM1tMoXtGSKIErZYKozkNet6inKrFgG2Mv684IkC3DqRpaDvo/s1600/SampleSpawnPoint.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqqiku6aiYHEFr8ta5d-qPR5ucdb8ahSxPrW0J_8HG6JAPz2EPbts7F8vQPLbwfC87nnxltcKQXf88J2nFfWXXaOmy2jwM1tMoXtGSKIErZYKozkNet6inKrFgG2Mv684IkC3DqRpaDvo/s1600/SampleSpawnPoint.png" height="240" width="320" /></a></div>
<br />
<br />
It is very easy to attach your icon to any object in a scene and that icon displays over the object.<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqCgk3kP203IVYTpxuujbt0H5aTOsk7W8Ixtryy7-kYGhidUvXVd4yPdO66i1M57izhqr1WvFcwAwMFmga7aaByVNB3ZL5IMdSjCFEt-goHfvAjRW1-7JTkhn1day-6RSVO0g2QJj62AQ/s1600/SelectGizmoIcon.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqCgk3kP203IVYTpxuujbt0H5aTOsk7W8Ixtryy7-kYGhidUvXVd4yPdO66i1M57izhqr1WvFcwAwMFmga7aaByVNB3ZL5IMdSjCFEt-goHfvAjRW1-7JTkhn1day-6RSVO0g2QJj62AQ/s1600/SelectGizmoIcon.png" /></a></div>
<br />
<br />
That works well if you want to mark otherwise invisible points in your scene. An example of this might be waypoints for AI controlled characters.<br />
<br />
I prefer to create the Gizmos in code. This adds them to the Gizmos list in the game view.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHneHZdfY5pjsv9L6T8RxBR1oht2TCm-JxAUzpyz1yJC1aG9GgUl1MclcZPz3DZWdkTGA23xD59YA3_InK6pd16iPjmlGqQ8hRkq05S3Z3EmiUHgiwIUoRxy0V5RqAGJKX1ctmsvOr6CA/s1600/GizmoDropdown.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhHneHZdfY5pjsv9L6T8RxBR1oht2TCm-JxAUzpyz1yJC1aG9GgUl1MclcZPz3DZWdkTGA23xD59YA3_InK6pd16iPjmlGqQ8hRkq05S3Z3EmiUHgiwIUoRxy0V5RqAGJKX1ctmsvOr6CA/s1600/GizmoDropdown.png" height="320" width="245" /></a></div>
<br />
<br />
<b>Creating the Icon</b><br />
<br />
This can be done in any image editor and just needs whatever shape you want with a transparent background.<br />
<br />
The image can be any size if you intend to use the default automatic scaling method. For good quality I use anything between 512 and 1024 pixels high or wide images. If you don't use the automatic scaling the image in the 3D scene, at those sizes, is quite small.<br />
<br />
I used <a href="http://www.inkscape.org/" target="_blank">Inkscape</a> to create the following image.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL9sEo-Hyl9urmj_7vo0qBxzerVE7a9QR94-t-EL9WLt5uEsyVNx3lfffsT31Rlw797OOOyE-94yT9jVr_9_HTKlQ_eiIJjeUtbGoDLD08NWRFKW-tgmGxEJ-PTxWrabv4tJz_du0IjG8/s1600/PersonIcon.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhL9sEo-Hyl9urmj_7vo0qBxzerVE7a9QR94-t-EL9WLt5uEsyVNx3lfffsT31Rlw797OOOyE-94yT9jVr_9_HTKlQ_eiIJjeUtbGoDLD08NWRFKW-tgmGxEJ-PTxWrabv4tJz_du0IjG8/s1600/PersonIcon.png" height="320" width="153" /></a></div>
<br />
<br />
The important bit to know before you can use the image in your code is that it must be in the special Gizmos folder in Unity.<br />
<br />
There can only be one Gizmos folder and it must be in the root of the Assets folder.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKcF5WPydsJZF5gduzgqAU70pJaXlk1YDx-0qGSBOjDXIHpckbE5ToyrxsvDNt4tEdcTqi4r0N7G55ar5IXBprGuMbg7U5HXSHDHPF0CwJs0U9Wb4AoHPKMDuRBZe24S2bMsW7HGoVlRI/s1600/GizmosFolder.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhKcF5WPydsJZF5gduzgqAU70pJaXlk1YDx-0qGSBOjDXIHpckbE5ToyrxsvDNt4tEdcTqi4r0N7G55ar5IXBprGuMbg7U5HXSHDHPF0CwJs0U9Wb4AoHPKMDuRBZe24S2bMsW7HGoVlRI/s1600/GizmosFolder.png" /></a></div>
<br />
<br />
If you try to put your icon anywhere else, it will not work as a Gizmo in code.<br />
<br />
<b>Using the Icon for Your Object</b><br />
<br />
Well if you can write any Unity code this is the simplest possible. Just add the following in the <a href="http://docs.unity3d.com/Documentation/ScriptReference/Gizmos.html" target="_blank">code for your object</a> or create a small script with this in.<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqkQwYJgUqJgohcL5pNhc3fReu4J-0Y3SaH4d3QTIWnJoKE6N6LqrMVIm7LgVVohmT2LF1dgjN-IcKAvq7oO1MRYgAsm3qu85pmYH3ZYWjIOgGxWVrE5Fok4T2nritV8jS0WzaS35ffsAI/s320/codebg.gif") rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="-ms-word-wrap: normal; color: black;">
/// http://docs.unity3d.com/
/// Documentation/ScriptReference/Gizmos.html
void OnDrawGizmos()
{
// The icon image must be in the
// special folder called 'Gizmos'
// There can only be one Gizmos
// folder in the root of Assets.
Gizmos.DrawIcon (transform.position,
"PersonIcon.png",
true);
}
</code></pre>
<br />
<br />
That's it, you now have a Gizmo shown wherever you position that object.<br />
<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-30637147214159518032014-03-29T20:42:00.000+00:002014-03-29T20:42:17.383+00:00Unity Inspector Tool Tips and moreWhen I started working with Unity 3D I looked up adding tool tips to properties in the inspector. All the results of the searches came with a lot of code and no downloadable simple examples.<br />
<br />
I did not spend much time on the subject because I was looking for a quick answer. I was also probably using the wrong search criterion.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZw2_Fm35BmHJsMynKoHVTI7f6TilSDLhkIKm2lO4YxGGZHq0zUVOq4lO5VeY6RFba7OwJnRBl1MKGVmbs6lMVx1P2mjyRoUzW4XzW9MnLUsHW-SaHv3K7wKHhx66AgMkwOtz_i8LciGs/s1600/ToolTip001a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZw2_Fm35BmHJsMynKoHVTI7f6TilSDLhkIKm2lO4YxGGZHq0zUVOq4lO5VeY6RFba7OwJnRBl1MKGVmbs6lMVx1P2mjyRoUzW4XzW9MnLUsHW-SaHv3K7wKHhx66AgMkwOtz_i8LciGs/s1600/ToolTip001a.png" height="100" width="400" /></a></div>
<br />
<br />
Further along I had a more important requirement that I thought was worth coding because it would save me making mistakes when setting up scenes. As a consequence, I have leaned enough, very quickly, to create a simple but effective tool tip option for the properties, visible in the inspector.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4A15hxq2nRK1H3F_dIPAYhjnGtv2porcUFkvjXxaIndRHLhda5tFPAVEg3ArNx43z-H4rBqzBzlENAvjmAmrzz_jMfKUwAt0FhA-QMcMUfcnvfnsprVcENjigstZ1snt8ARVQwXdXOLw/s1600/TipCode002a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj4A15hxq2nRK1H3F_dIPAYhjnGtv2porcUFkvjXxaIndRHLhda5tFPAVEg3ArNx43z-H4rBqzBzlENAvjmAmrzz_jMfKUwAt0FhA-QMcMUfcnvfnsprVcENjigstZ1snt8ARVQwXdXOLw/s1600/TipCode002a.jpg" height="100" width="400" /></a></div>
<br />
<br />
I don't know if it is because I am using the latest version 4.3 of Unity but my solution does not need much code. Many of the samples I looked at had huge switch or if statement blocks to allow for different property types. I was able to use a built in method that replicated the default behaviour and allowed me to add the tool tip.<br />
<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqkQwYJgUqJgohcL5pNhc3fReu4J-0Y3SaH4d3QTIWnJoKE6N6LqrMVIm7LgVVohmT2LF1dgjN-IcKAvq7oO1MRYgAsm3qu85pmYH3ZYWjIOgGxWVrE5Fok4T2nritV8jS0WzaS35ffsAI/s320/codebg.gif") rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="-ms-word-wrap: normal; color: black;">
public class ToolTip : PropertyAttribute
{
public string TipText = "";
/// Display text when the mouse is over the label.
public ToolTip(string message)
{
TipText = message;
}
}
</code></pre>
<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqkQwYJgUqJgohcL5pNhc3fReu4J-0Y3SaH4d3QTIWnJoKE6N6LqrMVIm7LgVVohmT2LF1dgjN-IcKAvq7oO1MRYgAsm3qu85pmYH3ZYWjIOgGxWVrE5Fok4T2nritV8jS0WzaS35ffsAI/s320/codebg.gif") rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="-ms-word-wrap: normal; color: black;">
using UnityEditor;
using UnityEngine;
using System;
/// Display a tool tip when the mouse is over the label.
[CustomPropertyDrawer(typeof(ToolTip))]
public class ToolTipDrawer : PropertyDrawer
{
private ToolTip source { get { return ((ToolTip)attribute); } }
/// The height returned here must be appropriate for the property
/// being dawn.
public override float GetPropertyHeight (SerializedProperty property,
GUIContent label)
{
return GetOriginalHeight (property, label);
}
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
// Must reset the tip otherwise all labels get the same tooltip displayed!
string previousTip = label.tooltip;
if (!string.IsNullOrEmpty (source.TipText))
{
label.tooltip = source.TipText;
}
// Display the default fields for this property
EditorGUI.PropertyField (position, property, label, true);
// Must reset the tip otherwise all labels get the same tooltip displayed!
label.tooltip = previousTip;
}
/// Returns the height of the default control.
///
/// This can be reused by other property drawers.
public static float GetOriginalHeight (SerializedProperty prop,
GUIContent label)
{
const float spacing = 3f;
float baseSize = EditorStyles.label.lineHeight;
// Most types only use one line so they work with the base but a few are
// multiline and need more work.
float extraLines = 0f;
if (prop.propertyType == SerializedPropertyType.Bounds)
{
extraLines = EditorStyles.label.lineHeight * 2.2f;
baseSize = baseSize + extraLines + spacing;
}
else if (prop.propertyType == SerializedPropertyType.Rect)
{
extraLines = EditorStyles.label.lineHeight * 1f;
baseSize = baseSize + extraLines + spacing;
}
return baseSize + spacing;
}
}
</code></pre>
<br />
<br />
That's it, not much code.<br />
<br />
If you don't want to copy and paste, I've included the tool tip code and the code for other property attributes in to a GitHub project called <a href="https://github.com/ThatJCB/Unity3DUtilityKit" target="_blank">Unity3D Utility Kit</a>.<br />
<br />
Download the Utility Kit from:<br />
<a href="https://github.com/ThatJCB/Unity3DUtilityKit">https://github.com/ThatJCB/Unity3DUtilityKit</a><br />
<br />
The kit includes a test scene to show the usage of the attributes and to prove that they work.<br />
<br />
At the moment the property attributes included are:<br />
- A box to display a helpful message, which was my first idea before I got tool tips working.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiImHrWDeG7QhE0G8xNrN6sRvLVNunzHuboBmJvhZSlazU_fDXp10ZHxJKaAfpcL6S40AJcHQqVUutdWwRjyNmZwi5AMNyRuCS7VW3udVcG5SWhH9XKFeKo9OOF7ufm4HXxu4SdY8WB3hU/s1600/BoundsBox003a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiImHrWDeG7QhE0G8xNrN6sRvLVNunzHuboBmJvhZSlazU_fDXp10ZHxJKaAfpcL6S40AJcHQqVUutdWwRjyNmZwi5AMNyRuCS7VW3udVcG5SWhH9XKFeKo9OOF7ufm4HXxu4SdY8WB3hU/s1600/BoundsBox003a.jpg" height="86" width="400" /></a></div>
<br />
<br />
- The tool tip which displays when the mouse hovers over the label.<br />
- A <a href="http://blogs.unity3d.com/2012/09/07/property-drawers-in-unity-4/" target="_blank">Regular Expression mask for fields</a>, created by <a href="http://blogs.unity3d.com/author/lassej/" rel="author" title="Posts by Lasse Järvensivu">Lasse Järvensivu</a> , many thanks.<br />
- An integer slider that also works with float values to keep whole numbers.<br />
- A divider with an optional heading.<br />
- Scene selection list so you can only enter a scene name that has been included in the build list.<br />
There's some work in progress in there as well and I'll probably add more to the list over time.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijPkFLhHOp6aw2cIyZr9tuuQe75h2cItXdB6f1w9OuxT3pZvri8vswdPerTRCCTCY73ZPMJ_wtKPxJOgVcau78G3deMcxc7KwQhFo4XO0Ew6JF-PN5pAy77xn5JoYXi3sYZ_dDxu33U-A/s1600/SceneNameList004a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEijPkFLhHOp6aw2cIyZr9tuuQe75h2cItXdB6f1w9OuxT3pZvri8vswdPerTRCCTCY73ZPMJ_wtKPxJOgVcau78G3deMcxc7KwQhFo4XO0Ew6JF-PN5pAy77xn5JoYXi3sYZ_dDxu33U-A/s1600/SceneNameList004a.png" /></a></div>
<br />
<br />
That last item, for scene selection, was the reason I started looking at the Property Attributes and Drawers in the first place.<br />
<br />
I hope the examples will be useful to others.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com2tag:blogger.com,1999:blog-1185326540821386800.post-70528802510788552432014-03-29T18:55:00.000+00:002014-12-15T09:31:14.566+00:00Git Broke My Unity ProjectI've been using Subversion (SVN) for source control for a few years but finally decided I needed to give Git a try.<br />
<br />
For my purposes, working on my own, Subversion has served me very well. I only decided to move because when I went to add an open source project to <a href="https://www.codeplex.com/" target="_blank">Codeplex</a> it made it quite clear at every stage that SVN was not recommended and I got the feeling it was being depreciated out of existence.<br />
<br />
It took me a while to get my head round Git and despite what the web sites claimed, I did not think that there are more choices of good Git clients than there are SVN clients. That's just my opinion.<br />
<br />
The Git tutorials emphasized it's de-centralised design, which for my purposes has little benefit. I want a central master repository that holds the one version of the truth... that's a discussion for another day.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvJPFGDG9j0SUGAkS9TSCo6yHM35a9nFoC9yKEou7u-T9VIXvGPM4SL5uNJo6ZSae1_m0ok0pMdyiGCTTIKkzn8D4YZHzcfn9xmxR4Bn6ToR-4B7x3u-jYSMUzAR9-yVyud8LHU0vIQjo/s1600/PushPull.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjvJPFGDG9j0SUGAkS9TSCo6yHM35a9nFoC9yKEou7u-T9VIXvGPM4SL5uNJo6ZSae1_m0ok0pMdyiGCTTIKkzn8D4YZHzcfn9xmxR4Bn6ToR-4B7x3u-jYSMUzAR9-yVyud8LHU0vIQjo/s1600/PushPull.jpg" /></a></div>
<br />
<br />
The one command that the Git tutorials were fairly quiet about was the most important for me. Push. After all the Add and Commit stuff is out of the way, Push uploads it to a server. There is also the reverse Pull that I will need.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWdPZDG8nbIMUr-Htfn1Y0uD973h0QM9QmZzI_uBvx74lI56idTFFCEObf-etg-SyxcnwZqsahbuBrfwVJx5_QGWZNGeRII-z01Hx47MlfOkZrLQY0j48z1InAT2pnPahheVS5qCDgDYc/s1600/EasyAdd2014-03a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgWdPZDG8nbIMUr-Htfn1Y0uD973h0QM9QmZzI_uBvx74lI56idTFFCEObf-etg-SyxcnwZqsahbuBrfwVJx5_QGWZNGeRII-z01Hx47MlfOkZrLQY0j48z1InAT2pnPahheVS5qCDgDYc/s1600/EasyAdd2014-03a.jpg" height="137" width="320" /></a></div>
<br />
<br />
After having tried a few, the client I settled on was <a href="http://www.sourcetreeapp.com/" target="_blank">SourceTree</a>. It's written by the people who provide the <a href="http://bitbucket.org/" target="_blank">BitBucket</a> repository. After I had used it a few times with <a href="https://github.com/" target="_blank">GitHub</a> I got to like it. It has some handy options that make it easy for me to select the files, add them quickly and then commit and push in one easy action.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL891J77S6B5dNG79BJDB2tHeXmyHSqbhrGubSW-g0d0LUbh5RvSrXsbPcAA1oP93SDI1xIssTOQuPb9lzj2atDlzaBzjd_6KMQ6RXZZD_iHo1OHBIkQ6_W_rbnlJ0HECUJ2BfIB_7XRg/s1600/PushCommits2014-03a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL891J77S6B5dNG79BJDB2tHeXmyHSqbhrGubSW-g0d0LUbh5RvSrXsbPcAA1oP93SDI1xIssTOQuPb9lzj2atDlzaBzjd_6KMQ6RXZZD_iHo1OHBIkQ6_W_rbnlJ0HECUJ2BfIB_7XRg/s1600/PushCommits2014-03a.jpg" height="35" width="400" /></a></div>
<br />
It was fairly easy to install but could do with a better getting started guide instead of <a href="http://www.sourcetreeapp.com/faq/" target="_blank">some basic FAQ's</a>. I am not sure if it is necessary but I did need to read the instructions to create the SSH key:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7ZJS0eKJADIWiRBDlTvONeS0mWFY1U8whjHAmUUXHIxLQieHOBiGuRciEidRiJKQCDIv1wUrbPvsaDU2m28Ol7f1T_bp2xcUl6wVkUtcugRIAuClVS-aliuejDbLXfCOwj7YQams8hwA/s1600/SourceTreeFAQ-Setup+SSH+keys.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7ZJS0eKJADIWiRBDlTvONeS0mWFY1U8whjHAmUUXHIxLQieHOBiGuRciEidRiJKQCDIv1wUrbPvsaDU2m28Ol7f1T_bp2xcUl6wVkUtcugRIAuClVS-aliuejDbLXfCOwj7YQams8hwA/s1600/SourceTreeFAQ-Setup+SSH+keys.png" height="198" width="320" /></a></div>
<br />
I would rather not run two source control clients and I liked it enough that I have migrated my active projects.<br />
<br />
<b>Now for the one glitch.</b><br />
<br />
All was fine to start with but then <a href="http://monodevelop.com/" target="_blank">MonoDevelop</a> v4.0.1 lost the plot! This is the <a href="http://en.wikipedia.org/wiki/Integrated_development_environment" target="_blank">IDE</a> launched from within <a href="https://unity3d.com/" target="_blank">Unity</a> v4.3. It would no longer recognise changes I made to classes, so the auto-complete functions stopped working and many sections of my code became <span style="color: red;">coloured red</span>!<br />
<br />
The only change was that MonoDevelop had automatically recognised the Git source control and had started to use its Git Add-in.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMCODCXH45s847UBZfKtRsr_tXEU0CoQNO8jLxfDezoBNwizydT4XuoZ0B6J7twhbOU-6eoVKDGzHrbST7dXrUGBNDXY2Hk6x94j5yqK5pA2-r6TyqGILd2Oj4jVck9oeZTCKdBRNV1ps/s1600/VersionControlMenuAfter2014-03b.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMCODCXH45s847UBZfKtRsr_tXEU0CoQNO8jLxfDezoBNwizydT4XuoZ0B6J7twhbOU-6eoVKDGzHrbST7dXrUGBNDXY2Hk6x94j5yqK5pA2-r6TyqGILd2Oj4jVck9oeZTCKdBRNV1ps/s1600/VersionControlMenuAfter2014-03b.png" /></a></div>
<br />
<br />
It only took me a moment to decide that I needed to disable that. <br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkO61kZyKzYIAbNxaCFJO2ZyFD4AXklhrqJ1KBQL2oJNjcNJQgsrYQ9Xr-glGlPU90HPQFJA_11s_Vk-Ithm4KtUlvPkns6uqyqUhbu_3e-NHuQbJy6j5qtoIon948_Z6HQB_d0wemZ1w/s1600/AddinManager2014-03a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhkO61kZyKzYIAbNxaCFJO2ZyFD4AXklhrqJ1KBQL2oJNjcNJQgsrYQ9Xr-glGlPU90HPQFJA_11s_Vk-Ithm4KtUlvPkns6uqyqUhbu_3e-NHuQbJy6j5qtoIon948_Z6HQB_d0wemZ1w/s1600/AddinManager2014-03a.png" /></a></div>
<br />
<br />
Git add-in disabled, changes committed, Unity and Mono restarted and all was back to normal.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNj810kOxk2E0tzDaVdOIp3HU7WWWFUKDfu1nVC2iLpv6U6x8m1b5sUv3c-3PcnS4Xc7g3lKFxU2yrJZcrGevrEjOv3nOurmwJT43DcgiEEe7CF-nKabnZQEHJiYQOhNw4YTlus19P3ag/s1600/GitSupport2014-03a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiNj810kOxk2E0tzDaVdOIp3HU7WWWFUKDfu1nVC2iLpv6U6x8m1b5sUv3c-3PcnS4Xc7g3lKFxU2yrJZcrGevrEjOv3nOurmwJT43DcgiEEe7CF-nKabnZQEHJiYQOhNw4YTlus19P3ag/s1600/GitSupport2014-03a.png" height="150" width="400" /></a></div>
<br />
I am not a great fan of having everything built in to the IDE so it is no loss to me that I have had to disable the add-in. I didn't even notice it was there until it went wrong.<br />
<br />
Now I can get on and migrate more of my projects to Git repositories.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com2tag:blogger.com,1999:blog-1185326540821386800.post-60048112229421472752014-03-22T16:09:00.002+00:002014-03-22T16:58:31.465+00:00Networking with Photon for UnityI have not had as much time to spare for this project over the last month as I would have liked. My real work that pays the bills has been so busy I have only been able to tinker here and there but I am still making good progress. Tinkering in Unity produces results much quicker than it did in XNA.<br />
<br />
My decision to develop the menus first to learn how to use Unity has been a good choice. I have learnt a lot about the component model used by Unity and some of the best ways to do things.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhem1plkaXZdOI8d2N-Sgt0K384WkQZqQ7_aDUPCy7k_R-2EX_yNbnlJB9lOlGNh3IokVBU-KDBf1_7-DmwGO1N8l_Ovyn50YMdBi0ZNfniH1v-G54eRKDx2K7xRL2fn9Apn3d2BD0p8V4/s1600/SplitScreenSample2014-03a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhem1plkaXZdOI8d2N-Sgt0K384WkQZqQ7_aDUPCy7k_R-2EX_yNbnlJB9lOlGNh3IokVBU-KDBf1_7-DmwGO1N8l_Ovyn50YMdBi0ZNfniH1v-G54eRKDx2K7xRL2fn9Apn3d2BD0p8V4/s1600/SplitScreenSample2014-03a.png" height="210" width="400" /></a></div>
<br />
<br />
I have a menu system that works with the keyboard, mouse and gamepads and I have got as far as adding split screen including a test scene to show it in action. I have added the usual console style features, like popping up a message when a gampad disconnects and buttons to show which keys to press.<br />
<br />
I am itching to get on and build the levels and add characters to the game BUT from my experiences with XNA I want to sort out how network play will work before I start on the game scenes. I will eventually get to the main subject of this article which is about using the Photon Unity Networking service. First a bit about why I chose to use that.<br />
<br />
With XNA I made the mistake of developing movement that was difficult to translate in to something that works over a network.<br />
<br />
To avoid that I have been reading up on Unity networking. To cut a long story short the Unity network model is limiting. Not bad, it just has limits, which is exactly what I needed to know before going too far in the wrong direction.<br />
<br />
I won't go in to detail about how Unity networking is used because that was not the point of writing this article. <br />
<br />
All that I need to say is that having read lots of forums and tutorials most people have concluded that using a third party network provider has advantages over the built in Unity networking. Most commonly in threads people quote that Unity have not put much effort in to improving their networking for several years. The other area mentioned is that the Network Address Translation (NAT) punch through that end users can often have to struggle with on their home routers can be avoided with a cloud provider.<br />
<br />
I have therefore decided to use a third party network solution by <a href="https://www.exitgames.com/en/PUN" target="_blank">Exit Games called Photon</a>.<br />
<br />
There are several providers to select from but I liked Photon because it has a similar object model to the built in solution which helps when reading samples and tutorials and is also relatively easy to convert from one to the other. They have also put a lot of effort in to producing Unity samples.<br />
<br />
Another important consideration, for me, is that during development it is low cost. In fact free for 10 concurrent users, which is plenty for testing.<br />
<br />
Photon have good <a href="http://doc.exitgames.com/en/pun/current/getting-started/pun-overview" target="_blank">documentation</a> and is easy to sign up to at no cost.<br />
<br />
<a href="https://www.exitgames.com/" target="_blank">https://www.exitgames.com/</a><br />
<br />
I should point out that I have no connection with Exit Games or the Photon service.<br />
<br />
Adding Photon networking in to the game is as easy as importing the package. Making the game work as a network game still requires the same processes of adding network views to moving objects or using Remote Procedure Call (RPC) methods but Exit games have several <a href="http://doc.exitgames.com/en/pun/current/tutorials/tutorial-marco-polo" target="_blank">examples and tutorials</a>.<br />
<br />
I was up and running in no time and the add-in includes a Unity Editor menu for putting in the necessary details in to the demo project:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2WXTvsGphKza-GJ_ZCm6jOTFBkkDCe7UVrQCSgHG7KAr67xuWBAvqwSrugh3D5WmOx0_DFHFu1UCu6xUn8WtZsNiIa7SPNvcsIQzi4QE8qqdx5dS1NEqJBuSlm1J7-WNORQSp3mosf3s/s1600/WindowPhotonUnity2014-03a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2WXTvsGphKza-GJ_ZCm6jOTFBkkDCe7UVrQCSgHG7KAr67xuWBAvqwSrugh3D5WmOx0_DFHFu1UCu6xUn8WtZsNiIa7SPNvcsIQzi4QE8qqdx5dS1NEqJBuSlm1J7-WNORQSp3mosf3s/s1600/WindowPhotonUnity2014-03a.png" height="151" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
You just need your own AppID from the Photon web site:</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCBVd0qMrIsMYTJ18CIs4AeWPvE83milJRizUNLCDCeGfz0EhvJ8hyphenhyphengltZyzxImjoe6V0Hf2nZxwosgR74YSNAZeS-Fbw46K8uxWP4J9KYcujbrqHtcqwdypAe-63A-apcQroiN2G3KDI/s1600/PhotonCloudSettings2014-03a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCBVd0qMrIsMYTJ18CIs4AeWPvE83milJRizUNLCDCeGfz0EhvJ8hyphenhyphengltZyzxImjoe6V0Hf2nZxwosgR74YSNAZeS-Fbw46K8uxWP4J9KYcujbrqHtcqwdypAe-63A-apcQroiN2G3KDI/s1600/PhotonCloudSettings2014-03a.jpg" height="128" width="320" /></a></div>
<br />
<br />
Watch out for their web site though. It has a drop down to swap between the various services they provide. Look out for Photon Unity Networking (PUN).<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhthJbN8y_-hiygI6Kthxu06mh1s8Wv2RTzkKKzyo8WKQpzrvt4DYaD8sFpECZP94LWDrL0W_SoThJlwJcxdiMpIucTxiHkgv6J8J4-4VCrm_AwZkie8DEA1nqq9tp0sQPqHMJbJfK2Gsc/s1600/PhotonUnityNetworking2014-03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhthJbN8y_-hiygI6Kthxu06mh1s8Wv2RTzkKKzyo8WKQpzrvt4DYaD8sFpECZP94LWDrL0W_SoThJlwJcxdiMpIucTxiHkgv6J8J4-4VCrm_AwZkie8DEA1nqq9tp0sQPqHMJbJfK2Gsc/s1600/PhotonUnityNetworking2014-03.png" height="196" width="320" /></a></div>
<br />
<br />
You get different menus, different documentation and different account details if you have selected a different service.<br />
<br />
<span style="font-size: large;"><b>Testing</b></span><br />
<br />
Unity will only run one instance of the same project so I made two copies of the Photon Demo project, set one to run in the background...<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVb8Sx5f_jrPXtq238x6ATWDTl99cKXyfGukZVmyA8LX08ROra_mMX4EfsY-ITRH_jQWYAW9Itz8sVARK2rN3Juoh2svXwYTrW_gZYIn6N8bSSv0ORC2kM7k_Tr0q0Sk-9v_hHaIssU3k/s1600/EditProjectSettingsPlayer2014-03a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVb8Sx5f_jrPXtq238x6ATWDTl99cKXyfGukZVmyA8LX08ROra_mMX4EfsY-ITRH_jQWYAW9Itz8sVARK2rN3Juoh2svXwYTrW_gZYIn6N8bSSv0ORC2kM7k_Tr0q0Sk-9v_hHaIssU3k/s1600/EditProjectSettingsPlayer2014-03a.png" height="116" width="320" /></a></div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3ukNCK8cJdUco6yBys2DPfaL4LQ-F417-WNa07q1CUHTUJOgWdFn95U8p2K8usxy2Egp1nHZCbqv5HLLNReJXkiT5yznVbRgh-y-AZArjB6eCr0GXQqR54KwrsZaK0GMPKks5hYwFU8U/s1600/PlayerSettingsRunInBackground2014-03a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg3ukNCK8cJdUco6yBys2DPfaL4LQ-F417-WNa07q1CUHTUJOgWdFn95U8p2K8usxy2Egp1nHZCbqv5HLLNReJXkiT5yznVbRgh-y-AZArjB6eCr0GXQqR54KwrsZaK0GMPKks5hYwFU8U/s1600/PlayerSettingsRunInBackground2014-03a.jpg" /></a></div>
<br />
<br />
...left the other unchanged. Opened both in Unity and ran them both side by side:<br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Q7KavLSzj5nVoKy59gTjNMfskaqe9zkGSWmRSWOJo8dXKLt5lt_vzznRrv1t09wtd4u1vNw7WblvQWjAIfpb6zGvK6uKXppSq-dJw4QA2Vl7VqFt5UTflvhqCj3N2eZ5ki5N6gxzHfk/s1600/DemoBoxes2014-03a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh6Q7KavLSzj5nVoKy59gTjNMfskaqe9zkGSWmRSWOJo8dXKLt5lt_vzznRrv1t09wtd4u1vNw7WblvQWjAIfpb6zGvK6uKXppSq-dJw4QA2Vl7VqFt5UTflvhqCj3N2eZ5ki5N6gxzHfk/s1600/DemoBoxes2014-03a.png" height="151" width="400" /></a></div>
<br />
<br />
<br />
Photon has another advantage in that single player and multiplayer can share the same code. Photon can be set to offline mode and all the code just works without any changes. I have tried that out to confirm it and it does.<br />
<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqkQwYJgUqJgohcL5pNhc3fReu4J-0Y3SaH4d3QTIWnJoKE6N6LqrMVIm7LgVVohmT2LF1dgjN-IcKAvq7oO1MRYgAsm3qu85pmYH3ZYWjIOgGxWVrE5Fok4T2nritV8jS0WzaS35ffsAI/s320/codebg.gif") rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="-ms-word-wrap: normal; color: black;">
if (PhotonNetwork.offlineMode)
{
if (GUILayout.Button("Use Online Mode"))
{
PhotonNetwork.offlineMode = false;
}
}
else
{
if (GUILayout.Button("Use Offline Mode"))
{
PhotonNetwork.offlineMode = true;
}
}
</code></pre>
<br />
I added the above code in to the networked Photon Viking demo to try offline single player.<br />
<br />
The one missing bit that I would like, is local LAN play for <b>testing multiplayer</b> code while not connected to the Internet. This is not documented by Exit Games. They do offline single player or online multiplayer.<br />
<br />
There is a solution for <b>offline multiplayer</b> if you have a Windows PC. It requires installing the server locally. Photon provide the server executables so you can run your own server. I don't think it was intended for testing offline but it works.<br />
<br />
Photon provide <a href="http://doc.exitgames.com/en/onpremise/current/getting-started/photon-server-in-5min" target="_blank">good and quick documentation</a> to get the server installed on a Windows PC so I won't repeat that.<br />
<br />
I will just summarize it:<br />
<br />
<ul>
<li>Download the server package</li>
<li>Copy it all to a folder</li>
<li>Run 'Photon Control' from the appropriate folder for your machine.</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgROMXe5eQpx-HZyuUKeI31r_hwaBbAntaOgI55NOToR7eGSyhgAjxUy-PLDFdhtFpW0A9wc8y64bJyA5i1lCQO5Jx_66WDm058WgOXuB_6HsFgwF5SJTRWYjNurFBl_87P55HxWxG60m0/s1600/PhotonControl2014-03a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgROMXe5eQpx-HZyuUKeI31r_hwaBbAntaOgI55NOToR7eGSyhgAjxUy-PLDFdhtFpW0A9wc8y64bJyA5i1lCQO5Jx_66WDm058WgOXuB_6HsFgwF5SJTRWYjNurFBl_87P55HxWxG60m0/s1600/PhotonControl2014-03a.jpg" height="320" width="285" /></a></div>
<br />
<br />
When I tried it out I was connected to a network. I ran the 'Load Balancing (My Cloud)' option and set the IP address to Local. That was just two clicks from the sys tray menus.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxSoAW7nPY-1cRAZlgHNmEQ_XLKDYzrf-XNdvWw87DMPLDWf13I4m4xcEohZ3CGKjro1q5SR9ZLLhlai8xjGKyNJSaDJ11Nti8qqJAziHxVaDoppABwdyfHXI3lI7zp6luQezkNuhi8k0/s1600/LoadbalanceRunning2014-03-22a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjxSoAW7nPY-1cRAZlgHNmEQ_XLKDYzrf-XNdvWw87DMPLDWf13I4m4xcEohZ3CGKjro1q5SR9ZLLhlai8xjGKyNJSaDJ11Nti8qqJAziHxVaDoppABwdyfHXI3lI7zp6luQezkNuhi8k0/s1600/LoadbalanceRunning2014-03-22a.png" height="292" width="320" /></a></div>
<br />
I had to initially set the Windows Firewall options to enable network access but that was from an automated Windows popup. It all worked flawlessly.<br />
<br />
I could swap between local and cloud server by changing the settings from the Photon menu:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2WXTvsGphKza-GJ_ZCm6jOTFBkkDCe7UVrQCSgHG7KAr67xuWBAvqwSrugh3D5WmOx0_DFHFu1UCu6xUn8WtZsNiIa7SPNvcsIQzi4QE8qqdx5dS1NEqJBuSlm1J7-WNORQSp3mosf3s/s1600/WindowPhotonUnity2014-03a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2WXTvsGphKza-GJ_ZCm6jOTFBkkDCe7UVrQCSgHG7KAr67xuWBAvqwSrugh3D5WmOx0_DFHFu1UCu6xUn8WtZsNiIa7SPNvcsIQzi4QE8qqdx5dS1NEqJBuSlm1J7-WNORQSp3mosf3s/s1600/WindowPhotonUnity2014-03a.png" height="151" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy6j1UjXRbf9wAb9YG8D4vfQKxBa40oKwzpPdVrQmRmcxGUdFUX9-njzon-9bmGbR00dA-bsOM2dlD9TbxiS3p7vDlUA_TgW-hA227EcCIcMjNR-59cVuG796GwCw4jls_-nyInfE9Rjo/s1600/LocalServerSettings2014-03a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgy6j1UjXRbf9wAb9YG8D4vfQKxBa40oKwzpPdVrQmRmcxGUdFUX9-njzon-9bmGbR00dA-bsOM2dlD9TbxiS3p7vDlUA_TgW-hA227EcCIcMjNR-59cVuG796GwCw4jls_-nyInfE9Rjo/s1600/LocalServerSettings2014-03a.jpg" height="112" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
I used the same demo, side by side but this time it used the local server.<br />
<br />
<br />
<pre style="background: url("https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjqkQwYJgUqJgohcL5pNhc3fReu4J-0Y3SaH4d3QTIWnJoKE6N6LqrMVIm7LgVVohmT2LF1dgjN-IcKAvq7oO1MRYgAsm3qu85pmYH3ZYWjIOgGxWVrE5Fok4T2nritV8jS0WzaS35ffsAI/s320/codebg.gif") rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;"><code style="-ms-word-wrap: normal; color: black;">
if (!PhotonNetwork.connected)
{
if (GUILayout.Button("Use Local Cloud"))
{
PhotonNetwork.PhotonServerSettings.UseMyServer(
ServerSettings.DefaultServerAddress,
ServerSettings.DefaultMasterPort,
PhotonNetwork.PhotonServerSettings.AppID);
PhotonNetwork.ConnectUsingSettings("v1.0");
}
else if (GUILayout.Button("Use Internet Cloud"))
{
PhotonNetwork.PhotonServerSettings.UseCloud (
PhotonNetwork.PhotonServerSettings.AppID,
(int)CloudServerRegion.EU);
PhotonNetwork.ConnectUsingSettings("v1.0");
}
}
</code></pre>
<br />
I added the above code in to the networked Photon Viking demo to swap between local and cloud servers.<br />
<br />
<b>The above is all that most people will need.</b><br />
<br />
The following is only useful to a very small minority that want to test networking while totally disconnected, such as on a train or in an airplane.<br />
<br />
I hit one snag with the local server. When I had no network connection at all the server does not run. This happens to me every day when I am working on the train.<br />
<br />
As far as I can tell this is an oversight in the design. If all the network adapters on a Windows PC are disconnected then there is no IP address for the Photon server to bind to. <br />
<br />
There may be some Photon server settings to enable it to work but I got round this quickly by installing the Microsoft Loopback adapter. That is basically a dummy network interface that is always present. It is intended for testing networks but it does no harm and is included as standard with Windows installs, although not enabled.<br />
<br />
For Windows 8 it is <a href="http://support.microsoft.com/kb/2777200" target="_blank">installed from Device Manager</a>.<br />
<ul>
<li>Open Device Manager</li>
<li>Select the Network Adapters line</li>
<li>Action -> Add legacy hardware -> Network Adapters</li>
</ul>
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHHXMNm-i8-2jh7Ctd5-fSs_jp8zcpt6MkkG5oWOFb6kBAZNmbyqzUHkUagRUNayp1as4L4E-3MKySmWmYfRgSzefpM09Kxza87pFK4v51ZrHQrwzyjlp8NOhrFx7wuzXEHJsIHRRwP2Y/s1600/AddLegacy2014-03a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgHHXMNm-i8-2jh7Ctd5-fSs_jp8zcpt6MkkG5oWOFb6kBAZNmbyqzUHkUagRUNayp1as4L4E-3MKySmWmYfRgSzefpM09Kxza87pFK4v51ZrHQrwzyjlp8NOhrFx7wuzXEHJsIHRRwP2Y/s1600/AddLegacy2014-03a.png" height="320" width="265" /></a></div>
<br />
<br />
<br />
<ul>
<li>...Manually Select from a list (It takes a minute to display the list) then select...</li>
<li>Microsoft -> Microsoft KM-TEST Loopback Adapter</li>
</ul>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJJbo13aTk30QJtRIlT72vl5hfGrGJf9ipWt4_awutMv5h2HUDo5Dqob1J0CeHms7TmzWoeOUSawHsy6bPWhDbqwf0AXOZ7gVATL36cmA5Y_o37A6wngDjhsftHpJpg-UFin62gmK4qko/s1600/LoopbackAdapter2014-03.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhJJbo13aTk30QJtRIlT72vl5hfGrGJf9ipWt4_awutMv5h2HUDo5Dqob1J0CeHms7TmzWoeOUSawHsy6bPWhDbqwf0AXOZ7gVATL36cmA5Y_o37A6wngDjhsftHpJpg-UFin62gmK4qko/s1600/LoopbackAdapter2014-03.png" height="90" width="400" /></a></div>
<br />
<br />
<ul>
<li>Next, Next, Finish</li>
</ul>
<br />
<br />
That will add the extra adapter in to networking but I did not have to do anything with it.<br />
<br />
By default this is set to use DHCP but luckily it falls back to Microsoft's<br />
default IP address which is fine. Just the adapter's presence is enough.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA4lfhZGKI0i-eUckHGSMn0C38mZLniFPhNKlc1DB170iy73XLUvvl32-ng12JLUrS-b1kQ2phE2KQNbPoSJI4n4fW4d0_JtAg7fHWYSISb9Jqxb4Wskbeu0dRqFWVi30CPknLoB8b5VM/s1600/LocalIPAddress2014-03-22a.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjA4lfhZGKI0i-eUckHGSMn0C38mZLniFPhNKlc1DB170iy73XLUvvl32-ng12JLUrS-b1kQ2phE2KQNbPoSJI4n4fW4d0_JtAg7fHWYSISb9Jqxb4Wskbeu0dRqFWVi30CPknLoB8b5VM/s1600/LocalIPAddress2014-03-22a.png" height="288" width="320" /></a></div>
<br />
<br />
The Photon Server will now always have an IP to use locally. Remember that IP is only any good for testing and only really necessary when no other network connections are available.<br />
<br />
That last little bit may only be useful to a few but there is little if any documentation that I could find on using the server totally disconnected.<br />
<br />
I can now run the demos completely offline:<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSRI5MlBeIj0DzCHDPzufFjFyg3d3FCLVZ-vc5h0Quz4ki_asieCv9tDcitncDMzKDrxwI5v4IWyJ1Vq8C-XyoLa0qnPSogK19dDx2kiK07_Hg16yp8mTM5cpvQhWaug06-xwJxPIwcnA/s1600/DemoHub2014-03a.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSRI5MlBeIj0DzCHDPzufFjFyg3d3FCLVZ-vc5h0Quz4ki_asieCv9tDcitncDMzKDrxwI5v4IWyJ1Vq8C-XyoLa0qnPSogK19dDx2kiK07_Hg16yp8mTM5cpvQhWaug06-xwJxPIwcnA/s1600/DemoHub2014-03a.jpg" height="205" width="400" /></a></div>
<br />
<br />
I'm all setup to work on the connection and lobby scenes.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-63402129446992682412014-02-08T17:18:00.001+00:002014-12-12T10:23:17.932+00:00Unity ReflectionI'm still learning about Unity and how to code for it. Today I have found out that the OnGUI() method is deliberately called twice every frame.<br />
<br />
<a href="http://answers.unity3d.com/questions/551274/why-is-ongui-called-significantly-more-than-update.html">http://answers.unity3d.com/questions/551274/why-is-ongui-called-significantly-more-than-update.html</a><br />
<br />
For the most part this is not noticed but I was putting some home made mouse over methods within the OnGUI() method and getting double key press results.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTE12TiiAyEBX1Frq-M8z9YkBj8Da6QGyeaKc39OSo0oaD-vBlC0KYBOsbLhJv_bxWKnPjsMklulFrI6BgPgDMlrK3qT5PV38hNWOGwn7dmgQVjIRtqzSG1Rcg5Q1VdPIrWpgYaCTsFng/s1600/ControlsLayout2014-02-07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiTE12TiiAyEBX1Frq-M8z9YkBj8Da6QGyeaKc39OSo0oaD-vBlC0KYBOsbLhJv_bxWKnPjsMklulFrI6BgPgDMlrK3qT5PV38hNWOGwn7dmgQVjIRtqzSG1Rcg5Q1VdPIrWpgYaCTsFng/s1600/ControlsLayout2014-02-07.jpg" height="186" width="400" /></a></div>
<br />
<br />
That led me on to find out how Unity calls the MonoBehaviour methods, like Awake(), Start(), Update() and OnGUI(). Apparently Unity finds them using <strong>reflection</strong> rather than any form of interface or inheritance.<br />
<br />
That behaviour leads to an unexpected coding style compared to vanilla C# coding.<br />
<br />
You can define those methods any way you like. They can be public, private or protected and virtual or not. Unity will still behave as intended.<br />
<br />
It feels odd but just works.<br />
<br />
I'm getting the hang of creating components rather than joining everything together in one big mass of a project.<br />
<br />
I am surprised how much work is involved in getting a menu system with mouse, keyboard and gamepad input working but I am hopeful I will make up this time when it comes to creating the game levels.John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-73447237362095598942014-01-19T09:57:00.000+00:002014-01-25T16:07:51.227+00:00Absolute and Relative PositionsLaying out Unity menus using GUITexture and GUIText has been a bit confusing.<br />
<br />
I'm not entirely sure I understand it yet but the basics are that everything is relative to it's parent.<br />
I've been trying to calculate absolute pixel positions and this has been difficult. Rarely has anything ended up where it was intended.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAVIN6Z0hH9K0fnXxf1MF43rZXQtOvkXimk_5DnKOcByq4J1tlFoaCZZrac8mqtCUfaBncMidM9Tq9LZ5-Di7HydusqM4T8vgfI35yvdxYWY70pym7V7xsC51fWkVE7Dz6SVPmEbst1C8/s1600/ScreenLayoutProblem2014-01-19.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAVIN6Z0hH9K0fnXxf1MF43rZXQtOvkXimk_5DnKOcByq4J1tlFoaCZZrac8mqtCUfaBncMidM9Tq9LZ5-Di7HydusqM4T8vgfI35yvdxYWY70pym7V7xsC51fWkVE7Dz6SVPmEbst1C8/s1600/ScreenLayoutProblem2014-01-19.jpg" height="188" width="400" /></a></div>
<br />
<br />
It wasn't until I read the following post that it sunk in that Unity is trying to scale everything to fit the screen or viewport:<br />
<a href="http://answers.unity3d.com/questions/292620/scale-gui-texture-to-current-screen-size.html">http://answers.unity3d.com/questions/292620/scale-gui-texture-to-current-screen-size.html</a><br />
<br />
As far as I can tell Unity is designed to allow for any resolution on different screen sizes on different platforms. It scales to fit the screen automatically.<br />
<br />
If I am doing it manually and Unity is doing it automatically I end up with the wrong result.<br />
<br />
I haven't worked it all out myself yet but it might give others reading this a head start if they try to work with the Unity methods rather than bypass them!<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMCK7iiA-KXmFaUZGO5MT_hrJz6V14YMe5rZBzJUeMj_e4wnfALT1kqJxXJe-9M-vpOwYsLsnjXkWXAFPIvd66bGO99WeH6Qn0EQePSQPsQ4PmZM57dgHAoqfFCKaX-RhTOtkPHAVwzV8/s1600/CorrectLayout2014-01-25.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjMCK7iiA-KXmFaUZGO5MT_hrJz6V14YMe5rZBzJUeMj_e4wnfALT1kqJxXJe-9M-vpOwYsLsnjXkWXAFPIvd66bGO99WeH6Qn0EQePSQPsQ4PmZM57dgHAoqfFCKaX-RhTOtkPHAVwzV8/s1600/CorrectLayout2014-01-25.png" height="210" width="400" /></a></div>
<br />
<br />
==<br />
<br />
Follow-up: Since writing the above I have become more confused. If I try to save screen positions in the OnGUI() method to line up with the text or graphic positions on the screen and then process actions based on them in the Update() method I frequently find that the positions are no longer valid.<br />
<br />
My results are not consistent. At the moment if I want an input position to line up with text, like processing my own version of a mouse over event, my only reliable solution is to carry out all the processing in the OnGUI() method.<br />
<br />
Odd, perhaps someone can tell me why.John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-62442700004044986362014-01-07T08:53:00.001+00:002014-03-29T18:59:55.286+00:00MonoDevelop PreferencesI've grown to like MonoDevelop over the last few weeks.<br />
<br />
It has a few differences to Visual Studio, that I have been using for decades but so far nothing that makes me long to go back.<br />
<br />
Visual Studio (VS) feels like a more robust implimentation and I think is a little faster at picking up context sensitive colouring but that's it. MonoDevelop has hung a couple of times but never lost any of my work.<br />
<br />
I've always been happy to swap and change Integrated Development Environments (IDE), text editor and language so I am not the most critical about the cosmetics of my tools. I do however expect them to allow me to work without getting in the way.<br />
<br />
MonoDevelop allows me to get on with my work, provides some useful tools, like the refactor option which now I am used to it I prefer over the little drop down available in VS.<br />
<br />
So far I have only found two preferences that I have changed. One is simply the choice of colour coding style. The other is more important. By default MonoDevelop opens up the previous session when you start. Like I have done for Unity, this does not suit me as I swap between projects.<br />
<br />
There is a tick box to turn off this behaviour:<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAs-IUy2Ox6eDy4P-sIUQphLFx54PZuk9cyxOLXIs0mlY4X567CMm8jTE-NGIx7CauaBP_0e0VNEI0ASNYLnVpaVtMTca3H_75C_UraWFGKY2hI_ob764uQbwbszDTXYevS1oGnbafGBE/s1600/monoloadprevious.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAs-IUy2Ox6eDy4P-sIUQphLFx54PZuk9cyxOLXIs0mlY4X567CMm8jTE-NGIx7CauaBP_0e0VNEI0ASNYLnVpaVtMTca3H_75C_UraWFGKY2hI_ob764uQbwbszDTXYevS1oGnbafGBE/s1600/monoloadprevious.PNG" /></a></div>
It's in the Tools -> Options menu under Projects -> Load/Save.<br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-28285957064827294962013-12-21T12:23:00.001+00:002014-12-16T15:03:11.000+00:00Unity Input ManagerIt has not taken me long to come across one of the minor shortcomings of Unity, the InputManager.<br />
<br />
It is very simplistic and apparently it cannot be changed at runtime or at least not after the initial Unity provided options screen!<br />
<br />
<a href="http://docs.unity3d.com/Documentation/Manual/Input.html">http://docs.unity3d.com/Documentation/Manual/Input.html</a><br />
<br />
I think players of computer games should have some flexibility to customise their controls for a game and it should be easy to do even on the PC not just on Consoles. Not all games need this but first person shooters and similar, do, in my opinion.<br />
<br />
Yes, Unity provides some customisation but it is not very user friendly.<br />
<br />
I've started to write my own screens and am researching alternate input methods so that I can change this in my own, more user friendly, menus.<br />
<br />
This is a list of some of the information, samples and assets I have found:<br />
This is the sort of thing I want but I don't need everything: <a href="http://cinput2.weebly.com/index.html">http://cinput2.weebly.com/index.html</a><br />
The demo for CInput is useful for finding the Axes used by gamepads: <a href="http://cinput2.weebly.com/demo.html">http://cinput2.weebly.com/demo.html</a><br />
This free project supports Ouya and others at the level I need: <a href="https://github.com/pbhogan/InControl">https://github.com/pbhogan/InControl</a><br />
Edit 16 Dec 2014: A project with the same name is now on the Asset Store: <a href="https://www.assetstore.unity3d.com/en/#!/content/14695" target="_blank">https://www.assetstore.unity3d.com/en/#!/content/14695</a><br />
<br />John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0tag:blogger.com,1999:blog-1185326540821386800.post-32098086677441760272013-12-16T13:00:00.000+00:002014-03-23T13:34:37.457+00:00Unity Gotcha - What's in a name?I like my folder structure in any project to be tidy and understandable. <br />
<br />
Cosmetically I find it odd to have folders in folders with the same name. For example a Materials folder inside another folder called Materials.<br />
<br />
I tidied up my folders and used the name 'Resources' to put all my assets in, within that I have Materials, Textures etc. I thought it sounded like a good name to use.<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP_qTa3aNhq03mX2hxOaChPjq0yfmYOrDG8ydciS9FY3Z8rN9dcQLXPu_6GqQQQ2stbBNqCJxb7GQrO9ZK2KiJj3cXVuwpcH8MJ31xUOk-hiTJ0Eyfy-pPBoqYFGRwO_4PimAteHmYww8/s1600/ResourcesHasASpecialMeaning2013-12b.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjP_qTa3aNhq03mX2hxOaChPjq0yfmYOrDG8ydciS9FY3Z8rN9dcQLXPu_6GqQQQ2stbBNqCJxb7GQrO9ZK2KiJj3cXVuwpcH8MJ31xUOk-hiTJ0Eyfy-pPBoqYFGRwO_4PimAteHmYww8/s1600/ResourcesHasASpecialMeaning2013-12b.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<br />
Bad idea! Folders called <strong>'Resources'</strong> have a <a href="http://docs.unity3d.com/Documentation/ScriptReference/Resources.html" target="_blank">special meaning in Unity</a>!<br />
<br />
Anything in a <a href="http://docs.unity3d.com/Documentation/ScriptReference/Resources.html" target="_blank">folder with that name anywhere in the project folder tree</a> will <strong>get compiled</strong> in to the game build even if the assets within it are never used in the game!<br />
<br />
Everything in any other folder name only gets included in the build if it is used somewhere.<br />
<br />
Luckily I spotted this before I had gone too far and can move everything to a folder with another name, like 'Content'.<br />
<br />
Now I know that <a href="http://wiki.unity3d.com/index.php/Special_Folder_Names_in_your_Assets_Folder" target="_blank">some folders have special meanings</a>, I will be more carefull in the future.John C Brownhttp://www.blogger.com/profile/00595025767497289755noreply@blogger.com0