Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.SetFloat using a def'd int leads to invalid IL #344

Open
saikyun opened this issue Feb 9, 2019 · 2 comments
Open

.SetFloat using a def'd int leads to invalid IL #344

saikyun opened this issue Feb 9, 2019 · 2 comments

Comments

@saikyun
Copy link
Contributor

saikyun commented Feb 9, 2019

When running

(def saturation-id (Shader/PropertyToID "_Saturation"))
(.SetFloat mat saturation-id target)

where mat is a UnityEngine.Material, I get

InvalidProgramException: Invalid IL code in game$reactive$refresh_stamina_ui__20172:invokeStatic (object,object,object): IL_01cb: call      0x06fff620


game$reactive$refresh_stamina_ui__20172.invoke (System.Object , System.Object , System.Object ) (at <91f979e122e34249bc0a7928b0770bc1>:0)
game$reactive$cards_watcher_update__20209.invokeStatic (System.Object , System.Object ) (at <91f979e122e34249bc0a7928b0770bc1>:0)
game$reactive$cards_watcher_update__20209.invoke (System.Object , System.Object ) (at <91f979e122e34249bc0a7928b0770bc1>:0)
ArcadiaBehaviour.RunFunctions () (at Assets/Arcadia/Components/ArcadiaBehaviour.cs:499)
UpdateHook.Update () (at Assets/Arcadia/Components/UpdateHook.cs:9)

If I put 565 (the value of saturation-id) directly into the call of .SetFloat I don't get the error.

@nasser
Copy link
Contributor

nasser commented Feb 15, 2019

I can't seem to reproduce. Can you provide a more complete self-contained failing case? The following seems to work for me

(use 'arcadia.core)
(import [UnityEngine Shader Material MeshRenderer])

(def cube (create-primitive :cube))

(def saturation-id (Shader/PropertyToID "_Saturation"))
(def target 5.5)

(let [mat (.material (cmpt cube MeshRenderer))]
  (.SetFloat mat saturation-id target))

@saikyun
Copy link
Contributor Author

saikyun commented Mar 4, 2019

Sorry for not replying. I'll try to provide a better example, the issue is that sometimes it seems to work. There's something weird going on. I'll get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants