OneJS

O

OneJS

Join the community to ask questions about OneJS and get answers from other members.

Join

general-discussion

help

Ah there's an issue with esbuild not

Ah there's an issue with esbuild not bundling images for standalone player. Will get fixed soon. For now, you can work around by putting your images inside of Resources folders (under Assets) and use Unity's Resources.Load directly. https://docs.unity3d.com/ScriptReference/Resources.Load.html ```tsx import { h, render } from "preact" import { Resources, Texture2D } from "UnityEngine"...

You can use `flex-row` and `flex-wrap`.

You can use flex-row and flex-wrap. Some example code: ```tsx import { Dom } from "OneJS/Dom" import { Tab } from "onejs/comps" import { h, render } from "preact"...

Right now, this will work for inline

Right now, this will work for inline styling:
style={{ backgroundImage: tex, backgroundRepeat: "repeat norepeat", backgroundSize: "100 50", backgroundPositionX: "right 20%" }}
style={{ backgroundImage: tex, backgroundRepeat: "repeat norepeat", backgroundSize: "100 50", backgroundPositionX: "right 20%" }}
...

You can get the root VE via `UIDocument.

You can get the root VE via UIDocument.rootVisualElement (it's the UIDocument on the ScriptEngine GameObject) and find your TextField using UQuery: https://docs.unity3d.com/Manual/UIE-UQuery.html

Cyclical dependency when upgrading to 1.6

Another question as I try to figure out why I can't update to 1.6: is updateHookState from within useReducer in preact/hooks new? It's telling me that is where the cyclical dependency is coming from but I am unsure of how to debug this, especially since all the code before the update was minified.

If you are more familiar with UniTask s

If you are more familiar with UniTask's internals, maybe you'll have a better idea at using UniTask.Run inside the Object Converter

@eugene thread

Hello! Welcome! So you are trying to build tutorial 101 into an Android APK right? I'll make a test build later today when I get home. But right now just off the top of my head, are you using URP or built-in? GameObjects created with the CreatePrimitive API won't work directly in URP (somehow Unity still uses the standard shader in URP). So at runtime the materials will be invisible.

> incorporate script changes at runtime

incorporate script changes at runtime
Not sure if I'm getting the question correctly. Do you mean to execute some JS code string at runtime from Preact? If so, here's an example: Expose the ScriptEngine to your JS land:...
No description

DOTween with OneJS

This following works for me: ```tsx import { h, render } from "preact" import { useRef } from "preact/hooks" import { Vector3 } from "UnityEngine"...

Oops sorry missed this one Yes right TS

Oops sorry, missed this one. Yes, right. TS types are all stripped when transpiled into js. So calling C# generic functions from TS won't work directly.

Ah I see I m not too familiar with UI

Ah I see. I'm not too familiar with UI Toolkit + Sprites. Need to do some research. I'm looking at https://forum.unity.com/threads/feedback-wanted-sprite-assets-support.962958/. Will get back to you in a bit!

fixed in latest commit don t know how

(fixed in latest commit; don't know how it got there in the first place)

Can you send me an example code

Can you send me an example code?