[toVariant calls 
newVariant](https://github.com/pragmagic/godot-nim/blob/master/godot/nim/godotnim.nim#L505-L509),
 whereas [the as proc doesn't perform any calls, just safe type 
conversions.](https://github.com/pragmagic/godot-nim/blob/master/godot/nim/godotnim.nim#L322-L338)
 You can allow as to call toVariant by overloading the as call like this:
    
    
    proc `as`(obj: NimGodotObject, t: typedesc[Variant]): Variant =
      obj.toVariant()
    
    # ...
    mat.setShaderParam("texture_map", texture as Variant)
    
    
    Run

Reply via email to