Questions tagged [prefab]

92 questions
1
vote
3 answers

Exporting native libraries using AAR via Prefab on Android. Files are created but Package and Module Metadeta (prefab.json, module.json) are empty

As described in title. I have created an android library with a module that generates a prefab. buildFeatures { prefabPublishing true } prefab { functions { headers…
Kah Wai Lee
  • 127
  • 1
  • 2
  • 11
1
vote
1 answer

Object Insatiate with a plane that is procedurally generated

I am new to procedural generation in Unity and I am making a simple game with a player in a plane that is procedurally generated, the requirement is that I am trying to bring up some walls simultaneously with the generation of the plane which is not…
1
vote
0 answers

Prefab instantiating outside of viewport, and giving null reference exception in Unity C#

So, I'm aware that null reference exceptions are a pretty commonly brought up issue on here, but I'm genuinely stuck on this, as this code went from working fine to really not working, and I can't figure out why. I used this tutorial as a starter to…
EdW
  • 11
  • 3
1
vote
0 answers

Is it possible to create "Content Patches-" like Prefab Variants, but for an addressable/AssetReference?

I develop mods for a Unity Game- and that game supports Addressables, which is great. Modders can load ingame assets in order to modify them for their own purposes, then reuse them. The problem, though, is that it has to be done procedurally,…
Sky Lure
  • 31
  • 2
1
vote
2 answers

How do I set an existing Unity prefab's current scale to be 1, 1, 1

I have a prefab in Unity whose scale I have tweaked. I would like its current scale to be considered 1, 1, 1. This will simplify some other game mechanics I am coding.
John Joseph
  • 1,003
  • 1
  • 10
  • 20
1
vote
0 answers

How to edit a prefab to move a child object position

I am programming an endless runner that manipulates an airplane with the flexion of the wrist. I have a set of prefabs that move in front of the player. I have a simple prefab, it's a platform and an object called "Bone" as a child. his "Bone" each…
JI VB
  • 45
  • 5
1
vote
1 answer

How to click on instantiated objects and get points, then link points to score text?

What I want: I want the player to be able to click on instantiated objects and get points, then have those points show in the score-keeping text. What I’ve done: I’m currently using the following “FindGameObjectsWithTag” code to retrieve the buttons…
Alesf28
  • 23
  • 5
1
vote
1 answer

How to move a prefab object independently of the other objects

I want to be able to tap a switch and have it slide to the other side. Right now that switch is a prefab with my code attached. When I add copies of that prefab all of them move not the individual one I clicked. // Start is called before the…
Chris
  • 59
  • 1
  • 3
1
vote
2 answers

Moving a Prefab in Unity

The purpose of the code is to make a prefab of "Normal" and "Virus" make them move in random directions when they collide, change "Normal" into "Virus" Prefabs However, I've got stucked on step 2. I successfuly made "Normal" and "Virus" Prefabs…
Constant
  • 29
  • 5
1
vote
0 answers

Prefab optimization

We have a MonoBehaviour component holding a long list of prefabs (can be 100). Those prefabs are meant to be created/destroyed as needed. The component is singleton getting created on first usage. The question is related to the memory usage, using a…
fafase
  • 467
  • 3
  • 10
1
vote
3 answers

Load an array with prefabs programatically without inspector

I am following a tetris tutorial when it called for an array of prefabs as a part of the spawner object. The spawner would randomly create the shapes, such as the I shape, the T shape, etc. These shapes are prefabs. public class Spawner :…
1
vote
3 answers

The Canvas Environment on my Prefab is greyed out in the Unity inspector, what have I done?

I have made a prefab that also had a canvas. Unity added a Canvas Environment as the parent. Never had an issue until today. For some unknown reason, when I try to edit the prefab, the Canvas Environment is greyed out and not ticked in the…
1
vote
0 answers

How can I export prefab or an object in Unity runtime as FBX files? I want to select objects and export as FBX in runtime. I need the way(script)

I want to export some objects that I selected in playing in Unity, so I want to write the script for that but it's too difficult for me. Of course I can Export objects with FBX Exporter not playing but I just want to select objects and export them…
1
vote
1 answer

Android AAR native library with header only prefab

I've been trying to create a Android AAR native library with header only prefab without success. We distribute other native libraries we build in Android Studio as prefabs in AARs and include them in other Android native applications. We'd like to…
Johan L
  • 11
  • 2
0
votes
0 answers

Unity Game Engine : nested prefabs

i am learing unity game development from a online course and am facing a problem . In the course the instructor drags and drops CheckPoints prefab(parent) to prefab folder and in the prefab folder it shows like thisinstructors window but when i do…