When Your Code Is On Fire

Disasters do happen when you are working on projects. I am reminded of a certain situation in which a junior programmer imported something into the core library and errors started popping up everywhere. Like “the whole house is on fire” situation. Now, I know about not touching production rules, backups, etc. There are systems put together in-place to stop this particular problem from happening. But this post is more of how to handle things when shit happens. This guide is mainly for Junior Programmers of Unity, but it may be of help for other software and languages as well.

Do Not Touch, Take A Break first

Hands off, stand up and go drink water. Take a break, take a deep breath, try to calm yourself as much as you can. When your code is on fire, you will be freaked out. But, trying to fix things when you are not having a rational mind is the worst thing that you can do to yourself, it will create more errors, which in turn might be harder to fix afterwards.

Accept The Situation

We screwed up, accept the situation. Things happen, we cannot change what has happen, but we can make up for our mistakes by fixing it. You might be getting an earful, but you need to make things better.

Analyzing the errors, and fixing it

You need to look at the errors that pops up. Here are some of the patterns you need to look at:

If the errors looks like it comes from the same method, variable or class reference:

This means, you have inadvertently overwritten a certain class or file. If the class/file belongs to you, you can fix this by finding out what changes have you made from the current version and the old version. But, given the fact that you are reading this guide I am assuming that its not you that developed that particular class/file. In that case, you would need to ask your co-worker that written the class to see if he has a backup. If he does not, he can still help you since he understands his code better than you. Just be sure to say sorry, thank you for the help, and buy them lunch or something.

If the errors looks like it comes from a particular library:

When this happens, chances are your library versions are mismatched, one of them is either older or newer. Find out what the old version number is. Download the old one, create a backup of the current code, replace the library with the old version. Sometimes, different versions of libraries have what we call breaking-changes. These are changes to the codes that makes our old implementation to no longer works. So, do not simply upgrade a library without glancing through the change notes.

If the errors looks like it comes from multiple libraries:

Sometimes this happens because you messed with or mismatched their dependencies. Chances are, there are libraries that uses the same dependency components from other libraries. Go through the codes that contains the errors and find out which dependency they share, and replace that dependency library with the correct version.

When all else fails

You tried fixing it, but it does not work, the errors does not make sense. Here is what you should do.

  1. Backup the code. I am literally asking you to have a backup of your error ridden project. Just in case you turned the fire into inferno, you can always go back to just fire.
  2. Isolate the parts that does not have errors, move them out of your burning project folder into another project folder. Save what you can from the burning wreckage. You do not have to start from scratch.
  3. Reimport the libraries, download from original/error free source.
  4. Bring one of the code files that have errors into your new project, see if it still burns in the new project. If it does, see what is wrong, and fix them first. Do not add more files until you fixed this one code file.
  5. Repeat step 4 until you have a working version again. It might take time, but this will allow you to focus on the problems one at a time.

Learning from disasters

Here are a few things that you can do to avoid such disasters:

  1. Backup!, Backup!, Backup! before doing any changes, especially to Production/Core.
  2. Do Not Touch Production or Core. Make a copy of it in your machine, and make changes in that instead. If it is okay, run it by your person in charge, he will move it to core safely.
  3. Always refer the person in charge before doing anything in Production / Core. They are the ones who are responsible for the whole codebase, do not bypass them, ever. They are the ones that will be either saving you from disaster or help you out of one.
  4. If you are not sure, ask and clarify.

From SkecthFab 3D Model to Unity + Vuforia

One of the complaints that I usually get from people that want to create contents but unable to do so is “I do not know how to create 3d models”.

Here is my proposed solution, you can use 3D Models from SketchFab for your Unity + Vuforia AR. In this video I have made, you will learn to import Animated SketchFab 3D models straight into Unity for use with your Vuforia AR. This tutorial will work with most models that has simple animations. If you want to import a model with multiple animations, you need a different method

Getting Yourself Started with Vuforia with Unity 2019 above (2020 updates)

So, why is this sudden post? Err well, if you install the latest versions of Unity, you will notice that setting up Vuforia will be a little bit different. We will need to use Unity’s Package Manager. So to update this new knowledge, here’s the new tutorial for how to get started with Vuforia. From now on, I will be trying to use Camtasia Studio this time to easily explain things. Leave your comments on how you like it, and how I can improve

Publishing Your Android App to Play Store – XZIMG Augmented Vision Tutorial 7 of 7

