Hello.
I created a script that is supposed to fill an image, and can’t avoid the error on the line “this.fillingImage!.fill = newFill;”
using Unity 2022.3.10f1.
Thanks ahead!
code:
import { Behaviour, Mathf, serializable, Image } from "@needle-tools/engine"
export class FillableImage extends Behaviour {
/** The image to fill */
@serializable(Image) fillingImage?: Image;
start(): void {
this.setFillAmount(0);
}
private setFillAmount(newFill: number){
this.fillingImage!.fill = newFill;
}
setFill(fill: number, maxFill: number){
let division = fill / maxFill;
let fillAmount = 1 - division;
fillAmount = Mathf.clamp(fillAmount, 0, 1);
this.setFillAmount(fillAmount);
}
}
Edit:
Answer: Needle 7.1.5 does not support filling an image. Future versions may support it.
Original Post on Discord
by user 198447544408342528
marwie1
(marwi)
November 18, 2023, 12:00am
2
Hi! we dont have support for this particular image type right now. Can you share a bit more what it does in Unity and how it differs from the “Simple” type? Sorry I’m not so familiar with this feature
fill = 1
by user 198447544408342528
fill = 0.5
by user 198447544408342528
fill = 0.33
by user 198447544408342528
Maybe I used the wrong type? I am sorry for confusing.
I am trying to achieve the effect I sent as seperate pictures
by user 198447544408342528
marwie1
(marwi)
November 18, 2023, 12:00am
7
Ah i see! So yeah right now that’s not supported. I need to check if the library we’re using under the hood for rendering the UI is supporting it.
marwie1
(marwi)
November 18, 2023, 12:00am
8
We’re using the 7.x version if you would want to take a look yourself
Yes I can’t find it.
Do you think it’s possible to mimic this behaviour in the existing code? Or should I just move on
by user 198447544408342528
I am trying to recreate the existing system we have in our game as a POC, before we decide on using Needle in commercial usage (and get in the enterprise packages with your sales team…)
by user 198447544408342528
marwie1
(marwi)
November 18, 2023, 12:00am
12
Just updating the compiler here right now + improve codegen for editor code (if the namespace contains UnityEditor)
Thanks for the help marcel!
Now I just need this problem fixed and I am all out of questions (for now )
by user 198447544408342528
Discord is the easiest way to communicate over voice, video, and text. Chat, hang out, and stay close with your friends and communities.
by user 198447544408342528