Error.Set sprite parameter


(Sergey Ryabchenko) #1

Help pls!

ArgumentException: failed to convert parameters
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoMethod.cs:192)
System.Reflection.MonoProperty.SetValue (System.Object obj, System.Object value, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] index, System.Globalization.CultureInfo culture) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/MonoProperty.cs:331)
System.Reflection.PropertyInfo.SetValue (System.Object obj, System.Object value, System.Object[] index) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.Reflection/PropertyInfo.cs:102)
plyCommon.plyReflectionUtil.SetMemberValue (System.Reflection.MemberInfo member, System.Object obj, System.Object value) (at D:/Work/u50/_SOURCE_/plyCommon/plyReflectionUtil.cs:181)
UnityEngine.Debug:LogException(Exception)
plyCommon.plyReflectionUtil:SetMemberValue(MemberInfo, Object, Object) (at D:/Work/u50/_SOURCE_/plyCommon/plyReflectionUtil.cs:184)
plyBloxKit.ObjectPropertyData:_SetChachedObjValue(Object) (at D:/Work/u50/_SOURCE_/plyBlox/Defs/BlockFieldDefs/ObjectPropertyData.cs:371)
plyBloxKit.ObjectPropertyData:SetValue(Object, Object, Boolean) (at D:/Work/u50/_SOURCE_/plyBlox/Defs/BlockFieldDefs/ObjectPropertyData.cs:260)
plyBloxKit.SetObjPropertyValue:Run(BlockReturn) (at D:/Work/u50/_SOURCE_/plyBlox/Blocks/Common/Object/SetObjPropertyValue.cs:50)
plyBloxKit.plyBlock:RunChildren() (at D:/Work/u50/_SOURCE_/plyBlox/plyBlock.cs:111)
plyBloxKit.IfCondition_plyBlock:Run(BlockReturn) (at D:/Work/u50/_SOURCE_/plyBlox/Blocks/Flow/Conditions/IfCondition_plyBlock.cs:28)
plyBloxKit.plyEvent:Run() (at D:/Work/u50/_SOURCE_/plyBlox/plyEvent.cs:78)
plyBloxKit.plyBlox:RunEvent(plyEvent) (at D:/Work/u50/_SOURCE_/plyBlox/plyBlox.cs:643)
plyBloxKit.plyBlox:Update() (at D:/Work/u50/_SOURCE_/plyBlox/plyBlox.cs:308)

(Leslie Young) #2

It should be Sprite, not Texture2D that you add in the last field of “set SpriteRenderer.sprite”.

If you made a texture into a sprite you will see an arrow next to the object (file) in Project panel. Open it and the sprite is inside; Drag and drop this. To set the texture to be a sprite you need to choose Sprite for texture type in the inspector.