Final Roll-out

Click App releases

Under Production track, click Edit Release

Release to production window appears, scroll down and click Review

Confirm roll-out to production window appears. Click start roll-out to production

A confirmation window will appear, click Confirm

That’s it!, we are done! Click on your app menu, it will show that our app is now Pending Publication. Once it is approved, it will be on the Play Store

That is the end of our tutorial series on how to publish app to Play Store.

Thank you for following my tutorial everybody!

Publishing Your Android App to Play Store – XZIMG Augmented Vision Tutorial 6 of 7

Filling Up Store Listing Information

The Store Listing window appears. Firstly fill in your app’s short description and long description

Next, scroll down the page. Add the icon and screenshot

Scroll down a little more, and add the Feature Graphic

Scroll down a little more, under Categorisation, select your Application type and Category. The selection depends on whether you are building an AR App for education, games or etc. Select the apropriate settings for your app

Adding Tags to your app to make search easier

Click on Manage Tags

The Tags window will appear. Search for the appropriate tags suitable for your app. In this example, my AR is an Entertainment. Press Add to add tag

Confirmation window appears, press Add

Once you have added the relevant tag or tags, press the back arrow to go back to Store Listing

Scroll down all the way down to Contact details, fill in your email. On privacy policy, fill in the url to your privacy policy. Then, click Save Draft

We are done with this part. A green checkbox will appear beside Store Listing

A green checkbox will also appear beside App releases

In the next tutorial we will do our final push to the finish line

Publishing Your Android App to Play Store – XZIMG Augmented Vision Tutorial 5 of 7

Filling in App Content settings

Click on App Content

App Content window appears. Click Start

The first question is Target Age. Select your Target Age Group and click Next

The next question is whether the app could unintentionally appeal to children. you may select Yes or No. If Yes a ‘Not designed for children’ label may be shown next to your app on Google Play. In this example, I chose No.

Select your answer and click Next

A summary will appear, read it and if it is correct, click Submit

Success. Now a green checkmark appears beside App Content

Publishing Your Android App to Play Store – XZIMG Augmented Vision Tutorial 4 of 7

Setting the Pricing and Distribution

Click on Pricing and Distribution

Pricing and Distribution window appears. Firstly, select whether the application Free or Paid. In this example, for simplicity I will choose FREE

Under Countries, select the countries that you want the app to be available.

Scroll down further, there is a question on whether your app contain ads, in this example, I will select No

Under Consent, you need to agree to follow Content guidelines and US export laws. Then, click Save Draft

We are done with setting Pricing and Distribution a green checkmark will appear beside Pricing and Distribution

In the next tutorial, we will fill in our App Content section. See you in the next tutorial

Publishing Your Android App to Play Store – XZIMG Augmented Vision Tutorial 3 of 7

Setting the Content Rating

Click Content Rating

The content rating window appears, click Continue

The content rating Questionaire appears. Firstly, lets fill in our email address and confirm it.

Next we will select our app category. Based on your app type, you will have to answer different set of questionaire. In this example, I will click Reference but yours maybe different.

You will be asked a lot of Yes and No questions, answer all of them and press Save Questionnaire

If there are no errors, the Calculate Rating button will become blue. Click Calculate Rating

Yeay! we now have generated the Content Ratings. Click Apply Rating

Our ratings are now applied. You will see a green checkmark at Content Rating. Next, we will set Pricing and Distribution

See you in the next tutorial

Vuforia: Playing Sound when image detected and stop sound when image lost. The simplest way (2021 Updated)

Prerequisite

  1. A sound, you can find some free sounds from here http://soundbible.com/

Lets Start!

Drag and Drop the sound to your ImageTarget

Playing sound on Image Detected

While your ImageTarget is selected, on the Inspector window drag and drop AudioSource to the On Target Found() Object slot

Click the function selector and select AudioSource > Play()

Stopping sound on image lost

While your ImageTarget is selected, on the Inspector window drag and drop AudioSource to the On Target Lost() Object slot

Click the function selector and select AudioSource > Stop()

Final check

Default Trackable Event Handler should now look like this

Done, lets test it!

When image is detected, you sound will play and when image is lost, the sound will stop.

I have multiple Image Targets and sound to implement. How?

Its okay you now know all you need to know to do this. All you have to do is repeat these steps from “Let’s Start” to the end for each of your Image Target.

That’s all, happy creating