For change cursor i using this:
UnityEngine.Cursor.SetCursor(CursorTexture,
new Vector2(CursorTexture.width, CursorTexture.height) * 0.5f,
CursorMode.ForceSoftware);
I want to animate cursor when something happens.
Is it possible to anumate cursor using Cursor.SetCursor?
You can do it like LearnCocos2D says. The problem will be it will flicker a lot and the other problem you will most likely have is that the mouse pointer will be really sluggish. This is because software mouse pointers are not rendered by hardware so its always a couple of frames behind actual user's input on the pointer device.
Then for the animated texture to work on web browser you need to make sure you export the needed shaders you are using if anything on a resources folder of your web player project since lots of shaders are not exported to the web build by default. It should work if you are using a standard diffuse, but I think that for a mouse pointer since most likely it uses transparency then it may not work by default. You'll need to find the actual shader being used and export that by manually for your build.
Unity should have support for hardware animated cursors at least on PC, but sadly it doesn't...
Related
I used 3D WebView in Unity development. I dragged a WebViewPrefab into my scene and clicked 'play'. From the console I knew that it had already loaded the webpage I wanted, but I could't see it in the game window.
I had looked around, but still nothing in the game window.
Could anyone please tell me what had happened?
I had a similar problem not long ago. I found that WebView doesn't seem to be like those GameObjects we commonly use in unity, it can only be viewed from one direction. This means that if you look at it from behind, you won't see anything. Therefore, you need to adjust your main camera angle.
Also, when you use WebViewPrefab.Instantiate to create your WebView Object, it defaults to a somewhat strange position and angle. I usually set its position manually, and after that, it's easier to find in the game window in play mode.
In my current project, I am using the Oculus Integration package to interface my app with my Oculus Rift S headset and Unity 2021.3.6f1 URP.
While working on the project I played with the camera settings to get better visuals, and noticed that the field of view attribute always goes back to 90 (even when I set it at run time).
I went over the scripts that were imported from the Oculus package, mainly the following ones (since those are the ones used in the project): OVRCameraRig, OVRManager, OVRHeadsetEmulator.
But wasn't able to find anywhere in the code what is the cause. I even tried searching through all the scripts (using my IDE) for any piece of code that changes the fieldOfView property, and found some scripts but none of them is used in the project, and commenting those lines made no difference…
So, my question is why can't I change my camera's field of view? What caused it to constantly be set to 90?
Its a bad idea to change the default FOV on a VR camera - its meant to match the actual FOV of the headset and most users will experience heavy nausea if you change it more than a few degrees from the correct value. If you want to experience just how bad this feels, place a quad in front of the main camera, with unlit textured material with a texture written to from another camera (with a different fov). This simple solution will not give you stereoscopy, but should be enough to experience just how bad of and idea this is
I've just started my first Unity experience by moving a match-3 based game to Unity, and I want to be able to attach data to each available tile type specifying how likely that tile is to be dropped onto the board (and be able to override that value for each level). There are a few match-3 tutorials floating around, but besides a tendency to not explain how to make things happen in Unity, I haven't found any leveraging the Tilemap, which seems a shame since it looks like it provides a fair bit of necessary functionality. The only problem is, I don't see anywhere to attach data or a script to a base Tile, so I've been looking into whether going the Scriptable Tile / custom editor route would get me what I need; but then I run into the lack of instructions on how to get basic functionality on the custom editor (the ability to specify the underlying sprite seems rather fundamental, but I'm not finding anything).
Anyway, is the Scriptable Tile interface my best bet to get level-specific data attached to individual tiles, or should I be looking for a different way to get this data on there? Or should I just ditch the Tilemap and the functionality it does include out of the box altogether like all the tutorials seem to be doing?
Before I explain my situation, it's important that I mention I'm using an older version of Unity, 2017.42f2 (for PSVITA support). for this reason, I'm also using the old Post-Processing Stack.
I'm making a game in which I want a lot of bloom on the UI, but not as much for the rest of the game. I used a camera to render the UI, gave it Post-Processing (Screen Space - Camera on Canvas),
and another one to render the rest of the game
Each is given a different profile to use different effects.
My expectation is that the UI renderer camera would only apply it's effects to the Canvas. Instead, it also applies them to the camera beneath it; the game renderer camera.
As you can see I used Don't Clear clear flags. I also tried Depth-only, to see if it would make a difference.
I'm lost as to what I could do. Grain and bloom get applied to everything
yet the profile for those effects is only given to the UI renderer Camera's Post Processing Behavior Script.
Does anyone have any suggestions or ideas? I'm lost.
I wanna render VR from a native plugin. Is this possible?
So, far, what I have is this:
void OnRenderObject()
{
GL.IssuePluginEvent(getRenderCallback(), 1);
}
This is calling my native plugin and rendering something, but it makes this mess here.
It seems that I am rendering to the wrong texture. In fact, how to get the correct texture/framebuffer or whatever trick necessary to render VR from the native plugin OpenGL? For example, I need information about the camera being rendered (left or right) in order to render properly.
Any hints? I am trying with both Gear VR AND Google VR. Any hint about any of them is welcome.
My interpretation is, instead of Unity's default render from MeshRenderer, you want to overwrite that with your custom OpenGL calls.
Without knowing what you are rendering and what should be the correct behavior, I can't help more.
I can imagine that if you set up your own states such as turning on/off particular depth tests, blends, these would overwrite whatever states Unity set up for you prior to your custom function. And if you don't restore those states Unity is not aware and produces incorrect result.
As a side note, you may want to check out
https://github.com/Samsung/GearVRf/
It's Samsung's open source framework engine for GearVR. Being similar to Unity but open source, you may do something similar to what you posted while knowing what happens underneath