Category: MOBILE

MOBILE

UNITY IMAGE FILL AMOUNT FOR A HEALTH BAR

Today let’s talk about such property as fillAmount for Image objects in Unity3D.   There’s a pretty common case of UI in video games – a health bar. It often looks like a stripe filled with some color or gradient. The algorithm of a health bar is easy. All you need to have is: container – the object that […]

thaiphan 
MOBILE

REACT NATIVE JSX IF STATEMENT

This short article represents how to insert ‘If‘ statements into React Native JSX code. If-Then-Else statements are used in JSX code to display some parts depending on some conditions. Let’s imagine, you are displaying the list of records and if the list is empty, there should be the corresponding text. This is how you should implement it. […]

thaiphan 
MOBILE

FIXING REACT.CREATECLASS IS NOT A FUNCTION IN REACT NATIVE

React Native is still a fast-growing technology. That brings a good feeling of progress in the world of hybrid apps. But it also leads to new errors in your old working code. Among them: React.createClass is not a function in version 0.25.   COMMON CASE OF REACT.CREATECLASS IS NOT A FUNCTION The basic example of reproducing this error […]

thaiphan 
MOBILE

REACT NATIVE FLOATING BUTTON

In this lesson I will show you how to create a customizable floating button from material design using pure react code. First of all we need to use TouchableHighlight element to render an interactable element inside your current View tag. <View> <TouchableHighlight style={styles.addButton} underlayColor=’#ff7043′ onPress={()=>{console.log(‘pressed’)}}> <Text style={{fontSize: 50, color: ‘white’}}>+</Text> </TouchableHighlight> </View> In the code […]

thaiphan 
MOBILE

REACT-NATIVE TOUCHABLEHIGHLIGHT NOT WORKING

TouchableHighlight is a React-Native components that is used to respond to users touch.   The main problem of using this component is a difference between the API in some versions of React Native. There are some cases when TouchableHighlight elements are not really highlighted with no errors in the console. Here is a short guide […]

thaiphan 
MOBILE

UNITY – ROTATING A 2D SPRITE

Now let’s take a look on this example of writing a script for rotating a 2D sprite in Unity. This will be done in a simple line of code.   The solution is very simple. You should access a game object of this sprite and manipulate with its transform object: transform.Rotate(Vector3.forward * -90); RANDOM OBJECTS ROTATION If you want […]

thaiphan 
MOBILE

FIXING CS1503: ARGUMENT ‘#2’ CANNOT CONVERT ‘UNITYENGINE.FORCEMODE’ EXPRESSION TO TYPE ‘UNITYENGINE.FORCEMODE2D’

There is a common mistake for Unity3d newcomers when they are trying to implement jumping action in a 2D game. This error has code CS1503 and says that you cannot convert ‘UnityEngine.ForceMode’ expression to type ‘UnityEngine.ForceMode2D’. FIXING CS1503 CANNOT CONVERT ‘UNITYENGINE.FORCEMODE’ EXPRESSION TO TYPE ‘UNITYENGINE.FORCEMODE2D’ The fix is very simple. If you get this error it means that you’re […]

thaiphan 
MOBILE

UNITY STOP ANIMATION LOOPING

In this chapter you can learn a small step needed to prevent animation looping in Unity3d. It could be often used when you need to fire up just 1 animation loop. STOP LOOPS FOR UNITY3D ANIMATION To disable animation loop follow this simple steps: select animation in the Project tab open Inspector tab uncheck the checkbox “Loop […]

thaiphan 
MOBILE

UNITY EDITOR – SWITCH TO ANDROID PLATFORM

There’s a terrible situation in Unity when users get stuck while trying to switch to Android platform. Let’s look how to fix that. The problem: If you can’t set Android platform it means you did not install the Android Build Support package. One of the main reasons for that is the Unity update process. When the Unity Download Assistant runs […]

thaiphan