UnityEngine.AndroidJNISafe.SetDoubleField C# (CSharp) Method

SetDoubleField() public static method

public static SetDoubleField ( IntPtr obj, IntPtr fieldID, double val ) : void
obj System.IntPtr
fieldID System.IntPtr
val double
return void
        public static void SetDoubleField(IntPtr obj, IntPtr fieldID, double val)
        {
            try
            {
                AndroidJNI.SetDoubleField(obj, fieldID, val);
            }
            finally
            {
                CheckException();
            }
        }

Usage Example

コード例 #1
0
        protected void _Set <FieldType>(string fieldName, FieldType val)
        {
            IntPtr fieldID = AndroidJNIHelper.GetFieldID <FieldType>(this.m_jclass, fieldName, false);

            if (AndroidReflection.IsPrimitive(typeof(FieldType)))
            {
                if (typeof(FieldType) == typeof(int))
                {
                    AndroidJNISafe.SetIntField(this.m_jobject, fieldID, (int)val);
                }
                else if (typeof(FieldType) == typeof(bool))
                {
                    AndroidJNISafe.SetBooleanField(this.m_jobject, fieldID, (bool)val);
                }
                else if (typeof(FieldType) == typeof(byte))
                {
                    AndroidJNISafe.SetByteField(this.m_jobject, fieldID, (byte)val);
                }
                else if (typeof(FieldType) == typeof(short))
                {
                    AndroidJNISafe.SetShortField(this.m_jobject, fieldID, (short)val);
                }
                else if (typeof(FieldType) == typeof(long))
                {
                    AndroidJNISafe.SetLongField(this.m_jobject, fieldID, (long)val);
                }
                else if (typeof(FieldType) == typeof(float))
                {
                    AndroidJNISafe.SetFloatField(this.m_jobject, fieldID, (float)val);
                }
                else if (typeof(FieldType) == typeof(double))
                {
                    AndroidJNISafe.SetDoubleField(this.m_jobject, fieldID, (double)val);
                }
                else if (typeof(FieldType) == typeof(char))
                {
                    AndroidJNISafe.SetCharField(this.m_jobject, fieldID, (char)val);
                }
            }
            else if (typeof(FieldType) == typeof(string))
            {
                AndroidJNISafe.SetStringField(this.m_jobject, fieldID, (string)val);
            }
            else if (typeof(FieldType) == typeof(AndroidJavaClass))
            {
                AndroidJNISafe.SetObjectField(this.m_jobject, fieldID, ((AndroidJavaClass)val).m_jclass);
            }
            else if (typeof(FieldType) == typeof(AndroidJavaObject))
            {
                AndroidJNISafe.SetObjectField(this.m_jobject, fieldID, ((AndroidJavaObject)val).m_jobject);
            }
            else
            {
                if (!AndroidReflection.IsAssignableFrom(typeof(Array), typeof(FieldType)))
                {
                    throw new Exception("JNI: Unknown field type '" + typeof(FieldType) + "'");
                }
                IntPtr ptr2 = AndroidJNIHelper.ConvertToJNIArray((Array)val);
                AndroidJNISafe.SetObjectField(this.m_jclass, fieldID, ptr2);
            }
        }
All Usage Examples Of UnityEngine.AndroidJNISafe::SetDoubleField
AndroidJNISafe